Freeciv-3.1: /fast/freeciv/nightly/S3_1/common/packets_gen.c Source File

Freeciv-3.1

Loading...
Searching...
No Matches
packets_gen.c
Go to the documentation of this file.
1
2 /****************************************************************************
3 * THIS FILE WAS GENERATED *
4 * Script: common/generate_packets.py *
5 * Input: common/networking/packets.def *
6 * DO NOT CHANGE THIS FILE *
7 ****************************************************************************/
8
9
10#ifdef HAVE_CONFIG_H
11#include <fc_config.h>
12#endif
13
14#include <string.h>
15
16/* utility */
17#include "bitvector.h"
18#include "capability.h"
19#include "genhash.h"
20#include "log.h"
21#include "mem.h"
22#include "support.h"
23
24/* common */
25#include "capstr.h"
26#include "connection.h"
27#include "dataio.h"
28#include "game.h"
29
30#include "packets.h"
31
32 const char *const packet_functional_capability = "ids32 city-original rsdesc32";
33
34#ifdef FREECIV_DELTA_PROTOCOL
35static genhash_val_t hash_const(const void *vkey)
36{
37 return 0;
38}
39
40static bool cmp_const(const void *vkey1, const void *vkey2)
41{
42 return TRUE;
43}
44#endif /* FREECIV_DELTA_PROTOCOL */
45 void delta_stats_report(void) {}
46
47 void delta_stats_reset(void) {}
48
49 const char *packet_name(enum packet_type type)
50{
51 static const char *const names[PACKET_LAST] = {
52 "PACKET_PROCESSING_STARTED",
53 "PACKET_PROCESSING_FINISHED",
54 "unknown",
55 "unknown",
56 "PACKET_SERVER_JOIN_REQ",
57 "PACKET_SERVER_JOIN_REPLY",
58 "PACKET_AUTHENTICATION_REQ",
59 "PACKET_AUTHENTICATION_REPLY",
60 "PACKET_SERVER_SHUTDOWN",
61 "PACKET_RULESET_TECH_CLASS",
62 "PACKET_NATION_SELECT_REQ",
63 "PACKET_PLAYER_READY",
64 "PACKET_ENDGAME_REPORT",
65 "PACKET_SCENARIO_DESCRIPTION",
66 "PACKET_EDIT_SCENARIO_DESC",
67 "PACKET_TILE_INFO",
68 "PACKET_GAME_INFO",
69 "PACKET_MAP_INFO",
70 "PACKET_NUKE_TILE_INFO",
71 "PACKET_TEAM_NAME_INFO",
72 "unknown",
73 "PACKET_INVESTIGATE_STARTED",
74 "PACKET_INVESTIGATE_FINISHED",
75 "unknown",
76 "unknown",
77 "PACKET_CHAT_MSG",
78 "PACKET_CHAT_MSG_REQ",
79 "PACKET_CONNECT_MSG",
80 "PACKET_EARLY_CHAT_MSG",
81 "PACKET_SERVER_INFO",
82 "PACKET_CITY_REMOVE",
83 "PACKET_CITY_INFO",
84 "PACKET_CITY_SHORT_INFO",
85 "PACKET_CITY_SELL",
86 "PACKET_CITY_BUY",
87 "PACKET_CITY_CHANGE",
88 "PACKET_CITY_WORKLIST",
89 "PACKET_CITY_MAKE_SPECIALIST",
90 "PACKET_CITY_MAKE_WORKER",
91 "PACKET_CITY_CHANGE_SPECIALIST",
92 "PACKET_CITY_RENAME",
93 "PACKET_CITY_OPTIONS_REQ",
94 "PACKET_CITY_REFRESH",
95 "PACKET_CITY_NAME_SUGGESTION_REQ",
96 "PACKET_CITY_NAME_SUGGESTION_INFO",
97 "PACKET_CITY_SABOTAGE_LIST",
98 "PACKET_CITY_NATIONALITIES",
99 "unknown",
100 "unknown",
101 "unknown",
102 "PACKET_PLAYER_REMOVE",
103 "PACKET_PLAYER_INFO",
104 "PACKET_PLAYER_PHASE_DONE",
105 "PACKET_PLAYER_RATES",
106 "PACKET_PLAYER_CHANGE_GOVERNMENT",
107 "PACKET_PLAYER_RESEARCH",
108 "PACKET_PLAYER_TECH_GOAL",
109 "PACKET_PLAYER_ATTRIBUTE_BLOCK",
110 "PACKET_PLAYER_ATTRIBUTE_CHUNK",
111 "PACKET_PLAYER_DIPLSTATE",
112 "PACKET_RESEARCH_INFO",
113 "PACKET_PLAYER_PLACE_INFRA",
114 "PACKET_UNIT_REMOVE",
115 "PACKET_UNIT_INFO",
116 "PACKET_UNIT_SHORT_INFO",
117 "PACKET_UNIT_COMBAT_INFO",
118 "PACKET_UNKNOWN_RESEARCH",
119 "unknown",
120 "unknown",
121 "unknown",
122 "unknown",
123 "PACKET_UNIT_SSCS_SET",
124 "unknown",
125 "PACKET_UNIT_ORDERS",
126 "PACKET_UNIT_SERVER_SIDE_AGENT_SET",
127 "unknown",
128 "unknown",
129 "unknown",
130 "unknown",
131 "unknown",
132 "unknown",
133 "unknown",
134 "PACKET_UNIT_ACTION_QUERY",
135 "PACKET_UNIT_TYPE_UPGRADE",
136 "PACKET_UNIT_DO_ACTION",
137 "PACKET_UNIT_ACTION_ANSWER",
138 "unknown",
139 "PACKET_UNIT_GET_ACTIONS",
140 "PACKET_CONN_PING",
141 "PACKET_CONN_PONG",
142 "PACKET_UNIT_ACTIONS",
143 "unknown",
144 "unknown",
145 "unknown",
146 "unknown",
147 "PACKET_DIPLOMACY_INIT_MEETING_REQ",
148 "PACKET_DIPLOMACY_INIT_MEETING",
149 "PACKET_DIPLOMACY_CANCEL_MEETING_REQ",
150 "PACKET_DIPLOMACY_CANCEL_MEETING",
151 "PACKET_DIPLOMACY_CREATE_CLAUSE_REQ",
152 "PACKET_DIPLOMACY_CREATE_CLAUSE",
153 "PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ",
154 "PACKET_DIPLOMACY_REMOVE_CLAUSE",
155 "PACKET_DIPLOMACY_ACCEPT_TREATY_REQ",
156 "PACKET_DIPLOMACY_ACCEPT_TREATY",
157 "PACKET_DIPLOMACY_CANCEL_PACT",
158 "unknown",
159 "unknown",
160 "unknown",
161 "unknown",
162 "PACKET_PAGE_MSG",
163 "PACKET_REPORT_REQ",
164 "unknown",
165 "unknown",
166 "unknown",
167 "PACKET_CONN_INFO",
168 "PACKET_CONN_PING_INFO",
169 "unknown",
170 "unknown",
171 "PACKET_CLIENT_INFO",
172 "unknown",
173 "unknown",
174 "unknown",
175 "unknown",
176 "unknown",
177 "PACKET_END_PHASE",
178 "PACKET_START_PHASE",
179 "PACKET_NEW_YEAR",
180 "PACKET_BEGIN_TURN",
181 "PACKET_END_TURN",
182 "PACKET_FREEZE_CLIENT",
183 "PACKET_THAW_CLIENT",
184 "unknown",
185 "unknown",
186 "unknown",
187 "PACKET_SPACESHIP_LAUNCH",
188 "PACKET_SPACESHIP_PLACE",
189 "PACKET_SPACESHIP_INFO",
190 "PACKET_CITY_RALLY_POINT",
191 "unknown",
192 "PACKET_RULESET_UNIT",
193 "PACKET_RULESET_GAME",
194 "PACKET_RULESET_SPECIALIST",
195 "PACKET_RULESET_GOVERNMENT_RULER_TITLE",
196 "PACKET_RULESET_TECH",
197 "PACKET_RULESET_GOVERNMENT",
198 "PACKET_RULESET_TERRAIN_CONTROL",
199 "PACKET_RULESET_NATION_GROUPS",
200 "PACKET_RULESET_NATION",
201 "PACKET_RULESET_CITY",
202 "PACKET_RULESET_BUILDING",
203 "PACKET_RULESET_TERRAIN",
204 "PACKET_RULESET_UNIT_CLASS",
205 "PACKET_RULESET_BASE",
206 "unknown",
207 "PACKET_RULESET_CONTROL",
208 "unknown",
209 "unknown",
210 "unknown",
211 "unknown",
212 "PACKET_SINGLE_WANT_HACK_REQ",
213 "PACKET_SINGLE_WANT_HACK_REPLY",
214 "PACKET_RULESET_CHOICES",
215 "PACKET_GAME_LOAD",
216 "PACKET_SERVER_SETTING_CONTROL",
217 "PACKET_SERVER_SETTING_CONST",
218 "PACKET_SERVER_SETTING_BOOL",
219 "PACKET_SERVER_SETTING_INT",
220 "PACKET_SERVER_SETTING_STR",
221 "PACKET_SERVER_SETTING_ENUM",
222 "PACKET_SERVER_SETTING_BITWISE",
223 "unknown",
224 "unknown",
225 "unknown",
226 "unknown",
227 "PACKET_RULESET_EFFECT",
228 "unknown",
229 "PACKET_RULESET_RESOURCE",
230 "unknown",
231 "unknown",
232 "PACKET_SCENARIO_INFO",
233 "PACKET_SAVE_SCENARIO",
234 "unknown",
235 "unknown",
236 "unknown",
237 "PACKET_VOTE_NEW",
238 "PACKET_VOTE_UPDATE",
239 "PACKET_VOTE_REMOVE",
240 "PACKET_VOTE_RESOLVE",
241 "PACKET_VOTE_SUBMIT",
242 "PACKET_EDIT_MODE",
243 "unknown",
244 "unknown",
245 "unknown",
246 "unknown",
247 "unknown",
248 "unknown",
249 "PACKET_EDIT_RECALCULATE_BORDERS",
250 "PACKET_EDIT_CHECK_TILES",
251 "PACKET_EDIT_TOGGLE_FOGOFWAR",
252 "PACKET_EDIT_TILE_TERRAIN",
253 "unknown",
254 "PACKET_EDIT_TILE_EXTRA",
255 "unknown",
256 "PACKET_EDIT_STARTPOS",
257 "PACKET_EDIT_STARTPOS_FULL",
258 "PACKET_EDIT_TILE",
259 "PACKET_EDIT_UNIT_CREATE",
260 "PACKET_EDIT_UNIT_REMOVE",
261 "PACKET_EDIT_UNIT_REMOVE_BY_ID",
262 "PACKET_EDIT_UNIT",
263 "PACKET_EDIT_CITY_CREATE",
264 "PACKET_EDIT_CITY_REMOVE",
265 "PACKET_EDIT_CITY",
266 "PACKET_EDIT_PLAYER_CREATE",
267 "PACKET_EDIT_PLAYER_REMOVE",
268 "PACKET_EDIT_PLAYER",
269 "PACKET_EDIT_PLAYER_VISION",
270 "PACKET_EDIT_GAME",
271 "PACKET_EDIT_OBJECT_CREATED",
272 "PACKET_RULESET_ROAD",
273 "unknown",
274 "PACKET_UNIT_CHANGE_ACTIVITY",
275 "PACKET_ENDGAME_PLAYER",
276 "PACKET_RULESET_DISASTER",
277 "PACKET_RULESETS_READY",
278 "PACKET_RULESET_EXTRA_FLAG",
279 "PACKET_RULESET_TRADE",
280 "PACKET_RULESET_UNIT_BONUS",
281 "PACKET_RULESET_UNIT_FLAG",
282 "PACKET_RULESET_UNIT_CLASS_FLAG",
283 "PACKET_RULESET_TERRAIN_FLAG",
284 "PACKET_RULESET_EXTRA",
285 "PACKET_RULESET_ACHIEVEMENT",
286 "PACKET_RULESET_TECH_FLAG",
287 "PACKET_RULESET_ACTION_ENABLER",
288 "PACKET_RULESET_NATION_SETS",
289 "PACKET_NATION_AVAILABILITY",
290 "PACKET_ACHIEVEMENT_INFO",
291 "PACKET_RULESET_STYLE",
292 "PACKET_RULESET_MUSIC",
293 "PACKET_WORKER_TASK",
294 "PACKET_PLAYER_MULTIPLIER",
295 "PACKET_RULESET_MULTIPLIER",
296 "PACKET_TIMEOUT_INFO",
297 "PACKET_PLAY_MUSIC",
298 "PACKET_RULESET_ACTION",
299 "PACKET_RULESET_DESCRIPTION_PART",
300 "PACKET_RULESET_GOODS",
301 "PACKET_TRADE_ROUTE_INFO",
302 "PACKET_PAGE_MSG_PART",
303 "PACKET_RULESET_SUMMARY",
304 "PACKET_RULESET_ACTION_AUTO",
305 "PACKET_SET_TOPOLOGY",
306 "PACKET_CLIENT_HEARTBEAT",
307 "PACKET_CALENDAR_INFO",
308 "PACKET_WEB_CITY_INFO_ADDITION",
309 "PACKET_WEB_PLAYER_INFO_ADDITION",
310 "PACKET_WEB_RULESET_UNIT_ADDITION",
311 "unknown",
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 "unknown",
564 "PACKET_RULESET_CLAUSE",
565 };
566
567 return (type < PACKET_LAST ? names[type] : "unknown");
568}
569
570 bool packet_has_game_info_flag(enum packet_type type)
571{
572 static const bool flag[PACKET_LAST] = {
573 FALSE, /* PACKET_PROCESSING_STARTED */
574 FALSE, /* PACKET_PROCESSING_FINISHED */
575 FALSE,
576 FALSE,
577 FALSE, /* PACKET_SERVER_JOIN_REQ */
578 FALSE, /* PACKET_SERVER_JOIN_REPLY */
579 FALSE, /* PACKET_AUTHENTICATION_REQ */
580 FALSE, /* PACKET_AUTHENTICATION_REPLY */
581 FALSE, /* PACKET_SERVER_SHUTDOWN */
582 FALSE, /* PACKET_RULESET_TECH_CLASS */
583 FALSE, /* PACKET_NATION_SELECT_REQ */
584 FALSE, /* PACKET_PLAYER_READY */
585 FALSE, /* PACKET_ENDGAME_REPORT */
586 FALSE, /* PACKET_SCENARIO_DESCRIPTION */
587 FALSE, /* PACKET_EDIT_SCENARIO_DESC */
588 TRUE, /* PACKET_TILE_INFO */
589 FALSE, /* PACKET_GAME_INFO */
590 FALSE, /* PACKET_MAP_INFO */
591 FALSE, /* PACKET_NUKE_TILE_INFO */
592 FALSE, /* PACKET_TEAM_NAME_INFO */
593 FALSE,
594 FALSE, /* PACKET_INVESTIGATE_STARTED */
595 FALSE, /* PACKET_INVESTIGATE_FINISHED */
596 FALSE,
597 FALSE,
598 FALSE, /* PACKET_CHAT_MSG */
599 FALSE, /* PACKET_CHAT_MSG_REQ */
600 FALSE, /* PACKET_CONNECT_MSG */
601 FALSE, /* PACKET_EARLY_CHAT_MSG */
602 FALSE, /* PACKET_SERVER_INFO */
603 FALSE, /* PACKET_CITY_REMOVE */
604 TRUE, /* PACKET_CITY_INFO */
605 TRUE, /* PACKET_CITY_SHORT_INFO */
606 FALSE, /* PACKET_CITY_SELL */
607 FALSE, /* PACKET_CITY_BUY */
608 FALSE, /* PACKET_CITY_CHANGE */
609 FALSE, /* PACKET_CITY_WORKLIST */
610 FALSE, /* PACKET_CITY_MAKE_SPECIALIST */
611 FALSE, /* PACKET_CITY_MAKE_WORKER */
612 FALSE, /* PACKET_CITY_CHANGE_SPECIALIST */
613 FALSE, /* PACKET_CITY_RENAME */
614 FALSE, /* PACKET_CITY_OPTIONS_REQ */
615 FALSE, /* PACKET_CITY_REFRESH */
616 FALSE, /* PACKET_CITY_NAME_SUGGESTION_REQ */
617 FALSE, /* PACKET_CITY_NAME_SUGGESTION_INFO */
618 FALSE, /* PACKET_CITY_SABOTAGE_LIST */
619 TRUE, /* PACKET_CITY_NATIONALITIES */
620 FALSE,
621 FALSE,
622 FALSE,
623 FALSE, /* PACKET_PLAYER_REMOVE */
624 FALSE, /* PACKET_PLAYER_INFO */
625 FALSE, /* PACKET_PLAYER_PHASE_DONE */
626 FALSE, /* PACKET_PLAYER_RATES */
627 FALSE, /* PACKET_PLAYER_CHANGE_GOVERNMENT */
628 FALSE, /* PACKET_PLAYER_RESEARCH */
629 FALSE, /* PACKET_PLAYER_TECH_GOAL */
630 FALSE, /* PACKET_PLAYER_ATTRIBUTE_BLOCK */
631 FALSE, /* PACKET_PLAYER_ATTRIBUTE_CHUNK */
632 FALSE, /* PACKET_PLAYER_DIPLSTATE */
633 TRUE, /* PACKET_RESEARCH_INFO */
634 FALSE, /* PACKET_PLAYER_PLACE_INFRA */
635 FALSE, /* PACKET_UNIT_REMOVE */
636 TRUE, /* PACKET_UNIT_INFO */
637 TRUE, /* PACKET_UNIT_SHORT_INFO */
638 FALSE, /* PACKET_UNIT_COMBAT_INFO */
639 TRUE, /* PACKET_UNKNOWN_RESEARCH */
640 FALSE,
641 FALSE,
642 FALSE,
643 FALSE,
644 FALSE, /* PACKET_UNIT_SSCS_SET */
645 FALSE,
646 FALSE, /* PACKET_UNIT_ORDERS */
647 FALSE, /* PACKET_UNIT_SERVER_SIDE_AGENT_SET */
648 FALSE,
649 FALSE,
650 FALSE,
651 FALSE,
652 FALSE,
653 FALSE,
654 FALSE,
655 FALSE, /* PACKET_UNIT_ACTION_QUERY */
656 FALSE, /* PACKET_UNIT_TYPE_UPGRADE */
657 FALSE, /* PACKET_UNIT_DO_ACTION */
658 FALSE, /* PACKET_UNIT_ACTION_ANSWER */
659 FALSE,
660 FALSE, /* PACKET_UNIT_GET_ACTIONS */
661 FALSE, /* PACKET_CONN_PING */
662 FALSE, /* PACKET_CONN_PONG */
663 FALSE, /* PACKET_UNIT_ACTIONS */
664 FALSE,
665 FALSE,
666 FALSE,
667 FALSE,
668 FALSE, /* PACKET_DIPLOMACY_INIT_MEETING_REQ */
669 FALSE, /* PACKET_DIPLOMACY_INIT_MEETING */
670 FALSE, /* PACKET_DIPLOMACY_CANCEL_MEETING_REQ */
671 FALSE, /* PACKET_DIPLOMACY_CANCEL_MEETING */
672 FALSE, /* PACKET_DIPLOMACY_CREATE_CLAUSE_REQ */
673 FALSE, /* PACKET_DIPLOMACY_CREATE_CLAUSE */
674 FALSE, /* PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ */
675 FALSE, /* PACKET_DIPLOMACY_REMOVE_CLAUSE */
676 FALSE, /* PACKET_DIPLOMACY_ACCEPT_TREATY_REQ */
677 FALSE, /* PACKET_DIPLOMACY_ACCEPT_TREATY */
678 FALSE, /* PACKET_DIPLOMACY_CANCEL_PACT */
679 FALSE,
680 FALSE,
681 FALSE,
682 FALSE,
683 FALSE, /* PACKET_PAGE_MSG */
684 FALSE, /* PACKET_REPORT_REQ */
685 FALSE,
686 FALSE,
687 FALSE,
688 FALSE, /* PACKET_CONN_INFO */
689 FALSE, /* PACKET_CONN_PING_INFO */
690 FALSE,
691 FALSE,
692 FALSE, /* PACKET_CLIENT_INFO */
693 FALSE,
694 FALSE,
695 FALSE,
696 FALSE,
697 FALSE,
698 FALSE, /* PACKET_END_PHASE */
699 FALSE, /* PACKET_START_PHASE */
700 FALSE, /* PACKET_NEW_YEAR */
701 FALSE, /* PACKET_BEGIN_TURN */
702 FALSE, /* PACKET_END_TURN */
703 FALSE, /* PACKET_FREEZE_CLIENT */
704 FALSE, /* PACKET_THAW_CLIENT */
705 FALSE,
706 FALSE,
707 FALSE,
708 FALSE, /* PACKET_SPACESHIP_LAUNCH */
709 FALSE, /* PACKET_SPACESHIP_PLACE */
710 TRUE, /* PACKET_SPACESHIP_INFO */
711 TRUE, /* PACKET_CITY_RALLY_POINT */
712 FALSE,
713 FALSE, /* PACKET_RULESET_UNIT */
714 FALSE, /* PACKET_RULESET_GAME */
715 FALSE, /* PACKET_RULESET_SPECIALIST */
716 FALSE, /* PACKET_RULESET_GOVERNMENT_RULER_TITLE */
717 FALSE, /* PACKET_RULESET_TECH */
718 FALSE, /* PACKET_RULESET_GOVERNMENT */
719 FALSE, /* PACKET_RULESET_TERRAIN_CONTROL */
720 FALSE, /* PACKET_RULESET_NATION_GROUPS */
721 FALSE, /* PACKET_RULESET_NATION */
722 FALSE, /* PACKET_RULESET_CITY */
723 FALSE, /* PACKET_RULESET_BUILDING */
724 FALSE, /* PACKET_RULESET_TERRAIN */
725 FALSE, /* PACKET_RULESET_UNIT_CLASS */
726 FALSE, /* PACKET_RULESET_BASE */
727 FALSE,
728 FALSE, /* PACKET_RULESET_CONTROL */
729 FALSE,
730 FALSE,
731 FALSE,
732 FALSE,
733 FALSE, /* PACKET_SINGLE_WANT_HACK_REQ */
734 FALSE, /* PACKET_SINGLE_WANT_HACK_REPLY */
735 FALSE, /* PACKET_RULESET_CHOICES */
736 FALSE, /* PACKET_GAME_LOAD */
737 FALSE, /* PACKET_SERVER_SETTING_CONTROL */
738 FALSE, /* PACKET_SERVER_SETTING_CONST */
739 FALSE, /* PACKET_SERVER_SETTING_BOOL */
740 FALSE, /* PACKET_SERVER_SETTING_INT */
741 FALSE, /* PACKET_SERVER_SETTING_STR */
742 FALSE, /* PACKET_SERVER_SETTING_ENUM */
743 FALSE, /* PACKET_SERVER_SETTING_BITWISE */
744 FALSE,
745 FALSE,
746 FALSE,
747 FALSE,
748 FALSE, /* PACKET_RULESET_EFFECT */
749 FALSE,
750 FALSE, /* PACKET_RULESET_RESOURCE */
751 FALSE,
752 FALSE,
753 FALSE, /* PACKET_SCENARIO_INFO */
754 FALSE, /* PACKET_SAVE_SCENARIO */
755 FALSE,
756 FALSE,
757 FALSE,
758 FALSE, /* PACKET_VOTE_NEW */
759 FALSE, /* PACKET_VOTE_UPDATE */
760 FALSE, /* PACKET_VOTE_REMOVE */
761 FALSE, /* PACKET_VOTE_RESOLVE */
762 FALSE, /* PACKET_VOTE_SUBMIT */
763 FALSE, /* PACKET_EDIT_MODE */
764 FALSE,
765 FALSE,
766 FALSE,
767 FALSE,
768 FALSE,
769 FALSE,
770 FALSE, /* PACKET_EDIT_RECALCULATE_BORDERS */
771 FALSE, /* PACKET_EDIT_CHECK_TILES */
772 FALSE, /* PACKET_EDIT_TOGGLE_FOGOFWAR */
773 FALSE, /* PACKET_EDIT_TILE_TERRAIN */
774 FALSE,
775 FALSE, /* PACKET_EDIT_TILE_EXTRA */
776 FALSE,
777 FALSE, /* PACKET_EDIT_STARTPOS */
778 FALSE, /* PACKET_EDIT_STARTPOS_FULL */
779 FALSE, /* PACKET_EDIT_TILE */
780 FALSE, /* PACKET_EDIT_UNIT_CREATE */
781 FALSE, /* PACKET_EDIT_UNIT_REMOVE */
782 FALSE, /* PACKET_EDIT_UNIT_REMOVE_BY_ID */
783 FALSE, /* PACKET_EDIT_UNIT */
784 FALSE, /* PACKET_EDIT_CITY_CREATE */
785 FALSE, /* PACKET_EDIT_CITY_REMOVE */
786 FALSE, /* PACKET_EDIT_CITY */
787 FALSE, /* PACKET_EDIT_PLAYER_CREATE */
788 FALSE, /* PACKET_EDIT_PLAYER_REMOVE */
789 FALSE, /* PACKET_EDIT_PLAYER */
790 FALSE, /* PACKET_EDIT_PLAYER_VISION */
791 FALSE, /* PACKET_EDIT_GAME */
792 FALSE, /* PACKET_EDIT_OBJECT_CREATED */
793 FALSE, /* PACKET_RULESET_ROAD */
794 FALSE,
795 FALSE, /* PACKET_UNIT_CHANGE_ACTIVITY */
796 FALSE, /* PACKET_ENDGAME_PLAYER */
797 FALSE, /* PACKET_RULESET_DISASTER */
798 FALSE, /* PACKET_RULESETS_READY */
799 FALSE, /* PACKET_RULESET_EXTRA_FLAG */
800 FALSE, /* PACKET_RULESET_TRADE */
801 FALSE, /* PACKET_RULESET_UNIT_BONUS */
802 FALSE, /* PACKET_RULESET_UNIT_FLAG */
803 FALSE, /* PACKET_RULESET_UNIT_CLASS_FLAG */
804 FALSE, /* PACKET_RULESET_TERRAIN_FLAG */
805 FALSE, /* PACKET_RULESET_EXTRA */
806 FALSE, /* PACKET_RULESET_ACHIEVEMENT */
807 FALSE, /* PACKET_RULESET_TECH_FLAG */
808 FALSE, /* PACKET_RULESET_ACTION_ENABLER */
809 FALSE, /* PACKET_RULESET_NATION_SETS */
810 FALSE, /* PACKET_NATION_AVAILABILITY */
811 FALSE, /* PACKET_ACHIEVEMENT_INFO */
812 FALSE, /* PACKET_RULESET_STYLE */
813 FALSE, /* PACKET_RULESET_MUSIC */
814 FALSE, /* PACKET_WORKER_TASK */
815 FALSE, /* PACKET_PLAYER_MULTIPLIER */
816 FALSE, /* PACKET_RULESET_MULTIPLIER */
817 FALSE, /* PACKET_TIMEOUT_INFO */
818 FALSE, /* PACKET_PLAY_MUSIC */
819 FALSE, /* PACKET_RULESET_ACTION */
820 FALSE, /* PACKET_RULESET_DESCRIPTION_PART */
821 FALSE, /* PACKET_RULESET_GOODS */
822 FALSE, /* PACKET_TRADE_ROUTE_INFO */
823 FALSE, /* PACKET_PAGE_MSG_PART */
824 FALSE, /* PACKET_RULESET_SUMMARY */
825 FALSE, /* PACKET_RULESET_ACTION_AUTO */
826 FALSE, /* PACKET_SET_TOPOLOGY */
827 FALSE, /* PACKET_CLIENT_HEARTBEAT */
828 FALSE, /* PACKET_CALENDAR_INFO */
829 TRUE, /* PACKET_WEB_CITY_INFO_ADDITION */
830 FALSE, /* PACKET_WEB_PLAYER_INFO_ADDITION */
831 FALSE, /* PACKET_WEB_RULESET_UNIT_ADDITION */
832 FALSE,
833 FALSE,
834 FALSE,
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, /* PACKET_RULESET_CLAUSE */
1086 };
1087
1088 return (type < PACKET_LAST ? flag[type] : FALSE);
1089}
1090
1091 static struct packet_processing_started *receive_packet_processing_started_100(struct connection *pc)
1092{
1093 RECEIVE_PACKET_START(packet_processing_started, real_packet);
1094#if 1 /* To match endif */
1095 real_packet->__dummy = 0xff;
1096#endif
1097 log_packet_detailed("packet_processing_started_100: got info about ()");
1098 RECEIVE_PACKET_END(real_packet);
1099}
1100
1101 static int send_packet_processing_started_100(struct connection *pc)
1102{
1103 SEND_PACKET_START(PACKET_PROCESSING_STARTED);
1104
1105 log_packet_detailed("packet_processing_started_100: sending info about ()");
1106 SEND_PACKET_END(PACKET_PROCESSING_STARTED);
1107}
1108
1109 int send_packet_processing_started(struct connection *pc)
1110{
1111 if (!pc->used) {
1112 log_error("WARNING: trying to send data to the closed connection %s",
1113 conn_description(pc));
1114 return -1;
1115 }
1116 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PROCESSING_STARTED].no_packet != NULL, -1,
1117 "Handler for PACKET_PROCESSING_STARTED not installed");
1118 return pc->phs.handlers->send[PACKET_PROCESSING_STARTED].no_packet(pc);
1119}
1120
1121 static struct packet_processing_finished *receive_packet_processing_finished_100(struct connection *pc)
1122{
1123 RECEIVE_PACKET_START(packet_processing_finished, real_packet);
1124#if 1 /* To match endif */
1125 real_packet->__dummy = 0xff;
1126#endif
1127 log_packet_detailed("packet_processing_finished_100: got info about ()");
1128 RECEIVE_PACKET_END(real_packet);
1129}
1130
1131 static int send_packet_processing_finished_100(struct connection *pc)
1132{
1133 SEND_PACKET_START(PACKET_PROCESSING_FINISHED);
1134
1135 log_packet_detailed("packet_processing_finished_100: sending info about ()");
1136 SEND_PACKET_END(PACKET_PROCESSING_FINISHED);
1137}
1138
1139 int send_packet_processing_finished(struct connection *pc)
1140{
1141 if (!pc->used) {
1142 log_error("WARNING: trying to send data to the closed connection %s",
1143 conn_description(pc));
1144 return -1;
1145 }
1146 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PROCESSING_FINISHED].no_packet != NULL, -1,
1147 "Handler for PACKET_PROCESSING_FINISHED not installed");
1148 return pc->phs.handlers->send[PACKET_PROCESSING_FINISHED].no_packet(pc);
1149}
1150
1151#ifdef FREECIV_DELTA_PROTOCOL
1152#define hash_packet_investigate_started_100 hash_const
1153
1154#define cmp_packet_investigate_started_100 cmp_const
1155
1156 BV_DEFINE(packet_investigate_started_100_fields, 2);
1157#endif /* FREECIV_DELTA_PROTOCOL */
1158
1159 static struct packet_investigate_started *receive_packet_investigate_started_100(struct connection *pc)
1160{
1161#ifdef FREECIV_DELTA_PROTOCOL
1162 packet_investigate_started_100_fields fields;
1163 struct packet_investigate_started *old;
1164 struct genhash **hash = pc->phs.received + PACKET_INVESTIGATE_STARTED;
1165#endif /* FREECIV_DELTA_PROTOCOL */
1166 RECEIVE_PACKET_START(packet_investigate_started, real_packet);
1167#ifdef FREECIV_JSON_CONNECTION
1168 struct plocation field_addr;
1169 {
1170 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1171 field_addr = *field_addr_tmp;
1172 FC_FREE(field_addr_tmp);
1173 }
1174#endif /* FREECIV_JSON_CONNECTION */
1175
1176#ifdef FREECIV_DELTA_PROTOCOL
1177#ifdef FREECIV_JSON_CONNECTION
1178 field_addr.name = "fields";
1179#endif /* FREECIV_JSON_CONNECTION */
1180 DIO_BV_GET(&din, &field_addr, fields);
1181
1182#else /* FREECIV_DELTA_PROTOCOL */
1183 #ifdef FREECIV_JSON_CONNECTION
1184 field_addr.name = "unit_id32";
1185 #endif /* FREECIV_JSON_CONNECTION */
1186 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
1187 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
1188 }
1189 #ifdef FREECIV_JSON_CONNECTION
1190 field_addr.name = "city_id32";
1191 #endif /* FREECIV_JSON_CONNECTION */
1192 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
1193 RECEIVE_PACKET_FIELD_ERROR(city_id32);
1194 }
1195
1196#endif
1197 log_packet_detailed("packet_investigate_started_100: got info about ()");
1198
1199#ifdef FREECIV_DELTA_PROTOCOL
1200 if (NULL == *hash) {
1201 *hash = genhash_new_full(hash_packet_investigate_started_100, cmp_packet_investigate_started_100,
1202 NULL, NULL, NULL, free);
1203 }
1204
1205 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
1206 *real_packet = *old;
1207 } else {
1208 log_packet_detailed(" no old info");
1209 memset(real_packet, 0, sizeof(*real_packet));
1210 }
1211
1212 if (BV_ISSET(fields, 0)) {
1213 log_packet_detailed(" got field 'unit_id32'");
1214 #ifdef FREECIV_JSON_CONNECTION
1215 field_addr.name = "unit_id32";
1216 #endif /* FREECIV_JSON_CONNECTION */
1217 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
1218 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
1219 }
1220 }
1221 if (BV_ISSET(fields, 1)) {
1222 log_packet_detailed(" got field 'city_id32'");
1223 #ifdef FREECIV_JSON_CONNECTION
1224 field_addr.name = "city_id32";
1225 #endif /* FREECIV_JSON_CONNECTION */
1226 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
1227 RECEIVE_PACKET_FIELD_ERROR(city_id32);
1228 }
1229 }
1230
1231 if (NULL == old) {
1232 old = fc_malloc(sizeof(*old));
1233 *old = *real_packet;
1234 genhash_insert(*hash, old, old);
1235 } else {
1236 *old = *real_packet;
1237 }
1238
1239#endif /* FREECIV_DELTA_PROTOCOL */
1240 RECEIVE_PACKET_END(real_packet);
1241}
1242
1243 static int send_packet_investigate_started_100(struct connection *pc, const struct packet_investigate_started *packet)
1244{
1245 const struct packet_investigate_started *real_packet = packet;
1246#ifdef FREECIV_DELTA_PROTOCOL
1247 packet_investigate_started_100_fields fields;
1248 struct packet_investigate_started *old;
1249 bool differ;
1250 struct genhash **hash = pc->phs.sent + PACKET_INVESTIGATE_STARTED;
1251#endif /* FREECIV_DELTA_PROTOCOL */
1252 SEND_PACKET_START(PACKET_INVESTIGATE_STARTED);
1253#ifdef FREECIV_JSON_CONNECTION
1254 struct plocation field_addr;
1255 {
1256 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1257 field_addr = *field_addr_tmp;
1258 FC_FREE(field_addr_tmp);
1259 }
1260#endif /* FREECIV_JSON_CONNECTION */
1261
1262 log_packet_detailed("packet_investigate_started_100: sending info about ()");
1263
1264#ifdef FREECIV_DELTA_PROTOCOL
1265 if (NULL == *hash) {
1266 *hash = genhash_new_full(hash_packet_investigate_started_100, cmp_packet_investigate_started_100,
1267 NULL, NULL, NULL, free);
1268 }
1269 BV_CLR_ALL(fields);
1270
1271 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
1272 old = fc_malloc(sizeof(*old));
1273 *old = *real_packet;
1274 genhash_insert(*hash, old, old);
1275 memset(old, 0, sizeof(*old));
1276 }
1277 differ = (old->unit_id32 != real_packet->unit_id32);
1278 if (differ) {
1279 BV_SET(fields, 0);
1280 }
1281
1282 differ = (old->city_id32 != real_packet->city_id32);
1283 if (differ) {
1284 BV_SET(fields, 1);
1285 }
1286
1287
1288#ifdef FREECIV_JSON_CONNECTION
1289 field_addr.name = "fields";
1290#endif /* FREECIV_JSON_CONNECTION */
1291 DIO_BV_PUT(&dout, &field_addr, fields);
1292
1293 if (BV_ISSET(fields, 0)) {
1294 log_packet_detailed(" field 'unit_id32' has changed");
1295 #ifdef FREECIV_JSON_CONNECTION
1296 field_addr.name = "unit_id32";
1297#endif /* FREECIV_JSON_CONNECTION */
1298 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
1299 }
1300 if (BV_ISSET(fields, 1)) {
1301 log_packet_detailed(" field 'city_id32' has changed");
1302 #ifdef FREECIV_JSON_CONNECTION
1303 field_addr.name = "city_id32";
1304#endif /* FREECIV_JSON_CONNECTION */
1305 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
1306 }
1307
1308 *old = *real_packet;
1309#endif /* FREECIV_DELTA_PROTOCOL */
1310#ifndef FREECIV_DELTA_PROTOCOL
1311#ifdef FREECIV_JSON_CONNECTION
1312 field_addr.name = "unit_id32";
1313#endif /* FREECIV_JSON_CONNECTION */
1314 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
1315#ifdef FREECIV_JSON_CONNECTION
1316 field_addr.name = "city_id32";
1317#endif /* FREECIV_JSON_CONNECTION */
1318 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
1319
1320#endif
1321 SEND_PACKET_END(PACKET_INVESTIGATE_STARTED);
1322}
1323
1324#ifdef FREECIV_DELTA_PROTOCOL
1325#define hash_packet_investigate_started_101 hash_const
1326
1327#define cmp_packet_investigate_started_101 cmp_const
1328
1329 BV_DEFINE(packet_investigate_started_101_fields, 2);
1330#endif /* FREECIV_DELTA_PROTOCOL */
1331
1332 static struct packet_investigate_started *receive_packet_investigate_started_101(struct connection *pc)
1333{
1334#ifdef FREECIV_DELTA_PROTOCOL
1335 packet_investigate_started_101_fields fields;
1336 struct packet_investigate_started *old;
1337 struct genhash **hash = pc->phs.received + PACKET_INVESTIGATE_STARTED;
1338#endif /* FREECIV_DELTA_PROTOCOL */
1339 RECEIVE_PACKET_START(packet_investigate_started, real_packet);
1340#ifdef FREECIV_JSON_CONNECTION
1341 struct plocation field_addr;
1342 {
1343 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1344 field_addr = *field_addr_tmp;
1345 FC_FREE(field_addr_tmp);
1346 }
1347#endif /* FREECIV_JSON_CONNECTION */
1348
1349#ifdef FREECIV_DELTA_PROTOCOL
1350#ifdef FREECIV_JSON_CONNECTION
1351 field_addr.name = "fields";
1352#endif /* FREECIV_JSON_CONNECTION */
1353 DIO_BV_GET(&din, &field_addr, fields);
1354
1355#else /* FREECIV_DELTA_PROTOCOL */
1356 #ifdef FREECIV_JSON_CONNECTION
1357 field_addr.name = "unit_id16";
1358 #endif /* FREECIV_JSON_CONNECTION */
1359 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
1360 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
1361 }
1362 #ifdef FREECIV_JSON_CONNECTION
1363 field_addr.name = "city_id16";
1364 #endif /* FREECIV_JSON_CONNECTION */
1365 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
1366 RECEIVE_PACKET_FIELD_ERROR(city_id16);
1367 }
1368
1369#endif
1370 log_packet_detailed("packet_investigate_started_101: got info about ()");
1371
1372#ifdef FREECIV_DELTA_PROTOCOL
1373 if (NULL == *hash) {
1374 *hash = genhash_new_full(hash_packet_investigate_started_101, cmp_packet_investigate_started_101,
1375 NULL, NULL, NULL, free);
1376 }
1377
1378 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
1379 *real_packet = *old;
1380 } else {
1381 log_packet_detailed(" no old info");
1382 memset(real_packet, 0, sizeof(*real_packet));
1383 }
1384
1385 if (BV_ISSET(fields, 0)) {
1386 log_packet_detailed(" got field 'unit_id16'");
1387 #ifdef FREECIV_JSON_CONNECTION
1388 field_addr.name = "unit_id16";
1389 #endif /* FREECIV_JSON_CONNECTION */
1390 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
1391 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
1392 }
1393 }
1394 if (BV_ISSET(fields, 1)) {
1395 log_packet_detailed(" got field 'city_id16'");
1396 #ifdef FREECIV_JSON_CONNECTION
1397 field_addr.name = "city_id16";
1398 #endif /* FREECIV_JSON_CONNECTION */
1399 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
1400 RECEIVE_PACKET_FIELD_ERROR(city_id16);
1401 }
1402 }
1403
1404 if (NULL == old) {
1405 old = fc_malloc(sizeof(*old));
1406 *old = *real_packet;
1407 genhash_insert(*hash, old, old);
1408 } else {
1409 *old = *real_packet;
1410 }
1411
1412#endif /* FREECIV_DELTA_PROTOCOL */
1413 RECEIVE_PACKET_END(real_packet);
1414}
1415
1416 static int send_packet_investigate_started_101(struct connection *pc, const struct packet_investigate_started *packet)
1417{
1418 const struct packet_investigate_started *real_packet = packet;
1419#ifdef FREECIV_DELTA_PROTOCOL
1420 packet_investigate_started_101_fields fields;
1421 struct packet_investigate_started *old;
1422 bool differ;
1423 struct genhash **hash = pc->phs.sent + PACKET_INVESTIGATE_STARTED;
1424#endif /* FREECIV_DELTA_PROTOCOL */
1425 SEND_PACKET_START(PACKET_INVESTIGATE_STARTED);
1426#ifdef FREECIV_JSON_CONNECTION
1427 struct plocation field_addr;
1428 {
1429 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1430 field_addr = *field_addr_tmp;
1431 FC_FREE(field_addr_tmp);
1432 }
1433#endif /* FREECIV_JSON_CONNECTION */
1434
1435 log_packet_detailed("packet_investigate_started_101: sending info about ()");
1436
1437#ifdef FREECIV_DELTA_PROTOCOL
1438 if (NULL == *hash) {
1439 *hash = genhash_new_full(hash_packet_investigate_started_101, cmp_packet_investigate_started_101,
1440 NULL, NULL, NULL, free);
1441 }
1442 BV_CLR_ALL(fields);
1443
1444 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
1445 old = fc_malloc(sizeof(*old));
1446 *old = *real_packet;
1447 genhash_insert(*hash, old, old);
1448 memset(old, 0, sizeof(*old));
1449 }
1450 differ = (old->unit_id16 != real_packet->unit_id16);
1451 if (differ) {
1452 BV_SET(fields, 0);
1453 }
1454
1455 differ = (old->city_id16 != real_packet->city_id16);
1456 if (differ) {
1457 BV_SET(fields, 1);
1458 }
1459
1460
1461#ifdef FREECIV_JSON_CONNECTION
1462 field_addr.name = "fields";
1463#endif /* FREECIV_JSON_CONNECTION */
1464 DIO_BV_PUT(&dout, &field_addr, fields);
1465
1466 if (BV_ISSET(fields, 0)) {
1467 log_packet_detailed(" field 'unit_id16' has changed");
1468 #ifdef FREECIV_JSON_CONNECTION
1469 field_addr.name = "unit_id16";
1470#endif /* FREECIV_JSON_CONNECTION */
1471 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
1472 }
1473 if (BV_ISSET(fields, 1)) {
1474 log_packet_detailed(" field 'city_id16' has changed");
1475 #ifdef FREECIV_JSON_CONNECTION
1476 field_addr.name = "city_id16";
1477#endif /* FREECIV_JSON_CONNECTION */
1478 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
1479 }
1480
1481 *old = *real_packet;
1482#endif /* FREECIV_DELTA_PROTOCOL */
1483#ifndef FREECIV_DELTA_PROTOCOL
1484#ifdef FREECIV_JSON_CONNECTION
1485 field_addr.name = "unit_id16";
1486#endif /* FREECIV_JSON_CONNECTION */
1487 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
1488#ifdef FREECIV_JSON_CONNECTION
1489 field_addr.name = "city_id16";
1490#endif /* FREECIV_JSON_CONNECTION */
1491 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
1492
1493#endif
1494 SEND_PACKET_END(PACKET_INVESTIGATE_STARTED);
1495}
1496
1497 int send_packet_investigate_started(struct connection *pc, const struct packet_investigate_started *packet)
1498{
1499 if (!pc->used) {
1500 log_error("WARNING: trying to send data to the closed connection %s",
1501 conn_description(pc));
1502 return -1;
1503 }
1504 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_INVESTIGATE_STARTED].packet != NULL, -1,
1505 "Handler for PACKET_INVESTIGATE_STARTED not installed");
1506 return pc->phs.handlers->send[PACKET_INVESTIGATE_STARTED].packet(pc, packet);
1507}
1508
1509 int dsend_packet_investigate_started(struct connection *pc, int unit_id16, int unit_id32, int city_id16, int city_id32)
1510{
1511 struct packet_investigate_started packet, *real_packet = &packet;
1512
1513 real_packet->unit_id16 = unit_id16;
1514 real_packet->unit_id32 = unit_id32;
1515 real_packet->city_id16 = city_id16;
1516 real_packet->city_id32 = city_id32;
1517
1518 return send_packet_investigate_started(pc, real_packet);
1519}
1520
1521#ifdef FREECIV_DELTA_PROTOCOL
1522#define hash_packet_investigate_finished_100 hash_const
1523
1524#define cmp_packet_investigate_finished_100 cmp_const
1525
1526 BV_DEFINE(packet_investigate_finished_100_fields, 2);
1527#endif /* FREECIV_DELTA_PROTOCOL */
1528
1529 static struct packet_investigate_finished *receive_packet_investigate_finished_100(struct connection *pc)
1530{
1531#ifdef FREECIV_DELTA_PROTOCOL
1532 packet_investigate_finished_100_fields fields;
1533 struct packet_investigate_finished *old;
1534 struct genhash **hash = pc->phs.received + PACKET_INVESTIGATE_FINISHED;
1535#endif /* FREECIV_DELTA_PROTOCOL */
1536 RECEIVE_PACKET_START(packet_investigate_finished, real_packet);
1537#ifdef FREECIV_JSON_CONNECTION
1538 struct plocation field_addr;
1539 {
1540 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1541 field_addr = *field_addr_tmp;
1542 FC_FREE(field_addr_tmp);
1543 }
1544#endif /* FREECIV_JSON_CONNECTION */
1545
1546#ifdef FREECIV_DELTA_PROTOCOL
1547#ifdef FREECIV_JSON_CONNECTION
1548 field_addr.name = "fields";
1549#endif /* FREECIV_JSON_CONNECTION */
1550 DIO_BV_GET(&din, &field_addr, fields);
1551
1552#else /* FREECIV_DELTA_PROTOCOL */
1553 #ifdef FREECIV_JSON_CONNECTION
1554 field_addr.name = "unit_id32";
1555 #endif /* FREECIV_JSON_CONNECTION */
1556 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
1557 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
1558 }
1559 #ifdef FREECIV_JSON_CONNECTION
1560 field_addr.name = "city_id32";
1561 #endif /* FREECIV_JSON_CONNECTION */
1562 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
1563 RECEIVE_PACKET_FIELD_ERROR(city_id32);
1564 }
1565
1566#endif
1567 log_packet_detailed("packet_investigate_finished_100: got info about ()");
1568
1569#ifdef FREECIV_DELTA_PROTOCOL
1570 if (NULL == *hash) {
1571 *hash = genhash_new_full(hash_packet_investigate_finished_100, cmp_packet_investigate_finished_100,
1572 NULL, NULL, NULL, free);
1573 }
1574
1575 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
1576 *real_packet = *old;
1577 } else {
1578 log_packet_detailed(" no old info");
1579 memset(real_packet, 0, sizeof(*real_packet));
1580 }
1581
1582 if (BV_ISSET(fields, 0)) {
1583 log_packet_detailed(" got field 'unit_id32'");
1584 #ifdef FREECIV_JSON_CONNECTION
1585 field_addr.name = "unit_id32";
1586 #endif /* FREECIV_JSON_CONNECTION */
1587 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
1588 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
1589 }
1590 }
1591 if (BV_ISSET(fields, 1)) {
1592 log_packet_detailed(" got field 'city_id32'");
1593 #ifdef FREECIV_JSON_CONNECTION
1594 field_addr.name = "city_id32";
1595 #endif /* FREECIV_JSON_CONNECTION */
1596 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
1597 RECEIVE_PACKET_FIELD_ERROR(city_id32);
1598 }
1599 }
1600
1601 if (NULL == old) {
1602 old = fc_malloc(sizeof(*old));
1603 *old = *real_packet;
1604 genhash_insert(*hash, old, old);
1605 } else {
1606 *old = *real_packet;
1607 }
1608
1609#endif /* FREECIV_DELTA_PROTOCOL */
1610 RECEIVE_PACKET_END(real_packet);
1611}
1612
1613 static int send_packet_investigate_finished_100(struct connection *pc, const struct packet_investigate_finished *packet)
1614{
1615 const struct packet_investigate_finished *real_packet = packet;
1616#ifdef FREECIV_DELTA_PROTOCOL
1617 packet_investigate_finished_100_fields fields;
1618 struct packet_investigate_finished *old;
1619 bool differ;
1620 struct genhash **hash = pc->phs.sent + PACKET_INVESTIGATE_FINISHED;
1621#endif /* FREECIV_DELTA_PROTOCOL */
1622 SEND_PACKET_START(PACKET_INVESTIGATE_FINISHED);
1623#ifdef FREECIV_JSON_CONNECTION
1624 struct plocation field_addr;
1625 {
1626 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1627 field_addr = *field_addr_tmp;
1628 FC_FREE(field_addr_tmp);
1629 }
1630#endif /* FREECIV_JSON_CONNECTION */
1631
1632 log_packet_detailed("packet_investigate_finished_100: sending info about ()");
1633
1634#ifdef FREECIV_DELTA_PROTOCOL
1635 if (NULL == *hash) {
1636 *hash = genhash_new_full(hash_packet_investigate_finished_100, cmp_packet_investigate_finished_100,
1637 NULL, NULL, NULL, free);
1638 }
1639 BV_CLR_ALL(fields);
1640
1641 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
1642 old = fc_malloc(sizeof(*old));
1643 *old = *real_packet;
1644 genhash_insert(*hash, old, old);
1645 memset(old, 0, sizeof(*old));
1646 }
1647 differ = (old->unit_id32 != real_packet->unit_id32);
1648 if (differ) {
1649 BV_SET(fields, 0);
1650 }
1651
1652 differ = (old->city_id32 != real_packet->city_id32);
1653 if (differ) {
1654 BV_SET(fields, 1);
1655 }
1656
1657
1658#ifdef FREECIV_JSON_CONNECTION
1659 field_addr.name = "fields";
1660#endif /* FREECIV_JSON_CONNECTION */
1661 DIO_BV_PUT(&dout, &field_addr, fields);
1662
1663 if (BV_ISSET(fields, 0)) {
1664 log_packet_detailed(" field 'unit_id32' has changed");
1665 #ifdef FREECIV_JSON_CONNECTION
1666 field_addr.name = "unit_id32";
1667#endif /* FREECIV_JSON_CONNECTION */
1668 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
1669 }
1670 if (BV_ISSET(fields, 1)) {
1671 log_packet_detailed(" field 'city_id32' has changed");
1672 #ifdef FREECIV_JSON_CONNECTION
1673 field_addr.name = "city_id32";
1674#endif /* FREECIV_JSON_CONNECTION */
1675 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
1676 }
1677
1678 *old = *real_packet;
1679#endif /* FREECIV_DELTA_PROTOCOL */
1680#ifndef FREECIV_DELTA_PROTOCOL
1681#ifdef FREECIV_JSON_CONNECTION
1682 field_addr.name = "unit_id32";
1683#endif /* FREECIV_JSON_CONNECTION */
1684 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
1685#ifdef FREECIV_JSON_CONNECTION
1686 field_addr.name = "city_id32";
1687#endif /* FREECIV_JSON_CONNECTION */
1688 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
1689
1690#endif
1691 SEND_PACKET_END(PACKET_INVESTIGATE_FINISHED);
1692}
1693
1694#ifdef FREECIV_DELTA_PROTOCOL
1695#define hash_packet_investigate_finished_101 hash_const
1696
1697#define cmp_packet_investigate_finished_101 cmp_const
1698
1699 BV_DEFINE(packet_investigate_finished_101_fields, 2);
1700#endif /* FREECIV_DELTA_PROTOCOL */
1701
1702 static struct packet_investigate_finished *receive_packet_investigate_finished_101(struct connection *pc)
1703{
1704#ifdef FREECIV_DELTA_PROTOCOL
1705 packet_investigate_finished_101_fields fields;
1706 struct packet_investigate_finished *old;
1707 struct genhash **hash = pc->phs.received + PACKET_INVESTIGATE_FINISHED;
1708#endif /* FREECIV_DELTA_PROTOCOL */
1709 RECEIVE_PACKET_START(packet_investigate_finished, real_packet);
1710#ifdef FREECIV_JSON_CONNECTION
1711 struct plocation field_addr;
1712 {
1713 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1714 field_addr = *field_addr_tmp;
1715 FC_FREE(field_addr_tmp);
1716 }
1717#endif /* FREECIV_JSON_CONNECTION */
1718
1719#ifdef FREECIV_DELTA_PROTOCOL
1720#ifdef FREECIV_JSON_CONNECTION
1721 field_addr.name = "fields";
1722#endif /* FREECIV_JSON_CONNECTION */
1723 DIO_BV_GET(&din, &field_addr, fields);
1724
1725#else /* FREECIV_DELTA_PROTOCOL */
1726 #ifdef FREECIV_JSON_CONNECTION
1727 field_addr.name = "unit_id16";
1728 #endif /* FREECIV_JSON_CONNECTION */
1729 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
1730 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
1731 }
1732 #ifdef FREECIV_JSON_CONNECTION
1733 field_addr.name = "city_id16";
1734 #endif /* FREECIV_JSON_CONNECTION */
1735 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
1736 RECEIVE_PACKET_FIELD_ERROR(city_id16);
1737 }
1738
1739#endif
1740 log_packet_detailed("packet_investigate_finished_101: got info about ()");
1741
1742#ifdef FREECIV_DELTA_PROTOCOL
1743 if (NULL == *hash) {
1744 *hash = genhash_new_full(hash_packet_investigate_finished_101, cmp_packet_investigate_finished_101,
1745 NULL, NULL, NULL, free);
1746 }
1747
1748 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
1749 *real_packet = *old;
1750 } else {
1751 log_packet_detailed(" no old info");
1752 memset(real_packet, 0, sizeof(*real_packet));
1753 }
1754
1755 if (BV_ISSET(fields, 0)) {
1756 log_packet_detailed(" got field 'unit_id16'");
1757 #ifdef FREECIV_JSON_CONNECTION
1758 field_addr.name = "unit_id16";
1759 #endif /* FREECIV_JSON_CONNECTION */
1760 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
1761 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
1762 }
1763 }
1764 if (BV_ISSET(fields, 1)) {
1765 log_packet_detailed(" got field 'city_id16'");
1766 #ifdef FREECIV_JSON_CONNECTION
1767 field_addr.name = "city_id16";
1768 #endif /* FREECIV_JSON_CONNECTION */
1769 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
1770 RECEIVE_PACKET_FIELD_ERROR(city_id16);
1771 }
1772 }
1773
1774 if (NULL == old) {
1775 old = fc_malloc(sizeof(*old));
1776 *old = *real_packet;
1777 genhash_insert(*hash, old, old);
1778 } else {
1779 *old = *real_packet;
1780 }
1781
1782#endif /* FREECIV_DELTA_PROTOCOL */
1783 RECEIVE_PACKET_END(real_packet);
1784}
1785
1786 static int send_packet_investigate_finished_101(struct connection *pc, const struct packet_investigate_finished *packet)
1787{
1788 const struct packet_investigate_finished *real_packet = packet;
1789#ifdef FREECIV_DELTA_PROTOCOL
1790 packet_investigate_finished_101_fields fields;
1791 struct packet_investigate_finished *old;
1792 bool differ;
1793 struct genhash **hash = pc->phs.sent + PACKET_INVESTIGATE_FINISHED;
1794#endif /* FREECIV_DELTA_PROTOCOL */
1795 SEND_PACKET_START(PACKET_INVESTIGATE_FINISHED);
1796#ifdef FREECIV_JSON_CONNECTION
1797 struct plocation field_addr;
1798 {
1799 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1800 field_addr = *field_addr_tmp;
1801 FC_FREE(field_addr_tmp);
1802 }
1803#endif /* FREECIV_JSON_CONNECTION */
1804
1805 log_packet_detailed("packet_investigate_finished_101: sending info about ()");
1806
1807#ifdef FREECIV_DELTA_PROTOCOL
1808 if (NULL == *hash) {
1809 *hash = genhash_new_full(hash_packet_investigate_finished_101, cmp_packet_investigate_finished_101,
1810 NULL, NULL, NULL, free);
1811 }
1812 BV_CLR_ALL(fields);
1813
1814 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
1815 old = fc_malloc(sizeof(*old));
1816 *old = *real_packet;
1817 genhash_insert(*hash, old, old);
1818 memset(old, 0, sizeof(*old));
1819 }
1820 differ = (old->unit_id16 != real_packet->unit_id16);
1821 if (differ) {
1822 BV_SET(fields, 0);
1823 }
1824
1825 differ = (old->city_id16 != real_packet->city_id16);
1826 if (differ) {
1827 BV_SET(fields, 1);
1828 }
1829
1830
1831#ifdef FREECIV_JSON_CONNECTION
1832 field_addr.name = "fields";
1833#endif /* FREECIV_JSON_CONNECTION */
1834 DIO_BV_PUT(&dout, &field_addr, fields);
1835
1836 if (BV_ISSET(fields, 0)) {
1837 log_packet_detailed(" field 'unit_id16' has changed");
1838 #ifdef FREECIV_JSON_CONNECTION
1839 field_addr.name = "unit_id16";
1840#endif /* FREECIV_JSON_CONNECTION */
1841 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
1842 }
1843 if (BV_ISSET(fields, 1)) {
1844 log_packet_detailed(" field 'city_id16' has changed");
1845 #ifdef FREECIV_JSON_CONNECTION
1846 field_addr.name = "city_id16";
1847#endif /* FREECIV_JSON_CONNECTION */
1848 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
1849 }
1850
1851 *old = *real_packet;
1852#endif /* FREECIV_DELTA_PROTOCOL */
1853#ifndef FREECIV_DELTA_PROTOCOL
1854#ifdef FREECIV_JSON_CONNECTION
1855 field_addr.name = "unit_id16";
1856#endif /* FREECIV_JSON_CONNECTION */
1857 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
1858#ifdef FREECIV_JSON_CONNECTION
1859 field_addr.name = "city_id16";
1860#endif /* FREECIV_JSON_CONNECTION */
1861 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
1862
1863#endif
1864 SEND_PACKET_END(PACKET_INVESTIGATE_FINISHED);
1865}
1866
1867 int send_packet_investigate_finished(struct connection *pc, const struct packet_investigate_finished *packet)
1868{
1869 if (!pc->used) {
1870 log_error("WARNING: trying to send data to the closed connection %s",
1871 conn_description(pc));
1872 return -1;
1873 }
1874 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_INVESTIGATE_FINISHED].packet != NULL, -1,
1875 "Handler for PACKET_INVESTIGATE_FINISHED not installed");
1876 return pc->phs.handlers->send[PACKET_INVESTIGATE_FINISHED].packet(pc, packet);
1877}
1878
1879 int dsend_packet_investigate_finished(struct connection *pc, int unit_id16, int unit_id32, int city_id16, int city_id32)
1880{
1881 struct packet_investigate_finished packet, *real_packet = &packet;
1882
1883 real_packet->unit_id16 = unit_id16;
1884 real_packet->unit_id32 = unit_id32;
1885 real_packet->city_id16 = city_id16;
1886 real_packet->city_id32 = city_id32;
1887
1888 return send_packet_investigate_finished(pc, real_packet);
1889}
1890
1891 static struct packet_server_join_req *receive_packet_server_join_req_100(struct connection *pc)
1892{
1893 RECEIVE_PACKET_START(packet_server_join_req, real_packet);
1894#ifdef FREECIV_JSON_CONNECTION
1895 struct plocation field_addr;
1896 {
1897 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1898 field_addr = *field_addr_tmp;
1899 FC_FREE(field_addr_tmp);
1900 }
1901#endif /* FREECIV_JSON_CONNECTION */
1902#if 1 /* To match endif */
1903 #ifdef FREECIV_JSON_CONNECTION
1904 field_addr.name = "username";
1905 #endif /* FREECIV_JSON_CONNECTION */
1906 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
1907 RECEIVE_PACKET_FIELD_ERROR(username);
1908 }
1909 #ifdef FREECIV_JSON_CONNECTION
1910 field_addr.name = "capability";
1911 #endif /* FREECIV_JSON_CONNECTION */
1912 if (!DIO_GET(string, &din, &field_addr, real_packet->capability, sizeof(real_packet->capability))) {
1913 RECEIVE_PACKET_FIELD_ERROR(capability);
1914 }
1915 #ifdef FREECIV_JSON_CONNECTION
1916 field_addr.name = "version_label";
1917 #endif /* FREECIV_JSON_CONNECTION */
1918 if (!DIO_GET(string, &din, &field_addr, real_packet->version_label, sizeof(real_packet->version_label))) {
1919 RECEIVE_PACKET_FIELD_ERROR(version_label);
1920 }
1921 #ifdef FREECIV_JSON_CONNECTION
1922 field_addr.name = "major_version";
1923 #endif /* FREECIV_JSON_CONNECTION */
1924 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->major_version)) {
1925 RECEIVE_PACKET_FIELD_ERROR(major_version);
1926 }
1927 #ifdef FREECIV_JSON_CONNECTION
1928 field_addr.name = "minor_version";
1929 #endif /* FREECIV_JSON_CONNECTION */
1930 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->minor_version)) {
1931 RECEIVE_PACKET_FIELD_ERROR(minor_version);
1932 }
1933 #ifdef FREECIV_JSON_CONNECTION
1934 field_addr.name = "patch_version";
1935 #endif /* FREECIV_JSON_CONNECTION */
1936 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->patch_version)) {
1937 RECEIVE_PACKET_FIELD_ERROR(patch_version);
1938 }
1939
1940#endif
1941 log_packet_detailed("packet_server_join_req_100: got info about ()");
1942 RECEIVE_PACKET_END(real_packet);
1943}
1944
1945 static int send_packet_server_join_req_100(struct connection *pc, const struct packet_server_join_req *packet)
1946{
1947 const struct packet_server_join_req *real_packet = packet;
1948 SEND_PACKET_START(PACKET_SERVER_JOIN_REQ);
1949#ifdef FREECIV_JSON_CONNECTION
1950 struct plocation field_addr;
1951 {
1952 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1953 field_addr = *field_addr_tmp;
1954 FC_FREE(field_addr_tmp);
1955 }
1956#endif /* FREECIV_JSON_CONNECTION */
1957
1958 log_packet_detailed("packet_server_join_req_100: sending info about ()");
1959#if 1 /* To match endif */
1960#ifdef FREECIV_JSON_CONNECTION
1961 field_addr.name = "username";
1962#endif /* FREECIV_JSON_CONNECTION */
1963 DIO_PUT(string, &dout, &field_addr, real_packet->username);
1964#ifdef FREECIV_JSON_CONNECTION
1965 field_addr.name = "capability";
1966#endif /* FREECIV_JSON_CONNECTION */
1967 DIO_PUT(string, &dout, &field_addr, real_packet->capability);
1968#ifdef FREECIV_JSON_CONNECTION
1969 field_addr.name = "version_label";
1970#endif /* FREECIV_JSON_CONNECTION */
1971 DIO_PUT(string, &dout, &field_addr, real_packet->version_label);
1972#ifdef FREECIV_JSON_CONNECTION
1973 field_addr.name = "major_version";
1974#endif /* FREECIV_JSON_CONNECTION */
1975 DIO_PUT(uint32, &dout, &field_addr, real_packet->major_version);
1976#ifdef FREECIV_JSON_CONNECTION
1977 field_addr.name = "minor_version";
1978#endif /* FREECIV_JSON_CONNECTION */
1979 DIO_PUT(uint32, &dout, &field_addr, real_packet->minor_version);
1980#ifdef FREECIV_JSON_CONNECTION
1981 field_addr.name = "patch_version";
1982#endif /* FREECIV_JSON_CONNECTION */
1983 DIO_PUT(uint32, &dout, &field_addr, real_packet->patch_version);
1984
1985#endif
1986 SEND_PACKET_END(PACKET_SERVER_JOIN_REQ);
1987}
1988
1989 int send_packet_server_join_req(struct connection *pc, const struct packet_server_join_req *packet)
1990{
1991 if (!pc->used) {
1992 log_error("WARNING: trying to send data to the closed connection %s",
1993 conn_description(pc));
1994 return -1;
1995 }
1996 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_JOIN_REQ].packet != NULL, -1,
1997 "Handler for PACKET_SERVER_JOIN_REQ not installed");
1998 return pc->phs.handlers->send[PACKET_SERVER_JOIN_REQ].packet(pc, packet);
1999}
2000
2001 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)
2002{
2003 struct packet_server_join_req packet, *real_packet = &packet;
2004
2005 sz_strlcpy(real_packet->username, username);
2006 sz_strlcpy(real_packet->capability, capability);
2007 sz_strlcpy(real_packet->version_label, version_label);
2008 real_packet->major_version = major_version;
2009 real_packet->minor_version = minor_version;
2010 real_packet->patch_version = patch_version;
2011
2012 return send_packet_server_join_req(pc, real_packet);
2013}
2014
2015 static struct packet_server_join_reply *receive_packet_server_join_reply_100(struct connection *pc)
2016{
2017 RECEIVE_PACKET_START(packet_server_join_reply, real_packet);
2018#ifdef FREECIV_JSON_CONNECTION
2019 struct plocation field_addr;
2020 {
2021 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2022 field_addr = *field_addr_tmp;
2023 FC_FREE(field_addr_tmp);
2024 }
2025#endif /* FREECIV_JSON_CONNECTION */
2026#if 1 /* To match endif */
2027 #ifdef FREECIV_JSON_CONNECTION
2028 field_addr.name = "you_can_join";
2029 #endif /* FREECIV_JSON_CONNECTION */
2030 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->you_can_join)) {
2031 RECEIVE_PACKET_FIELD_ERROR(you_can_join);
2032 }
2033 #ifdef FREECIV_JSON_CONNECTION
2034 field_addr.name = "message";
2035 #endif /* FREECIV_JSON_CONNECTION */
2036 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
2037 RECEIVE_PACKET_FIELD_ERROR(message);
2038 }
2039 #ifdef FREECIV_JSON_CONNECTION
2040 field_addr.name = "capability";
2041 #endif /* FREECIV_JSON_CONNECTION */
2042 if (!DIO_GET(string, &din, &field_addr, real_packet->capability, sizeof(real_packet->capability))) {
2043 RECEIVE_PACKET_FIELD_ERROR(capability);
2044 }
2045 #ifdef FREECIV_JSON_CONNECTION
2046 field_addr.name = "challenge_file";
2047 #endif /* FREECIV_JSON_CONNECTION */
2048 if (!DIO_GET(string, &din, &field_addr, real_packet->challenge_file, sizeof(real_packet->challenge_file))) {
2049 RECEIVE_PACKET_FIELD_ERROR(challenge_file);
2050 }
2051 #ifdef FREECIV_JSON_CONNECTION
2052 field_addr.name = "conn_id";
2053 #endif /* FREECIV_JSON_CONNECTION */
2054 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
2055 RECEIVE_PACKET_FIELD_ERROR(conn_id);
2056 }
2057
2058#endif
2059 log_packet_detailed("packet_server_join_reply_100: got info about ()");
2060 post_receive_packet_server_join_reply(pc, real_packet);
2061 RECEIVE_PACKET_END(real_packet);
2062}
2063
2064 static int send_packet_server_join_reply_100(struct connection *pc, const struct packet_server_join_reply *packet)
2065{
2066 const struct packet_server_join_reply *real_packet = packet;
2067 SEND_PACKET_START(PACKET_SERVER_JOIN_REPLY);
2068#ifdef FREECIV_JSON_CONNECTION
2069 struct plocation field_addr;
2070 {
2071 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2072 field_addr = *field_addr_tmp;
2073 FC_FREE(field_addr_tmp);
2074 }
2075#endif /* FREECIV_JSON_CONNECTION */
2076
2077 log_packet_detailed("packet_server_join_reply_100: sending info about ()");
2078#if 1 /* To match endif */
2079#ifdef FREECIV_JSON_CONNECTION
2080 field_addr.name = "you_can_join";
2081#endif /* FREECIV_JSON_CONNECTION */
2082 DIO_PUT(bool8, &dout, &field_addr, real_packet->you_can_join);
2083#ifdef FREECIV_JSON_CONNECTION
2084 field_addr.name = "message";
2085#endif /* FREECIV_JSON_CONNECTION */
2086 DIO_PUT(string, &dout, &field_addr, real_packet->message);
2087#ifdef FREECIV_JSON_CONNECTION
2088 field_addr.name = "capability";
2089#endif /* FREECIV_JSON_CONNECTION */
2090 DIO_PUT(string, &dout, &field_addr, real_packet->capability);
2091#ifdef FREECIV_JSON_CONNECTION
2092 field_addr.name = "challenge_file";
2093#endif /* FREECIV_JSON_CONNECTION */
2094 DIO_PUT(string, &dout, &field_addr, real_packet->challenge_file);
2095#ifdef FREECIV_JSON_CONNECTION
2096 field_addr.name = "conn_id";
2097#endif /* FREECIV_JSON_CONNECTION */
2098 DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
2099
2100#endif
2101 post_send_packet_server_join_reply(pc, real_packet);
2102 SEND_PACKET_END(PACKET_SERVER_JOIN_REPLY);
2103}
2104
2105 int send_packet_server_join_reply(struct connection *pc, const struct packet_server_join_reply *packet)
2106{
2107 if (!pc->used) {
2108 log_error("WARNING: trying to send data to the closed connection %s",
2109 conn_description(pc));
2110 return -1;
2111 }
2112 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_JOIN_REPLY].packet != NULL, -1,
2113 "Handler for PACKET_SERVER_JOIN_REPLY not installed");
2114 return pc->phs.handlers->send[PACKET_SERVER_JOIN_REPLY].packet(pc, packet);
2115}
2116
2117#ifdef FREECIV_DELTA_PROTOCOL
2118#define hash_packet_authentication_req_100 hash_const
2119
2120#define cmp_packet_authentication_req_100 cmp_const
2121
2122 BV_DEFINE(packet_authentication_req_100_fields, 2);
2123#endif /* FREECIV_DELTA_PROTOCOL */
2124
2125 static struct packet_authentication_req *receive_packet_authentication_req_100(struct connection *pc)
2126{
2127#ifdef FREECIV_DELTA_PROTOCOL
2128 packet_authentication_req_100_fields fields;
2129 struct packet_authentication_req *old;
2130 struct genhash **hash = pc->phs.received + PACKET_AUTHENTICATION_REQ;
2131#endif /* FREECIV_DELTA_PROTOCOL */
2132 RECEIVE_PACKET_START(packet_authentication_req, real_packet);
2133#ifdef FREECIV_JSON_CONNECTION
2134 struct plocation field_addr;
2135 {
2136 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2137 field_addr = *field_addr_tmp;
2138 FC_FREE(field_addr_tmp);
2139 }
2140#endif /* FREECIV_JSON_CONNECTION */
2141
2142#ifdef FREECIV_DELTA_PROTOCOL
2143#ifdef FREECIV_JSON_CONNECTION
2144 field_addr.name = "fields";
2145#endif /* FREECIV_JSON_CONNECTION */
2146 DIO_BV_GET(&din, &field_addr, fields);
2147
2148#else /* FREECIV_DELTA_PROTOCOL */
2149 #ifdef FREECIV_JSON_CONNECTION
2150 field_addr.name = "type";
2151 #endif /* FREECIV_JSON_CONNECTION */
2152 {
2153 int readin;
2154
2155 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
2156 RECEIVE_PACKET_FIELD_ERROR(type);
2157 }
2158 real_packet->type = readin;
2159 }
2160 #ifdef FREECIV_JSON_CONNECTION
2161 field_addr.name = "message";
2162 #endif /* FREECIV_JSON_CONNECTION */
2163 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
2164 RECEIVE_PACKET_FIELD_ERROR(message);
2165 }
2166
2167#endif
2168 log_packet_detailed("packet_authentication_req_100: got info about ()");
2169
2170#ifdef FREECIV_DELTA_PROTOCOL
2171 if (NULL == *hash) {
2172 *hash = genhash_new_full(hash_packet_authentication_req_100, cmp_packet_authentication_req_100,
2173 NULL, NULL, NULL, free);
2174 }
2175
2176 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
2177 *real_packet = *old;
2178 } else {
2179 log_packet_detailed(" no old info");
2180 memset(real_packet, 0, sizeof(*real_packet));
2181 }
2182
2183 if (BV_ISSET(fields, 0)) {
2184 log_packet_detailed(" got field 'type'");
2185 #ifdef FREECIV_JSON_CONNECTION
2186 field_addr.name = "type";
2187 #endif /* FREECIV_JSON_CONNECTION */
2188 {
2189 int readin;
2190
2191 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
2192 RECEIVE_PACKET_FIELD_ERROR(type);
2193 }
2194 real_packet->type = readin;
2195 }
2196 }
2197 if (BV_ISSET(fields, 1)) {
2198 log_packet_detailed(" got field 'message'");
2199 #ifdef FREECIV_JSON_CONNECTION
2200 field_addr.name = "message";
2201 #endif /* FREECIV_JSON_CONNECTION */
2202 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
2203 RECEIVE_PACKET_FIELD_ERROR(message);
2204 }
2205 }
2206
2207 if (NULL == old) {
2208 old = fc_malloc(sizeof(*old));
2209 *old = *real_packet;
2210 genhash_insert(*hash, old, old);
2211 } else {
2212 *old = *real_packet;
2213 }
2214
2215#endif /* FREECIV_DELTA_PROTOCOL */
2216 RECEIVE_PACKET_END(real_packet);
2217}
2218
2219 static int send_packet_authentication_req_100(struct connection *pc, const struct packet_authentication_req *packet)
2220{
2221 const struct packet_authentication_req *real_packet = packet;
2222#ifdef FREECIV_DELTA_PROTOCOL
2223 packet_authentication_req_100_fields fields;
2224 struct packet_authentication_req *old;
2225 bool differ;
2226 struct genhash **hash = pc->phs.sent + PACKET_AUTHENTICATION_REQ;
2227#endif /* FREECIV_DELTA_PROTOCOL */
2228 SEND_PACKET_START(PACKET_AUTHENTICATION_REQ);
2229#ifdef FREECIV_JSON_CONNECTION
2230 struct plocation field_addr;
2231 {
2232 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2233 field_addr = *field_addr_tmp;
2234 FC_FREE(field_addr_tmp);
2235 }
2236#endif /* FREECIV_JSON_CONNECTION */
2237
2238 log_packet_detailed("packet_authentication_req_100: sending info about ()");
2239
2240#ifdef FREECIV_DELTA_PROTOCOL
2241 if (NULL == *hash) {
2242 *hash = genhash_new_full(hash_packet_authentication_req_100, cmp_packet_authentication_req_100,
2243 NULL, NULL, NULL, free);
2244 }
2245 BV_CLR_ALL(fields);
2246
2247 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
2248 old = fc_malloc(sizeof(*old));
2249 *old = *real_packet;
2250 genhash_insert(*hash, old, old);
2251 memset(old, 0, sizeof(*old));
2252 }
2253 differ = (old->type != real_packet->type);
2254 if (differ) {
2255 BV_SET(fields, 0);
2256 }
2257
2258 differ = (strcmp(old->message, real_packet->message) != 0);
2259 if (differ) {
2260 BV_SET(fields, 1);
2261 }
2262
2263
2264#ifdef FREECIV_JSON_CONNECTION
2265 field_addr.name = "fields";
2266#endif /* FREECIV_JSON_CONNECTION */
2267 DIO_BV_PUT(&dout, &field_addr, fields);
2268
2269 if (BV_ISSET(fields, 0)) {
2270 log_packet_detailed(" field 'type' has changed");
2271 #ifdef FREECIV_JSON_CONNECTION
2272 field_addr.name = "type";
2273#endif /* FREECIV_JSON_CONNECTION */
2274 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
2275 }
2276 if (BV_ISSET(fields, 1)) {
2277 log_packet_detailed(" field 'message' has changed");
2278 #ifdef FREECIV_JSON_CONNECTION
2279 field_addr.name = "message";
2280#endif /* FREECIV_JSON_CONNECTION */
2281 DIO_PUT(string, &dout, &field_addr, real_packet->message);
2282 }
2283
2284 *old = *real_packet;
2285#endif /* FREECIV_DELTA_PROTOCOL */
2286#ifndef FREECIV_DELTA_PROTOCOL
2287#ifdef FREECIV_JSON_CONNECTION
2288 field_addr.name = "type";
2289#endif /* FREECIV_JSON_CONNECTION */
2290 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
2291#ifdef FREECIV_JSON_CONNECTION
2292 field_addr.name = "message";
2293#endif /* FREECIV_JSON_CONNECTION */
2294 DIO_PUT(string, &dout, &field_addr, real_packet->message);
2295
2296#endif
2297 SEND_PACKET_END(PACKET_AUTHENTICATION_REQ);
2298}
2299
2300 int send_packet_authentication_req(struct connection *pc, const struct packet_authentication_req *packet)
2301{
2302 if (!pc->used) {
2303 log_error("WARNING: trying to send data to the closed connection %s",
2304 conn_description(pc));
2305 return -1;
2306 }
2307 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_AUTHENTICATION_REQ].packet != NULL, -1,
2308 "Handler for PACKET_AUTHENTICATION_REQ not installed");
2309 return pc->phs.handlers->send[PACKET_AUTHENTICATION_REQ].packet(pc, packet);
2310}
2311
2312 int dsend_packet_authentication_req(struct connection *pc, enum authentication_type type, const char *message)
2313{
2314 struct packet_authentication_req packet, *real_packet = &packet;
2315
2316 real_packet->type = type;
2317 sz_strlcpy(real_packet->message, message);
2318
2319 return send_packet_authentication_req(pc, real_packet);
2320}
2321
2322#ifdef FREECIV_DELTA_PROTOCOL
2323#define hash_packet_authentication_reply_100 hash_const
2324
2325#define cmp_packet_authentication_reply_100 cmp_const
2326
2327 BV_DEFINE(packet_authentication_reply_100_fields, 1);
2328#endif /* FREECIV_DELTA_PROTOCOL */
2329
2330 static struct packet_authentication_reply *receive_packet_authentication_reply_100(struct connection *pc)
2331{
2332#ifdef FREECIV_DELTA_PROTOCOL
2333 packet_authentication_reply_100_fields fields;
2334 struct packet_authentication_reply *old;
2335 struct genhash **hash = pc->phs.received + PACKET_AUTHENTICATION_REPLY;
2336#endif /* FREECIV_DELTA_PROTOCOL */
2337 RECEIVE_PACKET_START(packet_authentication_reply, real_packet);
2338#ifdef FREECIV_JSON_CONNECTION
2339 struct plocation field_addr;
2340 {
2341 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2342 field_addr = *field_addr_tmp;
2343 FC_FREE(field_addr_tmp);
2344 }
2345#endif /* FREECIV_JSON_CONNECTION */
2346
2347#ifdef FREECIV_DELTA_PROTOCOL
2348#ifdef FREECIV_JSON_CONNECTION
2349 field_addr.name = "fields";
2350#endif /* FREECIV_JSON_CONNECTION */
2351 DIO_BV_GET(&din, &field_addr, fields);
2352
2353#else /* FREECIV_DELTA_PROTOCOL */
2354 #ifdef FREECIV_JSON_CONNECTION
2355 field_addr.name = "password";
2356 #endif /* FREECIV_JSON_CONNECTION */
2357 if (!DIO_GET(string, &din, &field_addr, real_packet->password, sizeof(real_packet->password))) {
2358 RECEIVE_PACKET_FIELD_ERROR(password);
2359 }
2360
2361#endif
2362 log_packet_detailed("packet_authentication_reply_100: got info about ()");
2363
2364#ifdef FREECIV_DELTA_PROTOCOL
2365 if (NULL == *hash) {
2366 *hash = genhash_new_full(hash_packet_authentication_reply_100, cmp_packet_authentication_reply_100,
2367 NULL, NULL, NULL, free);
2368 }
2369
2370 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
2371 *real_packet = *old;
2372 } else {
2373 log_packet_detailed(" no old info");
2374 memset(real_packet, 0, sizeof(*real_packet));
2375 }
2376
2377 if (BV_ISSET(fields, 0)) {
2378 log_packet_detailed(" got field 'password'");
2379 #ifdef FREECIV_JSON_CONNECTION
2380 field_addr.name = "password";
2381 #endif /* FREECIV_JSON_CONNECTION */
2382 if (!DIO_GET(string, &din, &field_addr, real_packet->password, sizeof(real_packet->password))) {
2383 RECEIVE_PACKET_FIELD_ERROR(password);
2384 }
2385 }
2386
2387 if (NULL == old) {
2388 old = fc_malloc(sizeof(*old));
2389 *old = *real_packet;
2390 genhash_insert(*hash, old, old);
2391 } else {
2392 *old = *real_packet;
2393 }
2394
2395#endif /* FREECIV_DELTA_PROTOCOL */
2396 RECEIVE_PACKET_END(real_packet);
2397}
2398
2399 static int send_packet_authentication_reply_100(struct connection *pc, const struct packet_authentication_reply *packet)
2400{
2401 const struct packet_authentication_reply *real_packet = packet;
2402#ifdef FREECIV_DELTA_PROTOCOL
2403 packet_authentication_reply_100_fields fields;
2404 struct packet_authentication_reply *old;
2405 bool differ;
2406 struct genhash **hash = pc->phs.sent + PACKET_AUTHENTICATION_REPLY;
2407#endif /* FREECIV_DELTA_PROTOCOL */
2408 SEND_PACKET_START(PACKET_AUTHENTICATION_REPLY);
2409#ifdef FREECIV_JSON_CONNECTION
2410 struct plocation field_addr;
2411 {
2412 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2413 field_addr = *field_addr_tmp;
2414 FC_FREE(field_addr_tmp);
2415 }
2416#endif /* FREECIV_JSON_CONNECTION */
2417
2418 log_packet_detailed("packet_authentication_reply_100: sending info about ()");
2419
2420#ifdef FREECIV_DELTA_PROTOCOL
2421 if (NULL == *hash) {
2422 *hash = genhash_new_full(hash_packet_authentication_reply_100, cmp_packet_authentication_reply_100,
2423 NULL, NULL, NULL, free);
2424 }
2425 BV_CLR_ALL(fields);
2426
2427 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
2428 old = fc_malloc(sizeof(*old));
2429 *old = *real_packet;
2430 genhash_insert(*hash, old, old);
2431 memset(old, 0, sizeof(*old));
2432 }
2433 differ = (strcmp(old->password, real_packet->password) != 0);
2434 if (differ) {
2435 BV_SET(fields, 0);
2436 }
2437
2438
2439#ifdef FREECIV_JSON_CONNECTION
2440 field_addr.name = "fields";
2441#endif /* FREECIV_JSON_CONNECTION */
2442 DIO_BV_PUT(&dout, &field_addr, fields);
2443
2444 if (BV_ISSET(fields, 0)) {
2445 log_packet_detailed(" field 'password' has changed");
2446 #ifdef FREECIV_JSON_CONNECTION
2447 field_addr.name = "password";
2448#endif /* FREECIV_JSON_CONNECTION */
2449 DIO_PUT(string, &dout, &field_addr, real_packet->password);
2450 }
2451
2452 *old = *real_packet;
2453#endif /* FREECIV_DELTA_PROTOCOL */
2454#ifndef FREECIV_DELTA_PROTOCOL
2455#ifdef FREECIV_JSON_CONNECTION
2456 field_addr.name = "password";
2457#endif /* FREECIV_JSON_CONNECTION */
2458 DIO_PUT(string, &dout, &field_addr, real_packet->password);
2459
2460#endif
2461 SEND_PACKET_END(PACKET_AUTHENTICATION_REPLY);
2462}
2463
2464 int send_packet_authentication_reply(struct connection *pc, const struct packet_authentication_reply *packet)
2465{
2466 if (!pc->used) {
2467 log_error("WARNING: trying to send data to the closed connection %s",
2468 conn_description(pc));
2469 return -1;
2470 }
2471 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_AUTHENTICATION_REPLY].packet != NULL, -1,
2472 "Handler for PACKET_AUTHENTICATION_REPLY not installed");
2473 return pc->phs.handlers->send[PACKET_AUTHENTICATION_REPLY].packet(pc, packet);
2474}
2475
2476 static struct packet_server_shutdown *receive_packet_server_shutdown_100(struct connection *pc)
2477{
2478 RECEIVE_PACKET_START(packet_server_shutdown, real_packet);
2479#if 1 /* To match endif */
2480 real_packet->__dummy = 0xff;
2481#endif
2482 log_packet_detailed("packet_server_shutdown_100: got info about ()");
2483 RECEIVE_PACKET_END(real_packet);
2484}
2485
2486 static int send_packet_server_shutdown_100(struct connection *pc)
2487{
2488 SEND_PACKET_START(PACKET_SERVER_SHUTDOWN);
2489
2490 log_packet_detailed("packet_server_shutdown_100: sending info about ()");
2491 SEND_PACKET_END(PACKET_SERVER_SHUTDOWN);
2492}
2493
2494 int send_packet_server_shutdown(struct connection *pc)
2495{
2496 if (!pc->used) {
2497 log_error("WARNING: trying to send data to the closed connection %s",
2498 conn_description(pc));
2499 return -1;
2500 }
2501 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SHUTDOWN].no_packet != NULL, -1,
2502 "Handler for PACKET_SERVER_SHUTDOWN not installed");
2503 return pc->phs.handlers->send[PACKET_SERVER_SHUTDOWN].no_packet(pc);
2504}
2505
2506 void lsend_packet_server_shutdown(struct conn_list *dest)
2507{
2508 conn_list_iterate(dest, pconn) {
2509 send_packet_server_shutdown(pconn);
2510 } conn_list_iterate_end;
2511}
2512
2513#ifdef FREECIV_DELTA_PROTOCOL
2514#define hash_packet_nation_select_req_100 hash_const
2515
2516#define cmp_packet_nation_select_req_100 cmp_const
2517
2518 BV_DEFINE(packet_nation_select_req_100_fields, 5);
2519#endif /* FREECIV_DELTA_PROTOCOL */
2520
2521 static struct packet_nation_select_req *receive_packet_nation_select_req_100(struct connection *pc)
2522{
2523#ifdef FREECIV_DELTA_PROTOCOL
2524 packet_nation_select_req_100_fields fields;
2525 struct packet_nation_select_req *old;
2526 struct genhash **hash = pc->phs.received + PACKET_NATION_SELECT_REQ;
2527#endif /* FREECIV_DELTA_PROTOCOL */
2528 RECEIVE_PACKET_START(packet_nation_select_req, real_packet);
2529#ifdef FREECIV_JSON_CONNECTION
2530 struct plocation field_addr;
2531 {
2532 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2533 field_addr = *field_addr_tmp;
2534 FC_FREE(field_addr_tmp);
2535 }
2536#endif /* FREECIV_JSON_CONNECTION */
2537
2538#ifdef FREECIV_DELTA_PROTOCOL
2539#ifdef FREECIV_JSON_CONNECTION
2540 field_addr.name = "fields";
2541#endif /* FREECIV_JSON_CONNECTION */
2542 DIO_BV_GET(&din, &field_addr, fields);
2543
2544#else /* FREECIV_DELTA_PROTOCOL */
2545 #ifdef FREECIV_JSON_CONNECTION
2546 field_addr.name = "player_no";
2547 #endif /* FREECIV_JSON_CONNECTION */
2548 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_no)) {
2549 RECEIVE_PACKET_FIELD_ERROR(player_no);
2550 }
2551 #ifdef FREECIV_JSON_CONNECTION
2552 field_addr.name = "nation_no";
2553 #endif /* FREECIV_JSON_CONNECTION */
2554 {
2555 int readin;
2556
2557 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
2558 RECEIVE_PACKET_FIELD_ERROR(nation_no);
2559 }
2560 real_packet->nation_no = readin;
2561 }
2562 #ifdef FREECIV_JSON_CONNECTION
2563 field_addr.name = "is_male";
2564 #endif /* FREECIV_JSON_CONNECTION */
2565 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_male)) {
2566 RECEIVE_PACKET_FIELD_ERROR(is_male);
2567 }
2568 #ifdef FREECIV_JSON_CONNECTION
2569 field_addr.name = "name";
2570 #endif /* FREECIV_JSON_CONNECTION */
2571 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
2572 RECEIVE_PACKET_FIELD_ERROR(name);
2573 }
2574 #ifdef FREECIV_JSON_CONNECTION
2575 field_addr.name = "style";
2576 #endif /* FREECIV_JSON_CONNECTION */
2577 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
2578 RECEIVE_PACKET_FIELD_ERROR(style);
2579 }
2580
2581#endif
2582 log_packet_detailed("packet_nation_select_req_100: got info about ()");
2583
2584#ifdef FREECIV_DELTA_PROTOCOL
2585 if (NULL == *hash) {
2586 *hash = genhash_new_full(hash_packet_nation_select_req_100, cmp_packet_nation_select_req_100,
2587 NULL, NULL, NULL, free);
2588 }
2589
2590 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
2591 *real_packet = *old;
2592 } else {
2593 log_packet_detailed(" no old info");
2594 memset(real_packet, 0, sizeof(*real_packet));
2595 }
2596
2597 if (BV_ISSET(fields, 0)) {
2598 log_packet_detailed(" got field 'player_no'");
2599 #ifdef FREECIV_JSON_CONNECTION
2600 field_addr.name = "player_no";
2601 #endif /* FREECIV_JSON_CONNECTION */
2602 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_no)) {
2603 RECEIVE_PACKET_FIELD_ERROR(player_no);
2604 }
2605 }
2606 if (BV_ISSET(fields, 1)) {
2607 log_packet_detailed(" got field 'nation_no'");
2608 #ifdef FREECIV_JSON_CONNECTION
2609 field_addr.name = "nation_no";
2610 #endif /* FREECIV_JSON_CONNECTION */
2611 {
2612 int readin;
2613
2614 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
2615 RECEIVE_PACKET_FIELD_ERROR(nation_no);
2616 }
2617 real_packet->nation_no = readin;
2618 }
2619 }
2620 real_packet->is_male = BV_ISSET(fields, 2);
2621 if (BV_ISSET(fields, 3)) {
2622 log_packet_detailed(" got field 'name'");
2623 #ifdef FREECIV_JSON_CONNECTION
2624 field_addr.name = "name";
2625 #endif /* FREECIV_JSON_CONNECTION */
2626 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
2627 RECEIVE_PACKET_FIELD_ERROR(name);
2628 }
2629 }
2630 if (BV_ISSET(fields, 4)) {
2631 log_packet_detailed(" got field 'style'");
2632 #ifdef FREECIV_JSON_CONNECTION
2633 field_addr.name = "style";
2634 #endif /* FREECIV_JSON_CONNECTION */
2635 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
2636 RECEIVE_PACKET_FIELD_ERROR(style);
2637 }
2638 }
2639
2640 if (NULL == old) {
2641 old = fc_malloc(sizeof(*old));
2642 *old = *real_packet;
2643 genhash_insert(*hash, old, old);
2644 } else {
2645 *old = *real_packet;
2646 }
2647
2648#endif /* FREECIV_DELTA_PROTOCOL */
2649 RECEIVE_PACKET_END(real_packet);
2650}
2651
2652 static int send_packet_nation_select_req_100(struct connection *pc, const struct packet_nation_select_req *packet)
2653{
2654 const struct packet_nation_select_req *real_packet = packet;
2655#ifdef FREECIV_DELTA_PROTOCOL
2656 packet_nation_select_req_100_fields fields;
2657 struct packet_nation_select_req *old;
2658 bool differ;
2659 struct genhash **hash = pc->phs.sent + PACKET_NATION_SELECT_REQ;
2660#endif /* FREECIV_DELTA_PROTOCOL */
2661 SEND_PACKET_START(PACKET_NATION_SELECT_REQ);
2662#ifdef FREECIV_JSON_CONNECTION
2663 struct plocation field_addr;
2664 {
2665 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2666 field_addr = *field_addr_tmp;
2667 FC_FREE(field_addr_tmp);
2668 }
2669#endif /* FREECIV_JSON_CONNECTION */
2670
2671 log_packet_detailed("packet_nation_select_req_100: sending info about ()");
2672
2673#ifdef FREECIV_DELTA_PROTOCOL
2674 if (NULL == *hash) {
2675 *hash = genhash_new_full(hash_packet_nation_select_req_100, cmp_packet_nation_select_req_100,
2676 NULL, NULL, NULL, free);
2677 }
2678 BV_CLR_ALL(fields);
2679
2680 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
2681 old = fc_malloc(sizeof(*old));
2682 *old = *real_packet;
2683 genhash_insert(*hash, old, old);
2684 memset(old, 0, sizeof(*old));
2685 }
2686 differ = (old->player_no != real_packet->player_no);
2687 if (differ) {
2688 BV_SET(fields, 0);
2689 }
2690
2691 differ = (old->nation_no != real_packet->nation_no);
2692 if (differ) {
2693 BV_SET(fields, 1);
2694 }
2695
2696 if (packet->is_male) {
2697 BV_SET(fields, 2);
2698 }
2699
2700 differ = (strcmp(old->name, real_packet->name) != 0);
2701 if (differ) {
2702 BV_SET(fields, 3);
2703 }
2704
2705 differ = (old->style != real_packet->style);
2706 if (differ) {
2707 BV_SET(fields, 4);
2708 }
2709
2710
2711#ifdef FREECIV_JSON_CONNECTION
2712 field_addr.name = "fields";
2713#endif /* FREECIV_JSON_CONNECTION */
2714 DIO_BV_PUT(&dout, &field_addr, fields);
2715
2716 if (BV_ISSET(fields, 0)) {
2717 log_packet_detailed(" field 'player_no' has changed");
2718 #ifdef FREECIV_JSON_CONNECTION
2719 field_addr.name = "player_no";
2720#endif /* FREECIV_JSON_CONNECTION */
2721 DIO_PUT(uint16, &dout, &field_addr, real_packet->player_no);
2722 }
2723 if (BV_ISSET(fields, 1)) {
2724 log_packet_detailed(" field 'nation_no' has changed");
2725 #ifdef FREECIV_JSON_CONNECTION
2726 field_addr.name = "nation_no";
2727#endif /* FREECIV_JSON_CONNECTION */
2728 DIO_PUT(sint16, &dout, &field_addr, real_packet->nation_no);
2729 }
2730 /* field 2 is folded into the header */
2731 if (BV_ISSET(fields, 3)) {
2732 log_packet_detailed(" field 'name' has changed");
2733 #ifdef FREECIV_JSON_CONNECTION
2734 field_addr.name = "name";
2735#endif /* FREECIV_JSON_CONNECTION */
2736 DIO_PUT(string, &dout, &field_addr, real_packet->name);
2737 }
2738 if (BV_ISSET(fields, 4)) {
2739 log_packet_detailed(" field 'style' has changed");
2740 #ifdef FREECIV_JSON_CONNECTION
2741 field_addr.name = "style";
2742#endif /* FREECIV_JSON_CONNECTION */
2743 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
2744 }
2745
2746 *old = *real_packet;
2747#endif /* FREECIV_DELTA_PROTOCOL */
2748#ifndef FREECIV_DELTA_PROTOCOL
2749#ifdef FREECIV_JSON_CONNECTION
2750 field_addr.name = "player_no";
2751#endif /* FREECIV_JSON_CONNECTION */
2752 DIO_PUT(uint16, &dout, &field_addr, real_packet->player_no);
2753#ifdef FREECIV_JSON_CONNECTION
2754 field_addr.name = "nation_no";
2755#endif /* FREECIV_JSON_CONNECTION */
2756 DIO_PUT(sint16, &dout, &field_addr, real_packet->nation_no);
2757#ifdef FREECIV_JSON_CONNECTION
2758 field_addr.name = "is_male";
2759#endif /* FREECIV_JSON_CONNECTION */
2760 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_male);
2761#ifdef FREECIV_JSON_CONNECTION
2762 field_addr.name = "name";
2763#endif /* FREECIV_JSON_CONNECTION */
2764 DIO_PUT(string, &dout, &field_addr, real_packet->name);
2765#ifdef FREECIV_JSON_CONNECTION
2766 field_addr.name = "style";
2767#endif /* FREECIV_JSON_CONNECTION */
2768 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
2769
2770#endif
2771 SEND_PACKET_END(PACKET_NATION_SELECT_REQ);
2772}
2773
2774 int send_packet_nation_select_req(struct connection *pc, const struct packet_nation_select_req *packet)
2775{
2776 if (!pc->used) {
2777 log_error("WARNING: trying to send data to the closed connection %s",
2778 conn_description(pc));
2779 return -1;
2780 }
2781 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_NATION_SELECT_REQ].packet != NULL, -1,
2782 "Handler for PACKET_NATION_SELECT_REQ not installed");
2783 return pc->phs.handlers->send[PACKET_NATION_SELECT_REQ].packet(pc, packet);
2784}
2785
2786 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)
2787{
2788 struct packet_nation_select_req packet, *real_packet = &packet;
2789
2790 real_packet->player_no = player_no;
2791 real_packet->nation_no = nation_no;
2792 real_packet->is_male = is_male;
2793 sz_strlcpy(real_packet->name, name);
2794 real_packet->style = style;
2795
2796 return send_packet_nation_select_req(pc, real_packet);
2797}
2798
2799#ifdef FREECIV_DELTA_PROTOCOL
2800#define hash_packet_player_ready_100 hash_const
2801
2802#define cmp_packet_player_ready_100 cmp_const
2803
2804 BV_DEFINE(packet_player_ready_100_fields, 2);
2805#endif /* FREECIV_DELTA_PROTOCOL */
2806
2807 static struct packet_player_ready *receive_packet_player_ready_100(struct connection *pc)
2808{
2809#ifdef FREECIV_DELTA_PROTOCOL
2810 packet_player_ready_100_fields fields;
2811 struct packet_player_ready *old;
2812 struct genhash **hash = pc->phs.received + PACKET_PLAYER_READY;
2813#endif /* FREECIV_DELTA_PROTOCOL */
2814 RECEIVE_PACKET_START(packet_player_ready, real_packet);
2815#ifdef FREECIV_JSON_CONNECTION
2816 struct plocation field_addr;
2817 {
2818 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2819 field_addr = *field_addr_tmp;
2820 FC_FREE(field_addr_tmp);
2821 }
2822#endif /* FREECIV_JSON_CONNECTION */
2823
2824#ifdef FREECIV_DELTA_PROTOCOL
2825#ifdef FREECIV_JSON_CONNECTION
2826 field_addr.name = "fields";
2827#endif /* FREECIV_JSON_CONNECTION */
2828 DIO_BV_GET(&din, &field_addr, fields);
2829
2830#else /* FREECIV_DELTA_PROTOCOL */
2831 #ifdef FREECIV_JSON_CONNECTION
2832 field_addr.name = "player_no";
2833 #endif /* FREECIV_JSON_CONNECTION */
2834 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_no)) {
2835 RECEIVE_PACKET_FIELD_ERROR(player_no);
2836 }
2837 #ifdef FREECIV_JSON_CONNECTION
2838 field_addr.name = "is_ready";
2839 #endif /* FREECIV_JSON_CONNECTION */
2840 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_ready)) {
2841 RECEIVE_PACKET_FIELD_ERROR(is_ready);
2842 }
2843
2844#endif
2845 log_packet_detailed("packet_player_ready_100: got info about ()");
2846
2847#ifdef FREECIV_DELTA_PROTOCOL
2848 if (NULL == *hash) {
2849 *hash = genhash_new_full(hash_packet_player_ready_100, cmp_packet_player_ready_100,
2850 NULL, NULL, NULL, free);
2851 }
2852
2853 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
2854 *real_packet = *old;
2855 } else {
2856 log_packet_detailed(" no old info");
2857 memset(real_packet, 0, sizeof(*real_packet));
2858 }
2859
2860 if (BV_ISSET(fields, 0)) {
2861 log_packet_detailed(" got field 'player_no'");
2862 #ifdef FREECIV_JSON_CONNECTION
2863 field_addr.name = "player_no";
2864 #endif /* FREECIV_JSON_CONNECTION */
2865 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_no)) {
2866 RECEIVE_PACKET_FIELD_ERROR(player_no);
2867 }
2868 }
2869 real_packet->is_ready = BV_ISSET(fields, 1);
2870
2871 if (NULL == old) {
2872 old = fc_malloc(sizeof(*old));
2873 *old = *real_packet;
2874 genhash_insert(*hash, old, old);
2875 } else {
2876 *old = *real_packet;
2877 }
2878
2879#endif /* FREECIV_DELTA_PROTOCOL */
2880 RECEIVE_PACKET_END(real_packet);
2881}
2882
2883 static int send_packet_player_ready_100(struct connection *pc, const struct packet_player_ready *packet)
2884{
2885 const struct packet_player_ready *real_packet = packet;
2886#ifdef FREECIV_DELTA_PROTOCOL
2887 packet_player_ready_100_fields fields;
2888 struct packet_player_ready *old;
2889 bool differ;
2890 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_READY;
2891#endif /* FREECIV_DELTA_PROTOCOL */
2892 SEND_PACKET_START(PACKET_PLAYER_READY);
2893#ifdef FREECIV_JSON_CONNECTION
2894 struct plocation field_addr;
2895 {
2896 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2897 field_addr = *field_addr_tmp;
2898 FC_FREE(field_addr_tmp);
2899 }
2900#endif /* FREECIV_JSON_CONNECTION */
2901
2902 log_packet_detailed("packet_player_ready_100: sending info about ()");
2903
2904#ifdef FREECIV_DELTA_PROTOCOL
2905 if (NULL == *hash) {
2906 *hash = genhash_new_full(hash_packet_player_ready_100, cmp_packet_player_ready_100,
2907 NULL, NULL, NULL, free);
2908 }
2909 BV_CLR_ALL(fields);
2910
2911 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
2912 old = fc_malloc(sizeof(*old));
2913 *old = *real_packet;
2914 genhash_insert(*hash, old, old);
2915 memset(old, 0, sizeof(*old));
2916 }
2917 differ = (old->player_no != real_packet->player_no);
2918 if (differ) {
2919 BV_SET(fields, 0);
2920 }
2921
2922 if (packet->is_ready) {
2923 BV_SET(fields, 1);
2924 }
2925
2926
2927#ifdef FREECIV_JSON_CONNECTION
2928 field_addr.name = "fields";
2929#endif /* FREECIV_JSON_CONNECTION */
2930 DIO_BV_PUT(&dout, &field_addr, fields);
2931
2932 if (BV_ISSET(fields, 0)) {
2933 log_packet_detailed(" field 'player_no' has changed");
2934 #ifdef FREECIV_JSON_CONNECTION
2935 field_addr.name = "player_no";
2936#endif /* FREECIV_JSON_CONNECTION */
2937 DIO_PUT(uint16, &dout, &field_addr, real_packet->player_no);
2938 }
2939 /* field 1 is folded into the header */
2940
2941 *old = *real_packet;
2942#endif /* FREECIV_DELTA_PROTOCOL */
2943#ifndef FREECIV_DELTA_PROTOCOL
2944#ifdef FREECIV_JSON_CONNECTION
2945 field_addr.name = "player_no";
2946#endif /* FREECIV_JSON_CONNECTION */
2947 DIO_PUT(uint16, &dout, &field_addr, real_packet->player_no);
2948#ifdef FREECIV_JSON_CONNECTION
2949 field_addr.name = "is_ready";
2950#endif /* FREECIV_JSON_CONNECTION */
2951 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_ready);
2952
2953#endif
2954 SEND_PACKET_END(PACKET_PLAYER_READY);
2955}
2956
2957 int send_packet_player_ready(struct connection *pc, const struct packet_player_ready *packet)
2958{
2959 if (!pc->used) {
2960 log_error("WARNING: trying to send data to the closed connection %s",
2961 conn_description(pc));
2962 return -1;
2963 }
2964 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_READY].packet != NULL, -1,
2965 "Handler for PACKET_PLAYER_READY not installed");
2966 return pc->phs.handlers->send[PACKET_PLAYER_READY].packet(pc, packet);
2967}
2968
2969 int dsend_packet_player_ready(struct connection *pc, int player_no, bool is_ready)
2970{
2971 struct packet_player_ready packet, *real_packet = &packet;
2972
2973 real_packet->player_no = player_no;
2974 real_packet->is_ready = is_ready;
2975
2976 return send_packet_player_ready(pc, real_packet);
2977}
2978
2979 static struct packet_endgame_report *receive_packet_endgame_report_100(struct connection *pc)
2980{
2981 RECEIVE_PACKET_START(packet_endgame_report, real_packet);
2982#ifdef FREECIV_JSON_CONNECTION
2983 struct plocation field_addr;
2984 {
2985 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2986 field_addr = *field_addr_tmp;
2987 FC_FREE(field_addr_tmp);
2988 }
2989#endif /* FREECIV_JSON_CONNECTION */
2990#if 1 /* To match endif */
2991 #ifdef FREECIV_JSON_CONNECTION
2992 field_addr.name = "category_num";
2993 #endif /* FREECIV_JSON_CONNECTION */
2994 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category_num)) {
2995 RECEIVE_PACKET_FIELD_ERROR(category_num);
2996 }
2997 #ifdef FREECIV_JSON_CONNECTION
2998 field_addr.name = "category_name";
2999 #endif /* FREECIV_JSON_CONNECTION */
3000
3001 {
3002 int i;
3003
3004 #ifdef FREECIV_JSON_CONNECTION
3005 /* Enter array. */
3006 field_addr.sub_location = plocation_elem_new(0);
3007 #endif /* FREECIV_JSON_CONNECTION */
3008
3009 if (real_packet->category_num > 32) {
3010 RECEIVE_PACKET_FIELD_ERROR(category_name, ": truncation array");
3011 }
3012 for (i = 0; i < real_packet->category_num; i++) {
3013 #ifdef FREECIV_JSON_CONNECTION
3014 field_addr.sub_location->number = i;
3015 #endif /* FREECIV_JSON_CONNECTION */
3016 if (!DIO_GET(string, &din, &field_addr, real_packet->category_name[i], sizeof(real_packet->category_name[i]))) {
3017 RECEIVE_PACKET_FIELD_ERROR(category_name);
3018 }
3019 }
3020
3021 #ifdef FREECIV_JSON_CONNECTION
3022 /* Exit array. */
3023 free(field_addr.sub_location);
3024 field_addr.sub_location = NULL;
3025 #endif /* FREECIV_JSON_CONNECTION */
3026 }
3027 #ifdef FREECIV_JSON_CONNECTION
3028 field_addr.name = "player_num";
3029 #endif /* FREECIV_JSON_CONNECTION */
3030 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_num)) {
3031 RECEIVE_PACKET_FIELD_ERROR(player_num);
3032 }
3033
3034#endif
3035 log_packet_detailed("packet_endgame_report_100: got info about ()");
3036 RECEIVE_PACKET_END(real_packet);
3037}
3038
3039 static int send_packet_endgame_report_100(struct connection *pc, const struct packet_endgame_report *packet)
3040{
3041 const struct packet_endgame_report *real_packet = packet;
3042 SEND_PACKET_START(PACKET_ENDGAME_REPORT);
3043#ifdef FREECIV_JSON_CONNECTION
3044 struct plocation field_addr;
3045 {
3046 struct plocation *field_addr_tmp = plocation_field_new(NULL);
3047 field_addr = *field_addr_tmp;
3048 FC_FREE(field_addr_tmp);
3049 }
3050#endif /* FREECIV_JSON_CONNECTION */
3051
3052 log_packet_detailed("packet_endgame_report_100: sending info about ()");
3053#if 1 /* To match endif */
3054#ifdef FREECIV_JSON_CONNECTION
3055 field_addr.name = "category_num";
3056#endif /* FREECIV_JSON_CONNECTION */
3057 DIO_PUT(uint8, &dout, &field_addr, real_packet->category_num);
3058#ifdef FREECIV_JSON_CONNECTION
3059 field_addr.name = "category_name";
3060#endif /* FREECIV_JSON_CONNECTION */
3061
3062 {
3063 int i;
3064
3065#ifdef FREECIV_JSON_CONNECTION
3066 /* Create the array. */
3067 DIO_PUT(farray, &dout, &field_addr, real_packet->category_num);
3068
3069 /* Enter the array. */
3070 field_addr.sub_location = plocation_elem_new(0);
3071#endif /* FREECIV_JSON_CONNECTION */
3072
3073 for (i = 0; i < real_packet->category_num; i++) {
3074#ifdef FREECIV_JSON_CONNECTION
3075 /* Next array element. */
3076 field_addr.sub_location->number = i;
3077#endif /* FREECIV_JSON_CONNECTION */
3078 DIO_PUT(string, &dout, &field_addr, real_packet->category_name[i]);
3079 }
3080
3081#ifdef FREECIV_JSON_CONNECTION
3082 /* Exit array. */
3083 free(field_addr.sub_location);
3084 field_addr.sub_location = NULL;
3085#endif /* FREECIV_JSON_CONNECTION */
3086 }
3087#ifdef FREECIV_JSON_CONNECTION
3088 field_addr.name = "player_num";
3089#endif /* FREECIV_JSON_CONNECTION */
3090 DIO_PUT(uint16, &dout, &field_addr, real_packet->player_num);
3091
3092#endif
3093 SEND_PACKET_END(PACKET_ENDGAME_REPORT);
3094}
3095
3096 int send_packet_endgame_report(struct connection *pc, const struct packet_endgame_report *packet)
3097{
3098 if (!pc->used) {
3099 log_error("WARNING: trying to send data to the closed connection %s",
3100 conn_description(pc));
3101 return -1;
3102 }
3103 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_ENDGAME_REPORT].packet != NULL, -1,
3104 "Handler for PACKET_ENDGAME_REPORT not installed");
3105 return pc->phs.handlers->send[PACKET_ENDGAME_REPORT].packet(pc, packet);
3106}
3107
3108 void lsend_packet_endgame_report(struct conn_list *dest, const struct packet_endgame_report *packet)
3109{
3110 conn_list_iterate(dest, pconn) {
3111 send_packet_endgame_report(pconn, packet);
3112 } conn_list_iterate_end;
3113}
3114
3115 static struct packet_endgame_player *receive_packet_endgame_player_100(struct connection *pc)
3116{
3117 RECEIVE_PACKET_START(packet_endgame_player, real_packet);
3118#ifdef FREECIV_JSON_CONNECTION
3119 struct plocation field_addr;
3120 {
3121 struct plocation *field_addr_tmp = plocation_field_new(NULL);
3122 field_addr = *field_addr_tmp;
3123 FC_FREE(field_addr_tmp);
3124 }
3125#endif /* FREECIV_JSON_CONNECTION */
3126#if 1 /* To match endif */
3127 #ifdef FREECIV_JSON_CONNECTION
3128 field_addr.name = "category_num";
3129 #endif /* FREECIV_JSON_CONNECTION */
3130 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category_num)) {
3131 RECEIVE_PACKET_FIELD_ERROR(category_num);
3132 }
3133 #ifdef FREECIV_JSON_CONNECTION
3134 field_addr.name = "player_id";
3135 #endif /* FREECIV_JSON_CONNECTION */
3136 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_id)) {
3137 RECEIVE_PACKET_FIELD_ERROR(player_id);
3138 }
3139 #ifdef FREECIV_JSON_CONNECTION
3140 field_addr.name = "score";
3141 #endif /* FREECIV_JSON_CONNECTION */
3142 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->score)) {
3143 RECEIVE_PACKET_FIELD_ERROR(score);
3144 }
3145 #ifdef FREECIV_JSON_CONNECTION
3146 field_addr.name = "category_score";
3147 #endif /* FREECIV_JSON_CONNECTION */
3148
3149 {
3150 int i;
3151
3152 #ifdef FREECIV_JSON_CONNECTION
3153 /* Enter array. */
3154 field_addr.sub_location = plocation_elem_new(0);
3155 #endif /* FREECIV_JSON_CONNECTION */
3156
3157 if (real_packet->category_num > 32) {
3158 RECEIVE_PACKET_FIELD_ERROR(category_score, ": truncation array");
3159 }
3160 for (i = 0; i < real_packet->category_num; i++) {
3161 #ifdef FREECIV_JSON_CONNECTION
3162 field_addr.sub_location->number = i;
3163 #endif /* FREECIV_JSON_CONNECTION */
3164 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->category_score[i])) {
3165 RECEIVE_PACKET_FIELD_ERROR(category_score);
3166 }
3167 }
3168
3169 #ifdef FREECIV_JSON_CONNECTION
3170 /* Exit array. */
3171 free(field_addr.sub_location);
3172 field_addr.sub_location = NULL;
3173 #endif /* FREECIV_JSON_CONNECTION */
3174 }
3175 #ifdef FREECIV_JSON_CONNECTION
3176 field_addr.name = "winner";
3177 #endif /* FREECIV_JSON_CONNECTION */
3178 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->winner)) {
3179 RECEIVE_PACKET_FIELD_ERROR(winner);
3180 }
3181
3182#endif
3183 log_packet_detailed("packet_endgame_player_100: got info about ()");
3184 RECEIVE_PACKET_END(real_packet);
3185}
3186
3187 static int send_packet_endgame_player_100(struct connection *pc, const struct packet_endgame_player *packet)
3188{
3189 const struct packet_endgame_player *real_packet = packet;
3190 SEND_PACKET_START(PACKET_ENDGAME_PLAYER);
3191#ifdef FREECIV_JSON_CONNECTION
3192 struct plocation field_addr;
3193 {
3194 struct plocation *field_addr_tmp = plocation_field_new(NULL);
3195 field_addr = *field_addr_tmp;
3196 FC_FREE(field_addr_tmp);
3197 }
3198#endif /* FREECIV_JSON_CONNECTION */
3199
3200 log_packet_detailed("packet_endgame_player_100: sending info about ()");
3201#if 1 /* To match endif */
3202#ifdef FREECIV_JSON_CONNECTION
3203 field_addr.name = "category_num";
3204#endif /* FREECIV_JSON_CONNECTION */
3205 DIO_PUT(uint8, &dout, &field_addr, real_packet->category_num);
3206#ifdef FREECIV_JSON_CONNECTION
3207 field_addr.name = "player_id";
3208#endif /* FREECIV_JSON_CONNECTION */
3209 DIO_PUT(uint16, &dout, &field_addr, real_packet->player_id);
3210#ifdef FREECIV_JSON_CONNECTION
3211 field_addr.name = "score";
3212#endif /* FREECIV_JSON_CONNECTION */
3213 DIO_PUT(sint32, &dout, &field_addr, real_packet->score);
3214#ifdef FREECIV_JSON_CONNECTION
3215 field_addr.name = "category_score";
3216#endif /* FREECIV_JSON_CONNECTION */
3217
3218 {
3219 int i;
3220
3221#ifdef FREECIV_JSON_CONNECTION
3222 /* Create the array. */
3223 DIO_PUT(farray, &dout, &field_addr, real_packet->category_num);
3224
3225 /* Enter the array. */
3226 field_addr.sub_location = plocation_elem_new(0);
3227#endif /* FREECIV_JSON_CONNECTION */
3228
3229 for (i = 0; i < real_packet->category_num; i++) {
3230#ifdef FREECIV_JSON_CONNECTION
3231 /* Next array element. */
3232 field_addr.sub_location->number = i;
3233#endif /* FREECIV_JSON_CONNECTION */
3234 DIO_PUT(sint32, &dout, &field_addr, real_packet->category_score[i]);
3235 }
3236
3237#ifdef FREECIV_JSON_CONNECTION
3238 /* Exit array. */
3239 free(field_addr.sub_location);
3240 field_addr.sub_location = NULL;
3241#endif /* FREECIV_JSON_CONNECTION */
3242 }
3243#ifdef FREECIV_JSON_CONNECTION
3244 field_addr.name = "winner";
3245#endif /* FREECIV_JSON_CONNECTION */
3246 DIO_PUT(bool8, &dout, &field_addr, real_packet->winner);
3247
3248#endif
3249 SEND_PACKET_END(PACKET_ENDGAME_PLAYER);
3250}
3251
3252 int send_packet_endgame_player(struct connection *pc, const struct packet_endgame_player *packet)
3253{
3254 if (!pc->used) {
3255 log_error("WARNING: trying to send data to the closed connection %s",
3256 conn_description(pc));
3257 return -1;
3258 }
3259 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_ENDGAME_PLAYER].packet != NULL, -1,
3260 "Handler for PACKET_ENDGAME_PLAYER not installed");
3261 return pc->phs.handlers->send[PACKET_ENDGAME_PLAYER].packet(pc, packet);
3262}
3263
3264 void lsend_packet_endgame_player(struct conn_list *dest, const struct packet_endgame_player *packet)
3265{
3266 conn_list_iterate(dest, pconn) {
3267 send_packet_endgame_player(pconn, packet);
3268 } conn_list_iterate_end;
3269}
3270
3271#ifdef FREECIV_DELTA_PROTOCOL
3272static genhash_val_t hash_packet_tile_info_100(const void *vkey)
3273{
3274 const struct packet_tile_info *key = (const struct packet_tile_info *) vkey;
3275
3276 return key->tile;
3277}
3278
3279static bool cmp_packet_tile_info_100(const void *vkey1, const void *vkey2)
3280{
3281 const struct packet_tile_info *key1 = (const struct packet_tile_info *) vkey1;
3282 const struct packet_tile_info *key2 = (const struct packet_tile_info *) vkey2;
3283
3284 return key1->tile == key2->tile;
3285}
3286 BV_DEFINE(packet_tile_info_100_fields, 12);
3287#endif /* FREECIV_DELTA_PROTOCOL */
3288
3289 static struct packet_tile_info *receive_packet_tile_info_100(struct connection *pc)
3290{
3291#ifdef FREECIV_DELTA_PROTOCOL
3292 packet_tile_info_100_fields fields;
3293 struct packet_tile_info *old;
3294 struct genhash **hash = pc->phs.received + PACKET_TILE_INFO;
3295#endif /* FREECIV_DELTA_PROTOCOL */
3296 RECEIVE_PACKET_START(packet_tile_info, real_packet);
3297#ifdef FREECIV_JSON_CONNECTION
3298 struct plocation field_addr;
3299 {
3300 struct plocation *field_addr_tmp = plocation_field_new(NULL);
3301 field_addr = *field_addr_tmp;
3302 FC_FREE(field_addr_tmp);
3303 }
3304#endif /* FREECIV_JSON_CONNECTION */
3305
3306#ifdef FREECIV_DELTA_PROTOCOL
3307#ifdef FREECIV_JSON_CONNECTION
3308 field_addr.name = "fields";
3309#endif /* FREECIV_JSON_CONNECTION */
3310 DIO_BV_GET(&din, &field_addr, fields);
3311 #ifdef FREECIV_JSON_CONNECTION
3312 field_addr.name = "tile";
3313 #endif /* FREECIV_JSON_CONNECTION */
3314 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
3315 RECEIVE_PACKET_FIELD_ERROR(tile);
3316 }
3317
3318#else /* FREECIV_DELTA_PROTOCOL */
3319 #ifdef FREECIV_JSON_CONNECTION
3320 field_addr.name = "tile";
3321 #endif /* FREECIV_JSON_CONNECTION */
3322 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
3323 RECEIVE_PACKET_FIELD_ERROR(tile);
3324 }
3325 #ifdef FREECIV_JSON_CONNECTION
3326 field_addr.name = "continent";
3327 #endif /* FREECIV_JSON_CONNECTION */
3328 {
3329 int readin;
3330
3331 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
3332 RECEIVE_PACKET_FIELD_ERROR(continent);
3333 }
3334 real_packet->continent = readin;
3335 }
3336 #ifdef FREECIV_JSON_CONNECTION
3337 field_addr.name = "known";
3338 #endif /* FREECIV_JSON_CONNECTION */
3339 {
3340 int readin;
3341
3342 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3343 RECEIVE_PACKET_FIELD_ERROR(known);
3344 }
3345 real_packet->known = readin;
3346 }
3347 #ifdef FREECIV_JSON_CONNECTION
3348 field_addr.name = "owner";
3349 #endif /* FREECIV_JSON_CONNECTION */
3350 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
3351 RECEIVE_PACKET_FIELD_ERROR(owner);
3352 }
3353 #ifdef FREECIV_JSON_CONNECTION
3354 field_addr.name = "extras_owner";
3355 #endif /* FREECIV_JSON_CONNECTION */
3356 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->extras_owner)) {
3357 RECEIVE_PACKET_FIELD_ERROR(extras_owner);
3358 }
3359 #ifdef FREECIV_JSON_CONNECTION
3360 field_addr.name = "worked32";
3361 #endif /* FREECIV_JSON_CONNECTION */
3362 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->worked32)) {
3363 RECEIVE_PACKET_FIELD_ERROR(worked32);
3364 }
3365 #ifdef FREECIV_JSON_CONNECTION
3366 field_addr.name = "terrain";
3367 #endif /* FREECIV_JSON_CONNECTION */
3368 {
3369 int readin;
3370
3371 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3372 RECEIVE_PACKET_FIELD_ERROR(terrain);
3373 }
3374 real_packet->terrain = readin;
3375 }
3376 #ifdef FREECIV_JSON_CONNECTION
3377 field_addr.name = "resource";
3378 #endif /* FREECIV_JSON_CONNECTION */
3379 {
3380 int readin;
3381
3382 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3383 RECEIVE_PACKET_FIELD_ERROR(resource);
3384 }
3385 real_packet->resource = readin;
3386 }
3387 #ifdef FREECIV_JSON_CONNECTION
3388 field_addr.name = "extras";
3389 #endif /* FREECIV_JSON_CONNECTION */
3390 if (!DIO_BV_GET(&din, &field_addr, real_packet->extras)) {
3391 RECEIVE_PACKET_FIELD_ERROR(extras);
3392 }
3393 #ifdef FREECIV_JSON_CONNECTION
3394 field_addr.name = "placing";
3395 #endif /* FREECIV_JSON_CONNECTION */
3396 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->placing)) {
3397 RECEIVE_PACKET_FIELD_ERROR(placing);
3398 }
3399 #ifdef FREECIV_JSON_CONNECTION
3400 field_addr.name = "place_turn";
3401 #endif /* FREECIV_JSON_CONNECTION */
3402 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->place_turn)) {
3403 RECEIVE_PACKET_FIELD_ERROR(place_turn);
3404 }
3405 #ifdef FREECIV_JSON_CONNECTION
3406 field_addr.name = "spec_sprite";
3407 #endif /* FREECIV_JSON_CONNECTION */
3408 if (!DIO_GET(string, &din, &field_addr, real_packet->spec_sprite, sizeof(real_packet->spec_sprite))) {
3409 RECEIVE_PACKET_FIELD_ERROR(spec_sprite);
3410 }
3411 #ifdef FREECIV_JSON_CONNECTION
3412 field_addr.name = "label";
3413 #endif /* FREECIV_JSON_CONNECTION */
3414 if (!DIO_GET(string, &din, &field_addr, real_packet->label, sizeof(real_packet->label))) {
3415 RECEIVE_PACKET_FIELD_ERROR(label);
3416 }
3417
3418#endif
3419 log_packet_detailed("packet_tile_info_100: got info about (%d)",
3420 real_packet->tile);
3421
3422#ifdef FREECIV_DELTA_PROTOCOL
3423 if (NULL == *hash) {
3424 *hash = genhash_new_full(hash_packet_tile_info_100, cmp_packet_tile_info_100,
3425 NULL, NULL, NULL, free);
3426 }
3427
3428 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
3429 *real_packet = *old;
3430 } else {
3431 int tile = real_packet->tile;
3432
3433 log_packet_detailed(" no old info");
3434 memset(real_packet, 0, sizeof(*real_packet));
3435
3436 real_packet->tile = tile;
3437 }
3438
3439 if (BV_ISSET(fields, 0)) {
3440 log_packet_detailed(" got field 'continent'");
3441 #ifdef FREECIV_JSON_CONNECTION
3442 field_addr.name = "continent";
3443 #endif /* FREECIV_JSON_CONNECTION */
3444 {
3445 int readin;
3446
3447 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
3448 RECEIVE_PACKET_FIELD_ERROR(continent);
3449 }
3450 real_packet->continent = readin;
3451 }
3452 }
3453 if (BV_ISSET(fields, 1)) {
3454 log_packet_detailed(" got field 'known'");
3455 #ifdef FREECIV_JSON_CONNECTION
3456 field_addr.name = "known";
3457 #endif /* FREECIV_JSON_CONNECTION */
3458 {
3459 int readin;
3460
3461 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3462 RECEIVE_PACKET_FIELD_ERROR(known);
3463 }
3464 real_packet->known = readin;
3465 }
3466 }
3467 if (BV_ISSET(fields, 2)) {
3468 log_packet_detailed(" got field 'owner'");
3469 #ifdef FREECIV_JSON_CONNECTION
3470 field_addr.name = "owner";
3471 #endif /* FREECIV_JSON_CONNECTION */
3472 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
3473 RECEIVE_PACKET_FIELD_ERROR(owner);
3474 }
3475 }
3476 if (BV_ISSET(fields, 3)) {
3477 log_packet_detailed(" got field 'extras_owner'");
3478 #ifdef FREECIV_JSON_CONNECTION
3479 field_addr.name = "extras_owner";
3480 #endif /* FREECIV_JSON_CONNECTION */
3481 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->extras_owner)) {
3482 RECEIVE_PACKET_FIELD_ERROR(extras_owner);
3483 }
3484 }
3485 if (BV_ISSET(fields, 4)) {
3486 log_packet_detailed(" got field 'worked32'");
3487 #ifdef FREECIV_JSON_CONNECTION
3488 field_addr.name = "worked32";
3489 #endif /* FREECIV_JSON_CONNECTION */
3490 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->worked32)) {
3491 RECEIVE_PACKET_FIELD_ERROR(worked32);
3492 }
3493 }
3494 if (BV_ISSET(fields, 5)) {
3495 log_packet_detailed(" got field 'terrain'");
3496 #ifdef FREECIV_JSON_CONNECTION
3497 field_addr.name = "terrain";
3498 #endif /* FREECIV_JSON_CONNECTION */
3499 {
3500 int readin;
3501
3502 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3503 RECEIVE_PACKET_FIELD_ERROR(terrain);
3504 }
3505 real_packet->terrain = readin;
3506 }
3507 }
3508 if (BV_ISSET(fields, 6)) {
3509 log_packet_detailed(" got field 'resource'");
3510 #ifdef FREECIV_JSON_CONNECTION
3511 field_addr.name = "resource";
3512 #endif /* FREECIV_JSON_CONNECTION */
3513 {
3514 int readin;
3515
3516 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3517 RECEIVE_PACKET_FIELD_ERROR(resource);
3518 }
3519 real_packet->resource = readin;
3520 }
3521 }
3522 if (BV_ISSET(fields, 7)) {
3523 log_packet_detailed(" got field 'extras'");
3524 #ifdef FREECIV_JSON_CONNECTION
3525 field_addr.name = "extras";
3526 #endif /* FREECIV_JSON_CONNECTION */
3527 if (!DIO_BV_GET(&din, &field_addr, real_packet->extras)) {
3528 RECEIVE_PACKET_FIELD_ERROR(extras);
3529 }
3530 }
3531 if (BV_ISSET(fields, 8)) {
3532 log_packet_detailed(" got field 'placing'");
3533 #ifdef FREECIV_JSON_CONNECTION
3534 field_addr.name = "placing";
3535 #endif /* FREECIV_JSON_CONNECTION */
3536 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->placing)) {
3537 RECEIVE_PACKET_FIELD_ERROR(placing);
3538 }
3539 }
3540 if (BV_ISSET(fields, 9)) {
3541 log_packet_detailed(" got field 'place_turn'");
3542 #ifdef FREECIV_JSON_CONNECTION
3543 field_addr.name = "place_turn";
3544 #endif /* FREECIV_JSON_CONNECTION */
3545 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->place_turn)) {
3546 RECEIVE_PACKET_FIELD_ERROR(place_turn);
3547 }
3548 }
3549 if (BV_ISSET(fields, 10)) {
3550 log_packet_detailed(" got field 'spec_sprite'");
3551 #ifdef FREECIV_JSON_CONNECTION
3552 field_addr.name = "spec_sprite";
3553 #endif /* FREECIV_JSON_CONNECTION */
3554 if (!DIO_GET(string, &din, &field_addr, real_packet->spec_sprite, sizeof(real_packet->spec_sprite))) {
3555 RECEIVE_PACKET_FIELD_ERROR(spec_sprite);
3556 }
3557 }
3558 if (BV_ISSET(fields, 11)) {
3559 log_packet_detailed(" got field 'label'");
3560 #ifdef FREECIV_JSON_CONNECTION
3561 field_addr.name = "label";
3562 #endif /* FREECIV_JSON_CONNECTION */
3563 if (!DIO_GET(string, &din, &field_addr, real_packet->label, sizeof(real_packet->label))) {
3564 RECEIVE_PACKET_FIELD_ERROR(label);
3565 }
3566 }
3567
3568 if (NULL == old) {
3569 old = fc_malloc(sizeof(*old));
3570 *old = *real_packet;
3571 genhash_insert(*hash, old, old);
3572 } else {
3573 *old = *real_packet;
3574 }
3575
3576#endif /* FREECIV_DELTA_PROTOCOL */
3577 RECEIVE_PACKET_END(real_packet);
3578}
3579
3580 static int send_packet_tile_info_100(struct connection *pc, const struct packet_tile_info *packet)
3581{
3582 const struct packet_tile_info *real_packet = packet;
3583#ifdef FREECIV_DELTA_PROTOCOL
3584 packet_tile_info_100_fields fields;
3585 struct packet_tile_info *old;
3586 bool differ;
3587 struct genhash **hash = pc->phs.sent + PACKET_TILE_INFO;
3588 int different = 0;
3589#endif /* FREECIV_DELTA_PROTOCOL */
3590 SEND_PACKET_START(PACKET_TILE_INFO);
3591#ifdef FREECIV_JSON_CONNECTION
3592 struct plocation field_addr;
3593 {
3594 struct plocation *field_addr_tmp = plocation_field_new(NULL);
3595 field_addr = *field_addr_tmp;
3596 FC_FREE(field_addr_tmp);
3597 }
3598#endif /* FREECIV_JSON_CONNECTION */
3599
3600 log_packet_detailed("packet_tile_info_100: sending info about (%d)",
3601 real_packet->tile);
3602
3603#ifdef FREECIV_DELTA_PROTOCOL
3604 if (NULL == *hash) {
3605 *hash = genhash_new_full(hash_packet_tile_info_100, cmp_packet_tile_info_100,
3606 NULL, NULL, NULL, free);
3607 }
3608 BV_CLR_ALL(fields);
3609
3610 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
3611 old = fc_malloc(sizeof(*old));
3612 *old = *real_packet;
3613 genhash_insert(*hash, old, old);
3614 memset(old, 0, sizeof(*old));
3615 different = 1; /* Force to send. */
3616 }
3617 differ = (old->continent != real_packet->continent);
3618 if (differ) {
3619 different++;
3620 BV_SET(fields, 0);
3621 }
3622
3623 differ = (old->known != real_packet->known);
3624 if (differ) {
3625 different++;
3626 BV_SET(fields, 1);
3627 }
3628
3629 differ = (old->owner != real_packet->owner);
3630 if (differ) {
3631 different++;
3632 BV_SET(fields, 2);
3633 }
3634
3635 differ = (old->extras_owner != real_packet->extras_owner);
3636 if (differ) {
3637 different++;
3638 BV_SET(fields, 3);
3639 }
3640
3641 differ = (old->worked32 != real_packet->worked32);
3642 if (differ) {
3643 different++;
3644 BV_SET(fields, 4);
3645 }
3646
3647 differ = (old->terrain != real_packet->terrain);
3648 if (differ) {
3649 different++;
3650 BV_SET(fields, 5);
3651 }
3652
3653 differ = (old->resource != real_packet->resource);
3654 if (differ) {
3655 different++;
3656 BV_SET(fields, 6);
3657 }
3658
3659 differ = !BV_ARE_EQUAL(old->extras, real_packet->extras);
3660 if (differ) {
3661 different++;
3662 BV_SET(fields, 7);
3663 }
3664
3665 differ = (old->placing != real_packet->placing);
3666 if (differ) {
3667 different++;
3668 BV_SET(fields, 8);
3669 }
3670
3671 differ = (old->place_turn != real_packet->place_turn);
3672 if (differ) {
3673 different++;
3674 BV_SET(fields, 9);
3675 }
3676
3677 differ = (strcmp(old->spec_sprite, real_packet->spec_sprite) != 0);
3678 if (differ) {
3679 different++;
3680 BV_SET(fields, 10);
3681 }
3682
3683 differ = (strcmp(old->label, real_packet->label) != 0);
3684 if (differ) {
3685 different++;
3686 BV_SET(fields, 11);
3687 }
3688
3689
3690 if (different == 0) {
3691 log_packet_detailed(" no change -> discard");
3692 return 0;
3693 }
3694
3695#ifdef FREECIV_JSON_CONNECTION
3696 field_addr.name = "fields";
3697#endif /* FREECIV_JSON_CONNECTION */
3698 DIO_BV_PUT(&dout, &field_addr, fields);
3699#ifdef FREECIV_JSON_CONNECTION
3700 field_addr.name = "tile";
3701#endif /* FREECIV_JSON_CONNECTION */
3702 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
3703
3704 if (BV_ISSET(fields, 0)) {
3705 log_packet_detailed(" field 'continent' has changed");
3706 #ifdef FREECIV_JSON_CONNECTION
3707 field_addr.name = "continent";
3708#endif /* FREECIV_JSON_CONNECTION */
3709 DIO_PUT(sint16, &dout, &field_addr, real_packet->continent);
3710 }
3711 if (BV_ISSET(fields, 1)) {
3712 log_packet_detailed(" field 'known' has changed");
3713 #ifdef FREECIV_JSON_CONNECTION
3714 field_addr.name = "known";
3715#endif /* FREECIV_JSON_CONNECTION */
3716 DIO_PUT(uint8, &dout, &field_addr, real_packet->known);
3717 }
3718 if (BV_ISSET(fields, 2)) {
3719 log_packet_detailed(" field 'owner' has changed");
3720 #ifdef FREECIV_JSON_CONNECTION
3721 field_addr.name = "owner";
3722#endif /* FREECIV_JSON_CONNECTION */
3723 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
3724 }
3725 if (BV_ISSET(fields, 3)) {
3726 log_packet_detailed(" field 'extras_owner' has changed");
3727 #ifdef FREECIV_JSON_CONNECTION
3728 field_addr.name = "extras_owner";
3729#endif /* FREECIV_JSON_CONNECTION */
3730 DIO_PUT(uint16, &dout, &field_addr, real_packet->extras_owner);
3731 }
3732 if (BV_ISSET(fields, 4)) {
3733 log_packet_detailed(" field 'worked32' has changed");
3734 #ifdef FREECIV_JSON_CONNECTION
3735 field_addr.name = "worked32";
3736#endif /* FREECIV_JSON_CONNECTION */
3737 DIO_PUT(uint32, &dout, &field_addr, real_packet->worked32);
3738 }
3739 if (BV_ISSET(fields, 5)) {
3740 log_packet_detailed(" field 'terrain' has changed");
3741 #ifdef FREECIV_JSON_CONNECTION
3742 field_addr.name = "terrain";
3743#endif /* FREECIV_JSON_CONNECTION */
3744 DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
3745 }
3746 if (BV_ISSET(fields, 6)) {
3747 log_packet_detailed(" field 'resource' has changed");
3748 #ifdef FREECIV_JSON_CONNECTION
3749 field_addr.name = "resource";
3750#endif /* FREECIV_JSON_CONNECTION */
3751 DIO_PUT(uint8, &dout, &field_addr, real_packet->resource);
3752 }
3753 if (BV_ISSET(fields, 7)) {
3754 log_packet_detailed(" field 'extras' has changed");
3755 #ifdef FREECIV_JSON_CONNECTION
3756 field_addr.name = "extras";
3757#endif /* FREECIV_JSON_CONNECTION */
3758 DIO_BV_PUT(&dout, &field_addr, packet->extras);
3759 }
3760 if (BV_ISSET(fields, 8)) {
3761 log_packet_detailed(" field 'placing' has changed");
3762 #ifdef FREECIV_JSON_CONNECTION
3763 field_addr.name = "placing";
3764#endif /* FREECIV_JSON_CONNECTION */
3765 DIO_PUT(sint8, &dout, &field_addr, real_packet->placing);
3766 }
3767 if (BV_ISSET(fields, 9)) {
3768 log_packet_detailed(" field 'place_turn' has changed");
3769 #ifdef FREECIV_JSON_CONNECTION
3770 field_addr.name = "place_turn";
3771#endif /* FREECIV_JSON_CONNECTION */
3772 DIO_PUT(sint16, &dout, &field_addr, real_packet->place_turn);
3773 }
3774 if (BV_ISSET(fields, 10)) {
3775 log_packet_detailed(" field 'spec_sprite' has changed");
3776 #ifdef FREECIV_JSON_CONNECTION
3777 field_addr.name = "spec_sprite";
3778#endif /* FREECIV_JSON_CONNECTION */
3779 DIO_PUT(string, &dout, &field_addr, real_packet->spec_sprite);
3780 }
3781 if (BV_ISSET(fields, 11)) {
3782 log_packet_detailed(" field 'label' has changed");
3783 #ifdef FREECIV_JSON_CONNECTION
3784 field_addr.name = "label";
3785#endif /* FREECIV_JSON_CONNECTION */
3786 DIO_PUT(string, &dout, &field_addr, real_packet->label);
3787 }
3788
3789 *old = *real_packet;
3790#endif /* FREECIV_DELTA_PROTOCOL */
3791#ifndef FREECIV_DELTA_PROTOCOL
3792#ifdef FREECIV_JSON_CONNECTION
3793 field_addr.name = "tile";
3794#endif /* FREECIV_JSON_CONNECTION */
3795 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
3796#ifdef FREECIV_JSON_CONNECTION
3797 field_addr.name = "continent";
3798#endif /* FREECIV_JSON_CONNECTION */
3799 DIO_PUT(sint16, &dout, &field_addr, real_packet->continent);
3800#ifdef FREECIV_JSON_CONNECTION
3801 field_addr.name = "known";
3802#endif /* FREECIV_JSON_CONNECTION */
3803 DIO_PUT(uint8, &dout, &field_addr, real_packet->known);
3804#ifdef FREECIV_JSON_CONNECTION
3805 field_addr.name = "owner";
3806#endif /* FREECIV_JSON_CONNECTION */
3807 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
3808#ifdef FREECIV_JSON_CONNECTION
3809 field_addr.name = "extras_owner";
3810#endif /* FREECIV_JSON_CONNECTION */
3811 DIO_PUT(uint16, &dout, &field_addr, real_packet->extras_owner);
3812#ifdef FREECIV_JSON_CONNECTION
3813 field_addr.name = "worked32";
3814#endif /* FREECIV_JSON_CONNECTION */
3815 DIO_PUT(uint32, &dout, &field_addr, real_packet->worked32);
3816#ifdef FREECIV_JSON_CONNECTION
3817 field_addr.name = "terrain";
3818#endif /* FREECIV_JSON_CONNECTION */
3819 DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
3820#ifdef FREECIV_JSON_CONNECTION
3821 field_addr.name = "resource";
3822#endif /* FREECIV_JSON_CONNECTION */
3823 DIO_PUT(uint8, &dout, &field_addr, real_packet->resource);
3824#ifdef FREECIV_JSON_CONNECTION
3825 field_addr.name = "extras";
3826#endif /* FREECIV_JSON_CONNECTION */
3827 DIO_BV_PUT(&dout, &field_addr, packet->extras);
3828#ifdef FREECIV_JSON_CONNECTION
3829 field_addr.name = "placing";
3830#endif /* FREECIV_JSON_CONNECTION */
3831 DIO_PUT(sint8, &dout, &field_addr, real_packet->placing);
3832#ifdef FREECIV_JSON_CONNECTION
3833 field_addr.name = "place_turn";
3834#endif /* FREECIV_JSON_CONNECTION */
3835 DIO_PUT(sint16, &dout, &field_addr, real_packet->place_turn);
3836#ifdef FREECIV_JSON_CONNECTION
3837 field_addr.name = "spec_sprite";
3838#endif /* FREECIV_JSON_CONNECTION */
3839 DIO_PUT(string, &dout, &field_addr, real_packet->spec_sprite);
3840#ifdef FREECIV_JSON_CONNECTION
3841 field_addr.name = "label";
3842#endif /* FREECIV_JSON_CONNECTION */
3843 DIO_PUT(string, &dout, &field_addr, real_packet->label);
3844
3845#endif
3846 SEND_PACKET_END(PACKET_TILE_INFO);
3847}
3848
3849#ifdef FREECIV_DELTA_PROTOCOL
3850static genhash_val_t hash_packet_tile_info_101(const void *vkey)
3851{
3852 const struct packet_tile_info *key = (const struct packet_tile_info *) vkey;
3853
3854 return key->tile;
3855}
3856
3857static bool cmp_packet_tile_info_101(const void *vkey1, const void *vkey2)
3858{
3859 const struct packet_tile_info *key1 = (const struct packet_tile_info *) vkey1;
3860 const struct packet_tile_info *key2 = (const struct packet_tile_info *) vkey2;
3861
3862 return key1->tile == key2->tile;
3863}
3864 BV_DEFINE(packet_tile_info_101_fields, 12);
3865#endif /* FREECIV_DELTA_PROTOCOL */
3866
3867 static struct packet_tile_info *receive_packet_tile_info_101(struct connection *pc)
3868{
3869#ifdef FREECIV_DELTA_PROTOCOL
3870 packet_tile_info_101_fields fields;
3871 struct packet_tile_info *old;
3872 struct genhash **hash = pc->phs.received + PACKET_TILE_INFO;
3873#endif /* FREECIV_DELTA_PROTOCOL */
3874 RECEIVE_PACKET_START(packet_tile_info, real_packet);
3875#ifdef FREECIV_JSON_CONNECTION
3876 struct plocation field_addr;
3877 {
3878 struct plocation *field_addr_tmp = plocation_field_new(NULL);
3879 field_addr = *field_addr_tmp;
3880 FC_FREE(field_addr_tmp);
3881 }
3882#endif /* FREECIV_JSON_CONNECTION */
3883
3884#ifdef FREECIV_DELTA_PROTOCOL
3885#ifdef FREECIV_JSON_CONNECTION
3886 field_addr.name = "fields";
3887#endif /* FREECIV_JSON_CONNECTION */
3888 DIO_BV_GET(&din, &field_addr, fields);
3889 #ifdef FREECIV_JSON_CONNECTION
3890 field_addr.name = "tile";
3891 #endif /* FREECIV_JSON_CONNECTION */
3892 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
3893 RECEIVE_PACKET_FIELD_ERROR(tile);
3894 }
3895
3896#else /* FREECIV_DELTA_PROTOCOL */
3897 #ifdef FREECIV_JSON_CONNECTION
3898 field_addr.name = "tile";
3899 #endif /* FREECIV_JSON_CONNECTION */
3900 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
3901 RECEIVE_PACKET_FIELD_ERROR(tile);
3902 }
3903 #ifdef FREECIV_JSON_CONNECTION
3904 field_addr.name = "continent";
3905 #endif /* FREECIV_JSON_CONNECTION */
3906 {
3907 int readin;
3908
3909 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
3910 RECEIVE_PACKET_FIELD_ERROR(continent);
3911 }
3912 real_packet->continent = readin;
3913 }
3914 #ifdef FREECIV_JSON_CONNECTION
3915 field_addr.name = "known";
3916 #endif /* FREECIV_JSON_CONNECTION */
3917 {
3918 int readin;
3919
3920 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3921 RECEIVE_PACKET_FIELD_ERROR(known);
3922 }
3923 real_packet->known = readin;
3924 }
3925 #ifdef FREECIV_JSON_CONNECTION
3926 field_addr.name = "owner";
3927 #endif /* FREECIV_JSON_CONNECTION */
3928 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
3929 RECEIVE_PACKET_FIELD_ERROR(owner);
3930 }
3931 #ifdef FREECIV_JSON_CONNECTION
3932 field_addr.name = "extras_owner";
3933 #endif /* FREECIV_JSON_CONNECTION */
3934 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->extras_owner)) {
3935 RECEIVE_PACKET_FIELD_ERROR(extras_owner);
3936 }
3937 #ifdef FREECIV_JSON_CONNECTION
3938 field_addr.name = "worked16";
3939 #endif /* FREECIV_JSON_CONNECTION */
3940 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->worked16)) {
3941 RECEIVE_PACKET_FIELD_ERROR(worked16);
3942 }
3943 #ifdef FREECIV_JSON_CONNECTION
3944 field_addr.name = "terrain";
3945 #endif /* FREECIV_JSON_CONNECTION */
3946 {
3947 int readin;
3948
3949 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3950 RECEIVE_PACKET_FIELD_ERROR(terrain);
3951 }
3952 real_packet->terrain = readin;
3953 }
3954 #ifdef FREECIV_JSON_CONNECTION
3955 field_addr.name = "resource";
3956 #endif /* FREECIV_JSON_CONNECTION */
3957 {
3958 int readin;
3959
3960 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3961 RECEIVE_PACKET_FIELD_ERROR(resource);
3962 }
3963 real_packet->resource = readin;
3964 }
3965 #ifdef FREECIV_JSON_CONNECTION
3966 field_addr.name = "extras";
3967 #endif /* FREECIV_JSON_CONNECTION */
3968 if (!DIO_BV_GET(&din, &field_addr, real_packet->extras)) {
3969 RECEIVE_PACKET_FIELD_ERROR(extras);
3970 }
3971 #ifdef FREECIV_JSON_CONNECTION
3972 field_addr.name = "placing";
3973 #endif /* FREECIV_JSON_CONNECTION */
3974 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->placing)) {
3975 RECEIVE_PACKET_FIELD_ERROR(placing);
3976 }
3977 #ifdef FREECIV_JSON_CONNECTION
3978 field_addr.name = "place_turn";
3979 #endif /* FREECIV_JSON_CONNECTION */
3980 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->place_turn)) {
3981 RECEIVE_PACKET_FIELD_ERROR(place_turn);
3982 }
3983 #ifdef FREECIV_JSON_CONNECTION
3984 field_addr.name = "spec_sprite";
3985 #endif /* FREECIV_JSON_CONNECTION */
3986 if (!DIO_GET(string, &din, &field_addr, real_packet->spec_sprite, sizeof(real_packet->spec_sprite))) {
3987 RECEIVE_PACKET_FIELD_ERROR(spec_sprite);
3988 }
3989 #ifdef FREECIV_JSON_CONNECTION
3990 field_addr.name = "label";
3991 #endif /* FREECIV_JSON_CONNECTION */
3992 if (!DIO_GET(string, &din, &field_addr, real_packet->label, sizeof(real_packet->label))) {
3993 RECEIVE_PACKET_FIELD_ERROR(label);
3994 }
3995
3996#endif
3997 log_packet_detailed("packet_tile_info_101: got info about (%d)",
3998 real_packet->tile);
3999
4000#ifdef FREECIV_DELTA_PROTOCOL
4001 if (NULL == *hash) {
4002 *hash = genhash_new_full(hash_packet_tile_info_101, cmp_packet_tile_info_101,
4003 NULL, NULL, NULL, free);
4004 }
4005
4006 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
4007 *real_packet = *old;
4008 } else {
4009 int tile = real_packet->tile;
4010
4011 log_packet_detailed(" no old info");
4012 memset(real_packet, 0, sizeof(*real_packet));
4013
4014 real_packet->tile = tile;
4015 }
4016
4017 if (BV_ISSET(fields, 0)) {
4018 log_packet_detailed(" got field 'continent'");
4019 #ifdef FREECIV_JSON_CONNECTION
4020 field_addr.name = "continent";
4021 #endif /* FREECIV_JSON_CONNECTION */
4022 {
4023 int readin;
4024
4025 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
4026 RECEIVE_PACKET_FIELD_ERROR(continent);
4027 }
4028 real_packet->continent = readin;
4029 }
4030 }
4031 if (BV_ISSET(fields, 1)) {
4032 log_packet_detailed(" got field 'known'");
4033 #ifdef FREECIV_JSON_CONNECTION
4034 field_addr.name = "known";
4035 #endif /* FREECIV_JSON_CONNECTION */
4036 {
4037 int readin;
4038
4039 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4040 RECEIVE_PACKET_FIELD_ERROR(known);
4041 }
4042 real_packet->known = readin;
4043 }
4044 }
4045 if (BV_ISSET(fields, 2)) {
4046 log_packet_detailed(" got field 'owner'");
4047 #ifdef FREECIV_JSON_CONNECTION
4048 field_addr.name = "owner";
4049 #endif /* FREECIV_JSON_CONNECTION */
4050 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
4051 RECEIVE_PACKET_FIELD_ERROR(owner);
4052 }
4053 }
4054 if (BV_ISSET(fields, 3)) {
4055 log_packet_detailed(" got field 'extras_owner'");
4056 #ifdef FREECIV_JSON_CONNECTION
4057 field_addr.name = "extras_owner";
4058 #endif /* FREECIV_JSON_CONNECTION */
4059 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->extras_owner)) {
4060 RECEIVE_PACKET_FIELD_ERROR(extras_owner);
4061 }
4062 }
4063 if (BV_ISSET(fields, 4)) {
4064 log_packet_detailed(" got field 'worked16'");
4065 #ifdef FREECIV_JSON_CONNECTION
4066 field_addr.name = "worked16";
4067 #endif /* FREECIV_JSON_CONNECTION */
4068 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->worked16)) {
4069 RECEIVE_PACKET_FIELD_ERROR(worked16);
4070 }
4071 }
4072 if (BV_ISSET(fields, 5)) {
4073 log_packet_detailed(" got field 'terrain'");
4074 #ifdef FREECIV_JSON_CONNECTION
4075 field_addr.name = "terrain";
4076 #endif /* FREECIV_JSON_CONNECTION */
4077 {
4078 int readin;
4079
4080 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4081 RECEIVE_PACKET_FIELD_ERROR(terrain);
4082 }
4083 real_packet->terrain = readin;
4084 }
4085 }
4086 if (BV_ISSET(fields, 6)) {
4087 log_packet_detailed(" got field 'resource'");
4088 #ifdef FREECIV_JSON_CONNECTION
4089 field_addr.name = "resource";
4090 #endif /* FREECIV_JSON_CONNECTION */
4091 {
4092 int readin;
4093
4094 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4095 RECEIVE_PACKET_FIELD_ERROR(resource);
4096 }
4097 real_packet->resource = readin;
4098 }
4099 }
4100 if (BV_ISSET(fields, 7)) {
4101 log_packet_detailed(" got field 'extras'");
4102 #ifdef FREECIV_JSON_CONNECTION
4103 field_addr.name = "extras";
4104 #endif /* FREECIV_JSON_CONNECTION */
4105 if (!DIO_BV_GET(&din, &field_addr, real_packet->extras)) {
4106 RECEIVE_PACKET_FIELD_ERROR(extras);
4107 }
4108 }
4109 if (BV_ISSET(fields, 8)) {
4110 log_packet_detailed(" got field 'placing'");
4111 #ifdef FREECIV_JSON_CONNECTION
4112 field_addr.name = "placing";
4113 #endif /* FREECIV_JSON_CONNECTION */
4114 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->placing)) {
4115 RECEIVE_PACKET_FIELD_ERROR(placing);
4116 }
4117 }
4118 if (BV_ISSET(fields, 9)) {
4119 log_packet_detailed(" got field 'place_turn'");
4120 #ifdef FREECIV_JSON_CONNECTION
4121 field_addr.name = "place_turn";
4122 #endif /* FREECIV_JSON_CONNECTION */
4123 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->place_turn)) {
4124 RECEIVE_PACKET_FIELD_ERROR(place_turn);
4125 }
4126 }
4127 if (BV_ISSET(fields, 10)) {
4128 log_packet_detailed(" got field 'spec_sprite'");
4129 #ifdef FREECIV_JSON_CONNECTION
4130 field_addr.name = "spec_sprite";
4131 #endif /* FREECIV_JSON_CONNECTION */
4132 if (!DIO_GET(string, &din, &field_addr, real_packet->spec_sprite, sizeof(real_packet->spec_sprite))) {
4133 RECEIVE_PACKET_FIELD_ERROR(spec_sprite);
4134 }
4135 }
4136 if (BV_ISSET(fields, 11)) {
4137 log_packet_detailed(" got field 'label'");
4138 #ifdef FREECIV_JSON_CONNECTION
4139 field_addr.name = "label";
4140 #endif /* FREECIV_JSON_CONNECTION */
4141 if (!DIO_GET(string, &din, &field_addr, real_packet->label, sizeof(real_packet->label))) {
4142 RECEIVE_PACKET_FIELD_ERROR(label);
4143 }
4144 }
4145
4146 if (NULL == old) {
4147 old = fc_malloc(sizeof(*old));
4148 *old = *real_packet;
4149 genhash_insert(*hash, old, old);
4150 } else {
4151 *old = *real_packet;
4152 }
4153
4154#endif /* FREECIV_DELTA_PROTOCOL */
4155 RECEIVE_PACKET_END(real_packet);
4156}
4157
4158 static int send_packet_tile_info_101(struct connection *pc, const struct packet_tile_info *packet)
4159{
4160 const struct packet_tile_info *real_packet = packet;
4161#ifdef FREECIV_DELTA_PROTOCOL
4162 packet_tile_info_101_fields fields;
4163 struct packet_tile_info *old;
4164 bool differ;
4165 struct genhash **hash = pc->phs.sent + PACKET_TILE_INFO;
4166 int different = 0;
4167#endif /* FREECIV_DELTA_PROTOCOL */
4168 SEND_PACKET_START(PACKET_TILE_INFO);
4169#ifdef FREECIV_JSON_CONNECTION
4170 struct plocation field_addr;
4171 {
4172 struct plocation *field_addr_tmp = plocation_field_new(NULL);
4173 field_addr = *field_addr_tmp;
4174 FC_FREE(field_addr_tmp);
4175 }
4176#endif /* FREECIV_JSON_CONNECTION */
4177
4178 log_packet_detailed("packet_tile_info_101: sending info about (%d)",
4179 real_packet->tile);
4180
4181#ifdef FREECIV_DELTA_PROTOCOL
4182 if (NULL == *hash) {
4183 *hash = genhash_new_full(hash_packet_tile_info_101, cmp_packet_tile_info_101,
4184 NULL, NULL, NULL, free);
4185 }
4186 BV_CLR_ALL(fields);
4187
4188 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
4189 old = fc_malloc(sizeof(*old));
4190 *old = *real_packet;
4191 genhash_insert(*hash, old, old);
4192 memset(old, 0, sizeof(*old));
4193 different = 1; /* Force to send. */
4194 }
4195 differ = (old->continent != real_packet->continent);
4196 if (differ) {
4197 different++;
4198 BV_SET(fields, 0);
4199 }
4200
4201 differ = (old->known != real_packet->known);
4202 if (differ) {
4203 different++;
4204 BV_SET(fields, 1);
4205 }
4206
4207 differ = (old->owner != real_packet->owner);
4208 if (differ) {
4209 different++;
4210 BV_SET(fields, 2);
4211 }
4212
4213 differ = (old->extras_owner != real_packet->extras_owner);
4214 if (differ) {
4215 different++;
4216 BV_SET(fields, 3);
4217 }
4218
4219 differ = (old->worked16 != real_packet->worked16);
4220 if (differ) {
4221 different++;
4222 BV_SET(fields, 4);
4223 }
4224
4225 differ = (old->terrain != real_packet->terrain);
4226 if (differ) {
4227 different++;
4228 BV_SET(fields, 5);
4229 }
4230
4231 differ = (old->resource != real_packet->resource);
4232 if (differ) {
4233 different++;
4234 BV_SET(fields, 6);
4235 }
4236
4237 differ = !BV_ARE_EQUAL(old->extras, real_packet->extras);
4238 if (differ) {
4239 different++;
4240 BV_SET(fields, 7);
4241 }
4242
4243 differ = (old->placing != real_packet->placing);
4244 if (differ) {
4245 different++;
4246 BV_SET(fields, 8);
4247 }
4248
4249 differ = (old->place_turn != real_packet->place_turn);
4250 if (differ) {
4251 different++;
4252 BV_SET(fields, 9);
4253 }
4254
4255 differ = (strcmp(old->spec_sprite, real_packet->spec_sprite) != 0);
4256 if (differ) {
4257 different++;
4258 BV_SET(fields, 10);
4259 }
4260
4261 differ = (strcmp(old->label, real_packet->label) != 0);
4262 if (differ) {
4263 different++;
4264 BV_SET(fields, 11);
4265 }
4266
4267
4268 if (different == 0) {
4269 log_packet_detailed(" no change -> discard");
4270 return 0;
4271 }
4272
4273#ifdef FREECIV_JSON_CONNECTION
4274 field_addr.name = "fields";
4275#endif /* FREECIV_JSON_CONNECTION */
4276 DIO_BV_PUT(&dout, &field_addr, fields);
4277#ifdef FREECIV_JSON_CONNECTION
4278 field_addr.name = "tile";
4279#endif /* FREECIV_JSON_CONNECTION */
4280 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
4281
4282 if (BV_ISSET(fields, 0)) {
4283 log_packet_detailed(" field 'continent' has changed");
4284 #ifdef FREECIV_JSON_CONNECTION
4285 field_addr.name = "continent";
4286#endif /* FREECIV_JSON_CONNECTION */
4287 DIO_PUT(sint16, &dout, &field_addr, real_packet->continent);
4288 }
4289 if (BV_ISSET(fields, 1)) {
4290 log_packet_detailed(" field 'known' has changed");
4291 #ifdef FREECIV_JSON_CONNECTION
4292 field_addr.name = "known";
4293#endif /* FREECIV_JSON_CONNECTION */
4294 DIO_PUT(uint8, &dout, &field_addr, real_packet->known);
4295 }
4296 if (BV_ISSET(fields, 2)) {
4297 log_packet_detailed(" field 'owner' has changed");
4298 #ifdef FREECIV_JSON_CONNECTION
4299 field_addr.name = "owner";
4300#endif /* FREECIV_JSON_CONNECTION */
4301 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
4302 }
4303 if (BV_ISSET(fields, 3)) {
4304 log_packet_detailed(" field 'extras_owner' has changed");
4305 #ifdef FREECIV_JSON_CONNECTION
4306 field_addr.name = "extras_owner";
4307#endif /* FREECIV_JSON_CONNECTION */
4308 DIO_PUT(uint16, &dout, &field_addr, real_packet->extras_owner);
4309 }
4310 if (BV_ISSET(fields, 4)) {
4311 log_packet_detailed(" field 'worked16' has changed");
4312 #ifdef FREECIV_JSON_CONNECTION
4313 field_addr.name = "worked16";
4314#endif /* FREECIV_JSON_CONNECTION */
4315 DIO_PUT(uint16, &dout, &field_addr, real_packet->worked16);
4316 }
4317 if (BV_ISSET(fields, 5)) {
4318 log_packet_detailed(" field 'terrain' has changed");
4319 #ifdef FREECIV_JSON_CONNECTION
4320 field_addr.name = "terrain";
4321#endif /* FREECIV_JSON_CONNECTION */
4322 DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
4323 }
4324 if (BV_ISSET(fields, 6)) {
4325 log_packet_detailed(" field 'resource' has changed");
4326 #ifdef FREECIV_JSON_CONNECTION
4327 field_addr.name = "resource";
4328#endif /* FREECIV_JSON_CONNECTION */
4329 DIO_PUT(uint8, &dout, &field_addr, real_packet->resource);
4330 }
4331 if (BV_ISSET(fields, 7)) {
4332 log_packet_detailed(" field 'extras' has changed");
4333 #ifdef FREECIV_JSON_CONNECTION
4334 field_addr.name = "extras";
4335#endif /* FREECIV_JSON_CONNECTION */
4336 DIO_BV_PUT(&dout, &field_addr, packet->extras);
4337 }
4338 if (BV_ISSET(fields, 8)) {
4339 log_packet_detailed(" field 'placing' has changed");
4340 #ifdef FREECIV_JSON_CONNECTION
4341 field_addr.name = "placing";
4342#endif /* FREECIV_JSON_CONNECTION */
4343 DIO_PUT(sint8, &dout, &field_addr, real_packet->placing);
4344 }
4345 if (BV_ISSET(fields, 9)) {
4346 log_packet_detailed(" field 'place_turn' has changed");
4347 #ifdef FREECIV_JSON_CONNECTION
4348 field_addr.name = "place_turn";
4349#endif /* FREECIV_JSON_CONNECTION */
4350 DIO_PUT(sint16, &dout, &field_addr, real_packet->place_turn);
4351 }
4352 if (BV_ISSET(fields, 10)) {
4353 log_packet_detailed(" field 'spec_sprite' has changed");
4354 #ifdef FREECIV_JSON_CONNECTION
4355 field_addr.name = "spec_sprite";
4356#endif /* FREECIV_JSON_CONNECTION */
4357 DIO_PUT(string, &dout, &field_addr, real_packet->spec_sprite);
4358 }
4359 if (BV_ISSET(fields, 11)) {
4360 log_packet_detailed(" field 'label' has changed");
4361 #ifdef FREECIV_JSON_CONNECTION
4362 field_addr.name = "label";
4363#endif /* FREECIV_JSON_CONNECTION */
4364 DIO_PUT(string, &dout, &field_addr, real_packet->label);
4365 }
4366
4367 *old = *real_packet;
4368#endif /* FREECIV_DELTA_PROTOCOL */
4369#ifndef FREECIV_DELTA_PROTOCOL
4370#ifdef FREECIV_JSON_CONNECTION
4371 field_addr.name = "tile";
4372#endif /* FREECIV_JSON_CONNECTION */
4373 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
4374#ifdef FREECIV_JSON_CONNECTION
4375 field_addr.name = "continent";
4376#endif /* FREECIV_JSON_CONNECTION */
4377 DIO_PUT(sint16, &dout, &field_addr, real_packet->continent);
4378#ifdef FREECIV_JSON_CONNECTION
4379 field_addr.name = "known";
4380#endif /* FREECIV_JSON_CONNECTION */
4381 DIO_PUT(uint8, &dout, &field_addr, real_packet->known);
4382#ifdef FREECIV_JSON_CONNECTION
4383 field_addr.name = "owner";
4384#endif /* FREECIV_JSON_CONNECTION */
4385 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
4386#ifdef FREECIV_JSON_CONNECTION
4387 field_addr.name = "extras_owner";
4388#endif /* FREECIV_JSON_CONNECTION */
4389 DIO_PUT(uint16, &dout, &field_addr, real_packet->extras_owner);
4390#ifdef FREECIV_JSON_CONNECTION
4391 field_addr.name = "worked16";
4392#endif /* FREECIV_JSON_CONNECTION */
4393 DIO_PUT(uint16, &dout, &field_addr, real_packet->worked16);
4394#ifdef FREECIV_JSON_CONNECTION
4395 field_addr.name = "terrain";
4396#endif /* FREECIV_JSON_CONNECTION */
4397 DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
4398#ifdef FREECIV_JSON_CONNECTION
4399 field_addr.name = "resource";
4400#endif /* FREECIV_JSON_CONNECTION */
4401 DIO_PUT(uint8, &dout, &field_addr, real_packet->resource);
4402#ifdef FREECIV_JSON_CONNECTION
4403 field_addr.name = "extras";
4404#endif /* FREECIV_JSON_CONNECTION */
4405 DIO_BV_PUT(&dout, &field_addr, packet->extras);
4406#ifdef FREECIV_JSON_CONNECTION
4407 field_addr.name = "placing";
4408#endif /* FREECIV_JSON_CONNECTION */
4409 DIO_PUT(sint8, &dout, &field_addr, real_packet->placing);
4410#ifdef FREECIV_JSON_CONNECTION
4411 field_addr.name = "place_turn";
4412#endif /* FREECIV_JSON_CONNECTION */
4413 DIO_PUT(sint16, &dout, &field_addr, real_packet->place_turn);
4414#ifdef FREECIV_JSON_CONNECTION
4415 field_addr.name = "spec_sprite";
4416#endif /* FREECIV_JSON_CONNECTION */
4417 DIO_PUT(string, &dout, &field_addr, real_packet->spec_sprite);
4418#ifdef FREECIV_JSON_CONNECTION
4419 field_addr.name = "label";
4420#endif /* FREECIV_JSON_CONNECTION */
4421 DIO_PUT(string, &dout, &field_addr, real_packet->label);
4422
4423#endif
4424 SEND_PACKET_END(PACKET_TILE_INFO);
4425}
4426
4427 int send_packet_tile_info(struct connection *pc, const struct packet_tile_info *packet)
4428{
4429 if (!pc->used) {
4430 log_error("WARNING: trying to send data to the closed connection %s",
4431 conn_description(pc));
4432 return -1;
4433 }
4434 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_TILE_INFO].packet != NULL, -1,
4435 "Handler for PACKET_TILE_INFO not installed");
4436 return pc->phs.handlers->send[PACKET_TILE_INFO].packet(pc, packet);
4437}
4438
4439 void lsend_packet_tile_info(struct conn_list *dest, const struct packet_tile_info *packet)
4440{
4441 conn_list_iterate(dest, pconn) {
4442 send_packet_tile_info(pconn, packet);
4443 } conn_list_iterate_end;
4444}
4445
4446#ifdef FREECIV_DELTA_PROTOCOL
4447#define hash_packet_game_info_100 hash_const
4448
4449#define cmp_packet_game_info_100 cmp_const
4450
4451 BV_DEFINE(packet_game_info_100_fields, 131);
4452#endif /* FREECIV_DELTA_PROTOCOL */
4453
4454 static struct packet_game_info *receive_packet_game_info_100(struct connection *pc)
4455{
4456#ifdef FREECIV_DELTA_PROTOCOL
4457 packet_game_info_100_fields fields;
4458 struct packet_game_info *old;
4459 struct genhash **hash = pc->phs.received + PACKET_GAME_INFO;
4460#endif /* FREECIV_DELTA_PROTOCOL */
4461 RECEIVE_PACKET_START(packet_game_info, real_packet);
4462#ifdef FREECIV_JSON_CONNECTION
4463 struct plocation field_addr;
4464 {
4465 struct plocation *field_addr_tmp = plocation_field_new(NULL);
4466 field_addr = *field_addr_tmp;
4467 FC_FREE(field_addr_tmp);
4468 }
4469#endif /* FREECIV_JSON_CONNECTION */
4470
4471#ifdef FREECIV_DELTA_PROTOCOL
4472#ifdef FREECIV_JSON_CONNECTION
4473 field_addr.name = "fields";
4474#endif /* FREECIV_JSON_CONNECTION */
4475 DIO_BV_GET(&din, &field_addr, fields);
4476
4477#else /* FREECIV_DELTA_PROTOCOL */
4478 #ifdef FREECIV_JSON_CONNECTION
4479 field_addr.name = "add_to_size_limit";
4480 #endif /* FREECIV_JSON_CONNECTION */
4481 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->add_to_size_limit)) {
4482 RECEIVE_PACKET_FIELD_ERROR(add_to_size_limit);
4483 }
4484 #ifdef FREECIV_JSON_CONNECTION
4485 field_addr.name = "aifill";
4486 #endif /* FREECIV_JSON_CONNECTION */
4487 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->aifill)) {
4488 RECEIVE_PACKET_FIELD_ERROR(aifill);
4489 }
4490 #ifdef FREECIV_JSON_CONNECTION
4491 field_addr.name = "persistent_ready";
4492 #endif /* FREECIV_JSON_CONNECTION */
4493 {
4494 int readin;
4495
4496 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4497 RECEIVE_PACKET_FIELD_ERROR(persistent_ready);
4498 }
4499 real_packet->persistent_ready = readin;
4500 }
4501 #ifdef FREECIV_JSON_CONNECTION
4502 field_addr.name = "airlifting_style";
4503 #endif /* FREECIV_JSON_CONNECTION */
4504 {
4505 int readin;
4506
4507 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4508 RECEIVE_PACKET_FIELD_ERROR(airlifting_style);
4509 }
4510 real_packet->airlifting_style = readin;
4511 }
4512 #ifdef FREECIV_JSON_CONNECTION
4513 field_addr.name = "airlift_from_always_enabled";
4514 #endif /* FREECIV_JSON_CONNECTION */
4515 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->airlift_from_always_enabled)) {
4516 RECEIVE_PACKET_FIELD_ERROR(airlift_from_always_enabled);
4517 }
4518 #ifdef FREECIV_JSON_CONNECTION
4519 field_addr.name = "airlift_to_always_enabled";
4520 #endif /* FREECIV_JSON_CONNECTION */
4521 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->airlift_to_always_enabled)) {
4522 RECEIVE_PACKET_FIELD_ERROR(airlift_to_always_enabled);
4523 }
4524 #ifdef FREECIV_JSON_CONNECTION
4525 field_addr.name = "angrycitizen";
4526 #endif /* FREECIV_JSON_CONNECTION */
4527 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->angrycitizen)) {
4528 RECEIVE_PACKET_FIELD_ERROR(angrycitizen);
4529 }
4530 #ifdef FREECIV_JSON_CONNECTION
4531 field_addr.name = "base_pollution";
4532 #endif /* FREECIV_JSON_CONNECTION */
4533 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->base_pollution)) {
4534 RECEIVE_PACKET_FIELD_ERROR(base_pollution);
4535 }
4536 #ifdef FREECIV_JSON_CONNECTION
4537 field_addr.name = "base_tech_cost";
4538 #endif /* FREECIV_JSON_CONNECTION */
4539 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->base_tech_cost)) {
4540 RECEIVE_PACKET_FIELD_ERROR(base_tech_cost);
4541 }
4542 #ifdef FREECIV_JSON_CONNECTION
4543 field_addr.name = "tech_leak_pct";
4544 #endif /* FREECIV_JSON_CONNECTION */
4545 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tech_leak_pct)) {
4546 RECEIVE_PACKET_FIELD_ERROR(tech_leak_pct);
4547 }
4548 #ifdef FREECIV_JSON_CONNECTION
4549 field_addr.name = "border_city_radius_sq";
4550 #endif /* FREECIV_JSON_CONNECTION */
4551 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->border_city_radius_sq)) {
4552 RECEIVE_PACKET_FIELD_ERROR(border_city_radius_sq);
4553 }
4554 #ifdef FREECIV_JSON_CONNECTION
4555 field_addr.name = "border_size_effect";
4556 #endif /* FREECIV_JSON_CONNECTION */
4557 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->border_size_effect)) {
4558 RECEIVE_PACKET_FIELD_ERROR(border_size_effect);
4559 }
4560 #ifdef FREECIV_JSON_CONNECTION
4561 field_addr.name = "border_city_permanent_radius_sq";
4562 #endif /* FREECIV_JSON_CONNECTION */
4563 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->border_city_permanent_radius_sq)) {
4564 RECEIVE_PACKET_FIELD_ERROR(border_city_permanent_radius_sq);
4565 }
4566 #ifdef FREECIV_JSON_CONNECTION
4567 field_addr.name = "borders";
4568 #endif /* FREECIV_JSON_CONNECTION */
4569 {
4570 int readin;
4571
4572 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4573 RECEIVE_PACKET_FIELD_ERROR(borders);
4574 }
4575 real_packet->borders = readin;
4576 }
4577 #ifdef FREECIV_JSON_CONNECTION
4578 field_addr.name = "base_bribe_cost";
4579 #endif /* FREECIV_JSON_CONNECTION */
4580 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->base_bribe_cost)) {
4581 RECEIVE_PACKET_FIELD_ERROR(base_bribe_cost);
4582 }
4583 #ifdef FREECIV_JSON_CONNECTION
4584 field_addr.name = "caravan_bonus_style";
4585 #endif /* FREECIV_JSON_CONNECTION */
4586 {
4587 int readin;
4588
4589 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4590 RECEIVE_PACKET_FIELD_ERROR(caravan_bonus_style);
4591 }
4592 real_packet->caravan_bonus_style = readin;
4593 }
4594 #ifdef FREECIV_JSON_CONNECTION
4595 field_addr.name = "culture_vic_points";
4596 #endif /* FREECIV_JSON_CONNECTION */
4597 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture_vic_points)) {
4598 RECEIVE_PACKET_FIELD_ERROR(culture_vic_points);
4599 }
4600 #ifdef FREECIV_JSON_CONNECTION
4601 field_addr.name = "culture_vic_lead";
4602 #endif /* FREECIV_JSON_CONNECTION */
4603 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->culture_vic_lead)) {
4604 RECEIVE_PACKET_FIELD_ERROR(culture_vic_lead);
4605 }
4606 #ifdef FREECIV_JSON_CONNECTION
4607 field_addr.name = "culture_migration_pml";
4608 #endif /* FREECIV_JSON_CONNECTION */
4609 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->culture_migration_pml)) {
4610 RECEIVE_PACKET_FIELD_ERROR(culture_migration_pml);
4611 }
4612 #ifdef FREECIV_JSON_CONNECTION
4613 field_addr.name = "history_interest_pml";
4614 #endif /* FREECIV_JSON_CONNECTION */
4615 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->history_interest_pml)) {
4616 RECEIVE_PACKET_FIELD_ERROR(history_interest_pml);
4617 }
4618 #ifdef FREECIV_JSON_CONNECTION
4619 field_addr.name = "celebratesize";
4620 #endif /* FREECIV_JSON_CONNECTION */
4621 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->celebratesize)) {
4622 RECEIVE_PACKET_FIELD_ERROR(celebratesize);
4623 }
4624 #ifdef FREECIV_JSON_CONNECTION
4625 field_addr.name = "changable_tax";
4626 #endif /* FREECIV_JSON_CONNECTION */
4627 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->changable_tax)) {
4628 RECEIVE_PACKET_FIELD_ERROR(changable_tax);
4629 }
4630 #ifdef FREECIV_JSON_CONNECTION
4631 field_addr.name = "pop_report_zeroes";
4632 #endif /* FREECIV_JSON_CONNECTION */
4633 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pop_report_zeroes)) {
4634 RECEIVE_PACKET_FIELD_ERROR(pop_report_zeroes);
4635 }
4636 #ifdef FREECIV_JSON_CONNECTION
4637 field_addr.name = "citizen_nationality";
4638 #endif /* FREECIV_JSON_CONNECTION */
4639 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->citizen_nationality)) {
4640 RECEIVE_PACKET_FIELD_ERROR(citizen_nationality);
4641 }
4642 #ifdef FREECIV_JSON_CONNECTION
4643 field_addr.name = "citizen_convert_speed";
4644 #endif /* FREECIV_JSON_CONNECTION */
4645 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->citizen_convert_speed)) {
4646 RECEIVE_PACKET_FIELD_ERROR(citizen_convert_speed);
4647 }
4648 #ifdef FREECIV_JSON_CONNECTION
4649 field_addr.name = "conquest_convert_pct";
4650 #endif /* FREECIV_JSON_CONNECTION */
4651 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->conquest_convert_pct)) {
4652 RECEIVE_PACKET_FIELD_ERROR(conquest_convert_pct);
4653 }
4654 #ifdef FREECIV_JSON_CONNECTION
4655 field_addr.name = "citizen_partisans_pct";
4656 #endif /* FREECIV_JSON_CONNECTION */
4657 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->citizen_partisans_pct)) {
4658 RECEIVE_PACKET_FIELD_ERROR(citizen_partisans_pct);
4659 }
4660 #ifdef FREECIV_JSON_CONNECTION
4661 field_addr.name = "citymindist";
4662 #endif /* FREECIV_JSON_CONNECTION */
4663 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->citymindist)) {
4664 RECEIVE_PACKET_FIELD_ERROR(citymindist);
4665 }
4666 #ifdef FREECIV_JSON_CONNECTION
4667 field_addr.name = "cooling";
4668 #endif /* FREECIV_JSON_CONNECTION */
4669 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->cooling)) {
4670 RECEIVE_PACKET_FIELD_ERROR(cooling);
4671 }
4672 #ifdef FREECIV_JSON_CONNECTION
4673 field_addr.name = "coolinglevel";
4674 #endif /* FREECIV_JSON_CONNECTION */
4675 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->coolinglevel)) {
4676 RECEIVE_PACKET_FIELD_ERROR(coolinglevel);
4677 }
4678 #ifdef FREECIV_JSON_CONNECTION
4679 field_addr.name = "diplchance_initial_odds";
4680 #endif /* FREECIV_JSON_CONNECTION */
4681 if (!DIO_BV_GET(&din, &field_addr, real_packet->diplchance_initial_odds)) {
4682 RECEIVE_PACKET_FIELD_ERROR(diplchance_initial_odds);
4683 }
4684 #ifdef FREECIV_JSON_CONNECTION
4685 field_addr.name = "diplomacy";
4686 #endif /* FREECIV_JSON_CONNECTION */
4687 {
4688 int readin;
4689
4690 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4691 RECEIVE_PACKET_FIELD_ERROR(diplomacy);
4692 }
4693 real_packet->diplomacy = readin;
4694 }
4695 #ifdef FREECIV_JSON_CONNECTION
4696 field_addr.name = "fogofwar";
4697 #endif /* FREECIV_JSON_CONNECTION */
4698 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->fogofwar)) {
4699 RECEIVE_PACKET_FIELD_ERROR(fogofwar);
4700 }
4701 #ifdef FREECIV_JSON_CONNECTION
4702 field_addr.name = "food_cost";
4703 #endif /* FREECIV_JSON_CONNECTION */
4704 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->food_cost)) {
4705 RECEIVE_PACKET_FIELD_ERROR(food_cost);
4706 }
4707 #ifdef FREECIV_JSON_CONNECTION
4708 field_addr.name = "foodbox";
4709 #endif /* FREECIV_JSON_CONNECTION */
4710 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->foodbox)) {
4711 RECEIVE_PACKET_FIELD_ERROR(foodbox);
4712 }
4713 #ifdef FREECIV_JSON_CONNECTION
4714 field_addr.name = "forced_gold";
4715 #endif /* FREECIV_JSON_CONNECTION */
4716 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_gold)) {
4717 RECEIVE_PACKET_FIELD_ERROR(forced_gold);
4718 }
4719 #ifdef FREECIV_JSON_CONNECTION
4720 field_addr.name = "forced_luxury";
4721 #endif /* FREECIV_JSON_CONNECTION */
4722 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_luxury)) {
4723 RECEIVE_PACKET_FIELD_ERROR(forced_luxury);
4724 }
4725 #ifdef FREECIV_JSON_CONNECTION
4726 field_addr.name = "forced_science";
4727 #endif /* FREECIV_JSON_CONNECTION */
4728 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_science)) {
4729 RECEIVE_PACKET_FIELD_ERROR(forced_science);
4730 }
4731 #ifdef FREECIV_JSON_CONNECTION
4732 field_addr.name = "fulltradesize";
4733 #endif /* FREECIV_JSON_CONNECTION */
4734 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fulltradesize)) {
4735 RECEIVE_PACKET_FIELD_ERROR(fulltradesize);
4736 }
4737 #ifdef FREECIV_JSON_CONNECTION
4738 field_addr.name = "trade_world_rel_pct";
4739 #endif /* FREECIV_JSON_CONNECTION */
4740 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_world_rel_pct)) {
4741 RECEIVE_PACKET_FIELD_ERROR(trade_world_rel_pct);
4742 }
4743 #ifdef FREECIV_JSON_CONNECTION
4744 field_addr.name = "min_trade_route_val";
4745 #endif /* FREECIV_JSON_CONNECTION */
4746 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->min_trade_route_val)) {
4747 RECEIVE_PACKET_FIELD_ERROR(min_trade_route_val);
4748 }
4749 #ifdef FREECIV_JSON_CONNECTION
4750 field_addr.name = "goods_selection";
4751 #endif /* FREECIV_JSON_CONNECTION */
4752 {
4753 int readin;
4754
4755 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4756 RECEIVE_PACKET_FIELD_ERROR(goods_selection);
4757 }
4758 real_packet->goods_selection = readin;
4759 }
4760 #ifdef FREECIV_JSON_CONNECTION
4761 field_addr.name = "global_advance_count";
4762 #endif /* FREECIV_JSON_CONNECTION */
4763 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->global_advance_count)) {
4764 RECEIVE_PACKET_FIELD_ERROR(global_advance_count);
4765 }
4766 #ifdef FREECIV_JSON_CONNECTION
4767 field_addr.name = "global_advances";
4768 #endif /* FREECIV_JSON_CONNECTION */
4769
4770 {
4771 int i;
4772
4773 for (i = 0; i < A_LAST; i++) {
4774 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->global_advances[i])) {
4775 RECEIVE_PACKET_FIELD_ERROR(global_advances);
4776 }
4777 }
4778 }
4779 #ifdef FREECIV_JSON_CONNECTION
4780 field_addr.name = "global_warming";
4781 #endif /* FREECIV_JSON_CONNECTION */
4782 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->global_warming)) {
4783 RECEIVE_PACKET_FIELD_ERROR(global_warming);
4784 }
4785 #ifdef FREECIV_JSON_CONNECTION
4786 field_addr.name = "globalwarming";
4787 #endif /* FREECIV_JSON_CONNECTION */
4788 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->globalwarming)) {
4789 RECEIVE_PACKET_FIELD_ERROR(globalwarming);
4790 }
4791 #ifdef FREECIV_JSON_CONNECTION
4792 field_addr.name = "gold";
4793 #endif /* FREECIV_JSON_CONNECTION */
4794 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
4795 RECEIVE_PACKET_FIELD_ERROR(gold);
4796 }
4797 #ifdef FREECIV_JSON_CONNECTION
4798 field_addr.name = "gold_upkeep_style";
4799 #endif /* FREECIV_JSON_CONNECTION */
4800 {
4801 int readin;
4802
4803 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4804 RECEIVE_PACKET_FIELD_ERROR(gold_upkeep_style);
4805 }
4806 real_packet->gold_upkeep_style = readin;
4807 }
4808 #ifdef FREECIV_JSON_CONNECTION
4809 field_addr.name = "infrapoints";
4810 #endif /* FREECIV_JSON_CONNECTION */
4811 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->infrapoints)) {
4812 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
4813 }
4814 #ifdef FREECIV_JSON_CONNECTION
4815 field_addr.name = "revolentype";
4816 #endif /* FREECIV_JSON_CONNECTION */
4817 {
4818 int readin;
4819
4820 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4821 RECEIVE_PACKET_FIELD_ERROR(revolentype);
4822 }
4823 real_packet->revolentype = readin;
4824 }
4825 #ifdef FREECIV_JSON_CONNECTION
4826 field_addr.name = "default_government_id";
4827 #endif /* FREECIV_JSON_CONNECTION */
4828 {
4829 int readin;
4830
4831 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
4832 RECEIVE_PACKET_FIELD_ERROR(default_government_id);
4833 }
4834 real_packet->default_government_id = readin;
4835 }
4836 #ifdef FREECIV_JSON_CONNECTION
4837 field_addr.name = "government_during_revolution_id";
4838 #endif /* FREECIV_JSON_CONNECTION */
4839 {
4840 int readin;
4841
4842 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
4843 RECEIVE_PACKET_FIELD_ERROR(government_during_revolution_id);
4844 }
4845 real_packet->government_during_revolution_id = readin;
4846 }
4847 #ifdef FREECIV_JSON_CONNECTION
4848 field_addr.name = "granary_food_inc";
4849 #endif /* FREECIV_JSON_CONNECTION */
4850 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_food_inc)) {
4851 RECEIVE_PACKET_FIELD_ERROR(granary_food_inc);
4852 }
4853 #ifdef FREECIV_JSON_CONNECTION
4854 field_addr.name = "granary_food_ini";
4855 #endif /* FREECIV_JSON_CONNECTION */
4856
4857 {
4858 int i;
4859
4860 #ifdef FREECIV_JSON_CONNECTION
4861 /* Enter array. */
4862 field_addr.sub_location = plocation_elem_new(0);
4863 #endif /* FREECIV_JSON_CONNECTION */
4864
4865 for (i = 0; i < MAX_GRANARY_INIS; i++) {
4866 #ifdef FREECIV_JSON_CONNECTION
4867 field_addr.sub_location->number = i;
4868 #endif /* FREECIV_JSON_CONNECTION */
4869 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_food_ini[i])) {
4870 RECEIVE_PACKET_FIELD_ERROR(granary_food_ini);
4871 }
4872 }
4873
4874 #ifdef FREECIV_JSON_CONNECTION
4875 /* Exit array. */
4876 free(field_addr.sub_location);
4877 field_addr.sub_location = NULL;
4878 #endif /* FREECIV_JSON_CONNECTION */
4879 }
4880 #ifdef FREECIV_JSON_CONNECTION
4881 field_addr.name = "granary_num_inis";
4882 #endif /* FREECIV_JSON_CONNECTION */
4883 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->granary_num_inis)) {
4884 RECEIVE_PACKET_FIELD_ERROR(granary_num_inis);
4885 }
4886 #ifdef FREECIV_JSON_CONNECTION
4887 field_addr.name = "great_wonder_owners";
4888 #endif /* FREECIV_JSON_CONNECTION */
4889
4890 {
4891 int i;
4892
4893 for (i = 0; i < B_LAST; i++) {
4894 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->great_wonder_owners[i])) {
4895 RECEIVE_PACKET_FIELD_ERROR(great_wonder_owners);
4896 }
4897 }
4898 }
4899 #ifdef FREECIV_JSON_CONNECTION
4900 field_addr.name = "happy_cost";
4901 #endif /* FREECIV_JSON_CONNECTION */
4902 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->happy_cost)) {
4903 RECEIVE_PACKET_FIELD_ERROR(happy_cost);
4904 }
4905 #ifdef FREECIV_JSON_CONNECTION
4906 field_addr.name = "happyborders";
4907 #endif /* FREECIV_JSON_CONNECTION */
4908 {
4909 int readin;
4910
4911 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4912 RECEIVE_PACKET_FIELD_ERROR(happyborders);
4913 }
4914 real_packet->happyborders = readin;
4915 }
4916 #ifdef FREECIV_JSON_CONNECTION
4917 field_addr.name = "heating";
4918 #endif /* FREECIV_JSON_CONNECTION */
4919 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->heating)) {
4920 RECEIVE_PACKET_FIELD_ERROR(heating);
4921 }
4922 #ifdef FREECIV_JSON_CONNECTION
4923 field_addr.name = "illness_base_factor";
4924 #endif /* FREECIV_JSON_CONNECTION */
4925 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_base_factor)) {
4926 RECEIVE_PACKET_FIELD_ERROR(illness_base_factor);
4927 }
4928 #ifdef FREECIV_JSON_CONNECTION
4929 field_addr.name = "illness_min_size";
4930 #endif /* FREECIV_JSON_CONNECTION */
4931 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->illness_min_size)) {
4932 RECEIVE_PACKET_FIELD_ERROR(illness_min_size);
4933 }
4934 #ifdef FREECIV_JSON_CONNECTION
4935 field_addr.name = "illness_on";
4936 #endif /* FREECIV_JSON_CONNECTION */
4937 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->illness_on)) {
4938 RECEIVE_PACKET_FIELD_ERROR(illness_on);
4939 }
4940 #ifdef FREECIV_JSON_CONNECTION
4941 field_addr.name = "illness_pollution_factor";
4942 #endif /* FREECIV_JSON_CONNECTION */
4943 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_pollution_factor)) {
4944 RECEIVE_PACKET_FIELD_ERROR(illness_pollution_factor);
4945 }
4946 #ifdef FREECIV_JSON_CONNECTION
4947 field_addr.name = "illness_trade_infection";
4948 #endif /* FREECIV_JSON_CONNECTION */
4949 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade_infection)) {
4950 RECEIVE_PACKET_FIELD_ERROR(illness_trade_infection);
4951 }
4952 #ifdef FREECIV_JSON_CONNECTION
4953 field_addr.name = "init_city_radius_sq";
4954 #endif /* FREECIV_JSON_CONNECTION */
4955 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_city_radius_sq)) {
4956 RECEIVE_PACKET_FIELD_ERROR(init_city_radius_sq);
4957 }
4958 #ifdef FREECIV_JSON_CONNECTION
4959 field_addr.name = "is_edit_mode";
4960 #endif /* FREECIV_JSON_CONNECTION */
4961 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_edit_mode)) {
4962 RECEIVE_PACKET_FIELD_ERROR(is_edit_mode);
4963 }
4964 #ifdef FREECIV_JSON_CONNECTION
4965 field_addr.name = "is_new_game";
4966 #endif /* FREECIV_JSON_CONNECTION */
4967 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_new_game)) {
4968 RECEIVE_PACKET_FIELD_ERROR(is_new_game);
4969 }
4970 #ifdef FREECIV_JSON_CONNECTION
4971 field_addr.name = "killcitizen";
4972 #endif /* FREECIV_JSON_CONNECTION */
4973 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->killcitizen)) {
4974 RECEIVE_PACKET_FIELD_ERROR(killcitizen);
4975 }
4976 #ifdef FREECIV_JSON_CONNECTION
4977 field_addr.name = "killstack";
4978 #endif /* FREECIV_JSON_CONNECTION */
4979 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->killstack)) {
4980 RECEIVE_PACKET_FIELD_ERROR(killstack);
4981 }
4982 #ifdef FREECIV_JSON_CONNECTION
4983 field_addr.name = "only_killing_makes_veteran";
4984 #endif /* FREECIV_JSON_CONNECTION */
4985 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->only_killing_makes_veteran)) {
4986 RECEIVE_PACKET_FIELD_ERROR(only_killing_makes_veteran);
4987 }
4988 #ifdef FREECIV_JSON_CONNECTION
4989 field_addr.name = "only_real_fight_makes_veteran";
4990 #endif /* FREECIV_JSON_CONNECTION */
4991 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->only_real_fight_makes_veteran)) {
4992 RECEIVE_PACKET_FIELD_ERROR(only_real_fight_makes_veteran);
4993 }
4994 #ifdef FREECIV_JSON_CONNECTION
4995 field_addr.name = "combat_odds_scaled_veterancy";
4996 #endif /* FREECIV_JSON_CONNECTION */
4997 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->combat_odds_scaled_veterancy)) {
4998 RECEIVE_PACKET_FIELD_ERROR(combat_odds_scaled_veterancy);
4999 }
5000 #ifdef FREECIV_JSON_CONNECTION
5001 field_addr.name = "damage_reduces_bombard_rate";
5002 #endif /* FREECIV_JSON_CONNECTION */
5003 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->damage_reduces_bombard_rate)) {
5004 RECEIVE_PACKET_FIELD_ERROR(damage_reduces_bombard_rate);
5005 }
5006 #ifdef FREECIV_JSON_CONNECTION
5007 field_addr.name = "low_firepower_badwallattacker";
5008 #endif /* FREECIV_JSON_CONNECTION */
5009 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_badwallattacker)) {
5010 RECEIVE_PACKET_FIELD_ERROR(low_firepower_badwallattacker);
5011 }
5012 #ifdef FREECIV_JSON_CONNECTION
5013 field_addr.name = "low_firepower_pearl_harbour";
5014 #endif /* FREECIV_JSON_CONNECTION */
5015 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_pearl_harbour)) {
5016 RECEIVE_PACKET_FIELD_ERROR(low_firepower_pearl_harbour);
5017 }
5018 #ifdef FREECIV_JSON_CONNECTION
5019 field_addr.name = "low_firepower_combat_bonus";
5020 #endif /* FREECIV_JSON_CONNECTION */
5021 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_combat_bonus)) {
5022 RECEIVE_PACKET_FIELD_ERROR(low_firepower_combat_bonus);
5023 }
5024 #ifdef FREECIV_JSON_CONNECTION
5025 field_addr.name = "low_firepower_nonnat_bombard";
5026 #endif /* FREECIV_JSON_CONNECTION */
5027 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_nonnat_bombard)) {
5028 RECEIVE_PACKET_FIELD_ERROR(low_firepower_nonnat_bombard);
5029 }
5030 #ifdef FREECIV_JSON_CONNECTION
5031 field_addr.name = "nuke_pop_loss_pct";
5032 #endif /* FREECIV_JSON_CONNECTION */
5033 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nuke_pop_loss_pct)) {
5034 RECEIVE_PACKET_FIELD_ERROR(nuke_pop_loss_pct);
5035 }
5036 #ifdef FREECIV_JSON_CONNECTION
5037 field_addr.name = "nuke_defender_survival_chance_pct";
5038 #endif /* FREECIV_JSON_CONNECTION */
5039 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nuke_defender_survival_chance_pct)) {
5040 RECEIVE_PACKET_FIELD_ERROR(nuke_defender_survival_chance_pct);
5041 }
5042 #ifdef FREECIV_JSON_CONNECTION
5043 field_addr.name = "min_city_center_output";
5044 #endif /* FREECIV_JSON_CONNECTION */
5045
5046 {
5047 int i;
5048
5049 #ifdef FREECIV_JSON_CONNECTION
5050 /* Enter array. */
5051 field_addr.sub_location = plocation_elem_new(0);
5052 #endif /* FREECIV_JSON_CONNECTION */
5053
5054 for (i = 0; i < O_LAST; i++) {
5055 #ifdef FREECIV_JSON_CONNECTION
5056 field_addr.sub_location->number = i;
5057 #endif /* FREECIV_JSON_CONNECTION */
5058 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->min_city_center_output[i])) {
5059 RECEIVE_PACKET_FIELD_ERROR(min_city_center_output);
5060 }
5061 }
5062
5063 #ifdef FREECIV_JSON_CONNECTION
5064 /* Exit array. */
5065 free(field_addr.sub_location);
5066 field_addr.sub_location = NULL;
5067 #endif /* FREECIV_JSON_CONNECTION */
5068 }
5069 #ifdef FREECIV_JSON_CONNECTION
5070 field_addr.name = "muuk_food_wipe";
5071 #endif /* FREECIV_JSON_CONNECTION */
5072 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->muuk_food_wipe)) {
5073 RECEIVE_PACKET_FIELD_ERROR(muuk_food_wipe);
5074 }
5075 #ifdef FREECIV_JSON_CONNECTION
5076 field_addr.name = "muuk_gold_wipe";
5077 #endif /* FREECIV_JSON_CONNECTION */
5078 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->muuk_gold_wipe)) {
5079 RECEIVE_PACKET_FIELD_ERROR(muuk_gold_wipe);
5080 }
5081 #ifdef FREECIV_JSON_CONNECTION
5082 field_addr.name = "muuk_shield_wipe";
5083 #endif /* FREECIV_JSON_CONNECTION */
5084 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->muuk_shield_wipe)) {
5085 RECEIVE_PACKET_FIELD_ERROR(muuk_shield_wipe);
5086 }
5087 #ifdef FREECIV_JSON_CONNECTION
5088 field_addr.name = "notradesize";
5089 #endif /* FREECIV_JSON_CONNECTION */
5090 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->notradesize)) {
5091 RECEIVE_PACKET_FIELD_ERROR(notradesize);
5092 }
5093 #ifdef FREECIV_JSON_CONNECTION
5094 field_addr.name = "nuclear_winter";
5095 #endif /* FREECIV_JSON_CONNECTION */
5096 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->nuclear_winter)) {
5097 RECEIVE_PACKET_FIELD_ERROR(nuclear_winter);
5098 }
5099 #ifdef FREECIV_JSON_CONNECTION
5100 field_addr.name = "nuclearwinter";
5101 #endif /* FREECIV_JSON_CONNECTION */
5102 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->nuclearwinter)) {
5103 RECEIVE_PACKET_FIELD_ERROR(nuclearwinter);
5104 }
5105 #ifdef FREECIV_JSON_CONNECTION
5106 field_addr.name = "phase";
5107 #endif /* FREECIV_JSON_CONNECTION */
5108 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
5109 RECEIVE_PACKET_FIELD_ERROR(phase);
5110 }
5111 #ifdef FREECIV_JSON_CONNECTION
5112 field_addr.name = "phase_mode";
5113 #endif /* FREECIV_JSON_CONNECTION */
5114 {
5115 int readin;
5116
5117 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5118 RECEIVE_PACKET_FIELD_ERROR(phase_mode);
5119 }
5120 real_packet->phase_mode = readin;
5121 }
5122 #ifdef FREECIV_JSON_CONNECTION
5123 field_addr.name = "pillage_select";
5124 #endif /* FREECIV_JSON_CONNECTION */
5125 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->pillage_select)) {
5126 RECEIVE_PACKET_FIELD_ERROR(pillage_select);
5127 }
5128 #ifdef FREECIV_JSON_CONNECTION
5129 field_addr.name = "steal_maps_reveals_all_cities";
5130 #endif /* FREECIV_JSON_CONNECTION */
5131 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->steal_maps_reveals_all_cities)) {
5132 RECEIVE_PACKET_FIELD_ERROR(steal_maps_reveals_all_cities);
5133 }
5134 #ifdef FREECIV_JSON_CONNECTION
5135 field_addr.name = "poison_empties_food_stock";
5136 #endif /* FREECIV_JSON_CONNECTION */
5137 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->poison_empties_food_stock)) {
5138 RECEIVE_PACKET_FIELD_ERROR(poison_empties_food_stock);
5139 }
5140 #ifdef FREECIV_JSON_CONNECTION
5141 field_addr.name = "tech_steal_allow_holes";
5142 #endif /* FREECIV_JSON_CONNECTION */
5143 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_steal_allow_holes)) {
5144 RECEIVE_PACKET_FIELD_ERROR(tech_steal_allow_holes);
5145 }
5146 #ifdef FREECIV_JSON_CONNECTION
5147 field_addr.name = "tech_trade_allow_holes";
5148 #endif /* FREECIV_JSON_CONNECTION */
5149 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_trade_allow_holes)) {
5150 RECEIVE_PACKET_FIELD_ERROR(tech_trade_allow_holes);
5151 }
5152 #ifdef FREECIV_JSON_CONNECTION
5153 field_addr.name = "tech_trade_loss_allow_holes";
5154 #endif /* FREECIV_JSON_CONNECTION */
5155 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_trade_loss_allow_holes)) {
5156 RECEIVE_PACKET_FIELD_ERROR(tech_trade_loss_allow_holes);
5157 }
5158 #ifdef FREECIV_JSON_CONNECTION
5159 field_addr.name = "tech_parasite_allow_holes";
5160 #endif /* FREECIV_JSON_CONNECTION */
5161 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_parasite_allow_holes)) {
5162 RECEIVE_PACKET_FIELD_ERROR(tech_parasite_allow_holes);
5163 }
5164 #ifdef FREECIV_JSON_CONNECTION
5165 field_addr.name = "tech_loss_allow_holes";
5166 #endif /* FREECIV_JSON_CONNECTION */
5167 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_loss_allow_holes)) {
5168 RECEIVE_PACKET_FIELD_ERROR(tech_loss_allow_holes);
5169 }
5170 #ifdef FREECIV_JSON_CONNECTION
5171 field_addr.name = "rapturedelay";
5172 #endif /* FREECIV_JSON_CONNECTION */
5173 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rapturedelay)) {
5174 RECEIVE_PACKET_FIELD_ERROR(rapturedelay);
5175 }
5176 #ifdef FREECIV_JSON_CONNECTION
5177 field_addr.name = "disasters";
5178 #endif /* FREECIV_JSON_CONNECTION */
5179 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disasters)) {
5180 RECEIVE_PACKET_FIELD_ERROR(disasters);
5181 }
5182 #ifdef FREECIV_JSON_CONNECTION
5183 field_addr.name = "restrictinfra";
5184 #endif /* FREECIV_JSON_CONNECTION */
5185 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->restrictinfra)) {
5186 RECEIVE_PACKET_FIELD_ERROR(restrictinfra);
5187 }
5188 #ifdef FREECIV_JSON_CONNECTION
5189 field_addr.name = "unreachable_protects";
5190 #endif /* FREECIV_JSON_CONNECTION */
5191 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unreachable_protects)) {
5192 RECEIVE_PACKET_FIELD_ERROR(unreachable_protects);
5193 }
5194 #ifdef FREECIV_JSON_CONNECTION
5195 field_addr.name = "sciencebox";
5196 #endif /* FREECIV_JSON_CONNECTION */
5197 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->sciencebox)) {
5198 RECEIVE_PACKET_FIELD_ERROR(sciencebox);
5199 }
5200 #ifdef FREECIV_JSON_CONNECTION
5201 field_addr.name = "shieldbox";
5202 #endif /* FREECIV_JSON_CONNECTION */
5203 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->shieldbox)) {
5204 RECEIVE_PACKET_FIELD_ERROR(shieldbox);
5205 }
5206 #ifdef FREECIV_JSON_CONNECTION
5207 field_addr.name = "skill_level";
5208 #endif /* FREECIV_JSON_CONNECTION */
5209 {
5210 int readin;
5211
5212 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5213 RECEIVE_PACKET_FIELD_ERROR(skill_level);
5214 }
5215 real_packet->skill_level = readin;
5216 }
5217 #ifdef FREECIV_JSON_CONNECTION
5218 field_addr.name = "victory_conditions";
5219 #endif /* FREECIV_JSON_CONNECTION */
5220 {
5221 int readin;
5222
5223 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5224 RECEIVE_PACKET_FIELD_ERROR(victory_conditions);
5225 }
5226 real_packet->victory_conditions = readin;
5227 }
5228 #ifdef FREECIV_JSON_CONNECTION
5229 field_addr.name = "team_pooled_research";
5230 #endif /* FREECIV_JSON_CONNECTION */
5231 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->team_pooled_research)) {
5232 RECEIVE_PACKET_FIELD_ERROR(team_pooled_research);
5233 }
5234 #ifdef FREECIV_JSON_CONNECTION
5235 field_addr.name = "tech";
5236 #endif /* FREECIV_JSON_CONNECTION */
5237 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->tech)) {
5238 RECEIVE_PACKET_FIELD_ERROR(tech);
5239 }
5240 #ifdef FREECIV_JSON_CONNECTION
5241 field_addr.name = "tech_cost_style";
5242 #endif /* FREECIV_JSON_CONNECTION */
5243 {
5244 int readin;
5245
5246 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5247 RECEIVE_PACKET_FIELD_ERROR(tech_cost_style);
5248 }
5249 real_packet->tech_cost_style = readin;
5250 }
5251 #ifdef FREECIV_JSON_CONNECTION
5252 field_addr.name = "tech_leakage";
5253 #endif /* FREECIV_JSON_CONNECTION */
5254 {
5255 int readin;
5256
5257 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5258 RECEIVE_PACKET_FIELD_ERROR(tech_leakage);
5259 }
5260 real_packet->tech_leakage = readin;
5261 }
5262 #ifdef FREECIV_JSON_CONNECTION
5263 field_addr.name = "tech_upkeep_divider";
5264 #endif /* FREECIV_JSON_CONNECTION */
5265 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_upkeep_divider)) {
5266 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep_divider);
5267 }
5268 #ifdef FREECIV_JSON_CONNECTION
5269 field_addr.name = "tech_upkeep_style";
5270 #endif /* FREECIV_JSON_CONNECTION */
5271 {
5272 int readin;
5273
5274 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5275 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep_style);
5276 }
5277 real_packet->tech_upkeep_style = readin;
5278 }
5279 #ifdef FREECIV_JSON_CONNECTION
5280 field_addr.name = "techloss_forgiveness";
5281 #endif /* FREECIV_JSON_CONNECTION */
5282 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->techloss_forgiveness)) {
5283 RECEIVE_PACKET_FIELD_ERROR(techloss_forgiveness);
5284 }
5285 #ifdef FREECIV_JSON_CONNECTION
5286 field_addr.name = "free_tech_method";
5287 #endif /* FREECIV_JSON_CONNECTION */
5288 {
5289 int readin;
5290
5291 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5292 RECEIVE_PACKET_FIELD_ERROR(free_tech_method);
5293 }
5294 real_packet->free_tech_method = readin;
5295 }
5296 #ifdef FREECIV_JSON_CONNECTION
5297 field_addr.name = "gameloss_style";
5298 #endif /* FREECIV_JSON_CONNECTION */
5299 {
5300 int readin;
5301
5302 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5303 RECEIVE_PACKET_FIELD_ERROR(gameloss_style);
5304 }
5305 real_packet->gameloss_style = readin;
5306 }
5307 #ifdef FREECIV_JSON_CONNECTION
5308 field_addr.name = "timeout";
5309 #endif /* FREECIV_JSON_CONNECTION */
5310 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->timeout)) {
5311 RECEIVE_PACKET_FIELD_ERROR(timeout);
5312 }
5313 #ifdef FREECIV_JSON_CONNECTION
5314 field_addr.name = "first_timeout";
5315 #endif /* FREECIV_JSON_CONNECTION */
5316 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->first_timeout)) {
5317 RECEIVE_PACKET_FIELD_ERROR(first_timeout);
5318 }
5319 #ifdef FREECIV_JSON_CONNECTION
5320 field_addr.name = "tired_attack";
5321 #endif /* FREECIV_JSON_CONNECTION */
5322 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tired_attack)) {
5323 RECEIVE_PACKET_FIELD_ERROR(tired_attack);
5324 }
5325 #ifdef FREECIV_JSON_CONNECTION
5326 field_addr.name = "trademindist";
5327 #endif /* FREECIV_JSON_CONNECTION */
5328 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->trademindist)) {
5329 RECEIVE_PACKET_FIELD_ERROR(trademindist);
5330 }
5331 #ifdef FREECIV_JSON_CONNECTION
5332 field_addr.name = "trade_revenue_style";
5333 #endif /* FREECIV_JSON_CONNECTION */
5334 {
5335 int readin;
5336
5337 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5338 RECEIVE_PACKET_FIELD_ERROR(trade_revenue_style);
5339 }
5340 real_packet->trade_revenue_style = readin;
5341 }
5342 #ifdef FREECIV_JSON_CONNECTION
5343 field_addr.name = "trading_city";
5344 #endif /* FREECIV_JSON_CONNECTION */
5345 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->trading_city)) {
5346 RECEIVE_PACKET_FIELD_ERROR(trading_city);
5347 }
5348 #ifdef FREECIV_JSON_CONNECTION
5349 field_addr.name = "trading_gold";
5350 #endif /* FREECIV_JSON_CONNECTION */
5351 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->trading_gold)) {
5352 RECEIVE_PACKET_FIELD_ERROR(trading_gold);
5353 }
5354 #ifdef FREECIV_JSON_CONNECTION
5355 field_addr.name = "trading_tech";
5356 #endif /* FREECIV_JSON_CONNECTION */
5357 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->trading_tech)) {
5358 RECEIVE_PACKET_FIELD_ERROR(trading_tech);
5359 }
5360 #ifdef FREECIV_JSON_CONNECTION
5361 field_addr.name = "turn";
5362 #endif /* FREECIV_JSON_CONNECTION */
5363 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
5364 RECEIVE_PACKET_FIELD_ERROR(turn);
5365 }
5366 #ifdef FREECIV_JSON_CONNECTION
5367 field_addr.name = "warminglevel";
5368 #endif /* FREECIV_JSON_CONNECTION */
5369 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->warminglevel)) {
5370 RECEIVE_PACKET_FIELD_ERROR(warminglevel);
5371 }
5372 #ifdef FREECIV_JSON_CONNECTION
5373 field_addr.name = "year";
5374 #endif /* FREECIV_JSON_CONNECTION */
5375 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->year)) {
5376 RECEIVE_PACKET_FIELD_ERROR(year);
5377 }
5378 #ifdef FREECIV_JSON_CONNECTION
5379 field_addr.name = "year_0_hack";
5380 #endif /* FREECIV_JSON_CONNECTION */
5381 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->year_0_hack)) {
5382 RECEIVE_PACKET_FIELD_ERROR(year_0_hack);
5383 }
5384 #ifdef FREECIV_JSON_CONNECTION
5385 field_addr.name = "fragment_count";
5386 #endif /* FREECIV_JSON_CONNECTION */
5387 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->fragment_count)) {
5388 RECEIVE_PACKET_FIELD_ERROR(fragment_count);
5389 }
5390 #ifdef FREECIV_JSON_CONNECTION
5391 field_addr.name = "civil_war_enabled";
5392 #endif /* FREECIV_JSON_CONNECTION */
5393 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->civil_war_enabled)) {
5394 RECEIVE_PACKET_FIELD_ERROR(civil_war_enabled);
5395 }
5396 #ifdef FREECIV_JSON_CONNECTION
5397 field_addr.name = "civil_war_bonus_celebrating";
5398 #endif /* FREECIV_JSON_CONNECTION */
5399 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->civil_war_bonus_celebrating)) {
5400 RECEIVE_PACKET_FIELD_ERROR(civil_war_bonus_celebrating);
5401 }
5402 #ifdef FREECIV_JSON_CONNECTION
5403 field_addr.name = "civil_war_bonus_unhappy";
5404 #endif /* FREECIV_JSON_CONNECTION */
5405 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->civil_war_bonus_unhappy)) {
5406 RECEIVE_PACKET_FIELD_ERROR(civil_war_bonus_unhappy);
5407 }
5408 #ifdef FREECIV_JSON_CONNECTION
5409 field_addr.name = "granularity";
5410 #endif /* FREECIV_JSON_CONNECTION */
5411 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granularity)) {
5412 RECEIVE_PACKET_FIELD_ERROR(granularity);
5413 }
5414 #ifdef FREECIV_JSON_CONNECTION
5415 field_addr.name = "small_wonder_visibility";
5416 #endif /* FREECIV_JSON_CONNECTION */
5417 {
5418 int readin;
5419
5420 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5421 RECEIVE_PACKET_FIELD_ERROR(small_wonder_visibility);
5422 }
5423 real_packet->small_wonder_visibility = readin;
5424 }
5425
5426#endif
5427 log_packet_detailed("packet_game_info_100: got info about ()");
5428
5429#ifdef FREECIV_DELTA_PROTOCOL
5430 if (NULL == *hash) {
5431 *hash = genhash_new_full(hash_packet_game_info_100, cmp_packet_game_info_100,
5432 NULL, NULL, NULL, free);
5433 }
5434
5435 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
5436 *real_packet = *old;
5437 } else {
5438 log_packet_detailed(" no old info");
5439 memset(real_packet, 0, sizeof(*real_packet));
5440 }
5441
5442 if (BV_ISSET(fields, 0)) {
5443 log_packet_detailed(" got field 'add_to_size_limit'");
5444 #ifdef FREECIV_JSON_CONNECTION
5445 field_addr.name = "add_to_size_limit";
5446 #endif /* FREECIV_JSON_CONNECTION */
5447 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->add_to_size_limit)) {
5448 RECEIVE_PACKET_FIELD_ERROR(add_to_size_limit);
5449 }
5450 }
5451 if (BV_ISSET(fields, 1)) {
5452 log_packet_detailed(" got field 'aifill'");
5453 #ifdef FREECIV_JSON_CONNECTION
5454 field_addr.name = "aifill";
5455 #endif /* FREECIV_JSON_CONNECTION */
5456 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->aifill)) {
5457 RECEIVE_PACKET_FIELD_ERROR(aifill);
5458 }
5459 }
5460 if (BV_ISSET(fields, 2)) {
5461 log_packet_detailed(" got field 'persistent_ready'");
5462 #ifdef FREECIV_JSON_CONNECTION
5463 field_addr.name = "persistent_ready";
5464 #endif /* FREECIV_JSON_CONNECTION */
5465 {
5466 int readin;
5467
5468 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5469 RECEIVE_PACKET_FIELD_ERROR(persistent_ready);
5470 }
5471 real_packet->persistent_ready = readin;
5472 }
5473 }
5474 if (BV_ISSET(fields, 3)) {
5475 log_packet_detailed(" got field 'airlifting_style'");
5476 #ifdef FREECIV_JSON_CONNECTION
5477 field_addr.name = "airlifting_style";
5478 #endif /* FREECIV_JSON_CONNECTION */
5479 {
5480 int readin;
5481
5482 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5483 RECEIVE_PACKET_FIELD_ERROR(airlifting_style);
5484 }
5485 real_packet->airlifting_style = readin;
5486 }
5487 }
5488 real_packet->airlift_from_always_enabled = BV_ISSET(fields, 4);
5489 real_packet->airlift_to_always_enabled = BV_ISSET(fields, 5);
5490 if (BV_ISSET(fields, 6)) {
5491 log_packet_detailed(" got field 'angrycitizen'");
5492 #ifdef FREECIV_JSON_CONNECTION
5493 field_addr.name = "angrycitizen";
5494 #endif /* FREECIV_JSON_CONNECTION */
5495 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->angrycitizen)) {
5496 RECEIVE_PACKET_FIELD_ERROR(angrycitizen);
5497 }
5498 }
5499 if (BV_ISSET(fields, 7)) {
5500 log_packet_detailed(" got field 'base_pollution'");
5501 #ifdef FREECIV_JSON_CONNECTION
5502 field_addr.name = "base_pollution";
5503 #endif /* FREECIV_JSON_CONNECTION */
5504 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->base_pollution)) {
5505 RECEIVE_PACKET_FIELD_ERROR(base_pollution);
5506 }
5507 }
5508 if (BV_ISSET(fields, 8)) {
5509 log_packet_detailed(" got field 'base_tech_cost'");
5510 #ifdef FREECIV_JSON_CONNECTION
5511 field_addr.name = "base_tech_cost";
5512 #endif /* FREECIV_JSON_CONNECTION */
5513 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->base_tech_cost)) {
5514 RECEIVE_PACKET_FIELD_ERROR(base_tech_cost);
5515 }
5516 }
5517 if (BV_ISSET(fields, 9)) {
5518 log_packet_detailed(" got field 'tech_leak_pct'");
5519 #ifdef FREECIV_JSON_CONNECTION
5520 field_addr.name = "tech_leak_pct";
5521 #endif /* FREECIV_JSON_CONNECTION */
5522 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tech_leak_pct)) {
5523 RECEIVE_PACKET_FIELD_ERROR(tech_leak_pct);
5524 }
5525 }
5526 if (BV_ISSET(fields, 10)) {
5527 log_packet_detailed(" got field 'border_city_radius_sq'");
5528 #ifdef FREECIV_JSON_CONNECTION
5529 field_addr.name = "border_city_radius_sq";
5530 #endif /* FREECIV_JSON_CONNECTION */
5531 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->border_city_radius_sq)) {
5532 RECEIVE_PACKET_FIELD_ERROR(border_city_radius_sq);
5533 }
5534 }
5535 if (BV_ISSET(fields, 11)) {
5536 log_packet_detailed(" got field 'border_size_effect'");
5537 #ifdef FREECIV_JSON_CONNECTION
5538 field_addr.name = "border_size_effect";
5539 #endif /* FREECIV_JSON_CONNECTION */
5540 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->border_size_effect)) {
5541 RECEIVE_PACKET_FIELD_ERROR(border_size_effect);
5542 }
5543 }
5544 if (BV_ISSET(fields, 12)) {
5545 log_packet_detailed(" got field 'border_city_permanent_radius_sq'");
5546 #ifdef FREECIV_JSON_CONNECTION
5547 field_addr.name = "border_city_permanent_radius_sq";
5548 #endif /* FREECIV_JSON_CONNECTION */
5549 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->border_city_permanent_radius_sq)) {
5550 RECEIVE_PACKET_FIELD_ERROR(border_city_permanent_radius_sq);
5551 }
5552 }
5553 if (BV_ISSET(fields, 13)) {
5554 log_packet_detailed(" got field 'borders'");
5555 #ifdef FREECIV_JSON_CONNECTION
5556 field_addr.name = "borders";
5557 #endif /* FREECIV_JSON_CONNECTION */
5558 {
5559 int readin;
5560
5561 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5562 RECEIVE_PACKET_FIELD_ERROR(borders);
5563 }
5564 real_packet->borders = readin;
5565 }
5566 }
5567 if (BV_ISSET(fields, 14)) {
5568 log_packet_detailed(" got field 'base_bribe_cost'");
5569 #ifdef FREECIV_JSON_CONNECTION
5570 field_addr.name = "base_bribe_cost";
5571 #endif /* FREECIV_JSON_CONNECTION */
5572 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->base_bribe_cost)) {
5573 RECEIVE_PACKET_FIELD_ERROR(base_bribe_cost);
5574 }
5575 }
5576 if (BV_ISSET(fields, 15)) {
5577 log_packet_detailed(" got field 'caravan_bonus_style'");
5578 #ifdef FREECIV_JSON_CONNECTION
5579 field_addr.name = "caravan_bonus_style";
5580 #endif /* FREECIV_JSON_CONNECTION */
5581 {
5582 int readin;
5583
5584 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5585 RECEIVE_PACKET_FIELD_ERROR(caravan_bonus_style);
5586 }
5587 real_packet->caravan_bonus_style = readin;
5588 }
5589 }
5590 if (BV_ISSET(fields, 16)) {
5591 log_packet_detailed(" got field 'culture_vic_points'");
5592 #ifdef FREECIV_JSON_CONNECTION
5593 field_addr.name = "culture_vic_points";
5594 #endif /* FREECIV_JSON_CONNECTION */
5595 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture_vic_points)) {
5596 RECEIVE_PACKET_FIELD_ERROR(culture_vic_points);
5597 }
5598 }
5599 if (BV_ISSET(fields, 17)) {
5600 log_packet_detailed(" got field 'culture_vic_lead'");
5601 #ifdef FREECIV_JSON_CONNECTION
5602 field_addr.name = "culture_vic_lead";
5603 #endif /* FREECIV_JSON_CONNECTION */
5604 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->culture_vic_lead)) {
5605 RECEIVE_PACKET_FIELD_ERROR(culture_vic_lead);
5606 }
5607 }
5608 if (BV_ISSET(fields, 18)) {
5609 log_packet_detailed(" got field 'culture_migration_pml'");
5610 #ifdef FREECIV_JSON_CONNECTION
5611 field_addr.name = "culture_migration_pml";
5612 #endif /* FREECIV_JSON_CONNECTION */
5613 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->culture_migration_pml)) {
5614 RECEIVE_PACKET_FIELD_ERROR(culture_migration_pml);
5615 }
5616 }
5617 if (BV_ISSET(fields, 19)) {
5618 log_packet_detailed(" got field 'history_interest_pml'");
5619 #ifdef FREECIV_JSON_CONNECTION
5620 field_addr.name = "history_interest_pml";
5621 #endif /* FREECIV_JSON_CONNECTION */
5622 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->history_interest_pml)) {
5623 RECEIVE_PACKET_FIELD_ERROR(history_interest_pml);
5624 }
5625 }
5626 if (BV_ISSET(fields, 20)) {
5627 log_packet_detailed(" got field 'celebratesize'");
5628 #ifdef FREECIV_JSON_CONNECTION
5629 field_addr.name = "celebratesize";
5630 #endif /* FREECIV_JSON_CONNECTION */
5631 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->celebratesize)) {
5632 RECEIVE_PACKET_FIELD_ERROR(celebratesize);
5633 }
5634 }
5635 real_packet->changable_tax = BV_ISSET(fields, 21);
5636 if (BV_ISSET(fields, 22)) {
5637 log_packet_detailed(" got field 'pop_report_zeroes'");
5638 #ifdef FREECIV_JSON_CONNECTION
5639 field_addr.name = "pop_report_zeroes";
5640 #endif /* FREECIV_JSON_CONNECTION */
5641 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pop_report_zeroes)) {
5642 RECEIVE_PACKET_FIELD_ERROR(pop_report_zeroes);
5643 }
5644 }
5645 real_packet->citizen_nationality = BV_ISSET(fields, 23);
5646 if (BV_ISSET(fields, 24)) {
5647 log_packet_detailed(" got field 'citizen_convert_speed'");
5648 #ifdef FREECIV_JSON_CONNECTION
5649 field_addr.name = "citizen_convert_speed";
5650 #endif /* FREECIV_JSON_CONNECTION */
5651 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->citizen_convert_speed)) {
5652 RECEIVE_PACKET_FIELD_ERROR(citizen_convert_speed);
5653 }
5654 }
5655 if (BV_ISSET(fields, 25)) {
5656 log_packet_detailed(" got field 'conquest_convert_pct'");
5657 #ifdef FREECIV_JSON_CONNECTION
5658 field_addr.name = "conquest_convert_pct";
5659 #endif /* FREECIV_JSON_CONNECTION */
5660 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->conquest_convert_pct)) {
5661 RECEIVE_PACKET_FIELD_ERROR(conquest_convert_pct);
5662 }
5663 }
5664 if (BV_ISSET(fields, 26)) {
5665 log_packet_detailed(" got field 'citizen_partisans_pct'");
5666 #ifdef FREECIV_JSON_CONNECTION
5667 field_addr.name = "citizen_partisans_pct";
5668 #endif /* FREECIV_JSON_CONNECTION */
5669 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->citizen_partisans_pct)) {
5670 RECEIVE_PACKET_FIELD_ERROR(citizen_partisans_pct);
5671 }
5672 }
5673 if (BV_ISSET(fields, 27)) {
5674 log_packet_detailed(" got field 'citymindist'");
5675 #ifdef FREECIV_JSON_CONNECTION
5676 field_addr.name = "citymindist";
5677 #endif /* FREECIV_JSON_CONNECTION */
5678 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->citymindist)) {
5679 RECEIVE_PACKET_FIELD_ERROR(citymindist);
5680 }
5681 }
5682 if (BV_ISSET(fields, 28)) {
5683 log_packet_detailed(" got field 'cooling'");
5684 #ifdef FREECIV_JSON_CONNECTION
5685 field_addr.name = "cooling";
5686 #endif /* FREECIV_JSON_CONNECTION */
5687 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->cooling)) {
5688 RECEIVE_PACKET_FIELD_ERROR(cooling);
5689 }
5690 }
5691 if (BV_ISSET(fields, 29)) {
5692 log_packet_detailed(" got field 'coolinglevel'");
5693 #ifdef FREECIV_JSON_CONNECTION
5694 field_addr.name = "coolinglevel";
5695 #endif /* FREECIV_JSON_CONNECTION */
5696 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->coolinglevel)) {
5697 RECEIVE_PACKET_FIELD_ERROR(coolinglevel);
5698 }
5699 }
5700 if (BV_ISSET(fields, 30)) {
5701 log_packet_detailed(" got field 'diplchance_initial_odds'");
5702 #ifdef FREECIV_JSON_CONNECTION
5703 field_addr.name = "diplchance_initial_odds";
5704 #endif /* FREECIV_JSON_CONNECTION */
5705 if (!DIO_BV_GET(&din, &field_addr, real_packet->diplchance_initial_odds)) {
5706 RECEIVE_PACKET_FIELD_ERROR(diplchance_initial_odds);
5707 }
5708 }
5709 if (BV_ISSET(fields, 31)) {
5710 log_packet_detailed(" got field 'diplomacy'");
5711 #ifdef FREECIV_JSON_CONNECTION
5712 field_addr.name = "diplomacy";
5713 #endif /* FREECIV_JSON_CONNECTION */
5714 {
5715 int readin;
5716
5717 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5718 RECEIVE_PACKET_FIELD_ERROR(diplomacy);
5719 }
5720 real_packet->diplomacy = readin;
5721 }
5722 }
5723 real_packet->fogofwar = BV_ISSET(fields, 32);
5724 if (BV_ISSET(fields, 33)) {
5725 log_packet_detailed(" got field 'food_cost'");
5726 #ifdef FREECIV_JSON_CONNECTION
5727 field_addr.name = "food_cost";
5728 #endif /* FREECIV_JSON_CONNECTION */
5729 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->food_cost)) {
5730 RECEIVE_PACKET_FIELD_ERROR(food_cost);
5731 }
5732 }
5733 if (BV_ISSET(fields, 34)) {
5734 log_packet_detailed(" got field 'foodbox'");
5735 #ifdef FREECIV_JSON_CONNECTION
5736 field_addr.name = "foodbox";
5737 #endif /* FREECIV_JSON_CONNECTION */
5738 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->foodbox)) {
5739 RECEIVE_PACKET_FIELD_ERROR(foodbox);
5740 }
5741 }
5742 if (BV_ISSET(fields, 35)) {
5743 log_packet_detailed(" got field 'forced_gold'");
5744 #ifdef FREECIV_JSON_CONNECTION
5745 field_addr.name = "forced_gold";
5746 #endif /* FREECIV_JSON_CONNECTION */
5747 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_gold)) {
5748 RECEIVE_PACKET_FIELD_ERROR(forced_gold);
5749 }
5750 }
5751 if (BV_ISSET(fields, 36)) {
5752 log_packet_detailed(" got field 'forced_luxury'");
5753 #ifdef FREECIV_JSON_CONNECTION
5754 field_addr.name = "forced_luxury";
5755 #endif /* FREECIV_JSON_CONNECTION */
5756 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_luxury)) {
5757 RECEIVE_PACKET_FIELD_ERROR(forced_luxury);
5758 }
5759 }
5760 if (BV_ISSET(fields, 37)) {
5761 log_packet_detailed(" got field 'forced_science'");
5762 #ifdef FREECIV_JSON_CONNECTION
5763 field_addr.name = "forced_science";
5764 #endif /* FREECIV_JSON_CONNECTION */
5765 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_science)) {
5766 RECEIVE_PACKET_FIELD_ERROR(forced_science);
5767 }
5768 }
5769 if (BV_ISSET(fields, 38)) {
5770 log_packet_detailed(" got field 'fulltradesize'");
5771 #ifdef FREECIV_JSON_CONNECTION
5772 field_addr.name = "fulltradesize";
5773 #endif /* FREECIV_JSON_CONNECTION */
5774 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fulltradesize)) {
5775 RECEIVE_PACKET_FIELD_ERROR(fulltradesize);
5776 }
5777 }
5778 if (BV_ISSET(fields, 39)) {
5779 log_packet_detailed(" got field 'trade_world_rel_pct'");
5780 #ifdef FREECIV_JSON_CONNECTION
5781 field_addr.name = "trade_world_rel_pct";
5782 #endif /* FREECIV_JSON_CONNECTION */
5783 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_world_rel_pct)) {
5784 RECEIVE_PACKET_FIELD_ERROR(trade_world_rel_pct);
5785 }
5786 }
5787 if (BV_ISSET(fields, 40)) {
5788 log_packet_detailed(" got field 'min_trade_route_val'");
5789 #ifdef FREECIV_JSON_CONNECTION
5790 field_addr.name = "min_trade_route_val";
5791 #endif /* FREECIV_JSON_CONNECTION */
5792 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->min_trade_route_val)) {
5793 RECEIVE_PACKET_FIELD_ERROR(min_trade_route_val);
5794 }
5795 }
5796 if (BV_ISSET(fields, 41)) {
5797 log_packet_detailed(" got field 'goods_selection'");
5798 #ifdef FREECIV_JSON_CONNECTION
5799 field_addr.name = "goods_selection";
5800 #endif /* FREECIV_JSON_CONNECTION */
5801 {
5802 int readin;
5803
5804 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5805 RECEIVE_PACKET_FIELD_ERROR(goods_selection);
5806 }
5807 real_packet->goods_selection = readin;
5808 }
5809 }
5810 if (BV_ISSET(fields, 42)) {
5811 log_packet_detailed(" got field 'global_advance_count'");
5812 #ifdef FREECIV_JSON_CONNECTION
5813 field_addr.name = "global_advance_count";
5814 #endif /* FREECIV_JSON_CONNECTION */
5815 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->global_advance_count)) {
5816 RECEIVE_PACKET_FIELD_ERROR(global_advance_count);
5817 }
5818 }
5819 if (BV_ISSET(fields, 43)) {
5820 log_packet_detailed(" got field 'global_advances'");
5821 #ifdef FREECIV_JSON_CONNECTION
5822 field_addr.name = "global_advances";
5823 #endif /* FREECIV_JSON_CONNECTION */
5824
5825 {
5826 #ifdef FREECIV_JSON_CONNECTION
5827 int count;
5828
5829 /* Enter array. */
5830 field_addr.sub_location = plocation_elem_new(0);
5831
5832 for (count = 0;; count++) {
5833 int i;
5834
5835 field_addr.sub_location->number = count;
5836
5837 /* Enter diff array element (start at the index address). */
5838 field_addr.sub_location->sub_location = plocation_elem_new(0);
5839 #else /* FREECIV_JSON_CONNECTION */
5840 while (TRUE) {
5841 int i;
5842 #endif /* FREECIV_JSON_CONNECTION */
5843
5844 if (!DIO_GET(uint8, &din, &field_addr, &i)) {
5845 RECEIVE_PACKET_FIELD_ERROR(global_advances);
5846 }
5847 if (i == 255) {
5848 #ifdef FREECIV_JSON_CONNECTION
5849 /* Exit diff array element. */
5850 free(field_addr.sub_location->sub_location);
5851 field_addr.sub_location->sub_location = NULL;
5852
5853 /* Exit diff array. */
5854 free(field_addr.sub_location);
5855 field_addr.sub_location = NULL;
5856 #endif /* FREECIV_JSON_CONNECTION */
5857
5858 break;
5859 }
5860 if (i > A_LAST) {
5861 RECEIVE_PACKET_FIELD_ERROR(global_advances,
5862 ": unexpected value %d "
5863 "(> A_LAST) in array diff",
5864 i);
5865 } else {
5866 #ifdef FREECIV_JSON_CONNECTION
5867 /* Content address. */
5868 field_addr.sub_location->sub_location->number = 1;
5869 #endif /* FREECIV_JSON_CONNECTION */
5870 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->global_advances[i])) {
5871 RECEIVE_PACKET_FIELD_ERROR(global_advances);
5872 }
5873 }
5874
5875 #ifdef FREECIV_JSON_CONNECTION
5876 /* Exit diff array element. */
5877 free(field_addr.sub_location->sub_location);
5878 field_addr.sub_location->sub_location = NULL;
5879 #endif /* FREECIV_JSON_CONNECTION */
5880 }
5881
5882 #ifdef FREECIV_JSON_CONNECTION
5883 /* Exit array. */
5884 free(field_addr.sub_location);
5885 field_addr.sub_location = NULL;
5886 #endif /* FREECIV_JSON_CONNECTION */
5887 }
5888 }
5889 real_packet->global_warming = BV_ISSET(fields, 44);
5890 if (BV_ISSET(fields, 45)) {
5891 log_packet_detailed(" got field 'globalwarming'");
5892 #ifdef FREECIV_JSON_CONNECTION
5893 field_addr.name = "globalwarming";
5894 #endif /* FREECIV_JSON_CONNECTION */
5895 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->globalwarming)) {
5896 RECEIVE_PACKET_FIELD_ERROR(globalwarming);
5897 }
5898 }
5899 if (BV_ISSET(fields, 46)) {
5900 log_packet_detailed(" got field 'gold'");
5901 #ifdef FREECIV_JSON_CONNECTION
5902 field_addr.name = "gold";
5903 #endif /* FREECIV_JSON_CONNECTION */
5904 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
5905 RECEIVE_PACKET_FIELD_ERROR(gold);
5906 }
5907 }
5908 if (BV_ISSET(fields, 47)) {
5909 log_packet_detailed(" got field 'gold_upkeep_style'");
5910 #ifdef FREECIV_JSON_CONNECTION
5911 field_addr.name = "gold_upkeep_style";
5912 #endif /* FREECIV_JSON_CONNECTION */
5913 {
5914 int readin;
5915
5916 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5917 RECEIVE_PACKET_FIELD_ERROR(gold_upkeep_style);
5918 }
5919 real_packet->gold_upkeep_style = readin;
5920 }
5921 }
5922 if (BV_ISSET(fields, 48)) {
5923 log_packet_detailed(" got field 'infrapoints'");
5924 #ifdef FREECIV_JSON_CONNECTION
5925 field_addr.name = "infrapoints";
5926 #endif /* FREECIV_JSON_CONNECTION */
5927 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->infrapoints)) {
5928 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
5929 }
5930 }
5931 if (BV_ISSET(fields, 49)) {
5932 log_packet_detailed(" got field 'revolentype'");
5933 #ifdef FREECIV_JSON_CONNECTION
5934 field_addr.name = "revolentype";
5935 #endif /* FREECIV_JSON_CONNECTION */
5936 {
5937 int readin;
5938
5939 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5940 RECEIVE_PACKET_FIELD_ERROR(revolentype);
5941 }
5942 real_packet->revolentype = readin;
5943 }
5944 }
5945 if (BV_ISSET(fields, 50)) {
5946 log_packet_detailed(" got field 'default_government_id'");
5947 #ifdef FREECIV_JSON_CONNECTION
5948 field_addr.name = "default_government_id";
5949 #endif /* FREECIV_JSON_CONNECTION */
5950 {
5951 int readin;
5952
5953 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
5954 RECEIVE_PACKET_FIELD_ERROR(default_government_id);
5955 }
5956 real_packet->default_government_id = readin;
5957 }
5958 }
5959 if (BV_ISSET(fields, 51)) {
5960 log_packet_detailed(" got field 'government_during_revolution_id'");
5961 #ifdef FREECIV_JSON_CONNECTION
5962 field_addr.name = "government_during_revolution_id";
5963 #endif /* FREECIV_JSON_CONNECTION */
5964 {
5965 int readin;
5966
5967 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
5968 RECEIVE_PACKET_FIELD_ERROR(government_during_revolution_id);
5969 }
5970 real_packet->government_during_revolution_id = readin;
5971 }
5972 }
5973 if (BV_ISSET(fields, 52)) {
5974 log_packet_detailed(" got field 'granary_food_inc'");
5975 #ifdef FREECIV_JSON_CONNECTION
5976 field_addr.name = "granary_food_inc";
5977 #endif /* FREECIV_JSON_CONNECTION */
5978 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_food_inc)) {
5979 RECEIVE_PACKET_FIELD_ERROR(granary_food_inc);
5980 }
5981 }
5982 if (BV_ISSET(fields, 53)) {
5983 log_packet_detailed(" got field 'granary_food_ini'");
5984 #ifdef FREECIV_JSON_CONNECTION
5985 field_addr.name = "granary_food_ini";
5986 #endif /* FREECIV_JSON_CONNECTION */
5987
5988 {
5989 int i;
5990
5991 #ifdef FREECIV_JSON_CONNECTION
5992 /* Enter array. */
5993 field_addr.sub_location = plocation_elem_new(0);
5994 #endif /* FREECIV_JSON_CONNECTION */
5995
5996 for (i = 0; i < MAX_GRANARY_INIS; i++) {
5997 #ifdef FREECIV_JSON_CONNECTION
5998 field_addr.sub_location->number = i;
5999 #endif /* FREECIV_JSON_CONNECTION */
6000 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_food_ini[i])) {
6001 RECEIVE_PACKET_FIELD_ERROR(granary_food_ini);
6002 }
6003 }
6004
6005 #ifdef FREECIV_JSON_CONNECTION
6006 /* Exit array. */
6007 free(field_addr.sub_location);
6008 field_addr.sub_location = NULL;
6009 #endif /* FREECIV_JSON_CONNECTION */
6010 }
6011 }
6012 if (BV_ISSET(fields, 54)) {
6013 log_packet_detailed(" got field 'granary_num_inis'");
6014 #ifdef FREECIV_JSON_CONNECTION
6015 field_addr.name = "granary_num_inis";
6016 #endif /* FREECIV_JSON_CONNECTION */
6017 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->granary_num_inis)) {
6018 RECEIVE_PACKET_FIELD_ERROR(granary_num_inis);
6019 }
6020 }
6021 if (BV_ISSET(fields, 55)) {
6022 log_packet_detailed(" got field 'great_wonder_owners'");
6023 #ifdef FREECIV_JSON_CONNECTION
6024 field_addr.name = "great_wonder_owners";
6025 #endif /* FREECIV_JSON_CONNECTION */
6026
6027 {
6028 #ifdef FREECIV_JSON_CONNECTION
6029 int count;
6030
6031 /* Enter array. */
6032 field_addr.sub_location = plocation_elem_new(0);
6033
6034 for (count = 0;; count++) {
6035 int i;
6036
6037 field_addr.sub_location->number = count;
6038
6039 /* Enter diff array element (start at the index address). */
6040 field_addr.sub_location->sub_location = plocation_elem_new(0);
6041 #else /* FREECIV_JSON_CONNECTION */
6042 while (TRUE) {
6043 int i;
6044 #endif /* FREECIV_JSON_CONNECTION */
6045
6046 if (!DIO_GET(uint8, &din, &field_addr, &i)) {
6047 RECEIVE_PACKET_FIELD_ERROR(great_wonder_owners);
6048 }
6049 if (i == 255) {
6050 #ifdef FREECIV_JSON_CONNECTION
6051 /* Exit diff array element. */
6052 free(field_addr.sub_location->sub_location);
6053 field_addr.sub_location->sub_location = NULL;
6054
6055 /* Exit diff array. */
6056 free(field_addr.sub_location);
6057 field_addr.sub_location = NULL;
6058 #endif /* FREECIV_JSON_CONNECTION */
6059
6060 break;
6061 }
6062 if (i > B_LAST) {
6063 RECEIVE_PACKET_FIELD_ERROR(great_wonder_owners,
6064 ": unexpected value %d "
6065 "(> B_LAST) in array diff",
6066 i);
6067 } else {
6068 #ifdef FREECIV_JSON_CONNECTION
6069 /* Content address. */
6070 field_addr.sub_location->sub_location->number = 1;
6071 #endif /* FREECIV_JSON_CONNECTION */
6072 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->great_wonder_owners[i])) {
6073 RECEIVE_PACKET_FIELD_ERROR(great_wonder_owners);
6074 }
6075 }
6076
6077 #ifdef FREECIV_JSON_CONNECTION
6078 /* Exit diff array element. */
6079 free(field_addr.sub_location->sub_location);
6080 field_addr.sub_location->sub_location = NULL;
6081 #endif /* FREECIV_JSON_CONNECTION */
6082 }
6083
6084 #ifdef FREECIV_JSON_CONNECTION
6085 /* Exit array. */
6086 free(field_addr.sub_location);
6087 field_addr.sub_location = NULL;
6088 #endif /* FREECIV_JSON_CONNECTION */
6089 }
6090 }
6091 if (BV_ISSET(fields, 56)) {
6092 log_packet_detailed(" got field 'happy_cost'");
6093 #ifdef FREECIV_JSON_CONNECTION
6094 field_addr.name = "happy_cost";
6095 #endif /* FREECIV_JSON_CONNECTION */
6096 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->happy_cost)) {
6097 RECEIVE_PACKET_FIELD_ERROR(happy_cost);
6098 }
6099 }
6100 if (BV_ISSET(fields, 57)) {
6101 log_packet_detailed(" got field 'happyborders'");
6102 #ifdef FREECIV_JSON_CONNECTION
6103 field_addr.name = "happyborders";
6104 #endif /* FREECIV_JSON_CONNECTION */
6105 {
6106 int readin;
6107
6108 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6109 RECEIVE_PACKET_FIELD_ERROR(happyborders);
6110 }
6111 real_packet->happyborders = readin;
6112 }
6113 }
6114 if (BV_ISSET(fields, 58)) {
6115 log_packet_detailed(" got field 'heating'");
6116 #ifdef FREECIV_JSON_CONNECTION
6117 field_addr.name = "heating";
6118 #endif /* FREECIV_JSON_CONNECTION */
6119 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->heating)) {
6120 RECEIVE_PACKET_FIELD_ERROR(heating);
6121 }
6122 }
6123 if (BV_ISSET(fields, 59)) {
6124 log_packet_detailed(" got field 'illness_base_factor'");
6125 #ifdef FREECIV_JSON_CONNECTION
6126 field_addr.name = "illness_base_factor";
6127 #endif /* FREECIV_JSON_CONNECTION */
6128 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_base_factor)) {
6129 RECEIVE_PACKET_FIELD_ERROR(illness_base_factor);
6130 }
6131 }
6132 if (BV_ISSET(fields, 60)) {
6133 log_packet_detailed(" got field 'illness_min_size'");
6134 #ifdef FREECIV_JSON_CONNECTION
6135 field_addr.name = "illness_min_size";
6136 #endif /* FREECIV_JSON_CONNECTION */
6137 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->illness_min_size)) {
6138 RECEIVE_PACKET_FIELD_ERROR(illness_min_size);
6139 }
6140 }
6141 real_packet->illness_on = BV_ISSET(fields, 61);
6142 if (BV_ISSET(fields, 62)) {
6143 log_packet_detailed(" got field 'illness_pollution_factor'");
6144 #ifdef FREECIV_JSON_CONNECTION
6145 field_addr.name = "illness_pollution_factor";
6146 #endif /* FREECIV_JSON_CONNECTION */
6147 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_pollution_factor)) {
6148 RECEIVE_PACKET_FIELD_ERROR(illness_pollution_factor);
6149 }
6150 }
6151 if (BV_ISSET(fields, 63)) {
6152 log_packet_detailed(" got field 'illness_trade_infection'");
6153 #ifdef FREECIV_JSON_CONNECTION
6154 field_addr.name = "illness_trade_infection";
6155 #endif /* FREECIV_JSON_CONNECTION */
6156 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade_infection)) {
6157 RECEIVE_PACKET_FIELD_ERROR(illness_trade_infection);
6158 }
6159 }
6160 if (BV_ISSET(fields, 64)) {
6161 log_packet_detailed(" got field 'init_city_radius_sq'");
6162 #ifdef FREECIV_JSON_CONNECTION
6163 field_addr.name = "init_city_radius_sq";
6164 #endif /* FREECIV_JSON_CONNECTION */
6165 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_city_radius_sq)) {
6166 RECEIVE_PACKET_FIELD_ERROR(init_city_radius_sq);
6167 }
6168 }
6169 real_packet->is_edit_mode = BV_ISSET(fields, 65);
6170 real_packet->is_new_game = BV_ISSET(fields, 66);
6171 real_packet->killcitizen = BV_ISSET(fields, 67);
6172 real_packet->killstack = BV_ISSET(fields, 68);
6173 real_packet->only_killing_makes_veteran = BV_ISSET(fields, 69);
6174 real_packet->only_real_fight_makes_veteran = BV_ISSET(fields, 70);
6175 real_packet->combat_odds_scaled_veterancy = BV_ISSET(fields, 71);
6176 real_packet->damage_reduces_bombard_rate = BV_ISSET(fields, 72);
6177 if (BV_ISSET(fields, 73)) {
6178 log_packet_detailed(" got field 'low_firepower_badwallattacker'");
6179 #ifdef FREECIV_JSON_CONNECTION
6180 field_addr.name = "low_firepower_badwallattacker";
6181 #endif /* FREECIV_JSON_CONNECTION */
6182 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_badwallattacker)) {
6183 RECEIVE_PACKET_FIELD_ERROR(low_firepower_badwallattacker);
6184 }
6185 }
6186 if (BV_ISSET(fields, 74)) {
6187 log_packet_detailed(" got field 'low_firepower_pearl_harbour'");
6188 #ifdef FREECIV_JSON_CONNECTION
6189 field_addr.name = "low_firepower_pearl_harbour";
6190 #endif /* FREECIV_JSON_CONNECTION */
6191 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_pearl_harbour)) {
6192 RECEIVE_PACKET_FIELD_ERROR(low_firepower_pearl_harbour);
6193 }
6194 }
6195 if (BV_ISSET(fields, 75)) {
6196 log_packet_detailed(" got field 'low_firepower_combat_bonus'");
6197 #ifdef FREECIV_JSON_CONNECTION
6198 field_addr.name = "low_firepower_combat_bonus";
6199 #endif /* FREECIV_JSON_CONNECTION */
6200 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_combat_bonus)) {
6201 RECEIVE_PACKET_FIELD_ERROR(low_firepower_combat_bonus);
6202 }
6203 }
6204 if (BV_ISSET(fields, 76)) {
6205 log_packet_detailed(" got field 'low_firepower_nonnat_bombard'");
6206 #ifdef FREECIV_JSON_CONNECTION
6207 field_addr.name = "low_firepower_nonnat_bombard";
6208 #endif /* FREECIV_JSON_CONNECTION */
6209 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_nonnat_bombard)) {
6210 RECEIVE_PACKET_FIELD_ERROR(low_firepower_nonnat_bombard);
6211 }
6212 }
6213 if (BV_ISSET(fields, 77)) {
6214 log_packet_detailed(" got field 'nuke_pop_loss_pct'");
6215 #ifdef FREECIV_JSON_CONNECTION
6216 field_addr.name = "nuke_pop_loss_pct";
6217 #endif /* FREECIV_JSON_CONNECTION */
6218 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nuke_pop_loss_pct)) {
6219 RECEIVE_PACKET_FIELD_ERROR(nuke_pop_loss_pct);
6220 }
6221 }
6222 if (BV_ISSET(fields, 78)) {
6223 log_packet_detailed(" got field 'nuke_defender_survival_chance_pct'");
6224 #ifdef FREECIV_JSON_CONNECTION
6225 field_addr.name = "nuke_defender_survival_chance_pct";
6226 #endif /* FREECIV_JSON_CONNECTION */
6227 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nuke_defender_survival_chance_pct)) {
6228 RECEIVE_PACKET_FIELD_ERROR(nuke_defender_survival_chance_pct);
6229 }
6230 }
6231 if (BV_ISSET(fields, 79)) {
6232 log_packet_detailed(" got field 'min_city_center_output'");
6233 #ifdef FREECIV_JSON_CONNECTION
6234 field_addr.name = "min_city_center_output";
6235 #endif /* FREECIV_JSON_CONNECTION */
6236
6237 {
6238 int i;
6239
6240 #ifdef FREECIV_JSON_CONNECTION
6241 /* Enter array. */
6242 field_addr.sub_location = plocation_elem_new(0);
6243 #endif /* FREECIV_JSON_CONNECTION */
6244
6245 for (i = 0; i < O_LAST; i++) {
6246 #ifdef FREECIV_JSON_CONNECTION
6247 field_addr.sub_location->number = i;
6248 #endif /* FREECIV_JSON_CONNECTION */
6249 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->min_city_center_output[i])) {
6250 RECEIVE_PACKET_FIELD_ERROR(min_city_center_output);
6251 }
6252 }
6253
6254 #ifdef FREECIV_JSON_CONNECTION
6255 /* Exit array. */
6256 free(field_addr.sub_location);
6257 field_addr.sub_location = NULL;
6258 #endif /* FREECIV_JSON_CONNECTION */
6259 }
6260 }
6261 real_packet->muuk_food_wipe = BV_ISSET(fields, 80);
6262 real_packet->muuk_gold_wipe = BV_ISSET(fields, 81);
6263 real_packet->muuk_shield_wipe = BV_ISSET(fields, 82);
6264 if (BV_ISSET(fields, 83)) {
6265 log_packet_detailed(" got field 'notradesize'");
6266 #ifdef FREECIV_JSON_CONNECTION
6267 field_addr.name = "notradesize";
6268 #endif /* FREECIV_JSON_CONNECTION */
6269 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->notradesize)) {
6270 RECEIVE_PACKET_FIELD_ERROR(notradesize);
6271 }
6272 }
6273 real_packet->nuclear_winter = BV_ISSET(fields, 84);
6274 if (BV_ISSET(fields, 85)) {
6275 log_packet_detailed(" got field 'nuclearwinter'");
6276 #ifdef FREECIV_JSON_CONNECTION
6277 field_addr.name = "nuclearwinter";
6278 #endif /* FREECIV_JSON_CONNECTION */
6279 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->nuclearwinter)) {
6280 RECEIVE_PACKET_FIELD_ERROR(nuclearwinter);
6281 }
6282 }
6283 if (BV_ISSET(fields, 86)) {
6284 log_packet_detailed(" got field 'phase'");
6285 #ifdef FREECIV_JSON_CONNECTION
6286 field_addr.name = "phase";
6287 #endif /* FREECIV_JSON_CONNECTION */
6288 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
6289 RECEIVE_PACKET_FIELD_ERROR(phase);
6290 }
6291 }
6292 if (BV_ISSET(fields, 87)) {
6293 log_packet_detailed(" got field 'phase_mode'");
6294 #ifdef FREECIV_JSON_CONNECTION
6295 field_addr.name = "phase_mode";
6296 #endif /* FREECIV_JSON_CONNECTION */
6297 {
6298 int readin;
6299
6300 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6301 RECEIVE_PACKET_FIELD_ERROR(phase_mode);
6302 }
6303 real_packet->phase_mode = readin;
6304 }
6305 }
6306 real_packet->pillage_select = BV_ISSET(fields, 88);
6307 real_packet->steal_maps_reveals_all_cities = BV_ISSET(fields, 89);
6308 real_packet->poison_empties_food_stock = BV_ISSET(fields, 90);
6309 real_packet->tech_steal_allow_holes = BV_ISSET(fields, 91);
6310 real_packet->tech_trade_allow_holes = BV_ISSET(fields, 92);
6311 real_packet->tech_trade_loss_allow_holes = BV_ISSET(fields, 93);
6312 real_packet->tech_parasite_allow_holes = BV_ISSET(fields, 94);
6313 real_packet->tech_loss_allow_holes = BV_ISSET(fields, 95);
6314 if (BV_ISSET(fields, 96)) {
6315 log_packet_detailed(" got field 'rapturedelay'");
6316 #ifdef FREECIV_JSON_CONNECTION
6317 field_addr.name = "rapturedelay";
6318 #endif /* FREECIV_JSON_CONNECTION */
6319 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rapturedelay)) {
6320 RECEIVE_PACKET_FIELD_ERROR(rapturedelay);
6321 }
6322 }
6323 if (BV_ISSET(fields, 97)) {
6324 log_packet_detailed(" got field 'disasters'");
6325 #ifdef FREECIV_JSON_CONNECTION
6326 field_addr.name = "disasters";
6327 #endif /* FREECIV_JSON_CONNECTION */
6328 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disasters)) {
6329 RECEIVE_PACKET_FIELD_ERROR(disasters);
6330 }
6331 }
6332 real_packet->restrictinfra = BV_ISSET(fields, 98);
6333 real_packet->unreachable_protects = BV_ISSET(fields, 99);
6334 if (BV_ISSET(fields, 100)) {
6335 log_packet_detailed(" got field 'sciencebox'");
6336 #ifdef FREECIV_JSON_CONNECTION
6337 field_addr.name = "sciencebox";
6338 #endif /* FREECIV_JSON_CONNECTION */
6339 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->sciencebox)) {
6340 RECEIVE_PACKET_FIELD_ERROR(sciencebox);
6341 }
6342 }
6343 if (BV_ISSET(fields, 101)) {
6344 log_packet_detailed(" got field 'shieldbox'");
6345 #ifdef FREECIV_JSON_CONNECTION
6346 field_addr.name = "shieldbox";
6347 #endif /* FREECIV_JSON_CONNECTION */
6348 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->shieldbox)) {
6349 RECEIVE_PACKET_FIELD_ERROR(shieldbox);
6350 }
6351 }
6352 if (BV_ISSET(fields, 102)) {
6353 log_packet_detailed(" got field 'skill_level'");
6354 #ifdef FREECIV_JSON_CONNECTION
6355 field_addr.name = "skill_level";
6356 #endif /* FREECIV_JSON_CONNECTION */
6357 {
6358 int readin;
6359
6360 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6361 RECEIVE_PACKET_FIELD_ERROR(skill_level);
6362 }
6363 real_packet->skill_level = readin;
6364 }
6365 }
6366 if (BV_ISSET(fields, 103)) {
6367 log_packet_detailed(" got field 'victory_conditions'");
6368 #ifdef FREECIV_JSON_CONNECTION
6369 field_addr.name = "victory_conditions";
6370 #endif /* FREECIV_JSON_CONNECTION */
6371 {
6372 int readin;
6373
6374 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6375 RECEIVE_PACKET_FIELD_ERROR(victory_conditions);
6376 }
6377 real_packet->victory_conditions = readin;
6378 }
6379 }
6380 real_packet->team_pooled_research = BV_ISSET(fields, 104);
6381 if (BV_ISSET(fields, 105)) {
6382 log_packet_detailed(" got field 'tech'");
6383 #ifdef FREECIV_JSON_CONNECTION
6384 field_addr.name = "tech";
6385 #endif /* FREECIV_JSON_CONNECTION */
6386 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->tech)) {
6387 RECEIVE_PACKET_FIELD_ERROR(tech);
6388 }
6389 }
6390 if (BV_ISSET(fields, 106)) {
6391 log_packet_detailed(" got field 'tech_cost_style'");
6392 #ifdef FREECIV_JSON_CONNECTION
6393 field_addr.name = "tech_cost_style";
6394 #endif /* FREECIV_JSON_CONNECTION */
6395 {
6396 int readin;
6397
6398 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6399 RECEIVE_PACKET_FIELD_ERROR(tech_cost_style);
6400 }
6401 real_packet->tech_cost_style = readin;
6402 }
6403 }
6404 if (BV_ISSET(fields, 107)) {
6405 log_packet_detailed(" got field 'tech_leakage'");
6406 #ifdef FREECIV_JSON_CONNECTION
6407 field_addr.name = "tech_leakage";
6408 #endif /* FREECIV_JSON_CONNECTION */
6409 {
6410 int readin;
6411
6412 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6413 RECEIVE_PACKET_FIELD_ERROR(tech_leakage);
6414 }
6415 real_packet->tech_leakage = readin;
6416 }
6417 }
6418 if (BV_ISSET(fields, 108)) {
6419 log_packet_detailed(" got field 'tech_upkeep_divider'");
6420 #ifdef FREECIV_JSON_CONNECTION
6421 field_addr.name = "tech_upkeep_divider";
6422 #endif /* FREECIV_JSON_CONNECTION */
6423 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_upkeep_divider)) {
6424 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep_divider);
6425 }
6426 }
6427 if (BV_ISSET(fields, 109)) {
6428 log_packet_detailed(" got field 'tech_upkeep_style'");
6429 #ifdef FREECIV_JSON_CONNECTION
6430 field_addr.name = "tech_upkeep_style";
6431 #endif /* FREECIV_JSON_CONNECTION */
6432 {
6433 int readin;
6434
6435 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6436 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep_style);
6437 }
6438 real_packet->tech_upkeep_style = readin;
6439 }
6440 }
6441 if (BV_ISSET(fields, 110)) {
6442 log_packet_detailed(" got field 'techloss_forgiveness'");
6443 #ifdef FREECIV_JSON_CONNECTION
6444 field_addr.name = "techloss_forgiveness";
6445 #endif /* FREECIV_JSON_CONNECTION */
6446 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->techloss_forgiveness)) {
6447 RECEIVE_PACKET_FIELD_ERROR(techloss_forgiveness);
6448 }
6449 }
6450 if (BV_ISSET(fields, 111)) {
6451 log_packet_detailed(" got field 'free_tech_method'");
6452 #ifdef FREECIV_JSON_CONNECTION
6453 field_addr.name = "free_tech_method";
6454 #endif /* FREECIV_JSON_CONNECTION */
6455 {
6456 int readin;
6457
6458 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6459 RECEIVE_PACKET_FIELD_ERROR(free_tech_method);
6460 }
6461 real_packet->free_tech_method = readin;
6462 }
6463 }
6464 if (BV_ISSET(fields, 112)) {
6465 log_packet_detailed(" got field 'gameloss_style'");
6466 #ifdef FREECIV_JSON_CONNECTION
6467 field_addr.name = "gameloss_style";
6468 #endif /* FREECIV_JSON_CONNECTION */
6469 {
6470 int readin;
6471
6472 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6473 RECEIVE_PACKET_FIELD_ERROR(gameloss_style);
6474 }
6475 real_packet->gameloss_style = readin;
6476 }
6477 }
6478 if (BV_ISSET(fields, 113)) {
6479 log_packet_detailed(" got field 'timeout'");
6480 #ifdef FREECIV_JSON_CONNECTION
6481 field_addr.name = "timeout";
6482 #endif /* FREECIV_JSON_CONNECTION */
6483 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->timeout)) {
6484 RECEIVE_PACKET_FIELD_ERROR(timeout);
6485 }
6486 }
6487 if (BV_ISSET(fields, 114)) {
6488 log_packet_detailed(" got field 'first_timeout'");
6489 #ifdef FREECIV_JSON_CONNECTION
6490 field_addr.name = "first_timeout";
6491 #endif /* FREECIV_JSON_CONNECTION */
6492 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->first_timeout)) {
6493 RECEIVE_PACKET_FIELD_ERROR(first_timeout);
6494 }
6495 }
6496 real_packet->tired_attack = BV_ISSET(fields, 115);
6497 if (BV_ISSET(fields, 116)) {
6498 log_packet_detailed(" got field 'trademindist'");
6499 #ifdef FREECIV_JSON_CONNECTION
6500 field_addr.name = "trademindist";
6501 #endif /* FREECIV_JSON_CONNECTION */
6502 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->trademindist)) {
6503 RECEIVE_PACKET_FIELD_ERROR(trademindist);
6504 }
6505 }
6506 if (BV_ISSET(fields, 117)) {
6507 log_packet_detailed(" got field 'trade_revenue_style'");
6508 #ifdef FREECIV_JSON_CONNECTION
6509 field_addr.name = "trade_revenue_style";
6510 #endif /* FREECIV_JSON_CONNECTION */
6511 {
6512 int readin;
6513
6514 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6515 RECEIVE_PACKET_FIELD_ERROR(trade_revenue_style);
6516 }
6517 real_packet->trade_revenue_style = readin;
6518 }
6519 }
6520 real_packet->trading_city = BV_ISSET(fields, 118);
6521 real_packet->trading_gold = BV_ISSET(fields, 119);
6522 real_packet->trading_tech = BV_ISSET(fields, 120);
6523 if (BV_ISSET(fields, 121)) {
6524 log_packet_detailed(" got field 'turn'");
6525 #ifdef FREECIV_JSON_CONNECTION
6526 field_addr.name = "turn";
6527 #endif /* FREECIV_JSON_CONNECTION */
6528 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
6529 RECEIVE_PACKET_FIELD_ERROR(turn);
6530 }
6531 }
6532 if (BV_ISSET(fields, 122)) {
6533 log_packet_detailed(" got field 'warminglevel'");
6534 #ifdef FREECIV_JSON_CONNECTION
6535 field_addr.name = "warminglevel";
6536 #endif /* FREECIV_JSON_CONNECTION */
6537 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->warminglevel)) {
6538 RECEIVE_PACKET_FIELD_ERROR(warminglevel);
6539 }
6540 }
6541 if (BV_ISSET(fields, 123)) {
6542 log_packet_detailed(" got field 'year'");
6543 #ifdef FREECIV_JSON_CONNECTION
6544 field_addr.name = "year";
6545 #endif /* FREECIV_JSON_CONNECTION */
6546 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->year)) {
6547 RECEIVE_PACKET_FIELD_ERROR(year);
6548 }
6549 }
6550 real_packet->year_0_hack = BV_ISSET(fields, 124);
6551 if (BV_ISSET(fields, 125)) {
6552 log_packet_detailed(" got field 'fragment_count'");
6553 #ifdef FREECIV_JSON_CONNECTION
6554 field_addr.name = "fragment_count";
6555 #endif /* FREECIV_JSON_CONNECTION */
6556 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->fragment_count)) {
6557 RECEIVE_PACKET_FIELD_ERROR(fragment_count);
6558 }
6559 }
6560 real_packet->civil_war_enabled = BV_ISSET(fields, 126);
6561 if (BV_ISSET(fields, 127)) {
6562 log_packet_detailed(" got field 'civil_war_bonus_celebrating'");
6563 #ifdef FREECIV_JSON_CONNECTION
6564 field_addr.name = "civil_war_bonus_celebrating";
6565 #endif /* FREECIV_JSON_CONNECTION */
6566 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->civil_war_bonus_celebrating)) {
6567 RECEIVE_PACKET_FIELD_ERROR(civil_war_bonus_celebrating);
6568 }
6569 }
6570 if (BV_ISSET(fields, 128)) {
6571 log_packet_detailed(" got field 'civil_war_bonus_unhappy'");
6572 #ifdef FREECIV_JSON_CONNECTION
6573 field_addr.name = "civil_war_bonus_unhappy";
6574 #endif /* FREECIV_JSON_CONNECTION */
6575 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->civil_war_bonus_unhappy)) {
6576 RECEIVE_PACKET_FIELD_ERROR(civil_war_bonus_unhappy);
6577 }
6578 }
6579 if (BV_ISSET(fields, 129)) {
6580 log_packet_detailed(" got field 'granularity'");
6581 #ifdef FREECIV_JSON_CONNECTION
6582 field_addr.name = "granularity";
6583 #endif /* FREECIV_JSON_CONNECTION */
6584 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granularity)) {
6585 RECEIVE_PACKET_FIELD_ERROR(granularity);
6586 }
6587 }
6588 if (BV_ISSET(fields, 130)) {
6589 log_packet_detailed(" got field 'small_wonder_visibility'");
6590 #ifdef FREECIV_JSON_CONNECTION
6591 field_addr.name = "small_wonder_visibility";
6592 #endif /* FREECIV_JSON_CONNECTION */
6593 {
6594 int readin;
6595
6596 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6597 RECEIVE_PACKET_FIELD_ERROR(small_wonder_visibility);
6598 }
6599 real_packet->small_wonder_visibility = readin;
6600 }
6601 }
6602
6603 if (NULL == old) {
6604 old = fc_malloc(sizeof(*old));
6605 *old = *real_packet;
6606 genhash_insert(*hash, old, old);
6607 } else {
6608 *old = *real_packet;
6609 }
6610
6611#endif /* FREECIV_DELTA_PROTOCOL */
6612 RECEIVE_PACKET_END(real_packet);
6613}
6614
6615 static int send_packet_game_info_100(struct connection *pc, const struct packet_game_info *packet)
6616{
6617 const struct packet_game_info *real_packet = packet;
6618#ifdef FREECIV_DELTA_PROTOCOL
6619 packet_game_info_100_fields fields;
6620 struct packet_game_info *old;
6621 bool differ;
6622 struct genhash **hash = pc->phs.sent + PACKET_GAME_INFO;
6623 int different = 0;
6624#endif /* FREECIV_DELTA_PROTOCOL */
6625 SEND_PACKET_START(PACKET_GAME_INFO);
6626#ifdef FREECIV_JSON_CONNECTION
6627 struct plocation field_addr;
6628 {
6629 struct plocation *field_addr_tmp = plocation_field_new(NULL);
6630 field_addr = *field_addr_tmp;
6631 FC_FREE(field_addr_tmp);
6632 }
6633#endif /* FREECIV_JSON_CONNECTION */
6634
6635 log_packet_detailed("packet_game_info_100: sending info about ()");
6636
6637#ifdef FREECIV_DELTA_PROTOCOL
6638 if (NULL == *hash) {
6639 *hash = genhash_new_full(hash_packet_game_info_100, cmp_packet_game_info_100,
6640 NULL, NULL, NULL, free);
6641 }
6642 BV_CLR_ALL(fields);
6643
6644 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
6645 old = fc_malloc(sizeof(*old));
6646 *old = *real_packet;
6647 genhash_insert(*hash, old, old);
6648 memset(old, 0, sizeof(*old));
6649 different = 1; /* Force to send. */
6650 }
6651 differ = (old->add_to_size_limit != real_packet->add_to_size_limit);
6652 if (differ) {
6653 different++;
6654 BV_SET(fields, 0);
6655 }
6656
6657 differ = (old->aifill != real_packet->aifill);
6658 if (differ) {
6659 different++;
6660 BV_SET(fields, 1);
6661 }
6662
6663 differ = (old->persistent_ready != real_packet->persistent_ready);
6664 if (differ) {
6665 different++;
6666 BV_SET(fields, 2);
6667 }
6668
6669 differ = (old->airlifting_style != real_packet->airlifting_style);
6670 if (differ) {
6671 different++;
6672 BV_SET(fields, 3);
6673 }
6674
6675 differ = (old->airlift_from_always_enabled != real_packet->airlift_from_always_enabled);
6676 if (differ) {
6677 different++;
6678 }
6679 if (packet->airlift_from_always_enabled) {
6680 BV_SET(fields, 4);
6681 }
6682
6683 differ = (old->airlift_to_always_enabled != real_packet->airlift_to_always_enabled);
6684 if (differ) {
6685 different++;
6686 }
6687 if (packet->airlift_to_always_enabled) {
6688 BV_SET(fields, 5);
6689 }
6690
6691 differ = (old->angrycitizen != real_packet->angrycitizen);
6692 if (differ) {
6693 different++;
6694 BV_SET(fields, 6);
6695 }
6696
6697 differ = (old->base_pollution != real_packet->base_pollution);
6698 if (differ) {
6699 different++;
6700 BV_SET(fields, 7);
6701 }
6702
6703 differ = (old->base_tech_cost != real_packet->base_tech_cost);
6704 if (differ) {
6705 different++;
6706 BV_SET(fields, 8);
6707 }
6708
6709 differ = (old->tech_leak_pct != real_packet->tech_leak_pct);
6710 if (differ) {
6711 different++;
6712 BV_SET(fields, 9);
6713 }
6714
6715 differ = (old->border_city_radius_sq != real_packet->border_city_radius_sq);
6716 if (differ) {
6717 different++;
6718 BV_SET(fields, 10);
6719 }
6720
6721 differ = (old->border_size_effect != real_packet->border_size_effect);
6722 if (differ) {
6723 different++;
6724 BV_SET(fields, 11);
6725 }
6726
6727 differ = (old->border_city_permanent_radius_sq != real_packet->border_city_permanent_radius_sq);
6728 if (differ) {
6729 different++;
6730 BV_SET(fields, 12);
6731 }
6732
6733 differ = (old->borders != real_packet->borders);
6734 if (differ) {
6735 different++;
6736 BV_SET(fields, 13);
6737 }
6738
6739 differ = (old->base_bribe_cost != real_packet->base_bribe_cost);
6740 if (differ) {
6741 different++;
6742 BV_SET(fields, 14);
6743 }
6744
6745 differ = (old->caravan_bonus_style != real_packet->caravan_bonus_style);
6746 if (differ) {
6747 different++;
6748 BV_SET(fields, 15);
6749 }
6750
6751 differ = (old->culture_vic_points != real_packet->culture_vic_points);
6752 if (differ) {
6753 different++;
6754 BV_SET(fields, 16);
6755 }
6756
6757 differ = (old->culture_vic_lead != real_packet->culture_vic_lead);
6758 if (differ) {
6759 different++;
6760 BV_SET(fields, 17);
6761 }
6762
6763 differ = (old->culture_migration_pml != real_packet->culture_migration_pml);
6764 if (differ) {
6765 different++;
6766 BV_SET(fields, 18);
6767 }
6768
6769 differ = (old->history_interest_pml != real_packet->history_interest_pml);
6770 if (differ) {
6771 different++;
6772 BV_SET(fields, 19);
6773 }
6774
6775 differ = (old->celebratesize != real_packet->celebratesize);
6776 if (differ) {
6777 different++;
6778 BV_SET(fields, 20);
6779 }
6780
6781 differ = (old->changable_tax != real_packet->changable_tax);
6782 if (differ) {
6783 different++;
6784 }
6785 if (packet->changable_tax) {
6786 BV_SET(fields, 21);
6787 }
6788
6789 differ = (old->pop_report_zeroes != real_packet->pop_report_zeroes);
6790 if (differ) {
6791 different++;
6792 BV_SET(fields, 22);
6793 }
6794
6795 differ = (old->citizen_nationality != real_packet->citizen_nationality);
6796 if (differ) {
6797 different++;
6798 }
6799 if (packet->citizen_nationality) {
6800 BV_SET(fields, 23);
6801 }
6802
6803 differ = (old->citizen_convert_speed != real_packet->citizen_convert_speed);
6804 if (differ) {
6805 different++;
6806 BV_SET(fields, 24);
6807 }
6808
6809 differ = (old->conquest_convert_pct != real_packet->conquest_convert_pct);
6810 if (differ) {
6811 different++;
6812 BV_SET(fields, 25);
6813 }
6814
6815 differ = (old->citizen_partisans_pct != real_packet->citizen_partisans_pct);
6816 if (differ) {
6817 different++;
6818 BV_SET(fields, 26);
6819 }
6820
6821 differ = (old->citymindist != real_packet->citymindist);
6822 if (differ) {
6823 different++;
6824 BV_SET(fields, 27);
6825 }
6826
6827 differ = (old->cooling != real_packet->cooling);
6828 if (differ) {
6829 different++;
6830 BV_SET(fields, 28);
6831 }
6832
6833 differ = (old->coolinglevel != real_packet->coolinglevel);
6834 if (differ) {
6835 different++;
6836 BV_SET(fields, 29);
6837 }
6838
6839 differ = !BV_ARE_EQUAL(old->diplchance_initial_odds, real_packet->diplchance_initial_odds);
6840 if (differ) {
6841 different++;
6842 BV_SET(fields, 30);
6843 }
6844
6845 differ = (old->diplomacy != real_packet->diplomacy);
6846 if (differ) {
6847 different++;
6848 BV_SET(fields, 31);
6849 }
6850
6851 differ = (old->fogofwar != real_packet->fogofwar);
6852 if (differ) {
6853 different++;
6854 }
6855 if (packet->fogofwar) {
6856 BV_SET(fields, 32);
6857 }
6858
6859 differ = (old->food_cost != real_packet->food_cost);
6860 if (differ) {
6861 different++;
6862 BV_SET(fields, 33);
6863 }
6864
6865 differ = (old->foodbox != real_packet->foodbox);
6866 if (differ) {
6867 different++;
6868 BV_SET(fields, 34);
6869 }
6870
6871 differ = (old->forced_gold != real_packet->forced_gold);
6872 if (differ) {
6873 different++;
6874 BV_SET(fields, 35);
6875 }
6876
6877 differ = (old->forced_luxury != real_packet->forced_luxury);
6878 if (differ) {
6879 different++;
6880 BV_SET(fields, 36);
6881 }
6882
6883 differ = (old->forced_science != real_packet->forced_science);
6884 if (differ) {
6885 different++;
6886 BV_SET(fields, 37);
6887 }
6888
6889 differ = (old->fulltradesize != real_packet->fulltradesize);
6890 if (differ) {
6891 different++;
6892 BV_SET(fields, 38);
6893 }
6894
6895 differ = (old->trade_world_rel_pct != real_packet->trade_world_rel_pct);
6896 if (differ) {
6897 different++;
6898 BV_SET(fields, 39);
6899 }
6900
6901 differ = (old->min_trade_route_val != real_packet->min_trade_route_val);
6902 if (differ) {
6903 different++;
6904 BV_SET(fields, 40);
6905 }
6906
6907 differ = (old->goods_selection != real_packet->goods_selection);
6908 if (differ) {
6909 different++;
6910 BV_SET(fields, 41);
6911 }
6912
6913 differ = (old->global_advance_count != real_packet->global_advance_count);
6914 if (differ) {
6915 different++;
6916 BV_SET(fields, 42);
6917 }
6918
6919
6920 {
6921 differ = FALSE;
6922 {
6923 int i;
6924
6925 for (i = 0; i < A_LAST; i++) {
6926 if (old->global_advances[i] != real_packet->global_advances[i]) {
6927 differ = TRUE;
6928 break;
6929 }
6930 }
6931 }
6932 }
6933 if (differ) {
6934 different++;
6935 BV_SET(fields, 43);
6936 }
6937
6938 differ = (old->global_warming != real_packet->global_warming);
6939 if (differ) {
6940 different++;
6941 }
6942 if (packet->global_warming) {
6943 BV_SET(fields, 44);
6944 }
6945
6946 differ = (old->globalwarming != real_packet->globalwarming);
6947 if (differ) {
6948 different++;
6949 BV_SET(fields, 45);
6950 }
6951
6952 differ = (old->gold != real_packet->gold);
6953 if (differ) {
6954 different++;
6955 BV_SET(fields, 46);
6956 }
6957
6958 differ = (old->gold_upkeep_style != real_packet->gold_upkeep_style);
6959 if (differ) {
6960 different++;
6961 BV_SET(fields, 47);
6962 }
6963
6964 differ = (old->infrapoints != real_packet->infrapoints);
6965 if (differ) {
6966 different++;
6967 BV_SET(fields, 48);
6968 }
6969
6970 differ = (old->revolentype != real_packet->revolentype);
6971 if (differ) {
6972 different++;
6973 BV_SET(fields, 49);
6974 }
6975
6976 differ = (old->default_government_id != real_packet->default_government_id);
6977 if (differ) {
6978 different++;
6979 BV_SET(fields, 50);
6980 }
6981
6982 differ = (old->government_during_revolution_id != real_packet->government_during_revolution_id);
6983 if (differ) {
6984 different++;
6985 BV_SET(fields, 51);
6986 }
6987
6988 differ = (old->granary_food_inc != real_packet->granary_food_inc);
6989 if (differ) {
6990 different++;
6991 BV_SET(fields, 52);
6992 }
6993
6994
6995 {
6996 differ = FALSE;
6997 {
6998 int i;
6999
7000 for (i = 0; i < MAX_GRANARY_INIS; i++) {
7001 if (old->granary_food_ini[i] != real_packet->granary_food_ini[i]) {
7002 differ = TRUE;
7003 break;
7004 }
7005 }
7006 }
7007 }
7008 if (differ) {
7009 different++;
7010 BV_SET(fields, 53);
7011 }
7012
7013 differ = (old->granary_num_inis != real_packet->granary_num_inis);
7014 if (differ) {
7015 different++;
7016 BV_SET(fields, 54);
7017 }
7018
7019
7020 {
7021 differ = FALSE;
7022 {
7023 int i;
7024
7025 for (i = 0; i < B_LAST; i++) {
7026 if (old->great_wonder_owners[i] != real_packet->great_wonder_owners[i]) {
7027 differ = TRUE;
7028 break;
7029 }
7030 }
7031 }
7032 }
7033 if (differ) {
7034 different++;
7035 BV_SET(fields, 55);
7036 }
7037
7038 differ = (old->happy_cost != real_packet->happy_cost);
7039 if (differ) {
7040 different++;
7041 BV_SET(fields, 56);
7042 }
7043
7044 differ = (old->happyborders != real_packet->happyborders);
7045 if (differ) {
7046 different++;
7047 BV_SET(fields, 57);
7048 }
7049
7050 differ = (old->heating != real_packet->heating);
7051 if (differ) {
7052 different++;
7053 BV_SET(fields, 58);
7054 }
7055
7056 differ = (old->illness_base_factor != real_packet->illness_base_factor);
7057 if (differ) {
7058 different++;
7059 BV_SET(fields, 59);
7060 }
7061
7062 differ = (old->illness_min_size != real_packet->illness_min_size);
7063 if (differ) {
7064 different++;
7065 BV_SET(fields, 60);
7066 }
7067
7068 differ = (old->illness_on != real_packet->illness_on);
7069 if (differ) {
7070 different++;
7071 }
7072 if (packet->illness_on) {
7073 BV_SET(fields, 61);
7074 }
7075
7076 differ = (old->illness_pollution_factor != real_packet->illness_pollution_factor);
7077 if (differ) {
7078 different++;
7079 BV_SET(fields, 62);
7080 }
7081
7082 differ = (old->illness_trade_infection != real_packet->illness_trade_infection);
7083 if (differ) {
7084 different++;
7085 BV_SET(fields, 63);
7086 }
7087
7088 differ = (old->init_city_radius_sq != real_packet->init_city_radius_sq);
7089 if (differ) {
7090 different++;
7091 BV_SET(fields, 64);
7092 }
7093
7094 differ = (old->is_edit_mode != real_packet->is_edit_mode);
7095 if (differ) {
7096 different++;
7097 }
7098 if (packet->is_edit_mode) {
7099 BV_SET(fields, 65);
7100 }
7101
7102 differ = (old->is_new_game != real_packet->is_new_game);
7103 if (differ) {
7104 different++;
7105 }
7106 if (packet->is_new_game) {
7107 BV_SET(fields, 66);
7108 }
7109
7110 differ = (old->killcitizen != real_packet->killcitizen);
7111 if (differ) {
7112 different++;
7113 }
7114 if (packet->killcitizen) {
7115 BV_SET(fields, 67);
7116 }
7117
7118 differ = (old->killstack != real_packet->killstack);
7119 if (differ) {
7120 different++;
7121 }
7122 if (packet->killstack) {
7123 BV_SET(fields, 68);
7124 }
7125
7126 differ = (old->only_killing_makes_veteran != real_packet->only_killing_makes_veteran);
7127 if (differ) {
7128 different++;
7129 }
7130 if (packet->only_killing_makes_veteran) {
7131 BV_SET(fields, 69);
7132 }
7133
7134 differ = (old->only_real_fight_makes_veteran != real_packet->only_real_fight_makes_veteran);
7135 if (differ) {
7136 different++;
7137 }
7138 if (packet->only_real_fight_makes_veteran) {
7139 BV_SET(fields, 70);
7140 }
7141
7142 differ = (old->combat_odds_scaled_veterancy != real_packet->combat_odds_scaled_veterancy);
7143 if (differ) {
7144 different++;
7145 }
7146 if (packet->combat_odds_scaled_veterancy) {
7147 BV_SET(fields, 71);
7148 }
7149
7150 differ = (old->damage_reduces_bombard_rate != real_packet->damage_reduces_bombard_rate);
7151 if (differ) {
7152 different++;
7153 }
7154 if (packet->damage_reduces_bombard_rate) {
7155 BV_SET(fields, 72);
7156 }
7157
7158 differ = (old->low_firepower_badwallattacker != real_packet->low_firepower_badwallattacker);
7159 if (differ) {
7160 different++;
7161 BV_SET(fields, 73);
7162 }
7163
7164 differ = (old->low_firepower_pearl_harbour != real_packet->low_firepower_pearl_harbour);
7165 if (differ) {
7166 different++;
7167 BV_SET(fields, 74);
7168 }
7169
7170 differ = (old->low_firepower_combat_bonus != real_packet->low_firepower_combat_bonus);
7171 if (differ) {
7172 different++;
7173 BV_SET(fields, 75);
7174 }
7175
7176 differ = (old->low_firepower_nonnat_bombard != real_packet->low_firepower_nonnat_bombard);
7177 if (differ) {
7178 different++;
7179 BV_SET(fields, 76);
7180 }
7181
7182 differ = (old->nuke_pop_loss_pct != real_packet->nuke_pop_loss_pct);
7183 if (differ) {
7184 different++;
7185 BV_SET(fields, 77);
7186 }
7187
7188 differ = (old->nuke_defender_survival_chance_pct != real_packet->nuke_defender_survival_chance_pct);
7189 if (differ) {
7190 different++;
7191 BV_SET(fields, 78);
7192 }
7193
7194
7195 {
7196 differ = FALSE;
7197 {
7198 int i;
7199
7200 for (i = 0; i < O_LAST; i++) {
7201 if (old->min_city_center_output[i] != real_packet->min_city_center_output[i]) {
7202 differ = TRUE;
7203 break;
7204 }
7205 }
7206 }
7207 }
7208 if (differ) {
7209 different++;
7210 BV_SET(fields, 79);
7211 }
7212
7213 differ = (old->muuk_food_wipe != real_packet->muuk_food_wipe);
7214 if (differ) {
7215 different++;
7216 }
7217 if (packet->muuk_food_wipe) {
7218 BV_SET(fields, 80);
7219 }
7220
7221 differ = (old->muuk_gold_wipe != real_packet->muuk_gold_wipe);
7222 if (differ) {
7223 different++;
7224 }
7225 if (packet->muuk_gold_wipe) {
7226 BV_SET(fields, 81);
7227 }
7228
7229 differ = (old->muuk_shield_wipe != real_packet->muuk_shield_wipe);
7230 if (differ) {
7231 different++;
7232 }
7233 if (packet->muuk_shield_wipe) {
7234 BV_SET(fields, 82);
7235 }
7236
7237 differ = (old->notradesize != real_packet->notradesize);
7238 if (differ) {
7239 different++;
7240 BV_SET(fields, 83);
7241 }
7242
7243 differ = (old->nuclear_winter != real_packet->nuclear_winter);
7244 if (differ) {
7245 different++;
7246 }
7247 if (packet->nuclear_winter) {
7248 BV_SET(fields, 84);
7249 }
7250
7251 differ = (old->nuclearwinter != real_packet->nuclearwinter);
7252 if (differ) {
7253 different++;
7254 BV_SET(fields, 85);
7255 }
7256
7257 differ = (old->phase != real_packet->phase);
7258 if (differ) {
7259 different++;
7260 BV_SET(fields, 86);
7261 }
7262
7263 differ = (old->phase_mode != real_packet->phase_mode);
7264 if (differ) {
7265 different++;
7266 BV_SET(fields, 87);
7267 }
7268
7269 differ = (old->pillage_select != real_packet->pillage_select);
7270 if (differ) {
7271 different++;
7272 }
7273 if (packet->pillage_select) {
7274 BV_SET(fields, 88);
7275 }
7276
7277 differ = (old->steal_maps_reveals_all_cities != real_packet->steal_maps_reveals_all_cities);
7278 if (differ) {
7279 different++;
7280 }
7281 if (packet->steal_maps_reveals_all_cities) {
7282 BV_SET(fields, 89);
7283 }
7284
7285 differ = (old->poison_empties_food_stock != real_packet->poison_empties_food_stock);
7286 if (differ) {
7287 different++;
7288 }
7289 if (packet->poison_empties_food_stock) {
7290 BV_SET(fields, 90);
7291 }
7292
7293 differ = (old->tech_steal_allow_holes != real_packet->tech_steal_allow_holes);
7294 if (differ) {
7295 different++;
7296 }
7297 if (packet->tech_steal_allow_holes) {
7298 BV_SET(fields, 91);
7299 }
7300
7301 differ = (old->tech_trade_allow_holes != real_packet->tech_trade_allow_holes);
7302 if (differ) {
7303 different++;
7304 }
7305 if (packet->tech_trade_allow_holes) {
7306 BV_SET(fields, 92);
7307 }
7308
7309 differ = (old->tech_trade_loss_allow_holes != real_packet->tech_trade_loss_allow_holes);
7310 if (differ) {
7311 different++;
7312 }
7313 if (packet->tech_trade_loss_allow_holes) {
7314 BV_SET(fields, 93);
7315 }
7316
7317 differ = (old->tech_parasite_allow_holes != real_packet->tech_parasite_allow_holes);
7318 if (differ) {
7319 different++;
7320 }
7321 if (packet->tech_parasite_allow_holes) {
7322 BV_SET(fields, 94);
7323 }
7324
7325 differ = (old->tech_loss_allow_holes != real_packet->tech_loss_allow_holes);
7326 if (differ) {
7327 different++;
7328 }
7329 if (packet->tech_loss_allow_holes) {
7330 BV_SET(fields, 95);
7331 }
7332
7333 differ = (old->rapturedelay != real_packet->rapturedelay);
7334 if (differ) {
7335 different++;
7336 BV_SET(fields, 96);
7337 }
7338
7339 differ = (old->disasters != real_packet->disasters);
7340 if (differ) {
7341 different++;
7342 BV_SET(fields, 97);
7343 }
7344
7345 differ = (old->restrictinfra != real_packet->restrictinfra);
7346 if (differ) {
7347 different++;
7348 }
7349 if (packet->restrictinfra) {
7350 BV_SET(fields, 98);
7351 }
7352
7353 differ = (old->unreachable_protects != real_packet->unreachable_protects);
7354 if (differ) {
7355 different++;
7356 }
7357 if (packet->unreachable_protects) {
7358 BV_SET(fields, 99);
7359 }
7360
7361 differ = (old->sciencebox != real_packet->sciencebox);
7362 if (differ) {
7363 different++;
7364 BV_SET(fields, 100);
7365 }
7366
7367 differ = (old->shieldbox != real_packet->shieldbox);
7368 if (differ) {
7369 different++;
7370 BV_SET(fields, 101);
7371 }
7372
7373 differ = (old->skill_level != real_packet->skill_level);
7374 if (differ) {
7375 different++;
7376 BV_SET(fields, 102);
7377 }
7378
7379 differ = (old->victory_conditions != real_packet->victory_conditions);
7380 if (differ) {
7381 different++;
7382 BV_SET(fields, 103);
7383 }
7384
7385 differ = (old->team_pooled_research != real_packet->team_pooled_research);
7386 if (differ) {
7387 different++;
7388 }
7389 if (packet->team_pooled_research) {
7390 BV_SET(fields, 104);
7391 }
7392
7393 differ = (old->tech != real_packet->tech);
7394 if (differ) {
7395 different++;
7396 BV_SET(fields, 105);
7397 }
7398
7399 differ = (old->tech_cost_style != real_packet->tech_cost_style);
7400 if (differ) {
7401 different++;
7402 BV_SET(fields, 106);
7403 }
7404
7405 differ = (old->tech_leakage != real_packet->tech_leakage);
7406 if (differ) {
7407 different++;
7408 BV_SET(fields, 107);
7409 }
7410
7411 differ = (old->tech_upkeep_divider != real_packet->tech_upkeep_divider);
7412 if (differ) {
7413 different++;
7414 BV_SET(fields, 108);
7415 }
7416
7417 differ = (old->tech_upkeep_style != real_packet->tech_upkeep_style);
7418 if (differ) {
7419 different++;
7420 BV_SET(fields, 109);
7421 }
7422
7423 differ = (old->techloss_forgiveness != real_packet->techloss_forgiveness);
7424 if (differ) {
7425 different++;
7426 BV_SET(fields, 110);
7427 }
7428
7429 differ = (old->free_tech_method != real_packet->free_tech_method);
7430 if (differ) {
7431 different++;
7432 BV_SET(fields, 111);
7433 }
7434
7435 differ = (old->gameloss_style != real_packet->gameloss_style);
7436 if (differ) {
7437 different++;
7438 BV_SET(fields, 112);
7439 }
7440
7441 differ = (old->timeout != real_packet->timeout);
7442 if (differ) {
7443 different++;
7444 BV_SET(fields, 113);
7445 }
7446
7447 differ = (old->first_timeout != real_packet->first_timeout);
7448 if (differ) {
7449 different++;
7450 BV_SET(fields, 114);
7451 }
7452
7453 differ = (old->tired_attack != real_packet->tired_attack);
7454 if (differ) {
7455 different++;
7456 }
7457 if (packet->tired_attack) {
7458 BV_SET(fields, 115);
7459 }
7460
7461 differ = (old->trademindist != real_packet->trademindist);
7462 if (differ) {
7463 different++;
7464 BV_SET(fields, 116);
7465 }
7466
7467 differ = (old->trade_revenue_style != real_packet->trade_revenue_style);
7468 if (differ) {
7469 different++;
7470 BV_SET(fields, 117);
7471 }
7472
7473 differ = (old->trading_city != real_packet->trading_city);
7474 if (differ) {
7475 different++;
7476 }
7477 if (packet->trading_city) {
7478 BV_SET(fields, 118);
7479 }
7480
7481 differ = (old->trading_gold != real_packet->trading_gold);
7482 if (differ) {
7483 different++;
7484 }
7485 if (packet->trading_gold) {
7486 BV_SET(fields, 119);
7487 }
7488
7489 differ = (old->trading_tech != real_packet->trading_tech);
7490 if (differ) {
7491 different++;
7492 }
7493 if (packet->trading_tech) {
7494 BV_SET(fields, 120);
7495 }
7496
7497 differ = (old->turn != real_packet->turn);
7498 if (differ) {
7499 different++;
7500 BV_SET(fields, 121);
7501 }
7502
7503 differ = (old->warminglevel != real_packet->warminglevel);
7504 if (differ) {
7505 different++;
7506 BV_SET(fields, 122);
7507 }
7508
7509 differ = (old->year != real_packet->year);
7510 if (differ) {
7511 different++;
7512 BV_SET(fields, 123);
7513 }
7514
7515 differ = (old->year_0_hack != real_packet->year_0_hack);
7516 if (differ) {
7517 different++;
7518 }
7519 if (packet->year_0_hack) {
7520 BV_SET(fields, 124);
7521 }
7522
7523 differ = (old->fragment_count != real_packet->fragment_count);
7524 if (differ) {
7525 different++;
7526 BV_SET(fields, 125);
7527 }
7528
7529 differ = (old->civil_war_enabled != real_packet->civil_war_enabled);
7530 if (differ) {
7531 different++;
7532 }
7533 if (packet->civil_war_enabled) {
7534 BV_SET(fields, 126);
7535 }
7536
7537 differ = (old->civil_war_bonus_celebrating != real_packet->civil_war_bonus_celebrating);
7538 if (differ) {
7539 different++;
7540 BV_SET(fields, 127);
7541 }
7542
7543 differ = (old->civil_war_bonus_unhappy != real_packet->civil_war_bonus_unhappy);
7544 if (differ) {
7545 different++;
7546 BV_SET(fields, 128);
7547 }
7548
7549 differ = (old->granularity != real_packet->granularity);
7550 if (differ) {
7551 different++;
7552 BV_SET(fields, 129);
7553 }
7554
7555 differ = (old->small_wonder_visibility != real_packet->small_wonder_visibility);
7556 if (differ) {
7557 different++;
7558 BV_SET(fields, 130);
7559 }
7560
7561
7562 if (different == 0) {
7563 log_packet_detailed(" no change -> discard");
7564 return 0;
7565 }
7566
7567#ifdef FREECIV_JSON_CONNECTION
7568 field_addr.name = "fields";
7569#endif /* FREECIV_JSON_CONNECTION */
7570 DIO_BV_PUT(&dout, &field_addr, fields);
7571
7572 if (BV_ISSET(fields, 0)) {
7573 log_packet_detailed(" field 'add_to_size_limit' has changed");
7574 #ifdef FREECIV_JSON_CONNECTION
7575 field_addr.name = "add_to_size_limit";
7576#endif /* FREECIV_JSON_CONNECTION */
7577 DIO_PUT(uint8, &dout, &field_addr, real_packet->add_to_size_limit);
7578 }
7579 if (BV_ISSET(fields, 1)) {
7580 log_packet_detailed(" field 'aifill' has changed");
7581 #ifdef FREECIV_JSON_CONNECTION
7582 field_addr.name = "aifill";
7583#endif /* FREECIV_JSON_CONNECTION */
7584 DIO_PUT(uint16, &dout, &field_addr, real_packet->aifill);
7585 }
7586 if (BV_ISSET(fields, 2)) {
7587 log_packet_detailed(" field 'persistent_ready' has changed");
7588 #ifdef FREECIV_JSON_CONNECTION
7589 field_addr.name = "persistent_ready";
7590#endif /* FREECIV_JSON_CONNECTION */
7591 DIO_PUT(uint8, &dout, &field_addr, real_packet->persistent_ready);
7592 }
7593 if (BV_ISSET(fields, 3)) {
7594 log_packet_detailed(" field 'airlifting_style' has changed");
7595 #ifdef FREECIV_JSON_CONNECTION
7596 field_addr.name = "airlifting_style";
7597#endif /* FREECIV_JSON_CONNECTION */
7598 DIO_PUT(uint8, &dout, &field_addr, real_packet->airlifting_style);
7599 }
7600 /* field 4 is folded into the header */
7601 /* field 5 is folded into the header */
7602 if (BV_ISSET(fields, 6)) {
7603 log_packet_detailed(" field 'angrycitizen' has changed");
7604 #ifdef FREECIV_JSON_CONNECTION
7605 field_addr.name = "angrycitizen";
7606#endif /* FREECIV_JSON_CONNECTION */
7607 DIO_PUT(uint8, &dout, &field_addr, real_packet->angrycitizen);
7608 }
7609 if (BV_ISSET(fields, 7)) {
7610 log_packet_detailed(" field 'base_pollution' has changed");
7611 #ifdef FREECIV_JSON_CONNECTION
7612 field_addr.name = "base_pollution";
7613#endif /* FREECIV_JSON_CONNECTION */
7614 DIO_PUT(sint16, &dout, &field_addr, real_packet->base_pollution);
7615 }
7616 if (BV_ISSET(fields, 8)) {
7617 log_packet_detailed(" field 'base_tech_cost' has changed");
7618 #ifdef FREECIV_JSON_CONNECTION
7619 field_addr.name = "base_tech_cost";
7620#endif /* FREECIV_JSON_CONNECTION */
7621 DIO_PUT(uint16, &dout, &field_addr, real_packet->base_tech_cost);
7622 }
7623 if (BV_ISSET(fields, 9)) {
7624 log_packet_detailed(" field 'tech_leak_pct' has changed");
7625 #ifdef FREECIV_JSON_CONNECTION
7626 field_addr.name = "tech_leak_pct";
7627#endif /* FREECIV_JSON_CONNECTION */
7628 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_leak_pct);
7629 }
7630 if (BV_ISSET(fields, 10)) {
7631 log_packet_detailed(" field 'border_city_radius_sq' has changed");
7632 #ifdef FREECIV_JSON_CONNECTION
7633 field_addr.name = "border_city_radius_sq";
7634#endif /* FREECIV_JSON_CONNECTION */
7635 DIO_PUT(uint16, &dout, &field_addr, real_packet->border_city_radius_sq);
7636 }
7637 if (BV_ISSET(fields, 11)) {
7638 log_packet_detailed(" field 'border_size_effect' has changed");
7639 #ifdef FREECIV_JSON_CONNECTION
7640 field_addr.name = "border_size_effect";
7641#endif /* FREECIV_JSON_CONNECTION */
7642 DIO_PUT(uint8, &dout, &field_addr, real_packet->border_size_effect);
7643 }
7644 if (BV_ISSET(fields, 12)) {
7645 log_packet_detailed(" field 'border_city_permanent_radius_sq' has changed");
7646 #ifdef FREECIV_JSON_CONNECTION
7647 field_addr.name = "border_city_permanent_radius_sq";
7648#endif /* FREECIV_JSON_CONNECTION */
7649 DIO_PUT(sint16, &dout, &field_addr, real_packet->border_city_permanent_radius_sq);
7650 }
7651 if (BV_ISSET(fields, 13)) {
7652 log_packet_detailed(" field 'borders' has changed");
7653 #ifdef FREECIV_JSON_CONNECTION
7654 field_addr.name = "borders";
7655#endif /* FREECIV_JSON_CONNECTION */
7656 DIO_PUT(uint8, &dout, &field_addr, real_packet->borders);
7657 }
7658 if (BV_ISSET(fields, 14)) {
7659 log_packet_detailed(" field 'base_bribe_cost' has changed");
7660 #ifdef FREECIV_JSON_CONNECTION
7661 field_addr.name = "base_bribe_cost";
7662#endif /* FREECIV_JSON_CONNECTION */
7663 DIO_PUT(uint32, &dout, &field_addr, real_packet->base_bribe_cost);
7664 }
7665 if (BV_ISSET(fields, 15)) {
7666 log_packet_detailed(" field 'caravan_bonus_style' has changed");
7667 #ifdef FREECIV_JSON_CONNECTION
7668 field_addr.name = "caravan_bonus_style";
7669#endif /* FREECIV_JSON_CONNECTION */
7670 DIO_PUT(uint8, &dout, &field_addr, real_packet->caravan_bonus_style);
7671 }
7672 if (BV_ISSET(fields, 16)) {
7673 log_packet_detailed(" field 'culture_vic_points' has changed");
7674 #ifdef FREECIV_JSON_CONNECTION
7675 field_addr.name = "culture_vic_points";
7676#endif /* FREECIV_JSON_CONNECTION */
7677 DIO_PUT(uint32, &dout, &field_addr, real_packet->culture_vic_points);
7678 }
7679 if (BV_ISSET(fields, 17)) {
7680 log_packet_detailed(" field 'culture_vic_lead' has changed");
7681 #ifdef FREECIV_JSON_CONNECTION
7682 field_addr.name = "culture_vic_lead";
7683#endif /* FREECIV_JSON_CONNECTION */
7684 DIO_PUT(uint16, &dout, &field_addr, real_packet->culture_vic_lead);
7685 }
7686 if (BV_ISSET(fields, 18)) {
7687 log_packet_detailed(" field 'culture_migration_pml' has changed");
7688 #ifdef FREECIV_JSON_CONNECTION
7689 field_addr.name = "culture_migration_pml";
7690#endif /* FREECIV_JSON_CONNECTION */
7691 DIO_PUT(uint16, &dout, &field_addr, real_packet->culture_migration_pml);
7692 }
7693 if (BV_ISSET(fields, 19)) {
7694 log_packet_detailed(" field 'history_interest_pml' has changed");
7695 #ifdef FREECIV_JSON_CONNECTION
7696 field_addr.name = "history_interest_pml";
7697#endif /* FREECIV_JSON_CONNECTION */
7698 DIO_PUT(uint16, &dout, &field_addr, real_packet->history_interest_pml);
7699 }
7700 if (BV_ISSET(fields, 20)) {
7701 log_packet_detailed(" field 'celebratesize' has changed");
7702 #ifdef FREECIV_JSON_CONNECTION
7703 field_addr.name = "celebratesize";
7704#endif /* FREECIV_JSON_CONNECTION */
7705 DIO_PUT(uint8, &dout, &field_addr, real_packet->celebratesize);
7706 }
7707 /* field 21 is folded into the header */
7708 if (BV_ISSET(fields, 22)) {
7709 log_packet_detailed(" field 'pop_report_zeroes' has changed");
7710 #ifdef FREECIV_JSON_CONNECTION
7711 field_addr.name = "pop_report_zeroes";
7712#endif /* FREECIV_JSON_CONNECTION */
7713 DIO_PUT(uint8, &dout, &field_addr, real_packet->pop_report_zeroes);
7714 }
7715 /* field 23 is folded into the header */
7716 if (BV_ISSET(fields, 24)) {
7717 log_packet_detailed(" field 'citizen_convert_speed' has changed");
7718 #ifdef FREECIV_JSON_CONNECTION
7719 field_addr.name = "citizen_convert_speed";
7720#endif /* FREECIV_JSON_CONNECTION */
7721 DIO_PUT(uint16, &dout, &field_addr, real_packet->citizen_convert_speed);
7722 }
7723 if (BV_ISSET(fields, 25)) {
7724 log_packet_detailed(" field 'conquest_convert_pct' has changed");
7725 #ifdef FREECIV_JSON_CONNECTION
7726 field_addr.name = "conquest_convert_pct";
7727#endif /* FREECIV_JSON_CONNECTION */
7728 DIO_PUT(uint8, &dout, &field_addr, real_packet->conquest_convert_pct);
7729 }
7730 if (BV_ISSET(fields, 26)) {
7731 log_packet_detailed(" field 'citizen_partisans_pct' has changed");
7732 #ifdef FREECIV_JSON_CONNECTION
7733 field_addr.name = "citizen_partisans_pct";
7734#endif /* FREECIV_JSON_CONNECTION */
7735 DIO_PUT(uint8, &dout, &field_addr, real_packet->citizen_partisans_pct);
7736 }
7737 if (BV_ISSET(fields, 27)) {
7738 log_packet_detailed(" field 'citymindist' has changed");
7739 #ifdef FREECIV_JSON_CONNECTION
7740 field_addr.name = "citymindist";
7741#endif /* FREECIV_JSON_CONNECTION */
7742 DIO_PUT(uint8, &dout, &field_addr, real_packet->citymindist);
7743 }
7744 if (BV_ISSET(fields, 28)) {
7745 log_packet_detailed(" field 'cooling' has changed");
7746 #ifdef FREECIV_JSON_CONNECTION
7747 field_addr.name = "cooling";
7748#endif /* FREECIV_JSON_CONNECTION */
7749 DIO_PUT(uint32, &dout, &field_addr, real_packet->cooling);
7750 }
7751 if (BV_ISSET(fields, 29)) {
7752 log_packet_detailed(" field 'coolinglevel' has changed");
7753 #ifdef FREECIV_JSON_CONNECTION
7754 field_addr.name = "coolinglevel";
7755#endif /* FREECIV_JSON_CONNECTION */
7756 DIO_PUT(uint32, &dout, &field_addr, real_packet->coolinglevel);
7757 }
7758 if (BV_ISSET(fields, 30)) {
7759 log_packet_detailed(" field 'diplchance_initial_odds' has changed");
7760 #ifdef FREECIV_JSON_CONNECTION
7761 field_addr.name = "diplchance_initial_odds";
7762#endif /* FREECIV_JSON_CONNECTION */
7763 DIO_BV_PUT(&dout, &field_addr, packet->diplchance_initial_odds);
7764 }
7765 if (BV_ISSET(fields, 31)) {
7766 log_packet_detailed(" field 'diplomacy' has changed");
7767 #ifdef FREECIV_JSON_CONNECTION
7768 field_addr.name = "diplomacy";
7769#endif /* FREECIV_JSON_CONNECTION */
7770 DIO_PUT(uint8, &dout, &field_addr, real_packet->diplomacy);
7771 }
7772 /* field 32 is folded into the header */
7773 if (BV_ISSET(fields, 33)) {
7774 log_packet_detailed(" field 'food_cost' has changed");
7775 #ifdef FREECIV_JSON_CONNECTION
7776 field_addr.name = "food_cost";
7777#endif /* FREECIV_JSON_CONNECTION */
7778 DIO_PUT(uint16, &dout, &field_addr, real_packet->food_cost);
7779 }
7780 if (BV_ISSET(fields, 34)) {
7781 log_packet_detailed(" field 'foodbox' has changed");
7782 #ifdef FREECIV_JSON_CONNECTION
7783 field_addr.name = "foodbox";
7784#endif /* FREECIV_JSON_CONNECTION */
7785 DIO_PUT(uint32, &dout, &field_addr, real_packet->foodbox);
7786 }
7787 if (BV_ISSET(fields, 35)) {
7788 log_packet_detailed(" field 'forced_gold' has changed");
7789 #ifdef FREECIV_JSON_CONNECTION
7790 field_addr.name = "forced_gold";
7791#endif /* FREECIV_JSON_CONNECTION */
7792 DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_gold);
7793 }
7794 if (BV_ISSET(fields, 36)) {
7795 log_packet_detailed(" field 'forced_luxury' has changed");
7796 #ifdef FREECIV_JSON_CONNECTION
7797 field_addr.name = "forced_luxury";
7798#endif /* FREECIV_JSON_CONNECTION */
7799 DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_luxury);
7800 }
7801 if (BV_ISSET(fields, 37)) {
7802 log_packet_detailed(" field 'forced_science' has changed");
7803 #ifdef FREECIV_JSON_CONNECTION
7804 field_addr.name = "forced_science";
7805#endif /* FREECIV_JSON_CONNECTION */
7806 DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_science);
7807 }
7808 if (BV_ISSET(fields, 38)) {
7809 log_packet_detailed(" field 'fulltradesize' has changed");
7810 #ifdef FREECIV_JSON_CONNECTION
7811 field_addr.name = "fulltradesize";
7812#endif /* FREECIV_JSON_CONNECTION */
7813 DIO_PUT(uint8, &dout, &field_addr, real_packet->fulltradesize);
7814 }
7815 if (BV_ISSET(fields, 39)) {
7816 log_packet_detailed(" field 'trade_world_rel_pct' has changed");
7817 #ifdef FREECIV_JSON_CONNECTION
7818 field_addr.name = "trade_world_rel_pct";
7819#endif /* FREECIV_JSON_CONNECTION */
7820 DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_world_rel_pct);
7821 }
7822 if (BV_ISSET(fields, 40)) {
7823 log_packet_detailed(" field 'min_trade_route_val' has changed");
7824 #ifdef FREECIV_JSON_CONNECTION
7825 field_addr.name = "min_trade_route_val";
7826#endif /* FREECIV_JSON_CONNECTION */
7827 DIO_PUT(uint8, &dout, &field_addr, real_packet->min_trade_route_val);
7828 }
7829 if (BV_ISSET(fields, 41)) {
7830 log_packet_detailed(" field 'goods_selection' has changed");
7831 #ifdef FREECIV_JSON_CONNECTION
7832 field_addr.name = "goods_selection";
7833#endif /* FREECIV_JSON_CONNECTION */
7834 DIO_PUT(uint8, &dout, &field_addr, real_packet->goods_selection);
7835 }
7836 if (BV_ISSET(fields, 42)) {
7837 log_packet_detailed(" field 'global_advance_count' has changed");
7838 #ifdef FREECIV_JSON_CONNECTION
7839 field_addr.name = "global_advance_count";
7840#endif /* FREECIV_JSON_CONNECTION */
7841 DIO_PUT(uint16, &dout, &field_addr, real_packet->global_advance_count);
7842 }
7843 if (BV_ISSET(fields, 43)) {
7844 log_packet_detailed(" field 'global_advances' has changed");
7845 #ifdef FREECIV_JSON_CONNECTION
7846 field_addr.name = "global_advances";
7847#endif /* FREECIV_JSON_CONNECTION */
7848
7849 {
7850 int i;
7851
7852#ifdef FREECIV_JSON_CONNECTION
7853 int count = 0;
7854
7855 for (i = 0; i < A_LAST; i++) {
7856 if (old->global_advances[i] != real_packet->global_advances[i]) {
7857 count++;
7858 }
7859 }
7860 /* Create the array. */
7861 DIO_PUT(farray, &dout, &field_addr, count + 1);
7862
7863 /* Enter array. */
7864 field_addr.sub_location = plocation_elem_new(0);
7865
7866 count = 0;
7867#endif /* FREECIV_JSON_CONNECTION */
7868
7869 fc_assert(A_LAST < 255);
7870
7871 for (i = 0; i < A_LAST; i++) {
7872 if (old->global_advances[i] != real_packet->global_advances[i]) {
7873#ifdef FREECIV_JSON_CONNECTION
7874 /* Next diff array element. */
7875 field_addr.sub_location->number = count - 1;
7876
7877 /* Create the diff array element. */
7878 DIO_PUT(farray, &dout, &field_addr, 2);
7879
7880 /* Enter diff array element (start at the index address). */
7881 field_addr.sub_location->sub_location = plocation_elem_new(0);
7882#endif /* FREECIV_JSON_CONNECTION */
7883 DIO_PUT(uint8, &dout, &field_addr, i);
7884
7885#ifdef FREECIV_JSON_CONNECTION
7886 /* Content address. */
7887 field_addr.sub_location->sub_location->number = 1;
7888#endif /* FREECIV_JSON_CONNECTION */
7889 DIO_PUT(bool8, &dout, &field_addr, real_packet->global_advances[i]);
7890
7891#ifdef FREECIV_JSON_CONNECTION
7892 /* Exit diff array element. */
7893 free(field_addr.sub_location->sub_location);
7894 field_addr.sub_location->sub_location = NULL;
7895#endif /* FREECIV_JSON_CONNECTION */
7896 }
7897 }
7898#ifdef FREECIV_JSON_CONNECTION
7899 field_addr.sub_location->number = count - 1;
7900
7901 /* Create the diff array element. */
7902 DIO_PUT(farray, &dout, &field_addr, A_LAST);
7903
7904 /* Enter diff array element. Point to index address. */
7905 field_addr.sub_location->sub_location = plocation_elem_new(0);
7906#endif /* FREECIV_JSON_CONNECTION */
7907 DIO_PUT(uint8, &dout, &field_addr, 255);
7908
7909#ifdef FREECIV_JSON_CONNECTION
7910 /* Exit diff array element. */
7911 free(field_addr.sub_location->sub_location);
7912 field_addr.sub_location->sub_location = NULL;
7913
7914 /* Exit array. */
7915 free(field_addr.sub_location);
7916 field_addr.sub_location = NULL;
7917#endif /* FREECIV_JSON_CONNECTION */
7918 }
7919 }
7920 /* field 44 is folded into the header */
7921 if (BV_ISSET(fields, 45)) {
7922 log_packet_detailed(" field 'globalwarming' has changed");
7923 #ifdef FREECIV_JSON_CONNECTION
7924 field_addr.name = "globalwarming";
7925#endif /* FREECIV_JSON_CONNECTION */
7926 DIO_PUT(uint32, &dout, &field_addr, real_packet->globalwarming);
7927 }
7928 if (BV_ISSET(fields, 46)) {
7929 log_packet_detailed(" field 'gold' has changed");
7930 #ifdef FREECIV_JSON_CONNECTION
7931 field_addr.name = "gold";
7932#endif /* FREECIV_JSON_CONNECTION */
7933 DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
7934 }
7935 if (BV_ISSET(fields, 47)) {
7936 log_packet_detailed(" field 'gold_upkeep_style' has changed");
7937 #ifdef FREECIV_JSON_CONNECTION
7938 field_addr.name = "gold_upkeep_style";
7939#endif /* FREECIV_JSON_CONNECTION */
7940 DIO_PUT(uint8, &dout, &field_addr, real_packet->gold_upkeep_style);
7941 }
7942 if (BV_ISSET(fields, 48)) {
7943 log_packet_detailed(" field 'infrapoints' has changed");
7944 #ifdef FREECIV_JSON_CONNECTION
7945 field_addr.name = "infrapoints";
7946#endif /* FREECIV_JSON_CONNECTION */
7947 DIO_PUT(uint32, &dout, &field_addr, real_packet->infrapoints);
7948 }
7949 if (BV_ISSET(fields, 49)) {
7950 log_packet_detailed(" field 'revolentype' has changed");
7951 #ifdef FREECIV_JSON_CONNECTION
7952 field_addr.name = "revolentype";
7953#endif /* FREECIV_JSON_CONNECTION */
7954 DIO_PUT(uint8, &dout, &field_addr, real_packet->revolentype);
7955 }
7956 if (BV_ISSET(fields, 50)) {
7957 log_packet_detailed(" field 'default_government_id' has changed");
7958 #ifdef FREECIV_JSON_CONNECTION
7959 field_addr.name = "default_government_id";
7960#endif /* FREECIV_JSON_CONNECTION */
7961 DIO_PUT(sint8, &dout, &field_addr, real_packet->default_government_id);
7962 }
7963 if (BV_ISSET(fields, 51)) {
7964 log_packet_detailed(" field 'government_during_revolution_id' has changed");
7965 #ifdef FREECIV_JSON_CONNECTION
7966 field_addr.name = "government_during_revolution_id";
7967#endif /* FREECIV_JSON_CONNECTION */
7968 DIO_PUT(sint8, &dout, &field_addr, real_packet->government_during_revolution_id);
7969 }
7970 if (BV_ISSET(fields, 52)) {
7971 log_packet_detailed(" field 'granary_food_inc' has changed");
7972 #ifdef FREECIV_JSON_CONNECTION
7973 field_addr.name = "granary_food_inc";
7974#endif /* FREECIV_JSON_CONNECTION */
7975 DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_food_inc);
7976 }
7977 if (BV_ISSET(fields, 53)) {
7978 log_packet_detailed(" field 'granary_food_ini' has changed");
7979 #ifdef FREECIV_JSON_CONNECTION
7980 field_addr.name = "granary_food_ini";
7981#endif /* FREECIV_JSON_CONNECTION */
7982
7983 {
7984 int i;
7985
7986#ifdef FREECIV_JSON_CONNECTION
7987 /* Create the array. */
7988 DIO_PUT(farray, &dout, &field_addr, MAX_GRANARY_INIS);
7989
7990 /* Enter the array. */
7991 field_addr.sub_location = plocation_elem_new(0);
7992#endif /* FREECIV_JSON_CONNECTION */
7993
7994 for (i = 0; i < MAX_GRANARY_INIS; i++) {
7995#ifdef FREECIV_JSON_CONNECTION
7996 /* Next array element. */
7997 field_addr.sub_location->number = i;
7998#endif /* FREECIV_JSON_CONNECTION */
7999 DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_food_ini[i]);
8000 }
8001
8002#ifdef FREECIV_JSON_CONNECTION
8003 /* Exit array. */
8004 free(field_addr.sub_location);
8005 field_addr.sub_location = NULL;
8006#endif /* FREECIV_JSON_CONNECTION */
8007 }
8008 }
8009 if (BV_ISSET(fields, 54)) {
8010 log_packet_detailed(" field 'granary_num_inis' has changed");
8011 #ifdef FREECIV_JSON_CONNECTION
8012 field_addr.name = "granary_num_inis";
8013#endif /* FREECIV_JSON_CONNECTION */
8014 DIO_PUT(uint8, &dout, &field_addr, real_packet->granary_num_inis);
8015 }
8016 if (BV_ISSET(fields, 55)) {
8017 log_packet_detailed(" field 'great_wonder_owners' has changed");
8018 #ifdef FREECIV_JSON_CONNECTION
8019 field_addr.name = "great_wonder_owners";
8020#endif /* FREECIV_JSON_CONNECTION */
8021
8022 {
8023 int i;
8024
8025#ifdef FREECIV_JSON_CONNECTION
8026 int count = 0;
8027
8028 for (i = 0; i < B_LAST; i++) {
8029 if (old->great_wonder_owners[i] != real_packet->great_wonder_owners[i]) {
8030 count++;
8031 }
8032 }
8033 /* Create the array. */
8034 DIO_PUT(farray, &dout, &field_addr, count + 1);
8035
8036 /* Enter array. */
8037 field_addr.sub_location = plocation_elem_new(0);
8038
8039 count = 0;
8040#endif /* FREECIV_JSON_CONNECTION */
8041
8042 fc_assert(B_LAST < 255);
8043
8044 for (i = 0; i < B_LAST; i++) {
8045 if (old->great_wonder_owners[i] != real_packet->great_wonder_owners[i]) {
8046#ifdef FREECIV_JSON_CONNECTION
8047 /* Next diff array element. */
8048 field_addr.sub_location->number = count - 1;
8049
8050 /* Create the diff array element. */
8051 DIO_PUT(farray, &dout, &field_addr, 2);
8052
8053 /* Enter diff array element (start at the index address). */
8054 field_addr.sub_location->sub_location = plocation_elem_new(0);
8055#endif /* FREECIV_JSON_CONNECTION */
8056 DIO_PUT(uint8, &dout, &field_addr, i);
8057
8058#ifdef FREECIV_JSON_CONNECTION
8059 /* Content address. */
8060 field_addr.sub_location->sub_location->number = 1;
8061#endif /* FREECIV_JSON_CONNECTION */
8062 DIO_PUT(uint16, &dout, &field_addr, real_packet->great_wonder_owners[i]);
8063
8064#ifdef FREECIV_JSON_CONNECTION
8065 /* Exit diff array element. */
8066 free(field_addr.sub_location->sub_location);
8067 field_addr.sub_location->sub_location = NULL;
8068#endif /* FREECIV_JSON_CONNECTION */
8069 }
8070 }
8071#ifdef FREECIV_JSON_CONNECTION
8072 field_addr.sub_location->number = count - 1;
8073
8074 /* Create the diff array element. */
8075 DIO_PUT(farray, &dout, &field_addr, B_LAST);
8076
8077 /* Enter diff array element. Point to index address. */
8078 field_addr.sub_location->sub_location = plocation_elem_new(0);
8079#endif /* FREECIV_JSON_CONNECTION */
8080 DIO_PUT(uint8, &dout, &field_addr, 255);
8081
8082#ifdef FREECIV_JSON_CONNECTION
8083 /* Exit diff array element. */
8084 free(field_addr.sub_location->sub_location);
8085 field_addr.sub_location->sub_location = NULL;
8086
8087 /* Exit array. */
8088 free(field_addr.sub_location);
8089 field_addr.sub_location = NULL;
8090#endif /* FREECIV_JSON_CONNECTION */
8091 }
8092 }
8093 if (BV_ISSET(fields, 56)) {
8094 log_packet_detailed(" field 'happy_cost' has changed");
8095 #ifdef FREECIV_JSON_CONNECTION
8096 field_addr.name = "happy_cost";
8097#endif /* FREECIV_JSON_CONNECTION */
8098 DIO_PUT(uint16, &dout, &field_addr, real_packet->happy_cost);
8099 }
8100 if (BV_ISSET(fields, 57)) {
8101 log_packet_detailed(" field 'happyborders' has changed");
8102 #ifdef FREECIV_JSON_CONNECTION
8103 field_addr.name = "happyborders";
8104#endif /* FREECIV_JSON_CONNECTION */
8105 DIO_PUT(uint8, &dout, &field_addr, real_packet->happyborders);
8106 }
8107 if (BV_ISSET(fields, 58)) {
8108 log_packet_detailed(" field 'heating' has changed");
8109 #ifdef FREECIV_JSON_CONNECTION
8110 field_addr.name = "heating";
8111#endif /* FREECIV_JSON_CONNECTION */
8112 DIO_PUT(uint32, &dout, &field_addr, real_packet->heating);
8113 }
8114 if (BV_ISSET(fields, 59)) {
8115 log_packet_detailed(" field 'illness_base_factor' has changed");
8116 #ifdef FREECIV_JSON_CONNECTION
8117 field_addr.name = "illness_base_factor";
8118#endif /* FREECIV_JSON_CONNECTION */
8119 DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_base_factor);
8120 }
8121 if (BV_ISSET(fields, 60)) {
8122 log_packet_detailed(" field 'illness_min_size' has changed");
8123 #ifdef FREECIV_JSON_CONNECTION
8124 field_addr.name = "illness_min_size";
8125#endif /* FREECIV_JSON_CONNECTION */
8126 DIO_PUT(uint8, &dout, &field_addr, real_packet->illness_min_size);
8127 }
8128 /* field 61 is folded into the header */
8129 if (BV_ISSET(fields, 62)) {
8130 log_packet_detailed(" field 'illness_pollution_factor' has changed");
8131 #ifdef FREECIV_JSON_CONNECTION
8132 field_addr.name = "illness_pollution_factor";
8133#endif /* FREECIV_JSON_CONNECTION */
8134 DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_pollution_factor);
8135 }
8136 if (BV_ISSET(fields, 63)) {
8137 log_packet_detailed(" field 'illness_trade_infection' has changed");
8138 #ifdef FREECIV_JSON_CONNECTION
8139 field_addr.name = "illness_trade_infection";
8140#endif /* FREECIV_JSON_CONNECTION */
8141 DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade_infection);
8142 }
8143 if (BV_ISSET(fields, 64)) {
8144 log_packet_detailed(" field 'init_city_radius_sq' has changed");
8145 #ifdef FREECIV_JSON_CONNECTION
8146 field_addr.name = "init_city_radius_sq";
8147#endif /* FREECIV_JSON_CONNECTION */
8148 DIO_PUT(uint8, &dout, &field_addr, real_packet->init_city_radius_sq);
8149 }
8150 /* field 65 is folded into the header */
8151 /* field 66 is folded into the header */
8152 /* field 67 is folded into the header */
8153 /* field 68 is folded into the header */
8154 /* field 69 is folded into the header */
8155 /* field 70 is folded into the header */
8156 /* field 71 is folded into the header */
8157 /* field 72 is folded into the header */
8158 if (BV_ISSET(fields, 73)) {
8159 log_packet_detailed(" field 'low_firepower_badwallattacker' has changed");
8160 #ifdef FREECIV_JSON_CONNECTION
8161 field_addr.name = "low_firepower_badwallattacker";
8162#endif /* FREECIV_JSON_CONNECTION */
8163 DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_badwallattacker);
8164 }
8165 if (BV_ISSET(fields, 74)) {
8166 log_packet_detailed(" field 'low_firepower_pearl_harbour' has changed");
8167 #ifdef FREECIV_JSON_CONNECTION
8168 field_addr.name = "low_firepower_pearl_harbour";
8169#endif /* FREECIV_JSON_CONNECTION */
8170 DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_pearl_harbour);
8171 }
8172 if (BV_ISSET(fields, 75)) {
8173 log_packet_detailed(" field 'low_firepower_combat_bonus' has changed");
8174 #ifdef FREECIV_JSON_CONNECTION
8175 field_addr.name = "low_firepower_combat_bonus";
8176#endif /* FREECIV_JSON_CONNECTION */
8177 DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_combat_bonus);
8178 }
8179 if (BV_ISSET(fields, 76)) {
8180 log_packet_detailed(" field 'low_firepower_nonnat_bombard' has changed");
8181 #ifdef FREECIV_JSON_CONNECTION
8182 field_addr.name = "low_firepower_nonnat_bombard";
8183#endif /* FREECIV_JSON_CONNECTION */
8184 DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_nonnat_bombard);
8185 }
8186 if (BV_ISSET(fields, 77)) {
8187 log_packet_detailed(" field 'nuke_pop_loss_pct' has changed");
8188 #ifdef FREECIV_JSON_CONNECTION
8189 field_addr.name = "nuke_pop_loss_pct";
8190#endif /* FREECIV_JSON_CONNECTION */
8191 DIO_PUT(uint8, &dout, &field_addr, real_packet->nuke_pop_loss_pct);
8192 }
8193 if (BV_ISSET(fields, 78)) {
8194 log_packet_detailed(" field 'nuke_defender_survival_chance_pct' has changed");
8195 #ifdef FREECIV_JSON_CONNECTION
8196 field_addr.name = "nuke_defender_survival_chance_pct";
8197#endif /* FREECIV_JSON_CONNECTION */
8198 DIO_PUT(uint8, &dout, &field_addr, real_packet->nuke_defender_survival_chance_pct);
8199 }
8200 if (BV_ISSET(fields, 79)) {
8201 log_packet_detailed(" field 'min_city_center_output' has changed");
8202 #ifdef FREECIV_JSON_CONNECTION
8203 field_addr.name = "min_city_center_output";
8204#endif /* FREECIV_JSON_CONNECTION */
8205
8206 {
8207 int i;
8208
8209#ifdef FREECIV_JSON_CONNECTION
8210 /* Create the array. */
8211 DIO_PUT(farray, &dout, &field_addr, O_LAST);
8212
8213 /* Enter the array. */
8214 field_addr.sub_location = plocation_elem_new(0);
8215#endif /* FREECIV_JSON_CONNECTION */
8216
8217 for (i = 0; i < O_LAST; i++) {
8218#ifdef FREECIV_JSON_CONNECTION
8219 /* Next array element. */
8220 field_addr.sub_location->number = i;
8221#endif /* FREECIV_JSON_CONNECTION */
8222 DIO_PUT(uint16, &dout, &field_addr, real_packet->min_city_center_output[i]);
8223 }
8224
8225#ifdef FREECIV_JSON_CONNECTION
8226 /* Exit array. */
8227 free(field_addr.sub_location);
8228 field_addr.sub_location = NULL;
8229#endif /* FREECIV_JSON_CONNECTION */
8230 }
8231 }
8232 /* field 80 is folded into the header */
8233 /* field 81 is folded into the header */
8234 /* field 82 is folded into the header */
8235 if (BV_ISSET(fields, 83)) {
8236 log_packet_detailed(" field 'notradesize' has changed");
8237 #ifdef FREECIV_JSON_CONNECTION
8238 field_addr.name = "notradesize";
8239#endif /* FREECIV_JSON_CONNECTION */
8240 DIO_PUT(uint8, &dout, &field_addr, real_packet->notradesize);
8241 }
8242 /* field 84 is folded into the header */
8243 if (BV_ISSET(fields, 85)) {
8244 log_packet_detailed(" field 'nuclearwinter' has changed");
8245 #ifdef FREECIV_JSON_CONNECTION
8246 field_addr.name = "nuclearwinter";
8247#endif /* FREECIV_JSON_CONNECTION */
8248 DIO_PUT(uint32, &dout, &field_addr, real_packet->nuclearwinter);
8249 }
8250 if (BV_ISSET(fields, 86)) {
8251 log_packet_detailed(" field 'phase' has changed");
8252 #ifdef FREECIV_JSON_CONNECTION
8253 field_addr.name = "phase";
8254#endif /* FREECIV_JSON_CONNECTION */
8255 DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
8256 }
8257 if (BV_ISSET(fields, 87)) {
8258 log_packet_detailed(" field 'phase_mode' has changed");
8259 #ifdef FREECIV_JSON_CONNECTION
8260 field_addr.name = "phase_mode";
8261#endif /* FREECIV_JSON_CONNECTION */
8262 DIO_PUT(uint8, &dout, &field_addr, real_packet->phase_mode);
8263 }
8264 /* field 88 is folded into the header */
8265 /* field 89 is folded into the header */
8266 /* field 90 is folded into the header */
8267 /* field 91 is folded into the header */
8268 /* field 92 is folded into the header */
8269 /* field 93 is folded into the header */
8270 /* field 94 is folded into the header */
8271 /* field 95 is folded into the header */
8272 if (BV_ISSET(fields, 96)) {
8273 log_packet_detailed(" field 'rapturedelay' has changed");
8274 #ifdef FREECIV_JSON_CONNECTION
8275 field_addr.name = "rapturedelay";
8276#endif /* FREECIV_JSON_CONNECTION */
8277 DIO_PUT(uint8, &dout, &field_addr, real_packet->rapturedelay);
8278 }
8279 if (BV_ISSET(fields, 97)) {
8280 log_packet_detailed(" field 'disasters' has changed");
8281 #ifdef FREECIV_JSON_CONNECTION
8282 field_addr.name = "disasters";
8283#endif /* FREECIV_JSON_CONNECTION */
8284 DIO_PUT(uint16, &dout, &field_addr, real_packet->disasters);
8285 }
8286 /* field 98 is folded into the header */
8287 /* field 99 is folded into the header */
8288 if (BV_ISSET(fields, 100)) {
8289 log_packet_detailed(" field 'sciencebox' has changed");
8290 #ifdef FREECIV_JSON_CONNECTION
8291 field_addr.name = "sciencebox";
8292#endif /* FREECIV_JSON_CONNECTION */
8293 DIO_PUT(uint32, &dout, &field_addr, real_packet->sciencebox);
8294 }
8295 if (BV_ISSET(fields, 101)) {
8296 log_packet_detailed(" field 'shieldbox' has changed");
8297 #ifdef FREECIV_JSON_CONNECTION
8298 field_addr.name = "shieldbox";
8299#endif /* FREECIV_JSON_CONNECTION */
8300 DIO_PUT(uint32, &dout, &field_addr, real_packet->shieldbox);
8301 }
8302 if (BV_ISSET(fields, 102)) {
8303 log_packet_detailed(" field 'skill_level' has changed");
8304 #ifdef FREECIV_JSON_CONNECTION
8305 field_addr.name = "skill_level";
8306#endif /* FREECIV_JSON_CONNECTION */
8307 DIO_PUT(uint8, &dout, &field_addr, real_packet->skill_level);
8308 }
8309 if (BV_ISSET(fields, 103)) {
8310 log_packet_detailed(" field 'victory_conditions' has changed");
8311 #ifdef FREECIV_JSON_CONNECTION
8312 field_addr.name = "victory_conditions";
8313#endif /* FREECIV_JSON_CONNECTION */
8314 DIO_PUT(uint8, &dout, &field_addr, real_packet->victory_conditions);
8315 }
8316 /* field 104 is folded into the header */
8317 if (BV_ISSET(fields, 105)) {
8318 log_packet_detailed(" field 'tech' has changed");
8319 #ifdef FREECIV_JSON_CONNECTION
8320 field_addr.name = "tech";
8321#endif /* FREECIV_JSON_CONNECTION */
8322 DIO_PUT(uint32, &dout, &field_addr, real_packet->tech);
8323 }
8324 if (BV_ISSET(fields, 106)) {
8325 log_packet_detailed(" field 'tech_cost_style' has changed");
8326 #ifdef FREECIV_JSON_CONNECTION
8327 field_addr.name = "tech_cost_style";
8328#endif /* FREECIV_JSON_CONNECTION */
8329 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_cost_style);
8330 }
8331 if (BV_ISSET(fields, 107)) {
8332 log_packet_detailed(" field 'tech_leakage' has changed");
8333 #ifdef FREECIV_JSON_CONNECTION
8334 field_addr.name = "tech_leakage";
8335#endif /* FREECIV_JSON_CONNECTION */
8336 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_leakage);
8337 }
8338 if (BV_ISSET(fields, 108)) {
8339 log_packet_detailed(" field 'tech_upkeep_divider' has changed");
8340 #ifdef FREECIV_JSON_CONNECTION
8341 field_addr.name = "tech_upkeep_divider";
8342#endif /* FREECIV_JSON_CONNECTION */
8343 DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_upkeep_divider);
8344 }
8345 if (BV_ISSET(fields, 109)) {
8346 log_packet_detailed(" field 'tech_upkeep_style' has changed");
8347 #ifdef FREECIV_JSON_CONNECTION
8348 field_addr.name = "tech_upkeep_style";
8349#endif /* FREECIV_JSON_CONNECTION */
8350 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_upkeep_style);
8351 }
8352 if (BV_ISSET(fields, 110)) {
8353 log_packet_detailed(" field 'techloss_forgiveness' has changed");
8354 #ifdef FREECIV_JSON_CONNECTION
8355 field_addr.name = "techloss_forgiveness";
8356#endif /* FREECIV_JSON_CONNECTION */
8357 DIO_PUT(sint16, &dout, &field_addr, real_packet->techloss_forgiveness);
8358 }
8359 if (BV_ISSET(fields, 111)) {
8360 log_packet_detailed(" field 'free_tech_method' has changed");
8361 #ifdef FREECIV_JSON_CONNECTION
8362 field_addr.name = "free_tech_method";
8363#endif /* FREECIV_JSON_CONNECTION */
8364 DIO_PUT(uint8, &dout, &field_addr, real_packet->free_tech_method);
8365 }
8366 if (BV_ISSET(fields, 112)) {
8367 log_packet_detailed(" field 'gameloss_style' has changed");
8368 #ifdef FREECIV_JSON_CONNECTION
8369 field_addr.name = "gameloss_style";
8370#endif /* FREECIV_JSON_CONNECTION */
8371 DIO_PUT(uint8, &dout, &field_addr, real_packet->gameloss_style);
8372 }
8373 if (BV_ISSET(fields, 113)) {
8374 log_packet_detailed(" field 'timeout' has changed");
8375 #ifdef FREECIV_JSON_CONNECTION
8376 field_addr.name = "timeout";
8377#endif /* FREECIV_JSON_CONNECTION */
8378 DIO_PUT(uint32, &dout, &field_addr, real_packet->timeout);
8379 }
8380 if (BV_ISSET(fields, 114)) {
8381 log_packet_detailed(" field 'first_timeout' has changed");
8382 #ifdef FREECIV_JSON_CONNECTION
8383 field_addr.name = "first_timeout";
8384#endif /* FREECIV_JSON_CONNECTION */
8385 DIO_PUT(uint32, &dout, &field_addr, real_packet->first_timeout);
8386 }
8387 /* field 115 is folded into the header */
8388 if (BV_ISSET(fields, 116)) {
8389 log_packet_detailed(" field 'trademindist' has changed");
8390 #ifdef FREECIV_JSON_CONNECTION
8391 field_addr.name = "trademindist";
8392#endif /* FREECIV_JSON_CONNECTION */
8393 DIO_PUT(uint16, &dout, &field_addr, real_packet->trademindist);
8394 }
8395 if (BV_ISSET(fields, 117)) {
8396 log_packet_detailed(" field 'trade_revenue_style' has changed");
8397 #ifdef FREECIV_JSON_CONNECTION
8398 field_addr.name = "trade_revenue_style";
8399#endif /* FREECIV_JSON_CONNECTION */
8400 DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_revenue_style);
8401 }
8402 /* field 118 is folded into the header */
8403 /* field 119 is folded into the header */
8404 /* field 120 is folded into the header */
8405 if (BV_ISSET(fields, 121)) {
8406 log_packet_detailed(" field 'turn' has changed");
8407 #ifdef FREECIV_JSON_CONNECTION
8408 field_addr.name = "turn";
8409#endif /* FREECIV_JSON_CONNECTION */
8410 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
8411 }
8412 if (BV_ISSET(fields, 122)) {
8413 log_packet_detailed(" field 'warminglevel' has changed");
8414 #ifdef FREECIV_JSON_CONNECTION
8415 field_addr.name = "warminglevel";
8416#endif /* FREECIV_JSON_CONNECTION */
8417 DIO_PUT(uint32, &dout, &field_addr, real_packet->warminglevel);
8418 }
8419 if (BV_ISSET(fields, 123)) {
8420 log_packet_detailed(" field 'year' has changed");
8421 #ifdef FREECIV_JSON_CONNECTION
8422 field_addr.name = "year";
8423#endif /* FREECIV_JSON_CONNECTION */
8424 DIO_PUT(sint32, &dout, &field_addr, real_packet->year);
8425 }
8426 /* field 124 is folded into the header */
8427 if (BV_ISSET(fields, 125)) {
8428 log_packet_detailed(" field 'fragment_count' has changed");
8429 #ifdef FREECIV_JSON_CONNECTION
8430 field_addr.name = "fragment_count";
8431#endif /* FREECIV_JSON_CONNECTION */
8432 DIO_PUT(uint16, &dout, &field_addr, real_packet->fragment_count);
8433 }
8434 /* field 126 is folded into the header */
8435 if (BV_ISSET(fields, 127)) {
8436 log_packet_detailed(" field 'civil_war_bonus_celebrating' has changed");
8437 #ifdef FREECIV_JSON_CONNECTION
8438 field_addr.name = "civil_war_bonus_celebrating";
8439#endif /* FREECIV_JSON_CONNECTION */
8440 DIO_PUT(sint16, &dout, &field_addr, real_packet->civil_war_bonus_celebrating);
8441 }
8442 if (BV_ISSET(fields, 128)) {
8443 log_packet_detailed(" field 'civil_war_bonus_unhappy' has changed");
8444 #ifdef FREECIV_JSON_CONNECTION
8445 field_addr.name = "civil_war_bonus_unhappy";
8446#endif /* FREECIV_JSON_CONNECTION */
8447 DIO_PUT(sint16, &dout, &field_addr, real_packet->civil_war_bonus_unhappy);
8448 }
8449 if (BV_ISSET(fields, 129)) {
8450 log_packet_detailed(" field 'granularity' has changed");
8451 #ifdef FREECIV_JSON_CONNECTION
8452 field_addr.name = "granularity";
8453#endif /* FREECIV_JSON_CONNECTION */
8454 DIO_PUT(uint16, &dout, &field_addr, real_packet->granularity);
8455 }
8456 if (BV_ISSET(fields, 130)) {
8457 log_packet_detailed(" field 'small_wonder_visibility' has changed");
8458 #ifdef FREECIV_JSON_CONNECTION
8459 field_addr.name = "small_wonder_visibility";
8460#endif /* FREECIV_JSON_CONNECTION */
8461 DIO_PUT(uint8, &dout, &field_addr, real_packet->small_wonder_visibility);
8462 }
8463
8464 *old = *real_packet;
8465#endif /* FREECIV_DELTA_PROTOCOL */
8466#ifndef FREECIV_DELTA_PROTOCOL
8467#ifdef FREECIV_JSON_CONNECTION
8468 field_addr.name = "add_to_size_limit";
8469#endif /* FREECIV_JSON_CONNECTION */
8470 DIO_PUT(uint8, &dout, &field_addr, real_packet->add_to_size_limit);
8471#ifdef FREECIV_JSON_CONNECTION
8472 field_addr.name = "aifill";
8473#endif /* FREECIV_JSON_CONNECTION */
8474 DIO_PUT(uint16, &dout, &field_addr, real_packet->aifill);
8475#ifdef FREECIV_JSON_CONNECTION
8476 field_addr.name = "persistent_ready";
8477#endif /* FREECIV_JSON_CONNECTION */
8478 DIO_PUT(uint8, &dout, &field_addr, real_packet->persistent_ready);
8479#ifdef FREECIV_JSON_CONNECTION
8480 field_addr.name = "airlifting_style";
8481#endif /* FREECIV_JSON_CONNECTION */
8482 DIO_PUT(uint8, &dout, &field_addr, real_packet->airlifting_style);
8483#ifdef FREECIV_JSON_CONNECTION
8484 field_addr.name = "airlift_from_always_enabled";
8485#endif /* FREECIV_JSON_CONNECTION */
8486 DIO_PUT(bool8, &dout, &field_addr, real_packet->airlift_from_always_enabled);
8487#ifdef FREECIV_JSON_CONNECTION
8488 field_addr.name = "airlift_to_always_enabled";
8489#endif /* FREECIV_JSON_CONNECTION */
8490 DIO_PUT(bool8, &dout, &field_addr, real_packet->airlift_to_always_enabled);
8491#ifdef FREECIV_JSON_CONNECTION
8492 field_addr.name = "angrycitizen";
8493#endif /* FREECIV_JSON_CONNECTION */
8494 DIO_PUT(uint8, &dout, &field_addr, real_packet->angrycitizen);
8495#ifdef FREECIV_JSON_CONNECTION
8496 field_addr.name = "base_pollution";
8497#endif /* FREECIV_JSON_CONNECTION */
8498 DIO_PUT(sint16, &dout, &field_addr, real_packet->base_pollution);
8499#ifdef FREECIV_JSON_CONNECTION
8500 field_addr.name = "base_tech_cost";
8501#endif /* FREECIV_JSON_CONNECTION */
8502 DIO_PUT(uint16, &dout, &field_addr, real_packet->base_tech_cost);
8503#ifdef FREECIV_JSON_CONNECTION
8504 field_addr.name = "tech_leak_pct";
8505#endif /* FREECIV_JSON_CONNECTION */
8506 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_leak_pct);
8507#ifdef FREECIV_JSON_CONNECTION
8508 field_addr.name = "border_city_radius_sq";
8509#endif /* FREECIV_JSON_CONNECTION */
8510 DIO_PUT(uint16, &dout, &field_addr, real_packet->border_city_radius_sq);
8511#ifdef FREECIV_JSON_CONNECTION
8512 field_addr.name = "border_size_effect";
8513#endif /* FREECIV_JSON_CONNECTION */
8514 DIO_PUT(uint8, &dout, &field_addr, real_packet->border_size_effect);
8515#ifdef FREECIV_JSON_CONNECTION
8516 field_addr.name = "border_city_permanent_radius_sq";
8517#endif /* FREECIV_JSON_CONNECTION */
8518 DIO_PUT(sint16, &dout, &field_addr, real_packet->border_city_permanent_radius_sq);
8519#ifdef FREECIV_JSON_CONNECTION
8520 field_addr.name = "borders";
8521#endif /* FREECIV_JSON_CONNECTION */
8522 DIO_PUT(uint8, &dout, &field_addr, real_packet->borders);
8523#ifdef FREECIV_JSON_CONNECTION
8524 field_addr.name = "base_bribe_cost";
8525#endif /* FREECIV_JSON_CONNECTION */
8526 DIO_PUT(uint32, &dout, &field_addr, real_packet->base_bribe_cost);
8527#ifdef FREECIV_JSON_CONNECTION
8528 field_addr.name = "caravan_bonus_style";
8529#endif /* FREECIV_JSON_CONNECTION */
8530 DIO_PUT(uint8, &dout, &field_addr, real_packet->caravan_bonus_style);
8531#ifdef FREECIV_JSON_CONNECTION
8532 field_addr.name = "culture_vic_points";
8533#endif /* FREECIV_JSON_CONNECTION */
8534 DIO_PUT(uint32, &dout, &field_addr, real_packet->culture_vic_points);
8535#ifdef FREECIV_JSON_CONNECTION
8536 field_addr.name = "culture_vic_lead";
8537#endif /* FREECIV_JSON_CONNECTION */
8538 DIO_PUT(uint16, &dout, &field_addr, real_packet->culture_vic_lead);
8539#ifdef FREECIV_JSON_CONNECTION
8540 field_addr.name = "culture_migration_pml";
8541#endif /* FREECIV_JSON_CONNECTION */
8542 DIO_PUT(uint16, &dout, &field_addr, real_packet->culture_migration_pml);
8543#ifdef FREECIV_JSON_CONNECTION
8544 field_addr.name = "history_interest_pml";
8545#endif /* FREECIV_JSON_CONNECTION */
8546 DIO_PUT(uint16, &dout, &field_addr, real_packet->history_interest_pml);
8547#ifdef FREECIV_JSON_CONNECTION
8548 field_addr.name = "celebratesize";
8549#endif /* FREECIV_JSON_CONNECTION */
8550 DIO_PUT(uint8, &dout, &field_addr, real_packet->celebratesize);
8551#ifdef FREECIV_JSON_CONNECTION
8552 field_addr.name = "changable_tax";
8553#endif /* FREECIV_JSON_CONNECTION */
8554 DIO_PUT(bool8, &dout, &field_addr, real_packet->changable_tax);
8555#ifdef FREECIV_JSON_CONNECTION
8556 field_addr.name = "pop_report_zeroes";
8557#endif /* FREECIV_JSON_CONNECTION */
8558 DIO_PUT(uint8, &dout, &field_addr, real_packet->pop_report_zeroes);
8559#ifdef FREECIV_JSON_CONNECTION
8560 field_addr.name = "citizen_nationality";
8561#endif /* FREECIV_JSON_CONNECTION */
8562 DIO_PUT(bool8, &dout, &field_addr, real_packet->citizen_nationality);
8563#ifdef FREECIV_JSON_CONNECTION
8564 field_addr.name = "citizen_convert_speed";
8565#endif /* FREECIV_JSON_CONNECTION */
8566 DIO_PUT(uint16, &dout, &field_addr, real_packet->citizen_convert_speed);
8567#ifdef FREECIV_JSON_CONNECTION
8568 field_addr.name = "conquest_convert_pct";
8569#endif /* FREECIV_JSON_CONNECTION */
8570 DIO_PUT(uint8, &dout, &field_addr, real_packet->conquest_convert_pct);
8571#ifdef FREECIV_JSON_CONNECTION
8572 field_addr.name = "citizen_partisans_pct";
8573#endif /* FREECIV_JSON_CONNECTION */
8574 DIO_PUT(uint8, &dout, &field_addr, real_packet->citizen_partisans_pct);
8575#ifdef FREECIV_JSON_CONNECTION
8576 field_addr.name = "citymindist";
8577#endif /* FREECIV_JSON_CONNECTION */
8578 DIO_PUT(uint8, &dout, &field_addr, real_packet->citymindist);
8579#ifdef FREECIV_JSON_CONNECTION
8580 field_addr.name = "cooling";
8581#endif /* FREECIV_JSON_CONNECTION */
8582 DIO_PUT(uint32, &dout, &field_addr, real_packet->cooling);
8583#ifdef FREECIV_JSON_CONNECTION
8584 field_addr.name = "coolinglevel";
8585#endif /* FREECIV_JSON_CONNECTION */
8586 DIO_PUT(uint32, &dout, &field_addr, real_packet->coolinglevel);
8587#ifdef FREECIV_JSON_CONNECTION
8588 field_addr.name = "diplchance_initial_odds";
8589#endif /* FREECIV_JSON_CONNECTION */
8590 DIO_BV_PUT(&dout, &field_addr, packet->diplchance_initial_odds);
8591#ifdef FREECIV_JSON_CONNECTION
8592 field_addr.name = "diplomacy";
8593#endif /* FREECIV_JSON_CONNECTION */
8594 DIO_PUT(uint8, &dout, &field_addr, real_packet->diplomacy);
8595#ifdef FREECIV_JSON_CONNECTION
8596 field_addr.name = "fogofwar";
8597#endif /* FREECIV_JSON_CONNECTION */
8598 DIO_PUT(bool8, &dout, &field_addr, real_packet->fogofwar);
8599#ifdef FREECIV_JSON_CONNECTION
8600 field_addr.name = "food_cost";
8601#endif /* FREECIV_JSON_CONNECTION */
8602 DIO_PUT(uint16, &dout, &field_addr, real_packet->food_cost);
8603#ifdef FREECIV_JSON_CONNECTION
8604 field_addr.name = "foodbox";
8605#endif /* FREECIV_JSON_CONNECTION */
8606 DIO_PUT(uint32, &dout, &field_addr, real_packet->foodbox);
8607#ifdef FREECIV_JSON_CONNECTION
8608 field_addr.name = "forced_gold";
8609#endif /* FREECIV_JSON_CONNECTION */
8610 DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_gold);
8611#ifdef FREECIV_JSON_CONNECTION
8612 field_addr.name = "forced_luxury";
8613#endif /* FREECIV_JSON_CONNECTION */
8614 DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_luxury);
8615#ifdef FREECIV_JSON_CONNECTION
8616 field_addr.name = "forced_science";
8617#endif /* FREECIV_JSON_CONNECTION */
8618 DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_science);
8619#ifdef FREECIV_JSON_CONNECTION
8620 field_addr.name = "fulltradesize";
8621#endif /* FREECIV_JSON_CONNECTION */
8622 DIO_PUT(uint8, &dout, &field_addr, real_packet->fulltradesize);
8623#ifdef FREECIV_JSON_CONNECTION
8624 field_addr.name = "trade_world_rel_pct";
8625#endif /* FREECIV_JSON_CONNECTION */
8626 DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_world_rel_pct);
8627#ifdef FREECIV_JSON_CONNECTION
8628 field_addr.name = "min_trade_route_val";
8629#endif /* FREECIV_JSON_CONNECTION */
8630 DIO_PUT(uint8, &dout, &field_addr, real_packet->min_trade_route_val);
8631#ifdef FREECIV_JSON_CONNECTION
8632 field_addr.name = "goods_selection";
8633#endif /* FREECIV_JSON_CONNECTION */
8634 DIO_PUT(uint8, &dout, &field_addr, real_packet->goods_selection);
8635#ifdef FREECIV_JSON_CONNECTION
8636 field_addr.name = "global_advance_count";
8637#endif /* FREECIV_JSON_CONNECTION */
8638 DIO_PUT(uint16, &dout, &field_addr, real_packet->global_advance_count);
8639#ifdef FREECIV_JSON_CONNECTION
8640 field_addr.name = "global_advances";
8641#endif /* FREECIV_JSON_CONNECTION */
8642
8643 {
8644 int i;
8645
8646#ifdef FREECIV_JSON_CONNECTION
8647 /* Create the array. */
8648 DIO_PUT(farray, &dout, &field_addr, A_LAST);
8649
8650 /* Enter the array. */
8651 field_addr.sub_location = plocation_elem_new(0);
8652#endif /* FREECIV_JSON_CONNECTION */
8653
8654 for (i = 0; i < A_LAST; i++) {
8655#ifdef FREECIV_JSON_CONNECTION
8656 /* Next array element. */
8657 field_addr.sub_location->number = i;
8658#endif /* FREECIV_JSON_CONNECTION */
8659 DIO_PUT(bool8, &dout, &field_addr, real_packet->global_advances[i]);
8660 }
8661
8662#ifdef FREECIV_JSON_CONNECTION
8663 /* Exit array. */
8664 free(field_addr.sub_location);
8665 field_addr.sub_location = NULL;
8666#endif /* FREECIV_JSON_CONNECTION */
8667 }
8668#ifdef FREECIV_JSON_CONNECTION
8669 field_addr.name = "global_warming";
8670#endif /* FREECIV_JSON_CONNECTION */
8671 DIO_PUT(bool8, &dout, &field_addr, real_packet->global_warming);
8672#ifdef FREECIV_JSON_CONNECTION
8673 field_addr.name = "globalwarming";
8674#endif /* FREECIV_JSON_CONNECTION */
8675 DIO_PUT(uint32, &dout, &field_addr, real_packet->globalwarming);
8676#ifdef FREECIV_JSON_CONNECTION
8677 field_addr.name = "gold";
8678#endif /* FREECIV_JSON_CONNECTION */
8679 DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
8680#ifdef FREECIV_JSON_CONNECTION
8681 field_addr.name = "gold_upkeep_style";
8682#endif /* FREECIV_JSON_CONNECTION */
8683 DIO_PUT(uint8, &dout, &field_addr, real_packet->gold_upkeep_style);
8684#ifdef FREECIV_JSON_CONNECTION
8685 field_addr.name = "infrapoints";
8686#endif /* FREECIV_JSON_CONNECTION */
8687 DIO_PUT(uint32, &dout, &field_addr, real_packet->infrapoints);
8688#ifdef FREECIV_JSON_CONNECTION
8689 field_addr.name = "revolentype";
8690#endif /* FREECIV_JSON_CONNECTION */
8691 DIO_PUT(uint8, &dout, &field_addr, real_packet->revolentype);
8692#ifdef FREECIV_JSON_CONNECTION
8693 field_addr.name = "default_government_id";
8694#endif /* FREECIV_JSON_CONNECTION */
8695 DIO_PUT(sint8, &dout, &field_addr, real_packet->default_government_id);
8696#ifdef FREECIV_JSON_CONNECTION
8697 field_addr.name = "government_during_revolution_id";
8698#endif /* FREECIV_JSON_CONNECTION */
8699 DIO_PUT(sint8, &dout, &field_addr, real_packet->government_during_revolution_id);
8700#ifdef FREECIV_JSON_CONNECTION
8701 field_addr.name = "granary_food_inc";
8702#endif /* FREECIV_JSON_CONNECTION */
8703 DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_food_inc);
8704#ifdef FREECIV_JSON_CONNECTION
8705 field_addr.name = "granary_food_ini";
8706#endif /* FREECIV_JSON_CONNECTION */
8707
8708 {
8709 int i;
8710
8711#ifdef FREECIV_JSON_CONNECTION
8712 /* Create the array. */
8713 DIO_PUT(farray, &dout, &field_addr, MAX_GRANARY_INIS);
8714
8715 /* Enter the array. */
8716 field_addr.sub_location = plocation_elem_new(0);
8717#endif /* FREECIV_JSON_CONNECTION */
8718
8719 for (i = 0; i < MAX_GRANARY_INIS; i++) {
8720#ifdef FREECIV_JSON_CONNECTION
8721 /* Next array element. */
8722 field_addr.sub_location->number = i;
8723#endif /* FREECIV_JSON_CONNECTION */
8724 DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_food_ini[i]);
8725 }
8726
8727#ifdef FREECIV_JSON_CONNECTION
8728 /* Exit array. */
8729 free(field_addr.sub_location);
8730 field_addr.sub_location = NULL;
8731#endif /* FREECIV_JSON_CONNECTION */
8732 }
8733#ifdef FREECIV_JSON_CONNECTION
8734 field_addr.name = "granary_num_inis";
8735#endif /* FREECIV_JSON_CONNECTION */
8736 DIO_PUT(uint8, &dout, &field_addr, real_packet->granary_num_inis);
8737#ifdef FREECIV_JSON_CONNECTION
8738 field_addr.name = "great_wonder_owners";
8739#endif /* FREECIV_JSON_CONNECTION */
8740
8741 {
8742 int i;
8743
8744#ifdef FREECIV_JSON_CONNECTION
8745 /* Create the array. */
8746 DIO_PUT(farray, &dout, &field_addr, B_LAST);
8747
8748 /* Enter the array. */
8749 field_addr.sub_location = plocation_elem_new(0);
8750#endif /* FREECIV_JSON_CONNECTION */
8751
8752 for (i = 0; i < B_LAST; i++) {
8753#ifdef FREECIV_JSON_CONNECTION
8754 /* Next array element. */
8755 field_addr.sub_location->number = i;
8756#endif /* FREECIV_JSON_CONNECTION */
8757 DIO_PUT(uint16, &dout, &field_addr, real_packet->great_wonder_owners[i]);
8758 }
8759
8760#ifdef FREECIV_JSON_CONNECTION
8761 /* Exit array. */
8762 free(field_addr.sub_location);
8763 field_addr.sub_location = NULL;
8764#endif /* FREECIV_JSON_CONNECTION */
8765 }
8766#ifdef FREECIV_JSON_CONNECTION
8767 field_addr.name = "happy_cost";
8768#endif /* FREECIV_JSON_CONNECTION */
8769 DIO_PUT(uint16, &dout, &field_addr, real_packet->happy_cost);
8770#ifdef FREECIV_JSON_CONNECTION
8771 field_addr.name = "happyborders";
8772#endif /* FREECIV_JSON_CONNECTION */
8773 DIO_PUT(uint8, &dout, &field_addr, real_packet->happyborders);
8774#ifdef FREECIV_JSON_CONNECTION
8775 field_addr.name = "heating";
8776#endif /* FREECIV_JSON_CONNECTION */
8777 DIO_PUT(uint32, &dout, &field_addr, real_packet->heating);
8778#ifdef FREECIV_JSON_CONNECTION
8779 field_addr.name = "illness_base_factor";
8780#endif /* FREECIV_JSON_CONNECTION */
8781 DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_base_factor);
8782#ifdef FREECIV_JSON_CONNECTION
8783 field_addr.name = "illness_min_size";
8784#endif /* FREECIV_JSON_CONNECTION */
8785 DIO_PUT(uint8, &dout, &field_addr, real_packet->illness_min_size);
8786#ifdef FREECIV_JSON_CONNECTION
8787 field_addr.name = "illness_on";
8788#endif /* FREECIV_JSON_CONNECTION */
8789 DIO_PUT(bool8, &dout, &field_addr, real_packet->illness_on);
8790#ifdef FREECIV_JSON_CONNECTION
8791 field_addr.name = "illness_pollution_factor";
8792#endif /* FREECIV_JSON_CONNECTION */
8793 DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_pollution_factor);
8794#ifdef FREECIV_JSON_CONNECTION
8795 field_addr.name = "illness_trade_infection";
8796#endif /* FREECIV_JSON_CONNECTION */
8797 DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade_infection);
8798#ifdef FREECIV_JSON_CONNECTION
8799 field_addr.name = "init_city_radius_sq";
8800#endif /* FREECIV_JSON_CONNECTION */
8801 DIO_PUT(uint8, &dout, &field_addr, real_packet->init_city_radius_sq);
8802#ifdef FREECIV_JSON_CONNECTION
8803 field_addr.name = "is_edit_mode";
8804#endif /* FREECIV_JSON_CONNECTION */
8805 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_edit_mode);
8806#ifdef FREECIV_JSON_CONNECTION
8807 field_addr.name = "is_new_game";
8808#endif /* FREECIV_JSON_CONNECTION */
8809 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_new_game);
8810#ifdef FREECIV_JSON_CONNECTION
8811 field_addr.name = "killcitizen";
8812#endif /* FREECIV_JSON_CONNECTION */
8813 DIO_PUT(bool8, &dout, &field_addr, real_packet->killcitizen);
8814#ifdef FREECIV_JSON_CONNECTION
8815 field_addr.name = "killstack";
8816#endif /* FREECIV_JSON_CONNECTION */
8817 DIO_PUT(bool8, &dout, &field_addr, real_packet->killstack);
8818#ifdef FREECIV_JSON_CONNECTION
8819 field_addr.name = "only_killing_makes_veteran";
8820#endif /* FREECIV_JSON_CONNECTION */
8821 DIO_PUT(bool8, &dout, &field_addr, real_packet->only_killing_makes_veteran);
8822#ifdef FREECIV_JSON_CONNECTION
8823 field_addr.name = "only_real_fight_makes_veteran";
8824#endif /* FREECIV_JSON_CONNECTION */
8825 DIO_PUT(bool8, &dout, &field_addr, real_packet->only_real_fight_makes_veteran);
8826#ifdef FREECIV_JSON_CONNECTION
8827 field_addr.name = "combat_odds_scaled_veterancy";
8828#endif /* FREECIV_JSON_CONNECTION */
8829 DIO_PUT(bool8, &dout, &field_addr, real_packet->combat_odds_scaled_veterancy);
8830#ifdef FREECIV_JSON_CONNECTION
8831 field_addr.name = "damage_reduces_bombard_rate";
8832#endif /* FREECIV_JSON_CONNECTION */
8833 DIO_PUT(bool8, &dout, &field_addr, real_packet->damage_reduces_bombard_rate);
8834#ifdef FREECIV_JSON_CONNECTION
8835 field_addr.name = "low_firepower_badwallattacker";
8836#endif /* FREECIV_JSON_CONNECTION */
8837 DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_badwallattacker);
8838#ifdef FREECIV_JSON_CONNECTION
8839 field_addr.name = "low_firepower_pearl_harbour";
8840#endif /* FREECIV_JSON_CONNECTION */
8841 DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_pearl_harbour);
8842#ifdef FREECIV_JSON_CONNECTION
8843 field_addr.name = "low_firepower_combat_bonus";
8844#endif /* FREECIV_JSON_CONNECTION */
8845 DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_combat_bonus);
8846#ifdef FREECIV_JSON_CONNECTION
8847 field_addr.name = "low_firepower_nonnat_bombard";
8848#endif /* FREECIV_JSON_CONNECTION */
8849 DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_nonnat_bombard);
8850#ifdef FREECIV_JSON_CONNECTION
8851 field_addr.name = "nuke_pop_loss_pct";
8852#endif /* FREECIV_JSON_CONNECTION */
8853 DIO_PUT(uint8, &dout, &field_addr, real_packet->nuke_pop_loss_pct);
8854#ifdef FREECIV_JSON_CONNECTION
8855 field_addr.name = "nuke_defender_survival_chance_pct";
8856#endif /* FREECIV_JSON_CONNECTION */
8857 DIO_PUT(uint8, &dout, &field_addr, real_packet->nuke_defender_survival_chance_pct);
8858#ifdef FREECIV_JSON_CONNECTION
8859 field_addr.name = "min_city_center_output";
8860#endif /* FREECIV_JSON_CONNECTION */
8861
8862 {
8863 int i;
8864
8865#ifdef FREECIV_JSON_CONNECTION
8866 /* Create the array. */
8867 DIO_PUT(farray, &dout, &field_addr, O_LAST);
8868
8869 /* Enter the array. */
8870 field_addr.sub_location = plocation_elem_new(0);
8871#endif /* FREECIV_JSON_CONNECTION */
8872
8873 for (i = 0; i < O_LAST; i++) {
8874#ifdef FREECIV_JSON_CONNECTION
8875 /* Next array element. */
8876 field_addr.sub_location->number = i;
8877#endif /* FREECIV_JSON_CONNECTION */
8878 DIO_PUT(uint16, &dout, &field_addr, real_packet->min_city_center_output[i]);
8879 }
8880
8881#ifdef FREECIV_JSON_CONNECTION
8882 /* Exit array. */
8883 free(field_addr.sub_location);
8884 field_addr.sub_location = NULL;
8885#endif /* FREECIV_JSON_CONNECTION */
8886 }
8887#ifdef FREECIV_JSON_CONNECTION
8888 field_addr.name = "muuk_food_wipe";
8889#endif /* FREECIV_JSON_CONNECTION */
8890 DIO_PUT(bool8, &dout, &field_addr, real_packet->muuk_food_wipe);
8891#ifdef FREECIV_JSON_CONNECTION
8892 field_addr.name = "muuk_gold_wipe";
8893#endif /* FREECIV_JSON_CONNECTION */
8894 DIO_PUT(bool8, &dout, &field_addr, real_packet->muuk_gold_wipe);
8895#ifdef FREECIV_JSON_CONNECTION
8896 field_addr.name = "muuk_shield_wipe";
8897#endif /* FREECIV_JSON_CONNECTION */
8898 DIO_PUT(bool8, &dout, &field_addr, real_packet->muuk_shield_wipe);
8899#ifdef FREECIV_JSON_CONNECTION
8900 field_addr.name = "notradesize";
8901#endif /* FREECIV_JSON_CONNECTION */
8902 DIO_PUT(uint8, &dout, &field_addr, real_packet->notradesize);
8903#ifdef FREECIV_JSON_CONNECTION
8904 field_addr.name = "nuclear_winter";
8905#endif /* FREECIV_JSON_CONNECTION */
8906 DIO_PUT(bool8, &dout, &field_addr, real_packet->nuclear_winter);
8907#ifdef FREECIV_JSON_CONNECTION
8908 field_addr.name = "nuclearwinter";
8909#endif /* FREECIV_JSON_CONNECTION */
8910 DIO_PUT(uint32, &dout, &field_addr, real_packet->nuclearwinter);
8911#ifdef FREECIV_JSON_CONNECTION
8912 field_addr.name = "phase";
8913#endif /* FREECIV_JSON_CONNECTION */
8914 DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
8915#ifdef FREECIV_JSON_CONNECTION
8916 field_addr.name = "phase_mode";
8917#endif /* FREECIV_JSON_CONNECTION */
8918 DIO_PUT(uint8, &dout, &field_addr, real_packet->phase_mode);
8919#ifdef FREECIV_JSON_CONNECTION
8920 field_addr.name = "pillage_select";
8921#endif /* FREECIV_JSON_CONNECTION */
8922 DIO_PUT(bool8, &dout, &field_addr, real_packet->pillage_select);
8923#ifdef FREECIV_JSON_CONNECTION
8924 field_addr.name = "steal_maps_reveals_all_cities";
8925#endif /* FREECIV_JSON_CONNECTION */
8926 DIO_PUT(bool8, &dout, &field_addr, real_packet->steal_maps_reveals_all_cities);
8927#ifdef FREECIV_JSON_CONNECTION
8928 field_addr.name = "poison_empties_food_stock";
8929#endif /* FREECIV_JSON_CONNECTION */
8930 DIO_PUT(bool8, &dout, &field_addr, real_packet->poison_empties_food_stock);
8931#ifdef FREECIV_JSON_CONNECTION
8932 field_addr.name = "tech_steal_allow_holes";
8933#endif /* FREECIV_JSON_CONNECTION */
8934 DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_steal_allow_holes);
8935#ifdef FREECIV_JSON_CONNECTION
8936 field_addr.name = "tech_trade_allow_holes";
8937#endif /* FREECIV_JSON_CONNECTION */
8938 DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_trade_allow_holes);
8939#ifdef FREECIV_JSON_CONNECTION
8940 field_addr.name = "tech_trade_loss_allow_holes";
8941#endif /* FREECIV_JSON_CONNECTION */
8942 DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_trade_loss_allow_holes);
8943#ifdef FREECIV_JSON_CONNECTION
8944 field_addr.name = "tech_parasite_allow_holes";
8945#endif /* FREECIV_JSON_CONNECTION */
8946 DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_parasite_allow_holes);
8947#ifdef FREECIV_JSON_CONNECTION
8948 field_addr.name = "tech_loss_allow_holes";
8949#endif /* FREECIV_JSON_CONNECTION */
8950 DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_loss_allow_holes);
8951#ifdef FREECIV_JSON_CONNECTION
8952 field_addr.name = "rapturedelay";
8953#endif /* FREECIV_JSON_CONNECTION */
8954 DIO_PUT(uint8, &dout, &field_addr, real_packet->rapturedelay);
8955#ifdef FREECIV_JSON_CONNECTION
8956 field_addr.name = "disasters";
8957#endif /* FREECIV_JSON_CONNECTION */
8958 DIO_PUT(uint16, &dout, &field_addr, real_packet->disasters);
8959#ifdef FREECIV_JSON_CONNECTION
8960 field_addr.name = "restrictinfra";
8961#endif /* FREECIV_JSON_CONNECTION */
8962 DIO_PUT(bool8, &dout, &field_addr, real_packet->restrictinfra);
8963#ifdef FREECIV_JSON_CONNECTION
8964 field_addr.name = "unreachable_protects";
8965#endif /* FREECIV_JSON_CONNECTION */
8966 DIO_PUT(bool8, &dout, &field_addr, real_packet->unreachable_protects);
8967#ifdef FREECIV_JSON_CONNECTION
8968 field_addr.name = "sciencebox";
8969#endif /* FREECIV_JSON_CONNECTION */
8970 DIO_PUT(uint32, &dout, &field_addr, real_packet->sciencebox);
8971#ifdef FREECIV_JSON_CONNECTION
8972 field_addr.name = "shieldbox";
8973#endif /* FREECIV_JSON_CONNECTION */
8974 DIO_PUT(uint32, &dout, &field_addr, real_packet->shieldbox);
8975#ifdef FREECIV_JSON_CONNECTION
8976 field_addr.name = "skill_level";
8977#endif /* FREECIV_JSON_CONNECTION */
8978 DIO_PUT(uint8, &dout, &field_addr, real_packet->skill_level);
8979#ifdef FREECIV_JSON_CONNECTION
8980 field_addr.name = "victory_conditions";
8981#endif /* FREECIV_JSON_CONNECTION */
8982 DIO_PUT(uint8, &dout, &field_addr, real_packet->victory_conditions);
8983#ifdef FREECIV_JSON_CONNECTION
8984 field_addr.name = "team_pooled_research";
8985#endif /* FREECIV_JSON_CONNECTION */
8986 DIO_PUT(bool8, &dout, &field_addr, real_packet->team_pooled_research);
8987#ifdef FREECIV_JSON_CONNECTION
8988 field_addr.name = "tech";
8989#endif /* FREECIV_JSON_CONNECTION */
8990 DIO_PUT(uint32, &dout, &field_addr, real_packet->tech);
8991#ifdef FREECIV_JSON_CONNECTION
8992 field_addr.name = "tech_cost_style";
8993#endif /* FREECIV_JSON_CONNECTION */
8994 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_cost_style);
8995#ifdef FREECIV_JSON_CONNECTION
8996 field_addr.name = "tech_leakage";
8997#endif /* FREECIV_JSON_CONNECTION */
8998 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_leakage);
8999#ifdef FREECIV_JSON_CONNECTION
9000 field_addr.name = "tech_upkeep_divider";
9001#endif /* FREECIV_JSON_CONNECTION */
9002 DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_upkeep_divider);
9003#ifdef FREECIV_JSON_CONNECTION
9004 field_addr.name = "tech_upkeep_style";
9005#endif /* FREECIV_JSON_CONNECTION */
9006 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_upkeep_style);
9007#ifdef FREECIV_JSON_CONNECTION
9008 field_addr.name = "techloss_forgiveness";
9009#endif /* FREECIV_JSON_CONNECTION */
9010 DIO_PUT(sint16, &dout, &field_addr, real_packet->techloss_forgiveness);
9011#ifdef FREECIV_JSON_CONNECTION
9012 field_addr.name = "free_tech_method";
9013#endif /* FREECIV_JSON_CONNECTION */
9014 DIO_PUT(uint8, &dout, &field_addr, real_packet->free_tech_method);
9015#ifdef FREECIV_JSON_CONNECTION
9016 field_addr.name = "gameloss_style";
9017#endif /* FREECIV_JSON_CONNECTION */
9018 DIO_PUT(uint8, &dout, &field_addr, real_packet->gameloss_style);
9019#ifdef FREECIV_JSON_CONNECTION
9020 field_addr.name = "timeout";
9021#endif /* FREECIV_JSON_CONNECTION */
9022 DIO_PUT(uint32, &dout, &field_addr, real_packet->timeout);
9023#ifdef FREECIV_JSON_CONNECTION
9024 field_addr.name = "first_timeout";
9025#endif /* FREECIV_JSON_CONNECTION */
9026 DIO_PUT(uint32, &dout, &field_addr, real_packet->first_timeout);
9027#ifdef FREECIV_JSON_CONNECTION
9028 field_addr.name = "tired_attack";
9029#endif /* FREECIV_JSON_CONNECTION */
9030 DIO_PUT(bool8, &dout, &field_addr, real_packet->tired_attack);
9031#ifdef FREECIV_JSON_CONNECTION
9032 field_addr.name = "trademindist";
9033#endif /* FREECIV_JSON_CONNECTION */
9034 DIO_PUT(uint16, &dout, &field_addr, real_packet->trademindist);
9035#ifdef FREECIV_JSON_CONNECTION
9036 field_addr.name = "trade_revenue_style";
9037#endif /* FREECIV_JSON_CONNECTION */
9038 DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_revenue_style);
9039#ifdef FREECIV_JSON_CONNECTION
9040 field_addr.name = "trading_city";
9041#endif /* FREECIV_JSON_CONNECTION */
9042 DIO_PUT(bool8, &dout, &field_addr, real_packet->trading_city);
9043#ifdef FREECIV_JSON_CONNECTION
9044 field_addr.name = "trading_gold";
9045#endif /* FREECIV_JSON_CONNECTION */
9046 DIO_PUT(bool8, &dout, &field_addr, real_packet->trading_gold);
9047#ifdef FREECIV_JSON_CONNECTION
9048 field_addr.name = "trading_tech";
9049#endif /* FREECIV_JSON_CONNECTION */
9050 DIO_PUT(bool8, &dout, &field_addr, real_packet->trading_tech);
9051#ifdef FREECIV_JSON_CONNECTION
9052 field_addr.name = "turn";
9053#endif /* FREECIV_JSON_CONNECTION */
9054 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
9055#ifdef FREECIV_JSON_CONNECTION
9056 field_addr.name = "warminglevel";
9057#endif /* FREECIV_JSON_CONNECTION */
9058 DIO_PUT(uint32, &dout, &field_addr, real_packet->warminglevel);
9059#ifdef FREECIV_JSON_CONNECTION
9060 field_addr.name = "year";
9061#endif /* FREECIV_JSON_CONNECTION */
9062 DIO_PUT(sint32, &dout, &field_addr, real_packet->year);
9063#ifdef FREECIV_JSON_CONNECTION
9064 field_addr.name = "year_0_hack";
9065#endif /* FREECIV_JSON_CONNECTION */
9066 DIO_PUT(bool8, &dout, &field_addr, real_packet->year_0_hack);
9067#ifdef FREECIV_JSON_CONNECTION
9068 field_addr.name = "fragment_count";
9069#endif /* FREECIV_JSON_CONNECTION */
9070 DIO_PUT(uint16, &dout, &field_addr, real_packet->fragment_count);
9071#ifdef FREECIV_JSON_CONNECTION
9072 field_addr.name = "civil_war_enabled";
9073#endif /* FREECIV_JSON_CONNECTION */
9074 DIO_PUT(bool8, &dout, &field_addr, real_packet->civil_war_enabled);
9075#ifdef FREECIV_JSON_CONNECTION
9076 field_addr.name = "civil_war_bonus_celebrating";
9077#endif /* FREECIV_JSON_CONNECTION */
9078 DIO_PUT(sint16, &dout, &field_addr, real_packet->civil_war_bonus_celebrating);
9079#ifdef FREECIV_JSON_CONNECTION
9080 field_addr.name = "civil_war_bonus_unhappy";
9081#endif /* FREECIV_JSON_CONNECTION */
9082 DIO_PUT(sint16, &dout, &field_addr, real_packet->civil_war_bonus_unhappy);
9083#ifdef FREECIV_JSON_CONNECTION
9084 field_addr.name = "granularity";
9085#endif /* FREECIV_JSON_CONNECTION */
9086 DIO_PUT(uint16, &dout, &field_addr, real_packet->granularity);
9087#ifdef FREECIV_JSON_CONNECTION
9088 field_addr.name = "small_wonder_visibility";
9089#endif /* FREECIV_JSON_CONNECTION */
9090 DIO_PUT(uint8, &dout, &field_addr, real_packet->small_wonder_visibility);
9091
9092#endif
9093 SEND_PACKET_END(PACKET_GAME_INFO);
9094}
9095
9096 int send_packet_game_info(struct connection *pc, const struct packet_game_info *packet)
9097{
9098 if (!pc->used) {
9099 log_error("WARNING: trying to send data to the closed connection %s",
9100 conn_description(pc));
9101 return -1;
9102 }
9103 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_GAME_INFO].packet != NULL, -1,
9104 "Handler for PACKET_GAME_INFO not installed");
9105 return pc->phs.handlers->send[PACKET_GAME_INFO].packet(pc, packet);
9106}
9107
9108#ifdef FREECIV_DELTA_PROTOCOL
9109#define hash_packet_calendar_info_100 hash_const
9110
9111#define cmp_packet_calendar_info_100 cmp_const
9112
9113 BV_DEFINE(packet_calendar_info_100_fields, 5);
9114#endif /* FREECIV_DELTA_PROTOCOL */
9115
9116 static struct packet_calendar_info *receive_packet_calendar_info_100(struct connection *pc)
9117{
9118#ifdef FREECIV_DELTA_PROTOCOL
9119 packet_calendar_info_100_fields fields;
9120 struct packet_calendar_info *old;
9121 struct genhash **hash = pc->phs.received + PACKET_CALENDAR_INFO;
9122#endif /* FREECIV_DELTA_PROTOCOL */
9123 RECEIVE_PACKET_START(packet_calendar_info, real_packet);
9124#ifdef FREECIV_JSON_CONNECTION
9125 struct plocation field_addr;
9126 {
9127 struct plocation *field_addr_tmp = plocation_field_new(NULL);
9128 field_addr = *field_addr_tmp;
9129 FC_FREE(field_addr_tmp);
9130 }
9131#endif /* FREECIV_JSON_CONNECTION */
9132
9133#ifdef FREECIV_DELTA_PROTOCOL
9134#ifdef FREECIV_JSON_CONNECTION
9135 field_addr.name = "fields";
9136#endif /* FREECIV_JSON_CONNECTION */
9137 DIO_BV_GET(&din, &field_addr, fields);
9138
9139#else /* FREECIV_DELTA_PROTOCOL */
9140 #ifdef FREECIV_JSON_CONNECTION
9141 field_addr.name = "positive_year_label";
9142 #endif /* FREECIV_JSON_CONNECTION */
9143 if (!DIO_GET(string, &din, &field_addr, real_packet->positive_year_label, sizeof(real_packet->positive_year_label))) {
9144 RECEIVE_PACKET_FIELD_ERROR(positive_year_label);
9145 }
9146 #ifdef FREECIV_JSON_CONNECTION
9147 field_addr.name = "negative_year_label";
9148 #endif /* FREECIV_JSON_CONNECTION */
9149 if (!DIO_GET(string, &din, &field_addr, real_packet->negative_year_label, sizeof(real_packet->negative_year_label))) {
9150 RECEIVE_PACKET_FIELD_ERROR(negative_year_label);
9151 }
9152 #ifdef FREECIV_JSON_CONNECTION
9153 field_addr.name = "calendar_fragments";
9154 #endif /* FREECIV_JSON_CONNECTION */
9155 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->calendar_fragments)) {
9156 RECEIVE_PACKET_FIELD_ERROR(calendar_fragments);
9157 }
9158 #ifdef FREECIV_JSON_CONNECTION
9159 field_addr.name = "calendar_fragment_name";
9160 #endif /* FREECIV_JSON_CONNECTION */
9161
9162 {
9163 int i;
9164
9165 #ifdef FREECIV_JSON_CONNECTION
9166 /* Enter array. */
9167 field_addr.sub_location = plocation_elem_new(0);
9168 #endif /* FREECIV_JSON_CONNECTION */
9169
9170 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
9171 #ifdef FREECIV_JSON_CONNECTION
9172 field_addr.sub_location->number = i;
9173 #endif /* FREECIV_JSON_CONNECTION */
9174 if (!DIO_GET(string, &din, &field_addr, real_packet->calendar_fragment_name[i], sizeof(real_packet->calendar_fragment_name[i]))) {
9175 RECEIVE_PACKET_FIELD_ERROR(calendar_fragment_name);
9176 }
9177 }
9178
9179 #ifdef FREECIV_JSON_CONNECTION
9180 /* Exit array. */
9181 free(field_addr.sub_location);
9182 field_addr.sub_location = NULL;
9183 #endif /* FREECIV_JSON_CONNECTION */
9184 }
9185 #ifdef FREECIV_JSON_CONNECTION
9186 field_addr.name = "calendar_skip_0";
9187 #endif /* FREECIV_JSON_CONNECTION */
9188 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->calendar_skip_0)) {
9189 RECEIVE_PACKET_FIELD_ERROR(calendar_skip_0);
9190 }
9191
9192#endif
9193 log_packet_detailed("packet_calendar_info_100: got info about ()");
9194
9195#ifdef FREECIV_DELTA_PROTOCOL
9196 if (NULL == *hash) {
9197 *hash = genhash_new_full(hash_packet_calendar_info_100, cmp_packet_calendar_info_100,
9198 NULL, NULL, NULL, free);
9199 }
9200
9201 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
9202 *real_packet = *old;
9203 } else {
9204 log_packet_detailed(" no old info");
9205 memset(real_packet, 0, sizeof(*real_packet));
9206 }
9207
9208 if (BV_ISSET(fields, 0)) {
9209 log_packet_detailed(" got field 'positive_year_label'");
9210 #ifdef FREECIV_JSON_CONNECTION
9211 field_addr.name = "positive_year_label";
9212 #endif /* FREECIV_JSON_CONNECTION */
9213 if (!DIO_GET(string, &din, &field_addr, real_packet->positive_year_label, sizeof(real_packet->positive_year_label))) {
9214 RECEIVE_PACKET_FIELD_ERROR(positive_year_label);
9215 }
9216 }
9217 if (BV_ISSET(fields, 1)) {
9218 log_packet_detailed(" got field 'negative_year_label'");
9219 #ifdef FREECIV_JSON_CONNECTION
9220 field_addr.name = "negative_year_label";
9221 #endif /* FREECIV_JSON_CONNECTION */
9222 if (!DIO_GET(string, &din, &field_addr, real_packet->negative_year_label, sizeof(real_packet->negative_year_label))) {
9223 RECEIVE_PACKET_FIELD_ERROR(negative_year_label);
9224 }
9225 }
9226 if (BV_ISSET(fields, 2)) {
9227 log_packet_detailed(" got field 'calendar_fragments'");
9228 #ifdef FREECIV_JSON_CONNECTION
9229 field_addr.name = "calendar_fragments";
9230 #endif /* FREECIV_JSON_CONNECTION */
9231 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->calendar_fragments)) {
9232 RECEIVE_PACKET_FIELD_ERROR(calendar_fragments);
9233 }
9234 }
9235 if (BV_ISSET(fields, 3)) {
9236 log_packet_detailed(" got field 'calendar_fragment_name'");
9237 #ifdef FREECIV_JSON_CONNECTION
9238 field_addr.name = "calendar_fragment_name";
9239 #endif /* FREECIV_JSON_CONNECTION */
9240
9241 {
9242 int i;
9243
9244 #ifdef FREECIV_JSON_CONNECTION
9245 /* Enter array. */
9246 field_addr.sub_location = plocation_elem_new(0);
9247 #endif /* FREECIV_JSON_CONNECTION */
9248
9249 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
9250 #ifdef FREECIV_JSON_CONNECTION
9251 field_addr.sub_location->number = i;
9252 #endif /* FREECIV_JSON_CONNECTION */
9253 if (!DIO_GET(string, &din, &field_addr, real_packet->calendar_fragment_name[i], sizeof(real_packet->calendar_fragment_name[i]))) {
9254 RECEIVE_PACKET_FIELD_ERROR(calendar_fragment_name);
9255 }
9256 }
9257
9258 #ifdef FREECIV_JSON_CONNECTION
9259 /* Exit array. */
9260 free(field_addr.sub_location);
9261 field_addr.sub_location = NULL;
9262 #endif /* FREECIV_JSON_CONNECTION */
9263 }
9264 }
9265 real_packet->calendar_skip_0 = BV_ISSET(fields, 4);
9266
9267 if (NULL == old) {
9268 old = fc_malloc(sizeof(*old));
9269 *old = *real_packet;
9270 genhash_insert(*hash, old, old);
9271 } else {
9272 *old = *real_packet;
9273 }
9274
9275#endif /* FREECIV_DELTA_PROTOCOL */
9276 RECEIVE_PACKET_END(real_packet);
9277}
9278
9279 static int send_packet_calendar_info_100(struct connection *pc, const struct packet_calendar_info *packet)
9280{
9281 const struct packet_calendar_info *real_packet = packet;
9282#ifdef FREECIV_DELTA_PROTOCOL
9283 packet_calendar_info_100_fields fields;
9284 struct packet_calendar_info *old;
9285 bool differ;
9286 struct genhash **hash = pc->phs.sent + PACKET_CALENDAR_INFO;
9287 int different = 0;
9288#endif /* FREECIV_DELTA_PROTOCOL */
9289 SEND_PACKET_START(PACKET_CALENDAR_INFO);
9290#ifdef FREECIV_JSON_CONNECTION
9291 struct plocation field_addr;
9292 {
9293 struct plocation *field_addr_tmp = plocation_field_new(NULL);
9294 field_addr = *field_addr_tmp;
9295 FC_FREE(field_addr_tmp);
9296 }
9297#endif /* FREECIV_JSON_CONNECTION */
9298
9299 log_packet_detailed("packet_calendar_info_100: sending info about ()");
9300
9301#ifdef FREECIV_DELTA_PROTOCOL
9302 if (NULL == *hash) {
9303 *hash = genhash_new_full(hash_packet_calendar_info_100, cmp_packet_calendar_info_100,
9304 NULL, NULL, NULL, free);
9305 }
9306 BV_CLR_ALL(fields);
9307
9308 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
9309 old = fc_malloc(sizeof(*old));
9310 *old = *real_packet;
9311 genhash_insert(*hash, old, old);
9312 memset(old, 0, sizeof(*old));
9313 different = 1; /* Force to send. */
9314 }
9315 differ = (strcmp(old->positive_year_label, real_packet->positive_year_label) != 0);
9316 if (differ) {
9317 different++;
9318 BV_SET(fields, 0);
9319 }
9320
9321 differ = (strcmp(old->negative_year_label, real_packet->negative_year_label) != 0);
9322 if (differ) {
9323 different++;
9324 BV_SET(fields, 1);
9325 }
9326
9327 differ = (old->calendar_fragments != real_packet->calendar_fragments);
9328 if (differ) {
9329 different++;
9330 BV_SET(fields, 2);
9331 }
9332
9333
9334 {
9335 differ = FALSE;
9336 {
9337 int i;
9338
9339 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
9340 if (strcmp(old->calendar_fragment_name[i], real_packet->calendar_fragment_name[i]) != 0) {
9341 differ = TRUE;
9342 break;
9343 }
9344 }
9345 }
9346 }
9347 if (differ) {
9348 different++;
9349 BV_SET(fields, 3);
9350 }
9351
9352 differ = (old->calendar_skip_0 != real_packet->calendar_skip_0);
9353 if (differ) {
9354 different++;
9355 }
9356 if (packet->calendar_skip_0) {
9357 BV_SET(fields, 4);
9358 }
9359
9360
9361 if (different == 0) {
9362 log_packet_detailed(" no change -> discard");
9363 return 0;
9364 }
9365
9366#ifdef FREECIV_JSON_CONNECTION
9367 field_addr.name = "fields";
9368#endif /* FREECIV_JSON_CONNECTION */
9369 DIO_BV_PUT(&dout, &field_addr, fields);
9370
9371 if (BV_ISSET(fields, 0)) {
9372 log_packet_detailed(" field 'positive_year_label' has changed");
9373 #ifdef FREECIV_JSON_CONNECTION
9374 field_addr.name = "positive_year_label";
9375#endif /* FREECIV_JSON_CONNECTION */
9376 DIO_PUT(string, &dout, &field_addr, real_packet->positive_year_label);
9377 }
9378 if (BV_ISSET(fields, 1)) {
9379 log_packet_detailed(" field 'negative_year_label' has changed");
9380 #ifdef FREECIV_JSON_CONNECTION
9381 field_addr.name = "negative_year_label";
9382#endif /* FREECIV_JSON_CONNECTION */
9383 DIO_PUT(string, &dout, &field_addr, real_packet->negative_year_label);
9384 }
9385 if (BV_ISSET(fields, 2)) {
9386 log_packet_detailed(" field 'calendar_fragments' has changed");
9387 #ifdef FREECIV_JSON_CONNECTION
9388 field_addr.name = "calendar_fragments";
9389#endif /* FREECIV_JSON_CONNECTION */
9390 DIO_PUT(uint16, &dout, &field_addr, real_packet->calendar_fragments);
9391 }
9392 if (BV_ISSET(fields, 3)) {
9393 log_packet_detailed(" field 'calendar_fragment_name' has changed");
9394 #ifdef FREECIV_JSON_CONNECTION
9395 field_addr.name = "calendar_fragment_name";
9396#endif /* FREECIV_JSON_CONNECTION */
9397
9398 {
9399 int i;
9400
9401#ifdef FREECIV_JSON_CONNECTION
9402 /* Create the array. */
9403 DIO_PUT(farray, &dout, &field_addr, MAX_CALENDAR_FRAGMENTS);
9404
9405 /* Enter the array. */
9406 field_addr.sub_location = plocation_elem_new(0);
9407#endif /* FREECIV_JSON_CONNECTION */
9408
9409 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
9410#ifdef FREECIV_JSON_CONNECTION
9411 /* Next array element. */
9412 field_addr.sub_location->number = i;
9413#endif /* FREECIV_JSON_CONNECTION */
9414 DIO_PUT(string, &dout, &field_addr, real_packet->calendar_fragment_name[i]);
9415 }
9416
9417#ifdef FREECIV_JSON_CONNECTION
9418 /* Exit array. */
9419 free(field_addr.sub_location);
9420 field_addr.sub_location = NULL;
9421#endif /* FREECIV_JSON_CONNECTION */
9422 }
9423 }
9424 /* field 4 is folded into the header */
9425
9426 *old = *real_packet;
9427#endif /* FREECIV_DELTA_PROTOCOL */
9428#ifndef FREECIV_DELTA_PROTOCOL
9429#ifdef FREECIV_JSON_CONNECTION
9430 field_addr.name = "positive_year_label";
9431#endif /* FREECIV_JSON_CONNECTION */
9432 DIO_PUT(string, &dout, &field_addr, real_packet->positive_year_label);
9433#ifdef FREECIV_JSON_CONNECTION
9434 field_addr.name = "negative_year_label";
9435#endif /* FREECIV_JSON_CONNECTION */
9436 DIO_PUT(string, &dout, &field_addr, real_packet->negative_year_label);
9437#ifdef FREECIV_JSON_CONNECTION
9438 field_addr.name = "calendar_fragments";
9439#endif /* FREECIV_JSON_CONNECTION */
9440 DIO_PUT(uint16, &dout, &field_addr, real_packet->calendar_fragments);
9441#ifdef FREECIV_JSON_CONNECTION
9442 field_addr.name = "calendar_fragment_name";
9443#endif /* FREECIV_JSON_CONNECTION */
9444
9445 {
9446 int i;
9447
9448#ifdef FREECIV_JSON_CONNECTION
9449 /* Create the array. */
9450 DIO_PUT(farray, &dout, &field_addr, MAX_CALENDAR_FRAGMENTS);
9451
9452 /* Enter the array. */
9453 field_addr.sub_location = plocation_elem_new(0);
9454#endif /* FREECIV_JSON_CONNECTION */
9455
9456 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
9457#ifdef FREECIV_JSON_CONNECTION
9458 /* Next array element. */
9459 field_addr.sub_location->number = i;
9460#endif /* FREECIV_JSON_CONNECTION */
9461 DIO_PUT(string, &dout, &field_addr, real_packet->calendar_fragment_name[i]);
9462 }
9463
9464#ifdef FREECIV_JSON_CONNECTION
9465 /* Exit array. */
9466 free(field_addr.sub_location);
9467 field_addr.sub_location = NULL;
9468#endif /* FREECIV_JSON_CONNECTION */
9469 }
9470#ifdef FREECIV_JSON_CONNECTION
9471 field_addr.name = "calendar_skip_0";
9472#endif /* FREECIV_JSON_CONNECTION */
9473 DIO_PUT(bool8, &dout, &field_addr, real_packet->calendar_skip_0);
9474
9475#endif
9476 SEND_PACKET_END(PACKET_CALENDAR_INFO);
9477}
9478
9479 int send_packet_calendar_info(struct connection *pc, const struct packet_calendar_info *packet)
9480{
9481 if (!pc->used) {
9482 log_error("WARNING: trying to send data to the closed connection %s",
9483 conn_description(pc));
9484 return -1;
9485 }
9486 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CALENDAR_INFO].packet != NULL, -1,
9487 "Handler for PACKET_CALENDAR_INFO not installed");
9488 return pc->phs.handlers->send[PACKET_CALENDAR_INFO].packet(pc, packet);
9489}
9490
9491#ifdef FREECIV_DELTA_PROTOCOL
9492#define hash_packet_timeout_info_100 hash_const
9493
9494#define cmp_packet_timeout_info_100 cmp_const
9495
9496 BV_DEFINE(packet_timeout_info_100_fields, 2);
9497#endif /* FREECIV_DELTA_PROTOCOL */
9498
9499 static struct packet_timeout_info *receive_packet_timeout_info_100(struct connection *pc)
9500{
9501#ifdef FREECIV_DELTA_PROTOCOL
9502 packet_timeout_info_100_fields fields;
9503 struct packet_timeout_info *old;
9504 struct genhash **hash = pc->phs.received + PACKET_TIMEOUT_INFO;
9505#endif /* FREECIV_DELTA_PROTOCOL */
9506 RECEIVE_PACKET_START(packet_timeout_info, real_packet);
9507#ifdef FREECIV_JSON_CONNECTION
9508 struct plocation field_addr;
9509 {
9510 struct plocation *field_addr_tmp = plocation_field_new(NULL);
9511 field_addr = *field_addr_tmp;
9512 FC_FREE(field_addr_tmp);
9513 }
9514#endif /* FREECIV_JSON_CONNECTION */
9515
9516#ifdef FREECIV_DELTA_PROTOCOL
9517#ifdef FREECIV_JSON_CONNECTION
9518 field_addr.name = "fields";
9519#endif /* FREECIV_JSON_CONNECTION */
9520 DIO_BV_GET(&din, &field_addr, fields);
9521
9522#else /* FREECIV_DELTA_PROTOCOL */
9523 #ifdef FREECIV_JSON_CONNECTION
9524 field_addr.name = "seconds_to_phasedone";
9525 #endif /* FREECIV_JSON_CONNECTION */
9526 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->seconds_to_phasedone, 100)) {
9527 RECEIVE_PACKET_FIELD_ERROR(seconds_to_phasedone);
9528 }
9529 #ifdef FREECIV_JSON_CONNECTION
9530 field_addr.name = "last_turn_change_time";
9531 #endif /* FREECIV_JSON_CONNECTION */
9532 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->last_turn_change_time, 100)) {
9533 RECEIVE_PACKET_FIELD_ERROR(last_turn_change_time);
9534 }
9535
9536#endif
9537 log_packet_detailed("packet_timeout_info_100: got info about ()");
9538
9539#ifdef FREECIV_DELTA_PROTOCOL
9540 if (NULL == *hash) {
9541 *hash = genhash_new_full(hash_packet_timeout_info_100, cmp_packet_timeout_info_100,
9542 NULL, NULL, NULL, free);
9543 }
9544
9545 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
9546 *real_packet = *old;
9547 } else {
9548 log_packet_detailed(" no old info");
9549 memset(real_packet, 0, sizeof(*real_packet));
9550 }
9551
9552 if (BV_ISSET(fields, 0)) {
9553 log_packet_detailed(" got field 'seconds_to_phasedone'");
9554 #ifdef FREECIV_JSON_CONNECTION
9555 field_addr.name = "seconds_to_phasedone";
9556 #endif /* FREECIV_JSON_CONNECTION */
9557 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->seconds_to_phasedone, 100)) {
9558 RECEIVE_PACKET_FIELD_ERROR(seconds_to_phasedone);
9559 }
9560 }
9561 if (BV_ISSET(fields, 1)) {
9562 log_packet_detailed(" got field 'last_turn_change_time'");
9563 #ifdef FREECIV_JSON_CONNECTION
9564 field_addr.name = "last_turn_change_time";
9565 #endif /* FREECIV_JSON_CONNECTION */
9566 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->last_turn_change_time, 100)) {
9567 RECEIVE_PACKET_FIELD_ERROR(last_turn_change_time);
9568 }
9569 }
9570
9571 if (NULL == old) {
9572 old = fc_malloc(sizeof(*old));
9573 *old = *real_packet;
9574 genhash_insert(*hash, old, old);
9575 } else {
9576 *old = *real_packet;
9577 }
9578
9579#endif /* FREECIV_DELTA_PROTOCOL */
9580 RECEIVE_PACKET_END(real_packet);
9581}
9582
9583 static int send_packet_timeout_info_100(struct connection *pc, const struct packet_timeout_info *packet)
9584{
9585 const struct packet_timeout_info *real_packet = packet;
9586#ifdef FREECIV_DELTA_PROTOCOL
9587 packet_timeout_info_100_fields fields;
9588 struct packet_timeout_info *old;
9589 bool differ;
9590 struct genhash **hash = pc->phs.sent + PACKET_TIMEOUT_INFO;
9591#endif /* FREECIV_DELTA_PROTOCOL */
9592 SEND_PACKET_START(PACKET_TIMEOUT_INFO);
9593#ifdef FREECIV_JSON_CONNECTION
9594 struct plocation field_addr;
9595 {
9596 struct plocation *field_addr_tmp = plocation_field_new(NULL);
9597 field_addr = *field_addr_tmp;
9598 FC_FREE(field_addr_tmp);
9599 }
9600#endif /* FREECIV_JSON_CONNECTION */
9601
9602 log_packet_detailed("packet_timeout_info_100: sending info about ()");
9603
9604#ifdef FREECIV_DELTA_PROTOCOL
9605 if (NULL == *hash) {
9606 *hash = genhash_new_full(hash_packet_timeout_info_100, cmp_packet_timeout_info_100,
9607 NULL, NULL, NULL, free);
9608 }
9609 BV_CLR_ALL(fields);
9610
9611 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
9612 old = fc_malloc(sizeof(*old));
9613 *old = *real_packet;
9614 genhash_insert(*hash, old, old);
9615 memset(old, 0, sizeof(*old));
9616 }
9617 differ = (old->seconds_to_phasedone != real_packet->seconds_to_phasedone);
9618 if (differ) {
9619 BV_SET(fields, 0);
9620 }
9621
9622 differ = (old->last_turn_change_time != real_packet->last_turn_change_time);
9623 if (differ) {
9624 BV_SET(fields, 1);
9625 }
9626
9627
9628#ifdef FREECIV_JSON_CONNECTION
9629 field_addr.name = "fields";
9630#endif /* FREECIV_JSON_CONNECTION */
9631 DIO_BV_PUT(&dout, &field_addr, fields);
9632
9633 if (BV_ISSET(fields, 0)) {
9634 log_packet_detailed(" field 'seconds_to_phasedone' has changed");
9635 #ifdef FREECIV_JSON_CONNECTION
9636 field_addr.name = "seconds_to_phasedone";
9637#endif /* FREECIV_JSON_CONNECTION */
9638 DIO_PUT(sfloat, &dout, &field_addr, real_packet->seconds_to_phasedone, 100);
9639 }
9640 if (BV_ISSET(fields, 1)) {
9641 log_packet_detailed(" field 'last_turn_change_time' has changed");
9642 #ifdef FREECIV_JSON_CONNECTION
9643 field_addr.name = "last_turn_change_time";
9644#endif /* FREECIV_JSON_CONNECTION */
9645 DIO_PUT(sfloat, &dout, &field_addr, real_packet->last_turn_change_time, 100);
9646 }
9647
9648 *old = *real_packet;
9649#endif /* FREECIV_DELTA_PROTOCOL */
9650#ifndef FREECIV_DELTA_PROTOCOL
9651#ifdef FREECIV_JSON_CONNECTION
9652 field_addr.name = "seconds_to_phasedone";
9653#endif /* FREECIV_JSON_CONNECTION */
9654 DIO_PUT(sfloat, &dout, &field_addr, real_packet->seconds_to_phasedone, 100);
9655#ifdef FREECIV_JSON_CONNECTION
9656 field_addr.name = "last_turn_change_time";
9657#endif /* FREECIV_JSON_CONNECTION */
9658 DIO_PUT(sfloat, &dout, &field_addr, real_packet->last_turn_change_time, 100);
9659
9660#endif
9661 SEND_PACKET_END(PACKET_TIMEOUT_INFO);
9662}
9663
9664 int send_packet_timeout_info(struct connection *pc, const struct packet_timeout_info *packet)
9665{
9666 if (!pc->used) {
9667 log_error("WARNING: trying to send data to the closed connection %s",
9668 conn_description(pc));
9669 return -1;
9670 }
9671 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_TIMEOUT_INFO].packet != NULL, -1,
9672 "Handler for PACKET_TIMEOUT_INFO not installed");
9673 return pc->phs.handlers->send[PACKET_TIMEOUT_INFO].packet(pc, packet);
9674}
9675
9676#ifdef FREECIV_DELTA_PROTOCOL
9677#define hash_packet_map_info_100 hash_const
9678
9679#define cmp_packet_map_info_100 cmp_const
9680
9681 BV_DEFINE(packet_map_info_100_fields, 3);
9682#endif /* FREECIV_DELTA_PROTOCOL */
9683
9684 static struct packet_map_info *receive_packet_map_info_100(struct connection *pc)
9685{
9686#ifdef FREECIV_DELTA_PROTOCOL
9687 packet_map_info_100_fields fields;
9688 struct packet_map_info *old;
9689 struct genhash **hash = pc->phs.received + PACKET_MAP_INFO;
9690#endif /* FREECIV_DELTA_PROTOCOL */
9691 RECEIVE_PACKET_START(packet_map_info, real_packet);
9692#ifdef FREECIV_JSON_CONNECTION
9693 struct plocation field_addr;
9694 {
9695 struct plocation *field_addr_tmp = plocation_field_new(NULL);
9696 field_addr = *field_addr_tmp;
9697 FC_FREE(field_addr_tmp);
9698 }
9699#endif /* FREECIV_JSON_CONNECTION */
9700
9701#ifdef FREECIV_DELTA_PROTOCOL
9702#ifdef FREECIV_JSON_CONNECTION
9703 field_addr.name = "fields";
9704#endif /* FREECIV_JSON_CONNECTION */
9705 DIO_BV_GET(&din, &field_addr, fields);
9706
9707#else /* FREECIV_DELTA_PROTOCOL */
9708 #ifdef FREECIV_JSON_CONNECTION
9709 field_addr.name = "xsize";
9710 #endif /* FREECIV_JSON_CONNECTION */
9711 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->xsize)) {
9712 RECEIVE_PACKET_FIELD_ERROR(xsize);
9713 }
9714 #ifdef FREECIV_JSON_CONNECTION
9715 field_addr.name = "ysize";
9716 #endif /* FREECIV_JSON_CONNECTION */
9717 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->ysize)) {
9718 RECEIVE_PACKET_FIELD_ERROR(ysize);
9719 }
9720 #ifdef FREECIV_JSON_CONNECTION
9721 field_addr.name = "topology_id";
9722 #endif /* FREECIV_JSON_CONNECTION */
9723 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->topology_id)) {
9724 RECEIVE_PACKET_FIELD_ERROR(topology_id);
9725 }
9726
9727#endif
9728 log_packet_detailed("packet_map_info_100: got info about ()");
9729
9730#ifdef FREECIV_DELTA_PROTOCOL
9731 if (NULL == *hash) {
9732 *hash = genhash_new_full(hash_packet_map_info_100, cmp_packet_map_info_100,
9733 NULL, NULL, NULL, free);
9734 }
9735
9736 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
9737 *real_packet = *old;
9738 } else {
9739 log_packet_detailed(" no old info");
9740 memset(real_packet, 0, sizeof(*real_packet));
9741 }
9742
9743 if (BV_ISSET(fields, 0)) {
9744 log_packet_detailed(" got field 'xsize'");
9745 #ifdef FREECIV_JSON_CONNECTION
9746 field_addr.name = "xsize";
9747 #endif /* FREECIV_JSON_CONNECTION */
9748 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->xsize)) {
9749 RECEIVE_PACKET_FIELD_ERROR(xsize);
9750 }
9751 }
9752 if (BV_ISSET(fields, 1)) {
9753 log_packet_detailed(" got field 'ysize'");
9754 #ifdef FREECIV_JSON_CONNECTION
9755 field_addr.name = "ysize";
9756 #endif /* FREECIV_JSON_CONNECTION */
9757 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->ysize)) {
9758 RECEIVE_PACKET_FIELD_ERROR(ysize);
9759 }
9760 }
9761 if (BV_ISSET(fields, 2)) {
9762 log_packet_detailed(" got field 'topology_id'");
9763 #ifdef FREECIV_JSON_CONNECTION
9764 field_addr.name = "topology_id";
9765 #endif /* FREECIV_JSON_CONNECTION */
9766 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->topology_id)) {
9767 RECEIVE_PACKET_FIELD_ERROR(topology_id);
9768 }
9769 }
9770
9771 if (NULL == old) {
9772 old = fc_malloc(sizeof(*old));
9773 *old = *real_packet;
9774 genhash_insert(*hash, old, old);
9775 } else {
9776 *old = *real_packet;
9777 }
9778
9779#endif /* FREECIV_DELTA_PROTOCOL */
9780 RECEIVE_PACKET_END(real_packet);
9781}
9782
9783 static int send_packet_map_info_100(struct connection *pc, const struct packet_map_info *packet)
9784{
9785 const struct packet_map_info *real_packet = packet;
9786#ifdef FREECIV_DELTA_PROTOCOL
9787 packet_map_info_100_fields fields;
9788 struct packet_map_info *old;
9789 bool differ;
9790 struct genhash **hash = pc->phs.sent + PACKET_MAP_INFO;
9791#endif /* FREECIV_DELTA_PROTOCOL */
9792 SEND_PACKET_START(PACKET_MAP_INFO);
9793#ifdef FREECIV_JSON_CONNECTION
9794 struct plocation field_addr;
9795 {
9796 struct plocation *field_addr_tmp = plocation_field_new(NULL);
9797 field_addr = *field_addr_tmp;
9798 FC_FREE(field_addr_tmp);
9799 }
9800#endif /* FREECIV_JSON_CONNECTION */
9801
9802 log_packet_detailed("packet_map_info_100: sending info about ()");
9803
9804#ifdef FREECIV_DELTA_PROTOCOL
9805 if (NULL == *hash) {
9806 *hash = genhash_new_full(hash_packet_map_info_100, cmp_packet_map_info_100,
9807 NULL, NULL, NULL, free);
9808 }
9809 BV_CLR_ALL(fields);
9810
9811 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
9812 old = fc_malloc(sizeof(*old));
9813 *old = *real_packet;
9814 genhash_insert(*hash, old, old);
9815 memset(old, 0, sizeof(*old));
9816 }
9817 differ = (old->xsize != real_packet->xsize);
9818 if (differ) {
9819 BV_SET(fields, 0);
9820 }
9821
9822 differ = (old->ysize != real_packet->ysize);
9823 if (differ) {
9824 BV_SET(fields, 1);
9825 }
9826
9827 differ = (old->topology_id != real_packet->topology_id);
9828 if (differ) {
9829 BV_SET(fields, 2);
9830 }
9831
9832
9833#ifdef FREECIV_JSON_CONNECTION
9834 field_addr.name = "fields";
9835#endif /* FREECIV_JSON_CONNECTION */
9836 DIO_BV_PUT(&dout, &field_addr, fields);
9837
9838 if (BV_ISSET(fields, 0)) {
9839 log_packet_detailed(" field 'xsize' has changed");
9840 #ifdef FREECIV_JSON_CONNECTION
9841 field_addr.name = "xsize";
9842#endif /* FREECIV_JSON_CONNECTION */
9843 DIO_PUT(uint16, &dout, &field_addr, real_packet->xsize);
9844 }
9845 if (BV_ISSET(fields, 1)) {
9846 log_packet_detailed(" field 'ysize' has changed");
9847 #ifdef FREECIV_JSON_CONNECTION
9848 field_addr.name = "ysize";
9849#endif /* FREECIV_JSON_CONNECTION */
9850 DIO_PUT(uint16, &dout, &field_addr, real_packet->ysize);
9851 }
9852 if (BV_ISSET(fields, 2)) {
9853 log_packet_detailed(" field 'topology_id' has changed");
9854 #ifdef FREECIV_JSON_CONNECTION
9855 field_addr.name = "topology_id";
9856#endif /* FREECIV_JSON_CONNECTION */
9857 DIO_PUT(uint8, &dout, &field_addr, real_packet->topology_id);
9858 }
9859
9860 *old = *real_packet;
9861#endif /* FREECIV_DELTA_PROTOCOL */
9862#ifndef FREECIV_DELTA_PROTOCOL
9863#ifdef FREECIV_JSON_CONNECTION
9864 field_addr.name = "xsize";
9865#endif /* FREECIV_JSON_CONNECTION */
9866 DIO_PUT(uint16, &dout, &field_addr, real_packet->xsize);
9867#ifdef FREECIV_JSON_CONNECTION
9868 field_addr.name = "ysize";
9869#endif /* FREECIV_JSON_CONNECTION */
9870 DIO_PUT(uint16, &dout, &field_addr, real_packet->ysize);
9871#ifdef FREECIV_JSON_CONNECTION
9872 field_addr.name = "topology_id";
9873#endif /* FREECIV_JSON_CONNECTION */
9874 DIO_PUT(uint8, &dout, &field_addr, real_packet->topology_id);
9875
9876#endif
9877 SEND_PACKET_END(PACKET_MAP_INFO);
9878}
9879
9880 int send_packet_map_info(struct connection *pc, const struct packet_map_info *packet)
9881{
9882 if (!pc->used) {
9883 log_error("WARNING: trying to send data to the closed connection %s",
9884 conn_description(pc));
9885 return -1;
9886 }
9887 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_MAP_INFO].packet != NULL, -1,
9888 "Handler for PACKET_MAP_INFO not installed");
9889 return pc->phs.handlers->send[PACKET_MAP_INFO].packet(pc, packet);
9890}
9891
9892 void lsend_packet_map_info(struct conn_list *dest, const struct packet_map_info *packet)
9893{
9894 conn_list_iterate(dest, pconn) {
9895 send_packet_map_info(pconn, packet);
9896 } conn_list_iterate_end;
9897}
9898
9899#ifdef FREECIV_DELTA_PROTOCOL
9900#define hash_packet_nuke_tile_info_100 hash_const
9901
9902#define cmp_packet_nuke_tile_info_100 cmp_const
9903
9904 BV_DEFINE(packet_nuke_tile_info_100_fields, 1);
9905#endif /* FREECIV_DELTA_PROTOCOL */
9906
9907 static struct packet_nuke_tile_info *receive_packet_nuke_tile_info_100(struct connection *pc)
9908{
9909#ifdef FREECIV_DELTA_PROTOCOL
9910 packet_nuke_tile_info_100_fields fields;
9911 struct packet_nuke_tile_info *old;
9912 struct genhash **hash = pc->phs.received + PACKET_NUKE_TILE_INFO;
9913#endif /* FREECIV_DELTA_PROTOCOL */
9914 RECEIVE_PACKET_START(packet_nuke_tile_info, real_packet);
9915#ifdef FREECIV_JSON_CONNECTION
9916 struct plocation field_addr;
9917 {
9918 struct plocation *field_addr_tmp = plocation_field_new(NULL);
9919 field_addr = *field_addr_tmp;
9920 FC_FREE(field_addr_tmp);
9921 }
9922#endif /* FREECIV_JSON_CONNECTION */
9923
9924#ifdef FREECIV_DELTA_PROTOCOL
9925#ifdef FREECIV_JSON_CONNECTION
9926 field_addr.name = "fields";
9927#endif /* FREECIV_JSON_CONNECTION */
9928 DIO_BV_GET(&din, &field_addr, fields);
9929
9930#else /* FREECIV_DELTA_PROTOCOL */
9931 #ifdef FREECIV_JSON_CONNECTION
9932 field_addr.name = "tile";
9933 #endif /* FREECIV_JSON_CONNECTION */
9934 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
9935 RECEIVE_PACKET_FIELD_ERROR(tile);
9936 }
9937
9938#endif
9939 log_packet_detailed("packet_nuke_tile_info_100: got info about ()");
9940
9941#ifdef FREECIV_DELTA_PROTOCOL
9942 if (NULL == *hash) {
9943 *hash = genhash_new_full(hash_packet_nuke_tile_info_100, cmp_packet_nuke_tile_info_100,
9944 NULL, NULL, NULL, free);
9945 }
9946
9947 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
9948 *real_packet = *old;
9949 } else {
9950 log_packet_detailed(" no old info");
9951 memset(real_packet, 0, sizeof(*real_packet));
9952 }
9953
9954 if (BV_ISSET(fields, 0)) {
9955 log_packet_detailed(" got field 'tile'");
9956 #ifdef FREECIV_JSON_CONNECTION
9957 field_addr.name = "tile";
9958 #endif /* FREECIV_JSON_CONNECTION */
9959 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
9960 RECEIVE_PACKET_FIELD_ERROR(tile);
9961 }
9962 }
9963
9964 if (NULL == old) {
9965 old = fc_malloc(sizeof(*old));
9966 *old = *real_packet;
9967 genhash_insert(*hash, old, old);
9968 } else {
9969 *old = *real_packet;
9970 }
9971
9972#endif /* FREECIV_DELTA_PROTOCOL */
9973 RECEIVE_PACKET_END(real_packet);
9974}
9975
9976 static int send_packet_nuke_tile_info_100(struct connection *pc, const struct packet_nuke_tile_info *packet)
9977{
9978 const struct packet_nuke_tile_info *real_packet = packet;
9979#ifdef FREECIV_DELTA_PROTOCOL
9980 packet_nuke_tile_info_100_fields fields;
9981 struct packet_nuke_tile_info *old;
9982 bool differ;
9983 struct genhash **hash = pc->phs.sent + PACKET_NUKE_TILE_INFO;
9984#endif /* FREECIV_DELTA_PROTOCOL */
9985 SEND_PACKET_START(PACKET_NUKE_TILE_INFO);
9986#ifdef FREECIV_JSON_CONNECTION
9987 struct plocation field_addr;
9988 {
9989 struct plocation *field_addr_tmp = plocation_field_new(NULL);
9990 field_addr = *field_addr_tmp;
9991 FC_FREE(field_addr_tmp);
9992 }
9993#endif /* FREECIV_JSON_CONNECTION */
9994
9995 log_packet_detailed("packet_nuke_tile_info_100: sending info about ()");
9996
9997#ifdef FREECIV_DELTA_PROTOCOL
9998 if (NULL == *hash) {
9999 *hash = genhash_new_full(hash_packet_nuke_tile_info_100, cmp_packet_nuke_tile_info_100,
10000 NULL, NULL, NULL, free);
10001 }
10002 BV_CLR_ALL(fields);
10003
10004 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
10005 old = fc_malloc(sizeof(*old));
10006 *old = *real_packet;
10007 genhash_insert(*hash, old, old);
10008 memset(old, 0, sizeof(*old));
10009 }
10010 differ = (old->tile != real_packet->tile);
10011 if (differ) {
10012 BV_SET(fields, 0);
10013 }
10014
10015
10016#ifdef FREECIV_JSON_CONNECTION
10017 field_addr.name = "fields";
10018#endif /* FREECIV_JSON_CONNECTION */
10019 DIO_BV_PUT(&dout, &field_addr, fields);
10020
10021 if (BV_ISSET(fields, 0)) {
10022 log_packet_detailed(" field 'tile' has changed");
10023 #ifdef FREECIV_JSON_CONNECTION
10024 field_addr.name = "tile";
10025#endif /* FREECIV_JSON_CONNECTION */
10026 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
10027 }
10028
10029 *old = *real_packet;
10030#endif /* FREECIV_DELTA_PROTOCOL */
10031#ifndef FREECIV_DELTA_PROTOCOL
10032#ifdef FREECIV_JSON_CONNECTION
10033 field_addr.name = "tile";
10034#endif /* FREECIV_JSON_CONNECTION */
10035 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
10036
10037#endif
10038 SEND_PACKET_END(PACKET_NUKE_TILE_INFO);
10039}
10040
10041 int send_packet_nuke_tile_info(struct connection *pc, const struct packet_nuke_tile_info *packet)
10042{
10043 if (!pc->used) {
10044 log_error("WARNING: trying to send data to the closed connection %s",
10045 conn_description(pc));
10046 return -1;
10047 }
10048 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_NUKE_TILE_INFO].packet != NULL, -1,
10049 "Handler for PACKET_NUKE_TILE_INFO not installed");
10050 return pc->phs.handlers->send[PACKET_NUKE_TILE_INFO].packet(pc, packet);
10051}
10052
10053 void lsend_packet_nuke_tile_info(struct conn_list *dest, const struct packet_nuke_tile_info *packet)
10054{
10055 conn_list_iterate(dest, pconn) {
10056 send_packet_nuke_tile_info(pconn, packet);
10057 } conn_list_iterate_end;
10058}
10059
10060 int dsend_packet_nuke_tile_info(struct connection *pc, int tile)
10061{
10062 struct packet_nuke_tile_info packet, *real_packet = &packet;
10063
10064 real_packet->tile = tile;
10065
10066 return send_packet_nuke_tile_info(pc, real_packet);
10067}
10068
10069 void dlsend_packet_nuke_tile_info(struct conn_list *dest, int tile)
10070{
10071 struct packet_nuke_tile_info packet, *real_packet = &packet;
10072
10073 real_packet->tile = tile;
10074
10075 lsend_packet_nuke_tile_info(dest, real_packet);
10076}
10077
10078#ifdef FREECIV_DELTA_PROTOCOL
10079static genhash_val_t hash_packet_team_name_info_100(const void *vkey)
10080{
10081 const struct packet_team_name_info *key = (const struct packet_team_name_info *) vkey;
10082
10083 return key->team_id;
10084}
10085
10086static bool cmp_packet_team_name_info_100(const void *vkey1, const void *vkey2)
10087{
10088 const struct packet_team_name_info *key1 = (const struct packet_team_name_info *) vkey1;
10089 const struct packet_team_name_info *key2 = (const struct packet_team_name_info *) vkey2;
10090
10091 return key1->team_id == key2->team_id;
10092}
10093 BV_DEFINE(packet_team_name_info_100_fields, 1);
10094#endif /* FREECIV_DELTA_PROTOCOL */
10095
10096 static struct packet_team_name_info *receive_packet_team_name_info_100(struct connection *pc)
10097{
10098#ifdef FREECIV_DELTA_PROTOCOL
10099 packet_team_name_info_100_fields fields;
10100 struct packet_team_name_info *old;
10101 struct genhash **hash = pc->phs.received + PACKET_TEAM_NAME_INFO;
10102#endif /* FREECIV_DELTA_PROTOCOL */
10103 RECEIVE_PACKET_START(packet_team_name_info, real_packet);
10104#ifdef FREECIV_JSON_CONNECTION
10105 struct plocation field_addr;
10106 {
10107 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10108 field_addr = *field_addr_tmp;
10109 FC_FREE(field_addr_tmp);
10110 }
10111#endif /* FREECIV_JSON_CONNECTION */
10112
10113#ifdef FREECIV_DELTA_PROTOCOL
10114#ifdef FREECIV_JSON_CONNECTION
10115 field_addr.name = "fields";
10116#endif /* FREECIV_JSON_CONNECTION */
10117 DIO_BV_GET(&din, &field_addr, fields);
10118 #ifdef FREECIV_JSON_CONNECTION
10119 field_addr.name = "team_id";
10120 #endif /* FREECIV_JSON_CONNECTION */
10121 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->team_id)) {
10122 RECEIVE_PACKET_FIELD_ERROR(team_id);
10123 }
10124
10125#else /* FREECIV_DELTA_PROTOCOL */
10126 #ifdef FREECIV_JSON_CONNECTION
10127 field_addr.name = "team_id";
10128 #endif /* FREECIV_JSON_CONNECTION */
10129 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->team_id)) {
10130 RECEIVE_PACKET_FIELD_ERROR(team_id);
10131 }
10132 #ifdef FREECIV_JSON_CONNECTION
10133 field_addr.name = "team_name";
10134 #endif /* FREECIV_JSON_CONNECTION */
10135 if (!DIO_GET(string, &din, &field_addr, real_packet->team_name, sizeof(real_packet->team_name))) {
10136 RECEIVE_PACKET_FIELD_ERROR(team_name);
10137 }
10138
10139#endif
10140 log_packet_detailed("packet_team_name_info_100: got info about (%d)",
10141 real_packet->team_id);
10142
10143#ifdef FREECIV_DELTA_PROTOCOL
10144 if (NULL == *hash) {
10145 *hash = genhash_new_full(hash_packet_team_name_info_100, cmp_packet_team_name_info_100,
10146 NULL, NULL, NULL, free);
10147 }
10148
10149 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
10150 *real_packet = *old;
10151 } else {
10152 int team_id = real_packet->team_id;
10153
10154 log_packet_detailed(" no old info");
10155 memset(real_packet, 0, sizeof(*real_packet));
10156
10157 real_packet->team_id = team_id;
10158 }
10159
10160 if (BV_ISSET(fields, 0)) {
10161 log_packet_detailed(" got field 'team_name'");
10162 #ifdef FREECIV_JSON_CONNECTION
10163 field_addr.name = "team_name";
10164 #endif /* FREECIV_JSON_CONNECTION */
10165 if (!DIO_GET(string, &din, &field_addr, real_packet->team_name, sizeof(real_packet->team_name))) {
10166 RECEIVE_PACKET_FIELD_ERROR(team_name);
10167 }
10168 }
10169
10170 if (NULL == old) {
10171 old = fc_malloc(sizeof(*old));
10172 *old = *real_packet;
10173 genhash_insert(*hash, old, old);
10174 } else {
10175 *old = *real_packet;
10176 }
10177
10178#endif /* FREECIV_DELTA_PROTOCOL */
10179 RECEIVE_PACKET_END(real_packet);
10180}
10181
10182 static int send_packet_team_name_info_100(struct connection *pc, const struct packet_team_name_info *packet)
10183{
10184 const struct packet_team_name_info *real_packet = packet;
10185#ifdef FREECIV_DELTA_PROTOCOL
10186 packet_team_name_info_100_fields fields;
10187 struct packet_team_name_info *old;
10188 bool differ;
10189 struct genhash **hash = pc->phs.sent + PACKET_TEAM_NAME_INFO;
10190#endif /* FREECIV_DELTA_PROTOCOL */
10191 SEND_PACKET_START(PACKET_TEAM_NAME_INFO);
10192#ifdef FREECIV_JSON_CONNECTION
10193 struct plocation field_addr;
10194 {
10195 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10196 field_addr = *field_addr_tmp;
10197 FC_FREE(field_addr_tmp);
10198 }
10199#endif /* FREECIV_JSON_CONNECTION */
10200
10201 log_packet_detailed("packet_team_name_info_100: sending info about (%d)",
10202 real_packet->team_id);
10203
10204#ifdef FREECIV_DELTA_PROTOCOL
10205 if (NULL == *hash) {
10206 *hash = genhash_new_full(hash_packet_team_name_info_100, cmp_packet_team_name_info_100,
10207 NULL, NULL, NULL, free);
10208 }
10209 BV_CLR_ALL(fields);
10210
10211 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
10212 old = fc_malloc(sizeof(*old));
10213 *old = *real_packet;
10214 genhash_insert(*hash, old, old);
10215 memset(old, 0, sizeof(*old));
10216 }
10217 differ = (strcmp(old->team_name, real_packet->team_name) != 0);
10218 if (differ) {
10219 BV_SET(fields, 0);
10220 }
10221
10222
10223#ifdef FREECIV_JSON_CONNECTION
10224 field_addr.name = "fields";
10225#endif /* FREECIV_JSON_CONNECTION */
10226 DIO_BV_PUT(&dout, &field_addr, fields);
10227#ifdef FREECIV_JSON_CONNECTION
10228 field_addr.name = "team_id";
10229#endif /* FREECIV_JSON_CONNECTION */
10230 DIO_PUT(uint16, &dout, &field_addr, real_packet->team_id);
10231
10232 if (BV_ISSET(fields, 0)) {
10233 log_packet_detailed(" field 'team_name' has changed");
10234 #ifdef FREECIV_JSON_CONNECTION
10235 field_addr.name = "team_name";
10236#endif /* FREECIV_JSON_CONNECTION */
10237 DIO_PUT(string, &dout, &field_addr, real_packet->team_name);
10238 }
10239
10240 *old = *real_packet;
10241#endif /* FREECIV_DELTA_PROTOCOL */
10242#ifndef FREECIV_DELTA_PROTOCOL
10243#ifdef FREECIV_JSON_CONNECTION
10244 field_addr.name = "team_id";
10245#endif /* FREECIV_JSON_CONNECTION */
10246 DIO_PUT(uint16, &dout, &field_addr, real_packet->team_id);
10247#ifdef FREECIV_JSON_CONNECTION
10248 field_addr.name = "team_name";
10249#endif /* FREECIV_JSON_CONNECTION */
10250 DIO_PUT(string, &dout, &field_addr, real_packet->team_name);
10251
10252#endif
10253 SEND_PACKET_END(PACKET_TEAM_NAME_INFO);
10254}
10255
10256 int send_packet_team_name_info(struct connection *pc, const struct packet_team_name_info *packet)
10257{
10258 if (!pc->used) {
10259 log_error("WARNING: trying to send data to the closed connection %s",
10260 conn_description(pc));
10261 return -1;
10262 }
10263 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_TEAM_NAME_INFO].packet != NULL, -1,
10264 "Handler for PACKET_TEAM_NAME_INFO not installed");
10265 return pc->phs.handlers->send[PACKET_TEAM_NAME_INFO].packet(pc, packet);
10266}
10267
10268 void lsend_packet_team_name_info(struct conn_list *dest, const struct packet_team_name_info *packet)
10269{
10270 conn_list_iterate(dest, pconn) {
10271 send_packet_team_name_info(pconn, packet);
10272 } conn_list_iterate_end;
10273}
10274
10275#ifdef FREECIV_DELTA_PROTOCOL
10276#define hash_packet_achievement_info_100 hash_const
10277
10278#define cmp_packet_achievement_info_100 cmp_const
10279
10280 BV_DEFINE(packet_achievement_info_100_fields, 3);
10281#endif /* FREECIV_DELTA_PROTOCOL */
10282
10283 static struct packet_achievement_info *receive_packet_achievement_info_100(struct connection *pc)
10284{
10285#ifdef FREECIV_DELTA_PROTOCOL
10286 packet_achievement_info_100_fields fields;
10287 struct packet_achievement_info *old;
10288 struct genhash **hash = pc->phs.received + PACKET_ACHIEVEMENT_INFO;
10289#endif /* FREECIV_DELTA_PROTOCOL */
10290 RECEIVE_PACKET_START(packet_achievement_info, real_packet);
10291#ifdef FREECIV_JSON_CONNECTION
10292 struct plocation field_addr;
10293 {
10294 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10295 field_addr = *field_addr_tmp;
10296 FC_FREE(field_addr_tmp);
10297 }
10298#endif /* FREECIV_JSON_CONNECTION */
10299
10300#ifdef FREECIV_DELTA_PROTOCOL
10301#ifdef FREECIV_JSON_CONNECTION
10302 field_addr.name = "fields";
10303#endif /* FREECIV_JSON_CONNECTION */
10304 DIO_BV_GET(&din, &field_addr, fields);
10305
10306#else /* FREECIV_DELTA_PROTOCOL */
10307 #ifdef FREECIV_JSON_CONNECTION
10308 field_addr.name = "id";
10309 #endif /* FREECIV_JSON_CONNECTION */
10310 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
10311 RECEIVE_PACKET_FIELD_ERROR(id);
10312 }
10313 #ifdef FREECIV_JSON_CONNECTION
10314 field_addr.name = "gained";
10315 #endif /* FREECIV_JSON_CONNECTION */
10316 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->gained)) {
10317 RECEIVE_PACKET_FIELD_ERROR(gained);
10318 }
10319 #ifdef FREECIV_JSON_CONNECTION
10320 field_addr.name = "first";
10321 #endif /* FREECIV_JSON_CONNECTION */
10322 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->first)) {
10323 RECEIVE_PACKET_FIELD_ERROR(first);
10324 }
10325
10326#endif
10327 log_packet_detailed("packet_achievement_info_100: got info about ()");
10328
10329#ifdef FREECIV_DELTA_PROTOCOL
10330 if (NULL == *hash) {
10331 *hash = genhash_new_full(hash_packet_achievement_info_100, cmp_packet_achievement_info_100,
10332 NULL, NULL, NULL, free);
10333 }
10334
10335 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
10336 *real_packet = *old;
10337 } else {
10338 log_packet_detailed(" no old info");
10339 memset(real_packet, 0, sizeof(*real_packet));
10340 }
10341
10342 if (BV_ISSET(fields, 0)) {
10343 log_packet_detailed(" got field 'id'");
10344 #ifdef FREECIV_JSON_CONNECTION
10345 field_addr.name = "id";
10346 #endif /* FREECIV_JSON_CONNECTION */
10347 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
10348 RECEIVE_PACKET_FIELD_ERROR(id);
10349 }
10350 }
10351 real_packet->gained = BV_ISSET(fields, 1);
10352 real_packet->first = BV_ISSET(fields, 2);
10353
10354 if (NULL == old) {
10355 old = fc_malloc(sizeof(*old));
10356 *old = *real_packet;
10357 genhash_insert(*hash, old, old);
10358 } else {
10359 *old = *real_packet;
10360 }
10361
10362#endif /* FREECIV_DELTA_PROTOCOL */
10363 RECEIVE_PACKET_END(real_packet);
10364}
10365
10366 static int send_packet_achievement_info_100(struct connection *pc, const struct packet_achievement_info *packet)
10367{
10368 const struct packet_achievement_info *real_packet = packet;
10369#ifdef FREECIV_DELTA_PROTOCOL
10370 packet_achievement_info_100_fields fields;
10371 struct packet_achievement_info *old;
10372 bool differ;
10373 struct genhash **hash = pc->phs.sent + PACKET_ACHIEVEMENT_INFO;
10374#endif /* FREECIV_DELTA_PROTOCOL */
10375 SEND_PACKET_START(PACKET_ACHIEVEMENT_INFO);
10376#ifdef FREECIV_JSON_CONNECTION
10377 struct plocation field_addr;
10378 {
10379 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10380 field_addr = *field_addr_tmp;
10381 FC_FREE(field_addr_tmp);
10382 }
10383#endif /* FREECIV_JSON_CONNECTION */
10384
10385 log_packet_detailed("packet_achievement_info_100: sending info about ()");
10386
10387#ifdef FREECIV_DELTA_PROTOCOL
10388 if (NULL == *hash) {
10389 *hash = genhash_new_full(hash_packet_achievement_info_100, cmp_packet_achievement_info_100,
10390 NULL, NULL, NULL, free);
10391 }
10392 BV_CLR_ALL(fields);
10393
10394 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
10395 old = fc_malloc(sizeof(*old));
10396 *old = *real_packet;
10397 genhash_insert(*hash, old, old);
10398 memset(old, 0, sizeof(*old));
10399 }
10400 differ = (old->id != real_packet->id);
10401 if (differ) {
10402 BV_SET(fields, 0);
10403 }
10404
10405 if (packet->gained) {
10406 BV_SET(fields, 1);
10407 }
10408
10409 if (packet->first) {
10410 BV_SET(fields, 2);
10411 }
10412
10413
10414#ifdef FREECIV_JSON_CONNECTION
10415 field_addr.name = "fields";
10416#endif /* FREECIV_JSON_CONNECTION */
10417 DIO_BV_PUT(&dout, &field_addr, fields);
10418
10419 if (BV_ISSET(fields, 0)) {
10420 log_packet_detailed(" field 'id' has changed");
10421 #ifdef FREECIV_JSON_CONNECTION
10422 field_addr.name = "id";
10423#endif /* FREECIV_JSON_CONNECTION */
10424 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
10425 }
10426 /* field 1 is folded into the header */
10427 /* field 2 is folded into the header */
10428
10429 *old = *real_packet;
10430#endif /* FREECIV_DELTA_PROTOCOL */
10431#ifndef FREECIV_DELTA_PROTOCOL
10432#ifdef FREECIV_JSON_CONNECTION
10433 field_addr.name = "id";
10434#endif /* FREECIV_JSON_CONNECTION */
10435 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
10436#ifdef FREECIV_JSON_CONNECTION
10437 field_addr.name = "gained";
10438#endif /* FREECIV_JSON_CONNECTION */
10439 DIO_PUT(bool8, &dout, &field_addr, real_packet->gained);
10440#ifdef FREECIV_JSON_CONNECTION
10441 field_addr.name = "first";
10442#endif /* FREECIV_JSON_CONNECTION */
10443 DIO_PUT(bool8, &dout, &field_addr, real_packet->first);
10444
10445#endif
10446 SEND_PACKET_END(PACKET_ACHIEVEMENT_INFO);
10447}
10448
10449 int send_packet_achievement_info(struct connection *pc, const struct packet_achievement_info *packet)
10450{
10451 if (!pc->used) {
10452 log_error("WARNING: trying to send data to the closed connection %s",
10453 conn_description(pc));
10454 return -1;
10455 }
10456 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_ACHIEVEMENT_INFO].packet != NULL, -1,
10457 "Handler for PACKET_ACHIEVEMENT_INFO not installed");
10458 return pc->phs.handlers->send[PACKET_ACHIEVEMENT_INFO].packet(pc, packet);
10459}
10460
10461 void lsend_packet_achievement_info(struct conn_list *dest, const struct packet_achievement_info *packet)
10462{
10463 conn_list_iterate(dest, pconn) {
10464 send_packet_achievement_info(pconn, packet);
10465 } conn_list_iterate_end;
10466}
10467
10468#ifdef FREECIV_DELTA_PROTOCOL
10469#define hash_packet_chat_msg_100 hash_const
10470
10471#define cmp_packet_chat_msg_100 cmp_const
10472
10473 BV_DEFINE(packet_chat_msg_100_fields, 6);
10474#endif /* FREECIV_DELTA_PROTOCOL */
10475
10476 static struct packet_chat_msg *receive_packet_chat_msg_100(struct connection *pc)
10477{
10478#ifdef FREECIV_DELTA_PROTOCOL
10479 packet_chat_msg_100_fields fields;
10480 struct packet_chat_msg *old;
10481 struct genhash **hash = pc->phs.received + PACKET_CHAT_MSG;
10482#endif /* FREECIV_DELTA_PROTOCOL */
10483 RECEIVE_PACKET_START(packet_chat_msg, real_packet);
10484#ifdef FREECIV_JSON_CONNECTION
10485 struct plocation field_addr;
10486 {
10487 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10488 field_addr = *field_addr_tmp;
10489 FC_FREE(field_addr_tmp);
10490 }
10491#endif /* FREECIV_JSON_CONNECTION */
10492
10493#ifdef FREECIV_DELTA_PROTOCOL
10494#ifdef FREECIV_JSON_CONNECTION
10495 field_addr.name = "fields";
10496#endif /* FREECIV_JSON_CONNECTION */
10497 DIO_BV_GET(&din, &field_addr, fields);
10498
10499#else /* FREECIV_DELTA_PROTOCOL */
10500 #ifdef FREECIV_JSON_CONNECTION
10501 field_addr.name = "message";
10502 #endif /* FREECIV_JSON_CONNECTION */
10503 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
10504 RECEIVE_PACKET_FIELD_ERROR(message);
10505 }
10506 #ifdef FREECIV_JSON_CONNECTION
10507 field_addr.name = "tile";
10508 #endif /* FREECIV_JSON_CONNECTION */
10509 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
10510 RECEIVE_PACKET_FIELD_ERROR(tile);
10511 }
10512 #ifdef FREECIV_JSON_CONNECTION
10513 field_addr.name = "event";
10514 #endif /* FREECIV_JSON_CONNECTION */
10515 {
10516 int readin;
10517
10518 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
10519 RECEIVE_PACKET_FIELD_ERROR(event);
10520 }
10521 real_packet->event = readin;
10522 }
10523 #ifdef FREECIV_JSON_CONNECTION
10524 field_addr.name = "turn";
10525 #endif /* FREECIV_JSON_CONNECTION */
10526 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
10527 RECEIVE_PACKET_FIELD_ERROR(turn);
10528 }
10529 #ifdef FREECIV_JSON_CONNECTION
10530 field_addr.name = "phase";
10531 #endif /* FREECIV_JSON_CONNECTION */
10532 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
10533 RECEIVE_PACKET_FIELD_ERROR(phase);
10534 }
10535 #ifdef FREECIV_JSON_CONNECTION
10536 field_addr.name = "conn_id";
10537 #endif /* FREECIV_JSON_CONNECTION */
10538 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
10539 RECEIVE_PACKET_FIELD_ERROR(conn_id);
10540 }
10541
10542#endif
10543 log_packet_detailed("packet_chat_msg_100: got info about ()");
10544
10545#ifdef FREECIV_DELTA_PROTOCOL
10546 if (NULL == *hash) {
10547 *hash = genhash_new_full(hash_packet_chat_msg_100, cmp_packet_chat_msg_100,
10548 NULL, NULL, NULL, free);
10549 }
10550
10551 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
10552 *real_packet = *old;
10553 } else {
10554 log_packet_detailed(" no old info");
10555 memset(real_packet, 0, sizeof(*real_packet));
10556 }
10557
10558 if (BV_ISSET(fields, 0)) {
10559 log_packet_detailed(" got field 'message'");
10560 #ifdef FREECIV_JSON_CONNECTION
10561 field_addr.name = "message";
10562 #endif /* FREECIV_JSON_CONNECTION */
10563 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
10564 RECEIVE_PACKET_FIELD_ERROR(message);
10565 }
10566 }
10567 if (BV_ISSET(fields, 1)) {
10568 log_packet_detailed(" got field 'tile'");
10569 #ifdef FREECIV_JSON_CONNECTION
10570 field_addr.name = "tile";
10571 #endif /* FREECIV_JSON_CONNECTION */
10572 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
10573 RECEIVE_PACKET_FIELD_ERROR(tile);
10574 }
10575 }
10576 if (BV_ISSET(fields, 2)) {
10577 log_packet_detailed(" got field 'event'");
10578 #ifdef FREECIV_JSON_CONNECTION
10579 field_addr.name = "event";
10580 #endif /* FREECIV_JSON_CONNECTION */
10581 {
10582 int readin;
10583
10584 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
10585 RECEIVE_PACKET_FIELD_ERROR(event);
10586 }
10587 real_packet->event = readin;
10588 }
10589 }
10590 if (BV_ISSET(fields, 3)) {
10591 log_packet_detailed(" got field 'turn'");
10592 #ifdef FREECIV_JSON_CONNECTION
10593 field_addr.name = "turn";
10594 #endif /* FREECIV_JSON_CONNECTION */
10595 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
10596 RECEIVE_PACKET_FIELD_ERROR(turn);
10597 }
10598 }
10599 if (BV_ISSET(fields, 4)) {
10600 log_packet_detailed(" got field 'phase'");
10601 #ifdef FREECIV_JSON_CONNECTION
10602 field_addr.name = "phase";
10603 #endif /* FREECIV_JSON_CONNECTION */
10604 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
10605 RECEIVE_PACKET_FIELD_ERROR(phase);
10606 }
10607 }
10608 if (BV_ISSET(fields, 5)) {
10609 log_packet_detailed(" got field 'conn_id'");
10610 #ifdef FREECIV_JSON_CONNECTION
10611 field_addr.name = "conn_id";
10612 #endif /* FREECIV_JSON_CONNECTION */
10613 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
10614 RECEIVE_PACKET_FIELD_ERROR(conn_id);
10615 }
10616 }
10617
10618 if (NULL == old) {
10619 old = fc_malloc(sizeof(*old));
10620 *old = *real_packet;
10621 genhash_insert(*hash, old, old);
10622 } else {
10623 *old = *real_packet;
10624 }
10625
10626#endif /* FREECIV_DELTA_PROTOCOL */
10627 RECEIVE_PACKET_END(real_packet);
10628}
10629
10630 static int send_packet_chat_msg_100(struct connection *pc, const struct packet_chat_msg *packet)
10631{
10632 const struct packet_chat_msg *real_packet = packet;
10633#ifdef FREECIV_DELTA_PROTOCOL
10634 packet_chat_msg_100_fields fields;
10635 struct packet_chat_msg *old;
10636 bool differ;
10637 struct genhash **hash = pc->phs.sent + PACKET_CHAT_MSG;
10638#endif /* FREECIV_DELTA_PROTOCOL */
10639 SEND_PACKET_START(PACKET_CHAT_MSG);
10640#ifdef FREECIV_JSON_CONNECTION
10641 struct plocation field_addr;
10642 {
10643 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10644 field_addr = *field_addr_tmp;
10645 FC_FREE(field_addr_tmp);
10646 }
10647#endif /* FREECIV_JSON_CONNECTION */
10648
10649 log_packet_detailed("packet_chat_msg_100: sending info about ()");
10650
10651#ifdef FREECIV_DELTA_PROTOCOL
10652 if (NULL == *hash) {
10653 *hash = genhash_new_full(hash_packet_chat_msg_100, cmp_packet_chat_msg_100,
10654 NULL, NULL, NULL, free);
10655 }
10656 BV_CLR_ALL(fields);
10657
10658 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
10659 old = fc_malloc(sizeof(*old));
10660 *old = *real_packet;
10661 genhash_insert(*hash, old, old);
10662 memset(old, 0, sizeof(*old));
10663 }
10664 differ = (strcmp(old->message, real_packet->message) != 0);
10665 if (differ) {
10666 BV_SET(fields, 0);
10667 }
10668
10669 differ = (old->tile != real_packet->tile);
10670 if (differ) {
10671 BV_SET(fields, 1);
10672 }
10673
10674 differ = (old->event != real_packet->event);
10675 if (differ) {
10676 BV_SET(fields, 2);
10677 }
10678
10679 differ = (old->turn != real_packet->turn);
10680 if (differ) {
10681 BV_SET(fields, 3);
10682 }
10683
10684 differ = (old->phase != real_packet->phase);
10685 if (differ) {
10686 BV_SET(fields, 4);
10687 }
10688
10689 differ = (old->conn_id != real_packet->conn_id);
10690 if (differ) {
10691 BV_SET(fields, 5);
10692 }
10693
10694
10695#ifdef FREECIV_JSON_CONNECTION
10696 field_addr.name = "fields";
10697#endif /* FREECIV_JSON_CONNECTION */
10698 DIO_BV_PUT(&dout, &field_addr, fields);
10699
10700 if (BV_ISSET(fields, 0)) {
10701 log_packet_detailed(" field 'message' has changed");
10702 #ifdef FREECIV_JSON_CONNECTION
10703 field_addr.name = "message";
10704#endif /* FREECIV_JSON_CONNECTION */
10705 DIO_PUT(string, &dout, &field_addr, real_packet->message);
10706 }
10707 if (BV_ISSET(fields, 1)) {
10708 log_packet_detailed(" field 'tile' has changed");
10709 #ifdef FREECIV_JSON_CONNECTION
10710 field_addr.name = "tile";
10711#endif /* FREECIV_JSON_CONNECTION */
10712 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
10713 }
10714 if (BV_ISSET(fields, 2)) {
10715 log_packet_detailed(" field 'event' has changed");
10716 #ifdef FREECIV_JSON_CONNECTION
10717 field_addr.name = "event";
10718#endif /* FREECIV_JSON_CONNECTION */
10719 DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
10720 }
10721 if (BV_ISSET(fields, 3)) {
10722 log_packet_detailed(" field 'turn' has changed");
10723 #ifdef FREECIV_JSON_CONNECTION
10724 field_addr.name = "turn";
10725#endif /* FREECIV_JSON_CONNECTION */
10726 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
10727 }
10728 if (BV_ISSET(fields, 4)) {
10729 log_packet_detailed(" field 'phase' has changed");
10730 #ifdef FREECIV_JSON_CONNECTION
10731 field_addr.name = "phase";
10732#endif /* FREECIV_JSON_CONNECTION */
10733 DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
10734 }
10735 if (BV_ISSET(fields, 5)) {
10736 log_packet_detailed(" field 'conn_id' has changed");
10737 #ifdef FREECIV_JSON_CONNECTION
10738 field_addr.name = "conn_id";
10739#endif /* FREECIV_JSON_CONNECTION */
10740 DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
10741 }
10742
10743 *old = *real_packet;
10744#endif /* FREECIV_DELTA_PROTOCOL */
10745#ifndef FREECIV_DELTA_PROTOCOL
10746#ifdef FREECIV_JSON_CONNECTION
10747 field_addr.name = "message";
10748#endif /* FREECIV_JSON_CONNECTION */
10749 DIO_PUT(string, &dout, &field_addr, real_packet->message);
10750#ifdef FREECIV_JSON_CONNECTION
10751 field_addr.name = "tile";
10752#endif /* FREECIV_JSON_CONNECTION */
10753 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
10754#ifdef FREECIV_JSON_CONNECTION
10755 field_addr.name = "event";
10756#endif /* FREECIV_JSON_CONNECTION */
10757 DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
10758#ifdef FREECIV_JSON_CONNECTION
10759 field_addr.name = "turn";
10760#endif /* FREECIV_JSON_CONNECTION */
10761 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
10762#ifdef FREECIV_JSON_CONNECTION
10763 field_addr.name = "phase";
10764#endif /* FREECIV_JSON_CONNECTION */
10765 DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
10766#ifdef FREECIV_JSON_CONNECTION
10767 field_addr.name = "conn_id";
10768#endif /* FREECIV_JSON_CONNECTION */
10769 DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
10770
10771#endif
10772 SEND_PACKET_END(PACKET_CHAT_MSG);
10773}
10774
10775 int send_packet_chat_msg(struct connection *pc, const struct packet_chat_msg *packet)
10776{
10777 if (!pc->used) {
10778 log_error("WARNING: trying to send data to the closed connection %s",
10779 conn_description(pc));
10780 return -1;
10781 }
10782 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CHAT_MSG].packet != NULL, -1,
10783 "Handler for PACKET_CHAT_MSG not installed");
10784 return pc->phs.handlers->send[PACKET_CHAT_MSG].packet(pc, packet);
10785}
10786
10787 void lsend_packet_chat_msg(struct conn_list *dest, const struct packet_chat_msg *packet)
10788{
10789 conn_list_iterate(dest, pconn) {
10790 send_packet_chat_msg(pconn, packet);
10791 } conn_list_iterate_end;
10792}
10793
10794#ifdef FREECIV_DELTA_PROTOCOL
10795#define hash_packet_early_chat_msg_100 hash_const
10796
10797#define cmp_packet_early_chat_msg_100 cmp_const
10798
10799 BV_DEFINE(packet_early_chat_msg_100_fields, 6);
10800#endif /* FREECIV_DELTA_PROTOCOL */
10801
10802 static struct packet_early_chat_msg *receive_packet_early_chat_msg_100(struct connection *pc)
10803{
10804#ifdef FREECIV_DELTA_PROTOCOL
10805 packet_early_chat_msg_100_fields fields;
10806 struct packet_early_chat_msg *old;
10807 struct genhash **hash = pc->phs.received + PACKET_EARLY_CHAT_MSG;
10808#endif /* FREECIV_DELTA_PROTOCOL */
10809 RECEIVE_PACKET_START(packet_early_chat_msg, real_packet);
10810#ifdef FREECIV_JSON_CONNECTION
10811 struct plocation field_addr;
10812 {
10813 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10814 field_addr = *field_addr_tmp;
10815 FC_FREE(field_addr_tmp);
10816 }
10817#endif /* FREECIV_JSON_CONNECTION */
10818
10819#ifdef FREECIV_DELTA_PROTOCOL
10820#ifdef FREECIV_JSON_CONNECTION
10821 field_addr.name = "fields";
10822#endif /* FREECIV_JSON_CONNECTION */
10823 DIO_BV_GET(&din, &field_addr, fields);
10824
10825#else /* FREECIV_DELTA_PROTOCOL */
10826 #ifdef FREECIV_JSON_CONNECTION
10827 field_addr.name = "message";
10828 #endif /* FREECIV_JSON_CONNECTION */
10829 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
10830 RECEIVE_PACKET_FIELD_ERROR(message);
10831 }
10832 #ifdef FREECIV_JSON_CONNECTION
10833 field_addr.name = "tile";
10834 #endif /* FREECIV_JSON_CONNECTION */
10835 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
10836 RECEIVE_PACKET_FIELD_ERROR(tile);
10837 }
10838 #ifdef FREECIV_JSON_CONNECTION
10839 field_addr.name = "event";
10840 #endif /* FREECIV_JSON_CONNECTION */
10841 {
10842 int readin;
10843
10844 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
10845 RECEIVE_PACKET_FIELD_ERROR(event);
10846 }
10847 real_packet->event = readin;
10848 }
10849 #ifdef FREECIV_JSON_CONNECTION
10850 field_addr.name = "turn";
10851 #endif /* FREECIV_JSON_CONNECTION */
10852 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
10853 RECEIVE_PACKET_FIELD_ERROR(turn);
10854 }
10855 #ifdef FREECIV_JSON_CONNECTION
10856 field_addr.name = "phase";
10857 #endif /* FREECIV_JSON_CONNECTION */
10858 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
10859 RECEIVE_PACKET_FIELD_ERROR(phase);
10860 }
10861 #ifdef FREECIV_JSON_CONNECTION
10862 field_addr.name = "conn_id";
10863 #endif /* FREECIV_JSON_CONNECTION */
10864 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
10865 RECEIVE_PACKET_FIELD_ERROR(conn_id);
10866 }
10867
10868#endif
10869 log_packet_detailed("packet_early_chat_msg_100: got info about ()");
10870
10871#ifdef FREECIV_DELTA_PROTOCOL
10872 if (NULL == *hash) {
10873 *hash = genhash_new_full(hash_packet_early_chat_msg_100, cmp_packet_early_chat_msg_100,
10874 NULL, NULL, NULL, free);
10875 }
10876
10877 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
10878 *real_packet = *old;
10879 } else {
10880 log_packet_detailed(" no old info");
10881 memset(real_packet, 0, sizeof(*real_packet));
10882 }
10883
10884 if (BV_ISSET(fields, 0)) {
10885 log_packet_detailed(" got field 'message'");
10886 #ifdef FREECIV_JSON_CONNECTION
10887 field_addr.name = "message";
10888 #endif /* FREECIV_JSON_CONNECTION */
10889 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
10890 RECEIVE_PACKET_FIELD_ERROR(message);
10891 }
10892 }
10893 if (BV_ISSET(fields, 1)) {
10894 log_packet_detailed(" got field 'tile'");
10895 #ifdef FREECIV_JSON_CONNECTION
10896 field_addr.name = "tile";
10897 #endif /* FREECIV_JSON_CONNECTION */
10898 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
10899 RECEIVE_PACKET_FIELD_ERROR(tile);
10900 }
10901 }
10902 if (BV_ISSET(fields, 2)) {
10903 log_packet_detailed(" got field 'event'");
10904 #ifdef FREECIV_JSON_CONNECTION
10905 field_addr.name = "event";
10906 #endif /* FREECIV_JSON_CONNECTION */
10907 {
10908 int readin;
10909
10910 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
10911 RECEIVE_PACKET_FIELD_ERROR(event);
10912 }
10913 real_packet->event = readin;
10914 }
10915 }
10916 if (BV_ISSET(fields, 3)) {
10917 log_packet_detailed(" got field 'turn'");
10918 #ifdef FREECIV_JSON_CONNECTION
10919 field_addr.name = "turn";
10920 #endif /* FREECIV_JSON_CONNECTION */
10921 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
10922 RECEIVE_PACKET_FIELD_ERROR(turn);
10923 }
10924 }
10925 if (BV_ISSET(fields, 4)) {
10926 log_packet_detailed(" got field 'phase'");
10927 #ifdef FREECIV_JSON_CONNECTION
10928 field_addr.name = "phase";
10929 #endif /* FREECIV_JSON_CONNECTION */
10930 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
10931 RECEIVE_PACKET_FIELD_ERROR(phase);
10932 }
10933 }
10934 if (BV_ISSET(fields, 5)) {
10935 log_packet_detailed(" got field 'conn_id'");
10936 #ifdef FREECIV_JSON_CONNECTION
10937 field_addr.name = "conn_id";
10938 #endif /* FREECIV_JSON_CONNECTION */
10939 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
10940 RECEIVE_PACKET_FIELD_ERROR(conn_id);
10941 }
10942 }
10943
10944 if (NULL == old) {
10945 old = fc_malloc(sizeof(*old));
10946 *old = *real_packet;
10947 genhash_insert(*hash, old, old);
10948 } else {
10949 *old = *real_packet;
10950 }
10951
10952#endif /* FREECIV_DELTA_PROTOCOL */
10953 RECEIVE_PACKET_END(real_packet);
10954}
10955
10956 static int send_packet_early_chat_msg_100(struct connection *pc, const struct packet_early_chat_msg *packet)
10957{
10958 const struct packet_early_chat_msg *real_packet = packet;
10959#ifdef FREECIV_DELTA_PROTOCOL
10960 packet_early_chat_msg_100_fields fields;
10961 struct packet_early_chat_msg *old;
10962 bool differ;
10963 struct genhash **hash = pc->phs.sent + PACKET_EARLY_CHAT_MSG;
10964#endif /* FREECIV_DELTA_PROTOCOL */
10965 SEND_PACKET_START(PACKET_EARLY_CHAT_MSG);
10966#ifdef FREECIV_JSON_CONNECTION
10967 struct plocation field_addr;
10968 {
10969 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10970 field_addr = *field_addr_tmp;
10971 FC_FREE(field_addr_tmp);
10972 }
10973#endif /* FREECIV_JSON_CONNECTION */
10974
10975 log_packet_detailed("packet_early_chat_msg_100: sending info about ()");
10976
10977#ifdef FREECIV_DELTA_PROTOCOL
10978 if (NULL == *hash) {
10979 *hash = genhash_new_full(hash_packet_early_chat_msg_100, cmp_packet_early_chat_msg_100,
10980 NULL, NULL, NULL, free);
10981 }
10982 BV_CLR_ALL(fields);
10983
10984 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
10985 old = fc_malloc(sizeof(*old));
10986 *old = *real_packet;
10987 genhash_insert(*hash, old, old);
10988 memset(old, 0, sizeof(*old));
10989 }
10990 differ = (strcmp(old->message, real_packet->message) != 0);
10991 if (differ) {
10992 BV_SET(fields, 0);
10993 }
10994
10995 differ = (old->tile != real_packet->tile);
10996 if (differ) {
10997 BV_SET(fields, 1);
10998 }
10999
11000 differ = (old->event != real_packet->event);
11001 if (differ) {
11002 BV_SET(fields, 2);
11003 }
11004
11005 differ = (old->turn != real_packet->turn);
11006 if (differ) {
11007 BV_SET(fields, 3);
11008 }
11009
11010 differ = (old->phase != real_packet->phase);
11011 if (differ) {
11012 BV_SET(fields, 4);
11013 }
11014
11015 differ = (old->conn_id != real_packet->conn_id);
11016 if (differ) {
11017 BV_SET(fields, 5);
11018 }
11019
11020
11021#ifdef FREECIV_JSON_CONNECTION
11022 field_addr.name = "fields";
11023#endif /* FREECIV_JSON_CONNECTION */
11024 DIO_BV_PUT(&dout, &field_addr, fields);
11025
11026 if (BV_ISSET(fields, 0)) {
11027 log_packet_detailed(" field 'message' has changed");
11028 #ifdef FREECIV_JSON_CONNECTION
11029 field_addr.name = "message";
11030#endif /* FREECIV_JSON_CONNECTION */
11031 DIO_PUT(string, &dout, &field_addr, real_packet->message);
11032 }
11033 if (BV_ISSET(fields, 1)) {
11034 log_packet_detailed(" field 'tile' has changed");
11035 #ifdef FREECIV_JSON_CONNECTION
11036 field_addr.name = "tile";
11037#endif /* FREECIV_JSON_CONNECTION */
11038 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
11039 }
11040 if (BV_ISSET(fields, 2)) {
11041 log_packet_detailed(" field 'event' has changed");
11042 #ifdef FREECIV_JSON_CONNECTION
11043 field_addr.name = "event";
11044#endif /* FREECIV_JSON_CONNECTION */
11045 DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
11046 }
11047 if (BV_ISSET(fields, 3)) {
11048 log_packet_detailed(" field 'turn' has changed");
11049 #ifdef FREECIV_JSON_CONNECTION
11050 field_addr.name = "turn";
11051#endif /* FREECIV_JSON_CONNECTION */
11052 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
11053 }
11054 if (BV_ISSET(fields, 4)) {
11055 log_packet_detailed(" field 'phase' has changed");
11056 #ifdef FREECIV_JSON_CONNECTION
11057 field_addr.name = "phase";
11058#endif /* FREECIV_JSON_CONNECTION */
11059 DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
11060 }
11061 if (BV_ISSET(fields, 5)) {
11062 log_packet_detailed(" field 'conn_id' has changed");
11063 #ifdef FREECIV_JSON_CONNECTION
11064 field_addr.name = "conn_id";
11065#endif /* FREECIV_JSON_CONNECTION */
11066 DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
11067 }
11068
11069 *old = *real_packet;
11070#endif /* FREECIV_DELTA_PROTOCOL */
11071#ifndef FREECIV_DELTA_PROTOCOL
11072#ifdef FREECIV_JSON_CONNECTION
11073 field_addr.name = "message";
11074#endif /* FREECIV_JSON_CONNECTION */
11075 DIO_PUT(string, &dout, &field_addr, real_packet->message);
11076#ifdef FREECIV_JSON_CONNECTION
11077 field_addr.name = "tile";
11078#endif /* FREECIV_JSON_CONNECTION */
11079 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
11080#ifdef FREECIV_JSON_CONNECTION
11081 field_addr.name = "event";
11082#endif /* FREECIV_JSON_CONNECTION */
11083 DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
11084#ifdef FREECIV_JSON_CONNECTION
11085 field_addr.name = "turn";
11086#endif /* FREECIV_JSON_CONNECTION */
11087 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
11088#ifdef FREECIV_JSON_CONNECTION
11089 field_addr.name = "phase";
11090#endif /* FREECIV_JSON_CONNECTION */
11091 DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
11092#ifdef FREECIV_JSON_CONNECTION
11093 field_addr.name = "conn_id";
11094#endif /* FREECIV_JSON_CONNECTION */
11095 DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
11096
11097#endif
11098 SEND_PACKET_END(PACKET_EARLY_CHAT_MSG);
11099}
11100
11101 int send_packet_early_chat_msg(struct connection *pc, const struct packet_early_chat_msg *packet)
11102{
11103 if (!pc->used) {
11104 log_error("WARNING: trying to send data to the closed connection %s",
11105 conn_description(pc));
11106 return -1;
11107 }
11108 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EARLY_CHAT_MSG].packet != NULL, -1,
11109 "Handler for PACKET_EARLY_CHAT_MSG not installed");
11110 return pc->phs.handlers->send[PACKET_EARLY_CHAT_MSG].packet(pc, packet);
11111}
11112
11113 void lsend_packet_early_chat_msg(struct conn_list *dest, const struct packet_early_chat_msg *packet)
11114{
11115 conn_list_iterate(dest, pconn) {
11116 send_packet_early_chat_msg(pconn, packet);
11117 } conn_list_iterate_end;
11118}
11119
11120#ifdef FREECIV_DELTA_PROTOCOL
11121#define hash_packet_chat_msg_req_100 hash_const
11122
11123#define cmp_packet_chat_msg_req_100 cmp_const
11124
11125 BV_DEFINE(packet_chat_msg_req_100_fields, 1);
11126#endif /* FREECIV_DELTA_PROTOCOL */
11127
11128 static struct packet_chat_msg_req *receive_packet_chat_msg_req_100(struct connection *pc)
11129{
11130#ifdef FREECIV_DELTA_PROTOCOL
11131 packet_chat_msg_req_100_fields fields;
11132 struct packet_chat_msg_req *old;
11133 struct genhash **hash = pc->phs.received + PACKET_CHAT_MSG_REQ;
11134#endif /* FREECIV_DELTA_PROTOCOL */
11135 RECEIVE_PACKET_START(packet_chat_msg_req, real_packet);
11136#ifdef FREECIV_JSON_CONNECTION
11137 struct plocation field_addr;
11138 {
11139 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11140 field_addr = *field_addr_tmp;
11141 FC_FREE(field_addr_tmp);
11142 }
11143#endif /* FREECIV_JSON_CONNECTION */
11144
11145#ifdef FREECIV_DELTA_PROTOCOL
11146#ifdef FREECIV_JSON_CONNECTION
11147 field_addr.name = "fields";
11148#endif /* FREECIV_JSON_CONNECTION */
11149 DIO_BV_GET(&din, &field_addr, fields);
11150
11151#else /* FREECIV_DELTA_PROTOCOL */
11152 #ifdef FREECIV_JSON_CONNECTION
11153 field_addr.name = "message";
11154 #endif /* FREECIV_JSON_CONNECTION */
11155 if (!DIO_GET(estring, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
11156 RECEIVE_PACKET_FIELD_ERROR(message);
11157 }
11158
11159#endif
11160 log_packet_detailed("packet_chat_msg_req_100: got info about ()");
11161
11162#ifdef FREECIV_DELTA_PROTOCOL
11163 if (NULL == *hash) {
11164 *hash = genhash_new_full(hash_packet_chat_msg_req_100, cmp_packet_chat_msg_req_100,
11165 NULL, NULL, NULL, free);
11166 }
11167
11168 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
11169 *real_packet = *old;
11170 } else {
11171 log_packet_detailed(" no old info");
11172 memset(real_packet, 0, sizeof(*real_packet));
11173 }
11174
11175 if (BV_ISSET(fields, 0)) {
11176 log_packet_detailed(" got field 'message'");
11177 #ifdef FREECIV_JSON_CONNECTION
11178 field_addr.name = "message";
11179 #endif /* FREECIV_JSON_CONNECTION */
11180 if (!DIO_GET(estring, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
11181 RECEIVE_PACKET_FIELD_ERROR(message);
11182 }
11183 }
11184
11185 if (NULL == old) {
11186 old = fc_malloc(sizeof(*old));
11187 *old = *real_packet;
11188 genhash_insert(*hash, old, old);
11189 } else {
11190 *old = *real_packet;
11191 }
11192
11193#endif /* FREECIV_DELTA_PROTOCOL */
11194 RECEIVE_PACKET_END(real_packet);
11195}
11196
11197 static int send_packet_chat_msg_req_100(struct connection *pc, const struct packet_chat_msg_req *packet)
11198{
11199 const struct packet_chat_msg_req *real_packet = packet;
11200#ifdef FREECIV_DELTA_PROTOCOL
11201 packet_chat_msg_req_100_fields fields;
11202 struct packet_chat_msg_req *old;
11203 bool differ;
11204 struct genhash **hash = pc->phs.sent + PACKET_CHAT_MSG_REQ;
11205#endif /* FREECIV_DELTA_PROTOCOL */
11206 SEND_PACKET_START(PACKET_CHAT_MSG_REQ);
11207#ifdef FREECIV_JSON_CONNECTION
11208 struct plocation field_addr;
11209 {
11210 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11211 field_addr = *field_addr_tmp;
11212 FC_FREE(field_addr_tmp);
11213 }
11214#endif /* FREECIV_JSON_CONNECTION */
11215
11216 log_packet_detailed("packet_chat_msg_req_100: sending info about ()");
11217
11218#ifdef FREECIV_DELTA_PROTOCOL
11219 if (NULL == *hash) {
11220 *hash = genhash_new_full(hash_packet_chat_msg_req_100, cmp_packet_chat_msg_req_100,
11221 NULL, NULL, NULL, free);
11222 }
11223 BV_CLR_ALL(fields);
11224
11225 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
11226 old = fc_malloc(sizeof(*old));
11227 *old = *real_packet;
11228 genhash_insert(*hash, old, old);
11229 memset(old, 0, sizeof(*old));
11230 }
11231 differ = (strcmp(old->message, real_packet->message) != 0);
11232 if (differ) {
11233 BV_SET(fields, 0);
11234 }
11235
11236
11237#ifdef FREECIV_JSON_CONNECTION
11238 field_addr.name = "fields";
11239#endif /* FREECIV_JSON_CONNECTION */
11240 DIO_BV_PUT(&dout, &field_addr, fields);
11241
11242 if (BV_ISSET(fields, 0)) {
11243 log_packet_detailed(" field 'message' has changed");
11244 #ifdef FREECIV_JSON_CONNECTION
11245 field_addr.name = "message";
11246#endif /* FREECIV_JSON_CONNECTION */
11247 DIO_PUT(estring, &dout, &field_addr, real_packet->message);
11248 }
11249
11250 *old = *real_packet;
11251#endif /* FREECIV_DELTA_PROTOCOL */
11252#ifndef FREECIV_DELTA_PROTOCOL
11253#ifdef FREECIV_JSON_CONNECTION
11254 field_addr.name = "message";
11255#endif /* FREECIV_JSON_CONNECTION */
11256 DIO_PUT(estring, &dout, &field_addr, real_packet->message);
11257
11258#endif
11259 SEND_PACKET_END(PACKET_CHAT_MSG_REQ);
11260}
11261
11262 int send_packet_chat_msg_req(struct connection *pc, const struct packet_chat_msg_req *packet)
11263{
11264 if (!pc->used) {
11265 log_error("WARNING: trying to send data to the closed connection %s",
11266 conn_description(pc));
11267 return -1;
11268 }
11269 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CHAT_MSG_REQ].packet != NULL, -1,
11270 "Handler for PACKET_CHAT_MSG_REQ not installed");
11271 return pc->phs.handlers->send[PACKET_CHAT_MSG_REQ].packet(pc, packet);
11272}
11273
11274 int dsend_packet_chat_msg_req(struct connection *pc, const char *message)
11275{
11276 struct packet_chat_msg_req packet, *real_packet = &packet;
11277
11278 sz_strlcpy(real_packet->message, message);
11279
11280 return send_packet_chat_msg_req(pc, real_packet);
11281}
11282
11283#ifdef FREECIV_DELTA_PROTOCOL
11284#define hash_packet_connect_msg_100 hash_const
11285
11286#define cmp_packet_connect_msg_100 cmp_const
11287
11288 BV_DEFINE(packet_connect_msg_100_fields, 1);
11289#endif /* FREECIV_DELTA_PROTOCOL */
11290
11291 static struct packet_connect_msg *receive_packet_connect_msg_100(struct connection *pc)
11292{
11293#ifdef FREECIV_DELTA_PROTOCOL
11294 packet_connect_msg_100_fields fields;
11295 struct packet_connect_msg *old;
11296 struct genhash **hash = pc->phs.received + PACKET_CONNECT_MSG;
11297#endif /* FREECIV_DELTA_PROTOCOL */
11298 RECEIVE_PACKET_START(packet_connect_msg, real_packet);
11299#ifdef FREECIV_JSON_CONNECTION
11300 struct plocation field_addr;
11301 {
11302 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11303 field_addr = *field_addr_tmp;
11304 FC_FREE(field_addr_tmp);
11305 }
11306#endif /* FREECIV_JSON_CONNECTION */
11307
11308#ifdef FREECIV_DELTA_PROTOCOL
11309#ifdef FREECIV_JSON_CONNECTION
11310 field_addr.name = "fields";
11311#endif /* FREECIV_JSON_CONNECTION */
11312 DIO_BV_GET(&din, &field_addr, fields);
11313
11314#else /* FREECIV_DELTA_PROTOCOL */
11315 #ifdef FREECIV_JSON_CONNECTION
11316 field_addr.name = "message";
11317 #endif /* FREECIV_JSON_CONNECTION */
11318 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
11319 RECEIVE_PACKET_FIELD_ERROR(message);
11320 }
11321
11322#endif
11323 log_packet_detailed("packet_connect_msg_100: got info about ()");
11324
11325#ifdef FREECIV_DELTA_PROTOCOL
11326 if (NULL == *hash) {
11327 *hash = genhash_new_full(hash_packet_connect_msg_100, cmp_packet_connect_msg_100,
11328 NULL, NULL, NULL, free);
11329 }
11330
11331 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
11332 *real_packet = *old;
11333 } else {
11334 log_packet_detailed(" no old info");
11335 memset(real_packet, 0, sizeof(*real_packet));
11336 }
11337
11338 if (BV_ISSET(fields, 0)) {
11339 log_packet_detailed(" got field 'message'");
11340 #ifdef FREECIV_JSON_CONNECTION
11341 field_addr.name = "message";
11342 #endif /* FREECIV_JSON_CONNECTION */
11343 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
11344 RECEIVE_PACKET_FIELD_ERROR(message);
11345 }
11346 }
11347
11348 if (NULL == old) {
11349 old = fc_malloc(sizeof(*old));
11350 *old = *real_packet;
11351 genhash_insert(*hash, old, old);
11352 } else {
11353 *old = *real_packet;
11354 }
11355
11356#endif /* FREECIV_DELTA_PROTOCOL */
11357 RECEIVE_PACKET_END(real_packet);
11358}
11359
11360 static int send_packet_connect_msg_100(struct connection *pc, const struct packet_connect_msg *packet)
11361{
11362 const struct packet_connect_msg *real_packet = packet;
11363#ifdef FREECIV_DELTA_PROTOCOL
11364 packet_connect_msg_100_fields fields;
11365 struct packet_connect_msg *old;
11366 bool differ;
11367 struct genhash **hash = pc->phs.sent + PACKET_CONNECT_MSG;
11368#endif /* FREECIV_DELTA_PROTOCOL */
11369 SEND_PACKET_START(PACKET_CONNECT_MSG);
11370#ifdef FREECIV_JSON_CONNECTION
11371 struct plocation field_addr;
11372 {
11373 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11374 field_addr = *field_addr_tmp;
11375 FC_FREE(field_addr_tmp);
11376 }
11377#endif /* FREECIV_JSON_CONNECTION */
11378
11379 log_packet_detailed("packet_connect_msg_100: sending info about ()");
11380
11381#ifdef FREECIV_DELTA_PROTOCOL
11382 if (NULL == *hash) {
11383 *hash = genhash_new_full(hash_packet_connect_msg_100, cmp_packet_connect_msg_100,
11384 NULL, NULL, NULL, free);
11385 }
11386 BV_CLR_ALL(fields);
11387
11388 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
11389 old = fc_malloc(sizeof(*old));
11390 *old = *real_packet;
11391 genhash_insert(*hash, old, old);
11392 memset(old, 0, sizeof(*old));
11393 }
11394 differ = (strcmp(old->message, real_packet->message) != 0);
11395 if (differ) {
11396 BV_SET(fields, 0);
11397 }
11398
11399
11400#ifdef FREECIV_JSON_CONNECTION
11401 field_addr.name = "fields";
11402#endif /* FREECIV_JSON_CONNECTION */
11403 DIO_BV_PUT(&dout, &field_addr, fields);
11404
11405 if (BV_ISSET(fields, 0)) {
11406 log_packet_detailed(" field 'message' has changed");
11407 #ifdef FREECIV_JSON_CONNECTION
11408 field_addr.name = "message";
11409#endif /* FREECIV_JSON_CONNECTION */
11410 DIO_PUT(string, &dout, &field_addr, real_packet->message);
11411 }
11412
11413 *old = *real_packet;
11414#endif /* FREECIV_DELTA_PROTOCOL */
11415#ifndef FREECIV_DELTA_PROTOCOL
11416#ifdef FREECIV_JSON_CONNECTION
11417 field_addr.name = "message";
11418#endif /* FREECIV_JSON_CONNECTION */
11419 DIO_PUT(string, &dout, &field_addr, real_packet->message);
11420
11421#endif
11422 SEND_PACKET_END(PACKET_CONNECT_MSG);
11423}
11424
11425 int send_packet_connect_msg(struct connection *pc, const struct packet_connect_msg *packet)
11426{
11427 if (!pc->used) {
11428 log_error("WARNING: trying to send data to the closed connection %s",
11429 conn_description(pc));
11430 return -1;
11431 }
11432 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONNECT_MSG].packet != NULL, -1,
11433 "Handler for PACKET_CONNECT_MSG not installed");
11434 return pc->phs.handlers->send[PACKET_CONNECT_MSG].packet(pc, packet);
11435}
11436
11437 int dsend_packet_connect_msg(struct connection *pc, const char *message)
11438{
11439 struct packet_connect_msg packet, *real_packet = &packet;
11440
11441 sz_strlcpy(real_packet->message, message);
11442
11443 return send_packet_connect_msg(pc, real_packet);
11444}
11445
11446#ifdef FREECIV_DELTA_PROTOCOL
11447#define hash_packet_server_info_100 hash_const
11448
11449#define cmp_packet_server_info_100 cmp_const
11450
11451 BV_DEFINE(packet_server_info_100_fields, 5);
11452#endif /* FREECIV_DELTA_PROTOCOL */
11453
11454 static struct packet_server_info *receive_packet_server_info_100(struct connection *pc)
11455{
11456#ifdef FREECIV_DELTA_PROTOCOL
11457 packet_server_info_100_fields fields;
11458 struct packet_server_info *old;
11459 struct genhash **hash = pc->phs.received + PACKET_SERVER_INFO;
11460#endif /* FREECIV_DELTA_PROTOCOL */
11461 RECEIVE_PACKET_START(packet_server_info, real_packet);
11462#ifdef FREECIV_JSON_CONNECTION
11463 struct plocation field_addr;
11464 {
11465 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11466 field_addr = *field_addr_tmp;
11467 FC_FREE(field_addr_tmp);
11468 }
11469#endif /* FREECIV_JSON_CONNECTION */
11470
11471#ifdef FREECIV_DELTA_PROTOCOL
11472#ifdef FREECIV_JSON_CONNECTION
11473 field_addr.name = "fields";
11474#endif /* FREECIV_JSON_CONNECTION */
11475 DIO_BV_GET(&din, &field_addr, fields);
11476
11477#else /* FREECIV_DELTA_PROTOCOL */
11478 #ifdef FREECIV_JSON_CONNECTION
11479 field_addr.name = "version_label";
11480 #endif /* FREECIV_JSON_CONNECTION */
11481 if (!DIO_GET(string, &din, &field_addr, real_packet->version_label, sizeof(real_packet->version_label))) {
11482 RECEIVE_PACKET_FIELD_ERROR(version_label);
11483 }
11484 #ifdef FREECIV_JSON_CONNECTION
11485 field_addr.name = "major_version";
11486 #endif /* FREECIV_JSON_CONNECTION */
11487 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->major_version)) {
11488 RECEIVE_PACKET_FIELD_ERROR(major_version);
11489 }
11490 #ifdef FREECIV_JSON_CONNECTION
11491 field_addr.name = "minor_version";
11492 #endif /* FREECIV_JSON_CONNECTION */
11493 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->minor_version)) {
11494 RECEIVE_PACKET_FIELD_ERROR(minor_version);
11495 }
11496 #ifdef FREECIV_JSON_CONNECTION
11497 field_addr.name = "patch_version";
11498 #endif /* FREECIV_JSON_CONNECTION */
11499 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->patch_version)) {
11500 RECEIVE_PACKET_FIELD_ERROR(patch_version);
11501 }
11502 #ifdef FREECIV_JSON_CONNECTION
11503 field_addr.name = "emerg_version";
11504 #endif /* FREECIV_JSON_CONNECTION */
11505 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->emerg_version)) {
11506 RECEIVE_PACKET_FIELD_ERROR(emerg_version);
11507 }
11508
11509#endif
11510 log_packet_detailed("packet_server_info_100: got info about ()");
11511
11512#ifdef FREECIV_DELTA_PROTOCOL
11513 if (NULL == *hash) {
11514 *hash = genhash_new_full(hash_packet_server_info_100, cmp_packet_server_info_100,
11515 NULL, NULL, NULL, free);
11516 }
11517
11518 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
11519 *real_packet = *old;
11520 } else {
11521 log_packet_detailed(" no old info");
11522 memset(real_packet, 0, sizeof(*real_packet));
11523 }
11524
11525 if (BV_ISSET(fields, 0)) {
11526 log_packet_detailed(" got field 'version_label'");
11527 #ifdef FREECIV_JSON_CONNECTION
11528 field_addr.name = "version_label";
11529 #endif /* FREECIV_JSON_CONNECTION */
11530 if (!DIO_GET(string, &din, &field_addr, real_packet->version_label, sizeof(real_packet->version_label))) {
11531 RECEIVE_PACKET_FIELD_ERROR(version_label);
11532 }
11533 }
11534 if (BV_ISSET(fields, 1)) {
11535 log_packet_detailed(" got field 'major_version'");
11536 #ifdef FREECIV_JSON_CONNECTION
11537 field_addr.name = "major_version";
11538 #endif /* FREECIV_JSON_CONNECTION */
11539 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->major_version)) {
11540 RECEIVE_PACKET_FIELD_ERROR(major_version);
11541 }
11542 }
11543 if (BV_ISSET(fields, 2)) {
11544 log_packet_detailed(" got field 'minor_version'");
11545 #ifdef FREECIV_JSON_CONNECTION
11546 field_addr.name = "minor_version";
11547 #endif /* FREECIV_JSON_CONNECTION */
11548 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->minor_version)) {
11549 RECEIVE_PACKET_FIELD_ERROR(minor_version);
11550 }
11551 }
11552 if (BV_ISSET(fields, 3)) {
11553 log_packet_detailed(" got field 'patch_version'");
11554 #ifdef FREECIV_JSON_CONNECTION
11555 field_addr.name = "patch_version";
11556 #endif /* FREECIV_JSON_CONNECTION */
11557 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->patch_version)) {
11558 RECEIVE_PACKET_FIELD_ERROR(patch_version);
11559 }
11560 }
11561 if (BV_ISSET(fields, 4)) {
11562 log_packet_detailed(" got field 'emerg_version'");
11563 #ifdef FREECIV_JSON_CONNECTION
11564 field_addr.name = "emerg_version";
11565 #endif /* FREECIV_JSON_CONNECTION */
11566 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->emerg_version)) {
11567 RECEIVE_PACKET_FIELD_ERROR(emerg_version);
11568 }
11569 }
11570
11571 if (NULL == old) {
11572 old = fc_malloc(sizeof(*old));
11573 *old = *real_packet;
11574 genhash_insert(*hash, old, old);
11575 } else {
11576 *old = *real_packet;
11577 }
11578
11579#endif /* FREECIV_DELTA_PROTOCOL */
11580 RECEIVE_PACKET_END(real_packet);
11581}
11582
11583 static int send_packet_server_info_100(struct connection *pc, const struct packet_server_info *packet)
11584{
11585 const struct packet_server_info *real_packet = packet;
11586#ifdef FREECIV_DELTA_PROTOCOL
11587 packet_server_info_100_fields fields;
11588 struct packet_server_info *old;
11589 bool differ;
11590 struct genhash **hash = pc->phs.sent + PACKET_SERVER_INFO;
11591#endif /* FREECIV_DELTA_PROTOCOL */
11592 SEND_PACKET_START(PACKET_SERVER_INFO);
11593#ifdef FREECIV_JSON_CONNECTION
11594 struct plocation field_addr;
11595 {
11596 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11597 field_addr = *field_addr_tmp;
11598 FC_FREE(field_addr_tmp);
11599 }
11600#endif /* FREECIV_JSON_CONNECTION */
11601
11602 log_packet_detailed("packet_server_info_100: sending info about ()");
11603
11604#ifdef FREECIV_DELTA_PROTOCOL
11605 if (NULL == *hash) {
11606 *hash = genhash_new_full(hash_packet_server_info_100, cmp_packet_server_info_100,
11607 NULL, NULL, NULL, free);
11608 }
11609 BV_CLR_ALL(fields);
11610
11611 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
11612 old = fc_malloc(sizeof(*old));
11613 *old = *real_packet;
11614 genhash_insert(*hash, old, old);
11615 memset(old, 0, sizeof(*old));
11616 }
11617 differ = (strcmp(old->version_label, real_packet->version_label) != 0);
11618 if (differ) {
11619 BV_SET(fields, 0);
11620 }
11621
11622 differ = (old->major_version != real_packet->major_version);
11623 if (differ) {
11624 BV_SET(fields, 1);
11625 }
11626
11627 differ = (old->minor_version != real_packet->minor_version);
11628 if (differ) {
11629 BV_SET(fields, 2);
11630 }
11631
11632 differ = (old->patch_version != real_packet->patch_version);
11633 if (differ) {
11634 BV_SET(fields, 3);
11635 }
11636
11637 differ = (old->emerg_version != real_packet->emerg_version);
11638 if (differ) {
11639 BV_SET(fields, 4);
11640 }
11641
11642
11643#ifdef FREECIV_JSON_CONNECTION
11644 field_addr.name = "fields";
11645#endif /* FREECIV_JSON_CONNECTION */
11646 DIO_BV_PUT(&dout, &field_addr, fields);
11647
11648 if (BV_ISSET(fields, 0)) {
11649 log_packet_detailed(" field 'version_label' has changed");
11650 #ifdef FREECIV_JSON_CONNECTION
11651 field_addr.name = "version_label";
11652#endif /* FREECIV_JSON_CONNECTION */
11653 DIO_PUT(string, &dout, &field_addr, real_packet->version_label);
11654 }
11655 if (BV_ISSET(fields, 1)) {
11656 log_packet_detailed(" field 'major_version' has changed");
11657 #ifdef FREECIV_JSON_CONNECTION
11658 field_addr.name = "major_version";
11659#endif /* FREECIV_JSON_CONNECTION */
11660 DIO_PUT(uint32, &dout, &field_addr, real_packet->major_version);
11661 }
11662 if (BV_ISSET(fields, 2)) {
11663 log_packet_detailed(" field 'minor_version' has changed");
11664 #ifdef FREECIV_JSON_CONNECTION
11665 field_addr.name = "minor_version";
11666#endif /* FREECIV_JSON_CONNECTION */
11667 DIO_PUT(uint32, &dout, &field_addr, real_packet->minor_version);
11668 }
11669 if (BV_ISSET(fields, 3)) {
11670 log_packet_detailed(" field 'patch_version' has changed");
11671 #ifdef FREECIV_JSON_CONNECTION
11672 field_addr.name = "patch_version";
11673#endif /* FREECIV_JSON_CONNECTION */
11674 DIO_PUT(uint32, &dout, &field_addr, real_packet->patch_version);
11675 }
11676 if (BV_ISSET(fields, 4)) {
11677 log_packet_detailed(" field 'emerg_version' has changed");
11678 #ifdef FREECIV_JSON_CONNECTION
11679 field_addr.name = "emerg_version";
11680#endif /* FREECIV_JSON_CONNECTION */
11681 DIO_PUT(uint32, &dout, &field_addr, real_packet->emerg_version);
11682 }
11683
11684 *old = *real_packet;
11685#endif /* FREECIV_DELTA_PROTOCOL */
11686#ifndef FREECIV_DELTA_PROTOCOL
11687#ifdef FREECIV_JSON_CONNECTION
11688 field_addr.name = "version_label";
11689#endif /* FREECIV_JSON_CONNECTION */
11690 DIO_PUT(string, &dout, &field_addr, real_packet->version_label);
11691#ifdef FREECIV_JSON_CONNECTION
11692 field_addr.name = "major_version";
11693#endif /* FREECIV_JSON_CONNECTION */
11694 DIO_PUT(uint32, &dout, &field_addr, real_packet->major_version);
11695#ifdef FREECIV_JSON_CONNECTION
11696 field_addr.name = "minor_version";
11697#endif /* FREECIV_JSON_CONNECTION */
11698 DIO_PUT(uint32, &dout, &field_addr, real_packet->minor_version);
11699#ifdef FREECIV_JSON_CONNECTION
11700 field_addr.name = "patch_version";
11701#endif /* FREECIV_JSON_CONNECTION */
11702 DIO_PUT(uint32, &dout, &field_addr, real_packet->patch_version);
11703#ifdef FREECIV_JSON_CONNECTION
11704 field_addr.name = "emerg_version";
11705#endif /* FREECIV_JSON_CONNECTION */
11706 DIO_PUT(uint32, &dout, &field_addr, real_packet->emerg_version);
11707
11708#endif
11709 SEND_PACKET_END(PACKET_SERVER_INFO);
11710}
11711
11712 int send_packet_server_info(struct connection *pc, const struct packet_server_info *packet)
11713{
11714 if (!pc->used) {
11715 log_error("WARNING: trying to send data to the closed connection %s",
11716 conn_description(pc));
11717 return -1;
11718 }
11719 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_INFO].packet != NULL, -1,
11720 "Handler for PACKET_SERVER_INFO not installed");
11721 return pc->phs.handlers->send[PACKET_SERVER_INFO].packet(pc, packet);
11722}
11723
11724 int dsend_packet_server_info(struct connection *pc, const char *version_label, int major_version, int minor_version, int patch_version, int emerg_version)
11725{
11726 struct packet_server_info packet, *real_packet = &packet;
11727
11728 sz_strlcpy(real_packet->version_label, version_label);
11729 real_packet->major_version = major_version;
11730 real_packet->minor_version = minor_version;
11731 real_packet->patch_version = patch_version;
11732 real_packet->emerg_version = emerg_version;
11733
11734 return send_packet_server_info(pc, real_packet);
11735}
11736
11737#ifdef FREECIV_DELTA_PROTOCOL
11738#define hash_packet_city_remove_100 hash_const
11739
11740#define cmp_packet_city_remove_100 cmp_const
11741
11742 BV_DEFINE(packet_city_remove_100_fields, 1);
11743#endif /* FREECIV_DELTA_PROTOCOL */
11744
11745 static struct packet_city_remove *receive_packet_city_remove_100(struct connection *pc)
11746{
11747#ifdef FREECIV_DELTA_PROTOCOL
11748 packet_city_remove_100_fields fields;
11749 struct packet_city_remove *old;
11750 struct genhash **hash = pc->phs.received + PACKET_CITY_REMOVE;
11751#endif /* FREECIV_DELTA_PROTOCOL */
11752 RECEIVE_PACKET_START(packet_city_remove, real_packet);
11753#ifdef FREECIV_JSON_CONNECTION
11754 struct plocation field_addr;
11755 {
11756 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11757 field_addr = *field_addr_tmp;
11758 FC_FREE(field_addr_tmp);
11759 }
11760#endif /* FREECIV_JSON_CONNECTION */
11761
11762#ifdef FREECIV_DELTA_PROTOCOL
11763#ifdef FREECIV_JSON_CONNECTION
11764 field_addr.name = "fields";
11765#endif /* FREECIV_JSON_CONNECTION */
11766 DIO_BV_GET(&din, &field_addr, fields);
11767
11768#else /* FREECIV_DELTA_PROTOCOL */
11769 #ifdef FREECIV_JSON_CONNECTION
11770 field_addr.name = "city_id32";
11771 #endif /* FREECIV_JSON_CONNECTION */
11772 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
11773 RECEIVE_PACKET_FIELD_ERROR(city_id32);
11774 }
11775
11776#endif
11777 log_packet_detailed("packet_city_remove_100: got info about ()");
11778
11779#ifdef FREECIV_DELTA_PROTOCOL
11780 if (NULL == *hash) {
11781 *hash = genhash_new_full(hash_packet_city_remove_100, cmp_packet_city_remove_100,
11782 NULL, NULL, NULL, free);
11783 }
11784
11785 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
11786 *real_packet = *old;
11787 } else {
11788 log_packet_detailed(" no old info");
11789 memset(real_packet, 0, sizeof(*real_packet));
11790 }
11791
11792 if (BV_ISSET(fields, 0)) {
11793 log_packet_detailed(" got field 'city_id32'");
11794 #ifdef FREECIV_JSON_CONNECTION
11795 field_addr.name = "city_id32";
11796 #endif /* FREECIV_JSON_CONNECTION */
11797 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
11798 RECEIVE_PACKET_FIELD_ERROR(city_id32);
11799 }
11800 }
11801
11802 if (NULL == old) {
11803 old = fc_malloc(sizeof(*old));
11804 *old = *real_packet;
11805 genhash_insert(*hash, old, old);
11806 } else {
11807 *old = *real_packet;
11808 }
11809
11810 hash = pc->phs.received + PACKET_CITY_INFO;
11811 if (NULL != *hash) {
11812 genhash_remove(*hash, real_packet);
11813 }
11814
11815 hash = pc->phs.received + PACKET_WEB_CITY_INFO_ADDITION;
11816 if (NULL != *hash) {
11817 genhash_remove(*hash, real_packet);
11818 }
11819
11820 hash = pc->phs.received + PACKET_CITY_NATIONALITIES;
11821 if (NULL != *hash) {
11822 genhash_remove(*hash, real_packet);
11823 }
11824
11825 hash = pc->phs.received + PACKET_CITY_RALLY_POINT;
11826 if (NULL != *hash) {
11827 genhash_remove(*hash, real_packet);
11828 }
11829
11830 hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
11831 if (NULL != *hash) {
11832 genhash_remove(*hash, real_packet);
11833 }
11834
11835#endif /* FREECIV_DELTA_PROTOCOL */
11836 RECEIVE_PACKET_END(real_packet);
11837}
11838
11839 static int send_packet_city_remove_100(struct connection *pc, const struct packet_city_remove *packet)
11840{
11841 const struct packet_city_remove *real_packet = packet;
11842#ifdef FREECIV_DELTA_PROTOCOL
11843 packet_city_remove_100_fields fields;
11844 struct packet_city_remove *old;
11845 bool differ;
11846 struct genhash **hash = pc->phs.sent + PACKET_CITY_REMOVE;
11847#endif /* FREECIV_DELTA_PROTOCOL */
11848 SEND_PACKET_START(PACKET_CITY_REMOVE);
11849#ifdef FREECIV_JSON_CONNECTION
11850 struct plocation field_addr;
11851 {
11852 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11853 field_addr = *field_addr_tmp;
11854 FC_FREE(field_addr_tmp);
11855 }
11856#endif /* FREECIV_JSON_CONNECTION */
11857
11858 log_packet_detailed("packet_city_remove_100: sending info about ()");
11859
11860#ifdef FREECIV_DELTA_PROTOCOL
11861 if (NULL == *hash) {
11862 *hash = genhash_new_full(hash_packet_city_remove_100, cmp_packet_city_remove_100,
11863 NULL, NULL, NULL, free);
11864 }
11865 BV_CLR_ALL(fields);
11866
11867 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
11868 old = fc_malloc(sizeof(*old));
11869 *old = *real_packet;
11870 genhash_insert(*hash, old, old);
11871 memset(old, 0, sizeof(*old));
11872 }
11873 differ = (old->city_id32 != real_packet->city_id32);
11874 if (differ) {
11875 BV_SET(fields, 0);
11876 }
11877
11878
11879#ifdef FREECIV_JSON_CONNECTION
11880 field_addr.name = "fields";
11881#endif /* FREECIV_JSON_CONNECTION */
11882 DIO_BV_PUT(&dout, &field_addr, fields);
11883
11884 if (BV_ISSET(fields, 0)) {
11885 log_packet_detailed(" field 'city_id32' has changed");
11886 #ifdef FREECIV_JSON_CONNECTION
11887 field_addr.name = "city_id32";
11888#endif /* FREECIV_JSON_CONNECTION */
11889 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
11890 }
11891
11892 *old = *real_packet;
11893
11894 hash = pc->phs.sent + PACKET_CITY_INFO;
11895 if (NULL != *hash) {
11896 genhash_remove(*hash, real_packet);
11897 }
11898
11899 hash = pc->phs.sent + PACKET_WEB_CITY_INFO_ADDITION;
11900 if (NULL != *hash) {
11901 genhash_remove(*hash, real_packet);
11902 }
11903
11904 hash = pc->phs.sent + PACKET_CITY_NATIONALITIES;
11905 if (NULL != *hash) {
11906 genhash_remove(*hash, real_packet);
11907 }
11908
11909 hash = pc->phs.sent + PACKET_CITY_RALLY_POINT;
11910 if (NULL != *hash) {
11911 genhash_remove(*hash, real_packet);
11912 }
11913
11914 hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
11915 if (NULL != *hash) {
11916 genhash_remove(*hash, real_packet);
11917 }
11918#endif /* FREECIV_DELTA_PROTOCOL */
11919#ifndef FREECIV_DELTA_PROTOCOL
11920#ifdef FREECIV_JSON_CONNECTION
11921 field_addr.name = "city_id32";
11922#endif /* FREECIV_JSON_CONNECTION */
11923 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
11924
11925#endif
11926 SEND_PACKET_END(PACKET_CITY_REMOVE);
11927}
11928
11929#ifdef FREECIV_DELTA_PROTOCOL
11930#define hash_packet_city_remove_101 hash_const
11931
11932#define cmp_packet_city_remove_101 cmp_const
11933
11934 BV_DEFINE(packet_city_remove_101_fields, 1);
11935#endif /* FREECIV_DELTA_PROTOCOL */
11936
11937 static struct packet_city_remove *receive_packet_city_remove_101(struct connection *pc)
11938{
11939#ifdef FREECIV_DELTA_PROTOCOL
11940 packet_city_remove_101_fields fields;
11941 struct packet_city_remove *old;
11942 struct genhash **hash = pc->phs.received + PACKET_CITY_REMOVE;
11943#endif /* FREECIV_DELTA_PROTOCOL */
11944 RECEIVE_PACKET_START(packet_city_remove, real_packet);
11945#ifdef FREECIV_JSON_CONNECTION
11946 struct plocation field_addr;
11947 {
11948 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11949 field_addr = *field_addr_tmp;
11950 FC_FREE(field_addr_tmp);
11951 }
11952#endif /* FREECIV_JSON_CONNECTION */
11953
11954#ifdef FREECIV_DELTA_PROTOCOL
11955#ifdef FREECIV_JSON_CONNECTION
11956 field_addr.name = "fields";
11957#endif /* FREECIV_JSON_CONNECTION */
11958 DIO_BV_GET(&din, &field_addr, fields);
11959
11960#else /* FREECIV_DELTA_PROTOCOL */
11961 #ifdef FREECIV_JSON_CONNECTION
11962 field_addr.name = "city_id16";
11963 #endif /* FREECIV_JSON_CONNECTION */
11964 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
11965 RECEIVE_PACKET_FIELD_ERROR(city_id16);
11966 }
11967
11968#endif
11969 log_packet_detailed("packet_city_remove_101: got info about ()");
11970
11971#ifdef FREECIV_DELTA_PROTOCOL
11972 if (NULL == *hash) {
11973 *hash = genhash_new_full(hash_packet_city_remove_101, cmp_packet_city_remove_101,
11974 NULL, NULL, NULL, free);
11975 }
11976
11977 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
11978 *real_packet = *old;
11979 } else {
11980 log_packet_detailed(" no old info");
11981 memset(real_packet, 0, sizeof(*real_packet));
11982 }
11983
11984 if (BV_ISSET(fields, 0)) {
11985 log_packet_detailed(" got field 'city_id16'");
11986 #ifdef FREECIV_JSON_CONNECTION
11987 field_addr.name = "city_id16";
11988 #endif /* FREECIV_JSON_CONNECTION */
11989 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
11990 RECEIVE_PACKET_FIELD_ERROR(city_id16);
11991 }
11992 }
11993
11994 if (NULL == old) {
11995 old = fc_malloc(sizeof(*old));
11996 *old = *real_packet;
11997 genhash_insert(*hash, old, old);
11998 } else {
11999 *old = *real_packet;
12000 }
12001
12002 hash = pc->phs.received + PACKET_CITY_INFO;
12003 if (NULL != *hash) {
12004 genhash_remove(*hash, real_packet);
12005 }
12006
12007 hash = pc->phs.received + PACKET_WEB_CITY_INFO_ADDITION;
12008 if (NULL != *hash) {
12009 genhash_remove(*hash, real_packet);
12010 }
12011
12012 hash = pc->phs.received + PACKET_CITY_NATIONALITIES;
12013 if (NULL != *hash) {
12014 genhash_remove(*hash, real_packet);
12015 }
12016
12017 hash = pc->phs.received + PACKET_CITY_RALLY_POINT;
12018 if (NULL != *hash) {
12019 genhash_remove(*hash, real_packet);
12020 }
12021
12022 hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
12023 if (NULL != *hash) {
12024 genhash_remove(*hash, real_packet);
12025 }
12026
12027#endif /* FREECIV_DELTA_PROTOCOL */
12028 RECEIVE_PACKET_END(real_packet);
12029}
12030
12031 static int send_packet_city_remove_101(struct connection *pc, const struct packet_city_remove *packet)
12032{
12033 const struct packet_city_remove *real_packet = packet;
12034#ifdef FREECIV_DELTA_PROTOCOL
12035 packet_city_remove_101_fields fields;
12036 struct packet_city_remove *old;
12037 bool differ;
12038 struct genhash **hash = pc->phs.sent + PACKET_CITY_REMOVE;
12039#endif /* FREECIV_DELTA_PROTOCOL */
12040 SEND_PACKET_START(PACKET_CITY_REMOVE);
12041#ifdef FREECIV_JSON_CONNECTION
12042 struct plocation field_addr;
12043 {
12044 struct plocation *field_addr_tmp = plocation_field_new(NULL);
12045 field_addr = *field_addr_tmp;
12046 FC_FREE(field_addr_tmp);
12047 }
12048#endif /* FREECIV_JSON_CONNECTION */
12049
12050 log_packet_detailed("packet_city_remove_101: sending info about ()");
12051
12052#ifdef FREECIV_DELTA_PROTOCOL
12053 if (NULL == *hash) {
12054 *hash = genhash_new_full(hash_packet_city_remove_101, cmp_packet_city_remove_101,
12055 NULL, NULL, NULL, free);
12056 }
12057 BV_CLR_ALL(fields);
12058
12059 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
12060 old = fc_malloc(sizeof(*old));
12061 *old = *real_packet;
12062 genhash_insert(*hash, old, old);
12063 memset(old, 0, sizeof(*old));
12064 }
12065 differ = (old->city_id16 != real_packet->city_id16);
12066 if (differ) {
12067 BV_SET(fields, 0);
12068 }
12069
12070
12071#ifdef FREECIV_JSON_CONNECTION
12072 field_addr.name = "fields";
12073#endif /* FREECIV_JSON_CONNECTION */
12074 DIO_BV_PUT(&dout, &field_addr, fields);
12075
12076 if (BV_ISSET(fields, 0)) {
12077 log_packet_detailed(" field 'city_id16' has changed");
12078 #ifdef FREECIV_JSON_CONNECTION
12079 field_addr.name = "city_id16";
12080#endif /* FREECIV_JSON_CONNECTION */
12081 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
12082 }
12083
12084 *old = *real_packet;
12085
12086 hash = pc->phs.sent + PACKET_CITY_INFO;
12087 if (NULL != *hash) {
12088 genhash_remove(*hash, real_packet);
12089 }
12090
12091 hash = pc->phs.sent + PACKET_WEB_CITY_INFO_ADDITION;
12092 if (NULL != *hash) {
12093 genhash_remove(*hash, real_packet);
12094 }
12095
12096 hash = pc->phs.sent + PACKET_CITY_NATIONALITIES;
12097 if (NULL != *hash) {
12098 genhash_remove(*hash, real_packet);
12099 }
12100
12101 hash = pc->phs.sent + PACKET_CITY_RALLY_POINT;
12102 if (NULL != *hash) {
12103 genhash_remove(*hash, real_packet);
12104 }
12105
12106 hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
12107 if (NULL != *hash) {
12108 genhash_remove(*hash, real_packet);
12109 }
12110#endif /* FREECIV_DELTA_PROTOCOL */
12111#ifndef FREECIV_DELTA_PROTOCOL
12112#ifdef FREECIV_JSON_CONNECTION
12113 field_addr.name = "city_id16";
12114#endif /* FREECIV_JSON_CONNECTION */
12115 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
12116
12117#endif
12118 SEND_PACKET_END(PACKET_CITY_REMOVE);
12119}
12120
12121 int send_packet_city_remove(struct connection *pc, const struct packet_city_remove *packet)
12122{
12123 if (!pc->used) {
12124 log_error("WARNING: trying to send data to the closed connection %s",
12125 conn_description(pc));
12126 return -1;
12127 }
12128 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_REMOVE].packet != NULL, -1,
12129 "Handler for PACKET_CITY_REMOVE not installed");
12130 return pc->phs.handlers->send[PACKET_CITY_REMOVE].packet(pc, packet);
12131}
12132
12133 void lsend_packet_city_remove(struct conn_list *dest, const struct packet_city_remove *packet)
12134{
12135 conn_list_iterate(dest, pconn) {
12136 send_packet_city_remove(pconn, packet);
12137 } conn_list_iterate_end;
12138}
12139
12140 int dsend_packet_city_remove(struct connection *pc, int city_id16, int city_id32)
12141{
12142 struct packet_city_remove packet, *real_packet = &packet;
12143
12144 real_packet->city_id16 = city_id16;
12145 real_packet->city_id32 = city_id32;
12146
12147 return send_packet_city_remove(pc, real_packet);
12148}
12149
12150 void dlsend_packet_city_remove(struct conn_list *dest, int city_id16, int city_id32)
12151{
12152 struct packet_city_remove packet, *real_packet = &packet;
12153
12154 real_packet->city_id16 = city_id16;
12155 real_packet->city_id32 = city_id32;
12156
12157 lsend_packet_city_remove(dest, real_packet);
12158}
12159
12160#ifdef FREECIV_DELTA_PROTOCOL
12161#define hash_packet_city_info_100 hash_const
12162
12163#define cmp_packet_city_info_100 cmp_const
12164
12165 BV_DEFINE(packet_city_info_100_fields, 50);
12166#endif /* FREECIV_DELTA_PROTOCOL */
12167
12168 static struct packet_city_info *receive_packet_city_info_100(struct connection *pc)
12169{
12170#ifdef FREECIV_DELTA_PROTOCOL
12171 packet_city_info_100_fields fields;
12172 struct packet_city_info *old;
12173 struct genhash **hash = pc->phs.received + PACKET_CITY_INFO;
12174#endif /* FREECIV_DELTA_PROTOCOL */
12175 RECEIVE_PACKET_START(packet_city_info, real_packet);
12176#ifdef FREECIV_JSON_CONNECTION
12177 struct plocation field_addr;
12178 {
12179 struct plocation *field_addr_tmp = plocation_field_new(NULL);
12180 field_addr = *field_addr_tmp;
12181 FC_FREE(field_addr_tmp);
12182 }
12183#endif /* FREECIV_JSON_CONNECTION */
12184
12185#ifdef FREECIV_DELTA_PROTOCOL
12186#ifdef FREECIV_JSON_CONNECTION
12187 field_addr.name = "fields";
12188#endif /* FREECIV_JSON_CONNECTION */
12189 DIO_BV_GET(&din, &field_addr, fields);
12190
12191#else /* FREECIV_DELTA_PROTOCOL */
12192 #ifdef FREECIV_JSON_CONNECTION
12193 field_addr.name = "id32";
12194 #endif /* FREECIV_JSON_CONNECTION */
12195 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
12196 RECEIVE_PACKET_FIELD_ERROR(id32);
12197 }
12198 #ifdef FREECIV_JSON_CONNECTION
12199 field_addr.name = "tile";
12200 #endif /* FREECIV_JSON_CONNECTION */
12201 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
12202 RECEIVE_PACKET_FIELD_ERROR(tile);
12203 }
12204 #ifdef FREECIV_JSON_CONNECTION
12205 field_addr.name = "owner";
12206 #endif /* FREECIV_JSON_CONNECTION */
12207 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
12208 RECEIVE_PACKET_FIELD_ERROR(owner);
12209 }
12210 #ifdef FREECIV_JSON_CONNECTION
12211 field_addr.name = "original";
12212 #endif /* FREECIV_JSON_CONNECTION */
12213 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->original)) {
12214 RECEIVE_PACKET_FIELD_ERROR(original);
12215 }
12216 #ifdef FREECIV_JSON_CONNECTION
12217 field_addr.name = "size";
12218 #endif /* FREECIV_JSON_CONNECTION */
12219 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
12220 RECEIVE_PACKET_FIELD_ERROR(size);
12221 }
12222 #ifdef FREECIV_JSON_CONNECTION
12223 field_addr.name = "city_radius_sq";
12224 #endif /* FREECIV_JSON_CONNECTION */
12225 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_radius_sq)) {
12226 RECEIVE_PACKET_FIELD_ERROR(city_radius_sq);
12227 }
12228 #ifdef FREECIV_JSON_CONNECTION
12229 field_addr.name = "style";
12230 #endif /* FREECIV_JSON_CONNECTION */
12231 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
12232 RECEIVE_PACKET_FIELD_ERROR(style);
12233 }
12234 #ifdef FREECIV_JSON_CONNECTION
12235 field_addr.name = "capital";
12236 #endif /* FREECIV_JSON_CONNECTION */
12237 {
12238 int readin;
12239
12240 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
12241 RECEIVE_PACKET_FIELD_ERROR(capital);
12242 }
12243 real_packet->capital = readin;
12244 }
12245 #ifdef FREECIV_JSON_CONNECTION
12246 field_addr.name = "ppl_happy";
12247 #endif /* FREECIV_JSON_CONNECTION */
12248
12249 {
12250 int i;
12251
12252 #ifdef FREECIV_JSON_CONNECTION
12253 /* Enter array. */
12254 field_addr.sub_location = plocation_elem_new(0);
12255 #endif /* FREECIV_JSON_CONNECTION */
12256
12257 for (i = 0; i < FEELING_LAST; i++) {
12258 #ifdef FREECIV_JSON_CONNECTION
12259 field_addr.sub_location->number = i;
12260 #endif /* FREECIV_JSON_CONNECTION */
12261 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
12262 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
12263 }
12264 }
12265
12266 #ifdef FREECIV_JSON_CONNECTION
12267 /* Exit array. */
12268 free(field_addr.sub_location);
12269 field_addr.sub_location = NULL;
12270 #endif /* FREECIV_JSON_CONNECTION */
12271 }
12272 #ifdef FREECIV_JSON_CONNECTION
12273 field_addr.name = "ppl_content";
12274 #endif /* FREECIV_JSON_CONNECTION */
12275
12276 {
12277 int i;
12278
12279 #ifdef FREECIV_JSON_CONNECTION
12280 /* Enter array. */
12281 field_addr.sub_location = plocation_elem_new(0);
12282 #endif /* FREECIV_JSON_CONNECTION */
12283
12284 for (i = 0; i < FEELING_LAST; i++) {
12285 #ifdef FREECIV_JSON_CONNECTION
12286 field_addr.sub_location->number = i;
12287 #endif /* FREECIV_JSON_CONNECTION */
12288 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
12289 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
12290 }
12291 }
12292
12293 #ifdef FREECIV_JSON_CONNECTION
12294 /* Exit array. */
12295 free(field_addr.sub_location);
12296 field_addr.sub_location = NULL;
12297 #endif /* FREECIV_JSON_CONNECTION */
12298 }
12299 #ifdef FREECIV_JSON_CONNECTION
12300 field_addr.name = "ppl_unhappy";
12301 #endif /* FREECIV_JSON_CONNECTION */
12302
12303 {
12304 int i;
12305
12306 #ifdef FREECIV_JSON_CONNECTION
12307 /* Enter array. */
12308 field_addr.sub_location = plocation_elem_new(0);
12309 #endif /* FREECIV_JSON_CONNECTION */
12310
12311 for (i = 0; i < FEELING_LAST; i++) {
12312 #ifdef FREECIV_JSON_CONNECTION
12313 field_addr.sub_location->number = i;
12314 #endif /* FREECIV_JSON_CONNECTION */
12315 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
12316 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
12317 }
12318 }
12319
12320 #ifdef FREECIV_JSON_CONNECTION
12321 /* Exit array. */
12322 free(field_addr.sub_location);
12323 field_addr.sub_location = NULL;
12324 #endif /* FREECIV_JSON_CONNECTION */
12325 }
12326 #ifdef FREECIV_JSON_CONNECTION
12327 field_addr.name = "ppl_angry";
12328 #endif /* FREECIV_JSON_CONNECTION */
12329
12330 {
12331 int i;
12332
12333 #ifdef FREECIV_JSON_CONNECTION
12334 /* Enter array. */
12335 field_addr.sub_location = plocation_elem_new(0);
12336 #endif /* FREECIV_JSON_CONNECTION */
12337
12338 for (i = 0; i < FEELING_LAST; i++) {
12339 #ifdef FREECIV_JSON_CONNECTION
12340 field_addr.sub_location->number = i;
12341 #endif /* FREECIV_JSON_CONNECTION */
12342 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
12343 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
12344 }
12345 }
12346
12347 #ifdef FREECIV_JSON_CONNECTION
12348 /* Exit array. */
12349 free(field_addr.sub_location);
12350 field_addr.sub_location = NULL;
12351 #endif /* FREECIV_JSON_CONNECTION */
12352 }
12353 #ifdef FREECIV_JSON_CONNECTION
12354 field_addr.name = "specialists_size";
12355 #endif /* FREECIV_JSON_CONNECTION */
12356 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
12357 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
12358 }
12359 #ifdef FREECIV_JSON_CONNECTION
12360 field_addr.name = "specialists";
12361 #endif /* FREECIV_JSON_CONNECTION */
12362
12363 {
12364 int i;
12365
12366 #ifdef FREECIV_JSON_CONNECTION
12367 /* Enter array. */
12368 field_addr.sub_location = plocation_elem_new(0);
12369 #endif /* FREECIV_JSON_CONNECTION */
12370
12371 if (real_packet->specialists_size > SP_MAX) {
12372 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
12373 }
12374 for (i = 0; i < real_packet->specialists_size; i++) {
12375 #ifdef FREECIV_JSON_CONNECTION
12376 field_addr.sub_location->number = i;
12377 #endif /* FREECIV_JSON_CONNECTION */
12378 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
12379 RECEIVE_PACKET_FIELD_ERROR(specialists);
12380 }
12381 }
12382
12383 #ifdef FREECIV_JSON_CONNECTION
12384 /* Exit array. */
12385 free(field_addr.sub_location);
12386 field_addr.sub_location = NULL;
12387 #endif /* FREECIV_JSON_CONNECTION */
12388 }
12389 #ifdef FREECIV_JSON_CONNECTION
12390 field_addr.name = "history";
12391 #endif /* FREECIV_JSON_CONNECTION */
12392 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
12393 RECEIVE_PACKET_FIELD_ERROR(history);
12394 }
12395 #ifdef FREECIV_JSON_CONNECTION
12396 field_addr.name = "culture";
12397 #endif /* FREECIV_JSON_CONNECTION */
12398 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
12399 RECEIVE_PACKET_FIELD_ERROR(culture);
12400 }
12401 #ifdef FREECIV_JSON_CONNECTION
12402 field_addr.name = "buy_cost";
12403 #endif /* FREECIV_JSON_CONNECTION */
12404 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->buy_cost)) {
12405 RECEIVE_PACKET_FIELD_ERROR(buy_cost);
12406 }
12407 #ifdef FREECIV_JSON_CONNECTION
12408 field_addr.name = "surplus";
12409 #endif /* FREECIV_JSON_CONNECTION */
12410
12411 {
12412 int i;
12413
12414 #ifdef FREECIV_JSON_CONNECTION
12415 /* Enter array. */
12416 field_addr.sub_location = plocation_elem_new(0);
12417 #endif /* FREECIV_JSON_CONNECTION */
12418
12419 for (i = 0; i < O_LAST; i++) {
12420 #ifdef FREECIV_JSON_CONNECTION
12421 field_addr.sub_location->number = i;
12422 #endif /* FREECIV_JSON_CONNECTION */
12423 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->surplus[i])) {
12424 RECEIVE_PACKET_FIELD_ERROR(surplus);
12425 }
12426 }
12427
12428 #ifdef FREECIV_JSON_CONNECTION
12429 /* Exit array. */
12430 free(field_addr.sub_location);
12431 field_addr.sub_location = NULL;
12432 #endif /* FREECIV_JSON_CONNECTION */
12433 }
12434 #ifdef FREECIV_JSON_CONNECTION
12435 field_addr.name = "waste";
12436 #endif /* FREECIV_JSON_CONNECTION */
12437
12438 {
12439 int i;
12440
12441 #ifdef FREECIV_JSON_CONNECTION
12442 /* Enter array. */
12443 field_addr.sub_location = plocation_elem_new(0);
12444 #endif /* FREECIV_JSON_CONNECTION */
12445
12446 for (i = 0; i < O_LAST; i++) {
12447 #ifdef FREECIV_JSON_CONNECTION
12448 field_addr.sub_location->number = i;
12449 #endif /* FREECIV_JSON_CONNECTION */
12450 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->waste[i])) {
12451 RECEIVE_PACKET_FIELD_ERROR(waste);
12452 }
12453 }
12454
12455 #ifdef FREECIV_JSON_CONNECTION
12456 /* Exit array. */
12457 free(field_addr.sub_location);
12458 field_addr.sub_location = NULL;
12459 #endif /* FREECIV_JSON_CONNECTION */
12460 }
12461 #ifdef FREECIV_JSON_CONNECTION
12462 field_addr.name = "unhappy_penalty";
12463 #endif /* FREECIV_JSON_CONNECTION */
12464
12465 {
12466 int i;
12467
12468 #ifdef FREECIV_JSON_CONNECTION
12469 /* Enter array. */
12470 field_addr.sub_location = plocation_elem_new(0);
12471 #endif /* FREECIV_JSON_CONNECTION */
12472
12473 for (i = 0; i < O_LAST; i++) {
12474 #ifdef FREECIV_JSON_CONNECTION
12475 field_addr.sub_location->number = i;
12476 #endif /* FREECIV_JSON_CONNECTION */
12477 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->unhappy_penalty[i])) {
12478 RECEIVE_PACKET_FIELD_ERROR(unhappy_penalty);
12479 }
12480 }
12481
12482 #ifdef FREECIV_JSON_CONNECTION
12483 /* Exit array. */
12484 free(field_addr.sub_location);
12485 field_addr.sub_location = NULL;
12486 #endif /* FREECIV_JSON_CONNECTION */
12487 }
12488 #ifdef FREECIV_JSON_CONNECTION
12489 field_addr.name = "prod";
12490 #endif /* FREECIV_JSON_CONNECTION */
12491
12492 {
12493 int i;
12494
12495 #ifdef FREECIV_JSON_CONNECTION
12496 /* Enter array. */
12497 field_addr.sub_location = plocation_elem_new(0);
12498 #endif /* FREECIV_JSON_CONNECTION */
12499
12500 for (i = 0; i < O_LAST; i++) {
12501 #ifdef FREECIV_JSON_CONNECTION
12502 field_addr.sub_location->number = i;
12503 #endif /* FREECIV_JSON_CONNECTION */
12504 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->prod[i])) {
12505 RECEIVE_PACKET_FIELD_ERROR(prod);
12506 }
12507 }
12508
12509 #ifdef FREECIV_JSON_CONNECTION
12510 /* Exit array. */
12511 free(field_addr.sub_location);
12512 field_addr.sub_location = NULL;
12513 #endif /* FREECIV_JSON_CONNECTION */
12514 }
12515 #ifdef FREECIV_JSON_CONNECTION
12516 field_addr.name = "citizen_base";
12517 #endif /* FREECIV_JSON_CONNECTION */
12518
12519 {
12520 int i;
12521
12522 #ifdef FREECIV_JSON_CONNECTION
12523 /* Enter array. */
12524 field_addr.sub_location = plocation_elem_new(0);
12525 #endif /* FREECIV_JSON_CONNECTION */
12526
12527 for (i = 0; i < O_LAST; i++) {
12528 #ifdef FREECIV_JSON_CONNECTION
12529 field_addr.sub_location->number = i;
12530 #endif /* FREECIV_JSON_CONNECTION */
12531 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->citizen_base[i])) {
12532 RECEIVE_PACKET_FIELD_ERROR(citizen_base);
12533 }
12534 }
12535
12536 #ifdef FREECIV_JSON_CONNECTION
12537 /* Exit array. */
12538 free(field_addr.sub_location);
12539 field_addr.sub_location = NULL;
12540 #endif /* FREECIV_JSON_CONNECTION */
12541 }
12542 #ifdef FREECIV_JSON_CONNECTION
12543 field_addr.name = "usage";
12544 #endif /* FREECIV_JSON_CONNECTION */
12545
12546 {
12547 int i;
12548
12549 #ifdef FREECIV_JSON_CONNECTION
12550 /* Enter array. */
12551 field_addr.sub_location = plocation_elem_new(0);
12552 #endif /* FREECIV_JSON_CONNECTION */
12553
12554 for (i = 0; i < O_LAST; i++) {
12555 #ifdef FREECIV_JSON_CONNECTION
12556 field_addr.sub_location->number = i;
12557 #endif /* FREECIV_JSON_CONNECTION */
12558 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->usage[i])) {
12559 RECEIVE_PACKET_FIELD_ERROR(usage);
12560 }
12561 }
12562
12563 #ifdef FREECIV_JSON_CONNECTION
12564 /* Exit array. */
12565 free(field_addr.sub_location);
12566 field_addr.sub_location = NULL;
12567 #endif /* FREECIV_JSON_CONNECTION */
12568 }
12569 #ifdef FREECIV_JSON_CONNECTION
12570 field_addr.name = "food_stock";
12571 #endif /* FREECIV_JSON_CONNECTION */
12572 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->food_stock)) {
12573 RECEIVE_PACKET_FIELD_ERROR(food_stock);
12574 }
12575 #ifdef FREECIV_JSON_CONNECTION
12576 field_addr.name = "shield_stock";
12577 #endif /* FREECIV_JSON_CONNECTION */
12578 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
12579 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
12580 }
12581 #ifdef FREECIV_JSON_CONNECTION
12582 field_addr.name = "trade_route_count";
12583 #endif /* FREECIV_JSON_CONNECTION */
12584 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_route_count)) {
12585 RECEIVE_PACKET_FIELD_ERROR(trade_route_count);
12586 }
12587 #ifdef FREECIV_JSON_CONNECTION
12588 field_addr.name = "pollution";
12589 #endif /* FREECIV_JSON_CONNECTION */
12590 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->pollution)) {
12591 RECEIVE_PACKET_FIELD_ERROR(pollution);
12592 }
12593 #ifdef FREECIV_JSON_CONNECTION
12594 field_addr.name = "illness_trade";
12595 #endif /* FREECIV_JSON_CONNECTION */
12596 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade)) {
12597 RECEIVE_PACKET_FIELD_ERROR(illness_trade);
12598 }
12599 #ifdef FREECIV_JSON_CONNECTION
12600 field_addr.name = "production_kind";
12601 #endif /* FREECIV_JSON_CONNECTION */
12602 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
12603 RECEIVE_PACKET_FIELD_ERROR(production_kind);
12604 }
12605 #ifdef FREECIV_JSON_CONNECTION
12606 field_addr.name = "production_value";
12607 #endif /* FREECIV_JSON_CONNECTION */
12608 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
12609 RECEIVE_PACKET_FIELD_ERROR(production_value);
12610 }
12611 #ifdef FREECIV_JSON_CONNECTION
12612 field_addr.name = "turn_founded";
12613 #endif /* FREECIV_JSON_CONNECTION */
12614 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
12615 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
12616 }
12617 #ifdef FREECIV_JSON_CONNECTION
12618 field_addr.name = "turn_last_built";
12619 #endif /* FREECIV_JSON_CONNECTION */
12620 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
12621 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
12622 }
12623 #ifdef FREECIV_JSON_CONNECTION
12624 field_addr.name = "changed_from_kind";
12625 #endif /* FREECIV_JSON_CONNECTION */
12626 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_kind)) {
12627 RECEIVE_PACKET_FIELD_ERROR(changed_from_kind);
12628 }
12629 #ifdef FREECIV_JSON_CONNECTION
12630 field_addr.name = "changed_from_value";
12631 #endif /* FREECIV_JSON_CONNECTION */
12632 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_value)) {
12633 RECEIVE_PACKET_FIELD_ERROR(changed_from_value);
12634 }
12635 #ifdef FREECIV_JSON_CONNECTION
12636 field_addr.name = "before_change_shields";
12637 #endif /* FREECIV_JSON_CONNECTION */
12638 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->before_change_shields)) {
12639 RECEIVE_PACKET_FIELD_ERROR(before_change_shields);
12640 }
12641 #ifdef FREECIV_JSON_CONNECTION
12642 field_addr.name = "disbanded_shields";
12643 #endif /* FREECIV_JSON_CONNECTION */
12644 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disbanded_shields)) {
12645 RECEIVE_PACKET_FIELD_ERROR(disbanded_shields);
12646 }
12647 #ifdef FREECIV_JSON_CONNECTION
12648 field_addr.name = "caravan_shields";
12649 #endif /* FREECIV_JSON_CONNECTION */
12650 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->caravan_shields)) {
12651 RECEIVE_PACKET_FIELD_ERROR(caravan_shields);
12652 }
12653 #ifdef FREECIV_JSON_CONNECTION
12654 field_addr.name = "last_turns_shield_surplus";
12655 #endif /* FREECIV_JSON_CONNECTION */
12656 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->last_turns_shield_surplus)) {
12657 RECEIVE_PACKET_FIELD_ERROR(last_turns_shield_surplus);
12658 }
12659 #ifdef FREECIV_JSON_CONNECTION
12660 field_addr.name = "airlift";
12661 #endif /* FREECIV_JSON_CONNECTION */
12662 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->airlift)) {
12663 RECEIVE_PACKET_FIELD_ERROR(airlift);
12664 }
12665 #ifdef FREECIV_JSON_CONNECTION
12666 field_addr.name = "did_buy";
12667 #endif /* FREECIV_JSON_CONNECTION */
12668 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_buy)) {
12669 RECEIVE_PACKET_FIELD_ERROR(did_buy);
12670 }
12671 #ifdef FREECIV_JSON_CONNECTION
12672 field_addr.name = "did_sell";
12673 #endif /* FREECIV_JSON_CONNECTION */
12674 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_sell)) {
12675 RECEIVE_PACKET_FIELD_ERROR(did_sell);
12676 }
12677 #ifdef FREECIV_JSON_CONNECTION
12678 field_addr.name = "was_happy";
12679 #endif /* FREECIV_JSON_CONNECTION */
12680 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->was_happy)) {
12681 RECEIVE_PACKET_FIELD_ERROR(was_happy);
12682 }
12683 #ifdef FREECIV_JSON_CONNECTION
12684 field_addr.name = "diplomat_investigate";
12685 #endif /* FREECIV_JSON_CONNECTION */
12686 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->diplomat_investigate)) {
12687 RECEIVE_PACKET_FIELD_ERROR(diplomat_investigate);
12688 }
12689 #ifdef FREECIV_JSON_CONNECTION
12690 field_addr.name = "walls";
12691 #endif /* FREECIV_JSON_CONNECTION */
12692 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
12693 RECEIVE_PACKET_FIELD_ERROR(walls);
12694 }
12695 #ifdef FREECIV_JSON_CONNECTION
12696 field_addr.name = "city_image";
12697 #endif /* FREECIV_JSON_CONNECTION */
12698 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
12699 RECEIVE_PACKET_FIELD_ERROR(city_image);
12700 }
12701 #ifdef FREECIV_JSON_CONNECTION
12702 field_addr.name = "steal";
12703 #endif /* FREECIV_JSON_CONNECTION */
12704 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->steal)) {
12705 RECEIVE_PACKET_FIELD_ERROR(steal);
12706 }
12707 #ifdef FREECIV_JSON_CONNECTION
12708 field_addr.name = "worklist";
12709 #endif /* FREECIV_JSON_CONNECTION */
12710 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
12711 RECEIVE_PACKET_FIELD_ERROR(worklist);
12712 }
12713 #ifdef FREECIV_JSON_CONNECTION
12714 field_addr.name = "improvements";
12715 #endif /* FREECIV_JSON_CONNECTION */
12716 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
12717 RECEIVE_PACKET_FIELD_ERROR(improvements);
12718 }
12719 #ifdef FREECIV_JSON_CONNECTION
12720 field_addr.name = "city_options";
12721 #endif /* FREECIV_JSON_CONNECTION */
12722 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
12723 RECEIVE_PACKET_FIELD_ERROR(city_options);
12724 }
12725 #ifdef FREECIV_JSON_CONNECTION
12726 field_addr.name = "name";
12727 #endif /* FREECIV_JSON_CONNECTION */
12728 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
12729 RECEIVE_PACKET_FIELD_ERROR(name);
12730 }
12731
12732#endif
12733 log_packet_detailed("packet_city_info_100: got info about ()");
12734
12735#ifdef FREECIV_DELTA_PROTOCOL
12736 if (NULL == *hash) {
12737 *hash = genhash_new_full(hash_packet_city_info_100, cmp_packet_city_info_100,
12738 NULL, NULL, NULL, free);
12739 }
12740
12741 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
12742 *real_packet = *old;
12743 } else {
12744 log_packet_detailed(" no old info");
12745 memset(real_packet, 0, sizeof(*real_packet));
12746 }
12747
12748 if (BV_ISSET(fields, 0)) {
12749 log_packet_detailed(" got field 'id32'");
12750 #ifdef FREECIV_JSON_CONNECTION
12751 field_addr.name = "id32";
12752 #endif /* FREECIV_JSON_CONNECTION */
12753 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
12754 RECEIVE_PACKET_FIELD_ERROR(id32);
12755 }
12756 }
12757 if (BV_ISSET(fields, 1)) {
12758 log_packet_detailed(" got field 'tile'");
12759 #ifdef FREECIV_JSON_CONNECTION
12760 field_addr.name = "tile";
12761 #endif /* FREECIV_JSON_CONNECTION */
12762 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
12763 RECEIVE_PACKET_FIELD_ERROR(tile);
12764 }
12765 }
12766 if (BV_ISSET(fields, 2)) {
12767 log_packet_detailed(" got field 'owner'");
12768 #ifdef FREECIV_JSON_CONNECTION
12769 field_addr.name = "owner";
12770 #endif /* FREECIV_JSON_CONNECTION */
12771 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
12772 RECEIVE_PACKET_FIELD_ERROR(owner);
12773 }
12774 }
12775 if (BV_ISSET(fields, 3)) {
12776 log_packet_detailed(" got field 'original'");
12777 #ifdef FREECIV_JSON_CONNECTION
12778 field_addr.name = "original";
12779 #endif /* FREECIV_JSON_CONNECTION */
12780 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->original)) {
12781 RECEIVE_PACKET_FIELD_ERROR(original);
12782 }
12783 }
12784 if (BV_ISSET(fields, 4)) {
12785 log_packet_detailed(" got field 'size'");
12786 #ifdef FREECIV_JSON_CONNECTION
12787 field_addr.name = "size";
12788 #endif /* FREECIV_JSON_CONNECTION */
12789 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
12790 RECEIVE_PACKET_FIELD_ERROR(size);
12791 }
12792 }
12793 if (BV_ISSET(fields, 5)) {
12794 log_packet_detailed(" got field 'city_radius_sq'");
12795 #ifdef FREECIV_JSON_CONNECTION
12796 field_addr.name = "city_radius_sq";
12797 #endif /* FREECIV_JSON_CONNECTION */
12798 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_radius_sq)) {
12799 RECEIVE_PACKET_FIELD_ERROR(city_radius_sq);
12800 }
12801 }
12802 if (BV_ISSET(fields, 6)) {
12803 log_packet_detailed(" got field 'style'");
12804 #ifdef FREECIV_JSON_CONNECTION
12805 field_addr.name = "style";
12806 #endif /* FREECIV_JSON_CONNECTION */
12807 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
12808 RECEIVE_PACKET_FIELD_ERROR(style);
12809 }
12810 }
12811 if (BV_ISSET(fields, 7)) {
12812 log_packet_detailed(" got field 'capital'");
12813 #ifdef FREECIV_JSON_CONNECTION
12814 field_addr.name = "capital";
12815 #endif /* FREECIV_JSON_CONNECTION */
12816 {
12817 int readin;
12818
12819 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
12820 RECEIVE_PACKET_FIELD_ERROR(capital);
12821 }
12822 real_packet->capital = readin;
12823 }
12824 }
12825 if (BV_ISSET(fields, 8)) {
12826 log_packet_detailed(" got field 'ppl_happy'");
12827 #ifdef FREECIV_JSON_CONNECTION
12828 field_addr.name = "ppl_happy";
12829 #endif /* FREECIV_JSON_CONNECTION */
12830
12831 {
12832 int i;
12833
12834 #ifdef FREECIV_JSON_CONNECTION
12835 /* Enter array. */
12836 field_addr.sub_location = plocation_elem_new(0);
12837 #endif /* FREECIV_JSON_CONNECTION */
12838
12839 for (i = 0; i < FEELING_LAST; i++) {
12840 #ifdef FREECIV_JSON_CONNECTION
12841 field_addr.sub_location->number = i;
12842 #endif /* FREECIV_JSON_CONNECTION */
12843 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
12844 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
12845 }
12846 }
12847
12848 #ifdef FREECIV_JSON_CONNECTION
12849 /* Exit array. */
12850 free(field_addr.sub_location);
12851 field_addr.sub_location = NULL;
12852 #endif /* FREECIV_JSON_CONNECTION */
12853 }
12854 }
12855 if (BV_ISSET(fields, 9)) {
12856 log_packet_detailed(" got field 'ppl_content'");
12857 #ifdef FREECIV_JSON_CONNECTION
12858 field_addr.name = "ppl_content";
12859 #endif /* FREECIV_JSON_CONNECTION */
12860
12861 {
12862 int i;
12863
12864 #ifdef FREECIV_JSON_CONNECTION
12865 /* Enter array. */
12866 field_addr.sub_location = plocation_elem_new(0);
12867 #endif /* FREECIV_JSON_CONNECTION */
12868
12869 for (i = 0; i < FEELING_LAST; i++) {
12870 #ifdef FREECIV_JSON_CONNECTION
12871 field_addr.sub_location->number = i;
12872 #endif /* FREECIV_JSON_CONNECTION */
12873 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
12874 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
12875 }
12876 }
12877
12878 #ifdef FREECIV_JSON_CONNECTION
12879 /* Exit array. */
12880 free(field_addr.sub_location);
12881 field_addr.sub_location = NULL;
12882 #endif /* FREECIV_JSON_CONNECTION */
12883 }
12884 }
12885 if (BV_ISSET(fields, 10)) {
12886 log_packet_detailed(" got field 'ppl_unhappy'");
12887 #ifdef FREECIV_JSON_CONNECTION
12888 field_addr.name = "ppl_unhappy";
12889 #endif /* FREECIV_JSON_CONNECTION */
12890
12891 {
12892 int i;
12893
12894 #ifdef FREECIV_JSON_CONNECTION
12895 /* Enter array. */
12896 field_addr.sub_location = plocation_elem_new(0);
12897 #endif /* FREECIV_JSON_CONNECTION */
12898
12899 for (i = 0; i < FEELING_LAST; i++) {
12900 #ifdef FREECIV_JSON_CONNECTION
12901 field_addr.sub_location->number = i;
12902 #endif /* FREECIV_JSON_CONNECTION */
12903 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
12904 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
12905 }
12906 }
12907
12908 #ifdef FREECIV_JSON_CONNECTION
12909 /* Exit array. */
12910 free(field_addr.sub_location);
12911 field_addr.sub_location = NULL;
12912 #endif /* FREECIV_JSON_CONNECTION */
12913 }
12914 }
12915 if (BV_ISSET(fields, 11)) {
12916 log_packet_detailed(" got field 'ppl_angry'");
12917 #ifdef FREECIV_JSON_CONNECTION
12918 field_addr.name = "ppl_angry";
12919 #endif /* FREECIV_JSON_CONNECTION */
12920
12921 {
12922 int i;
12923
12924 #ifdef FREECIV_JSON_CONNECTION
12925 /* Enter array. */
12926 field_addr.sub_location = plocation_elem_new(0);
12927 #endif /* FREECIV_JSON_CONNECTION */
12928
12929 for (i = 0; i < FEELING_LAST; i++) {
12930 #ifdef FREECIV_JSON_CONNECTION
12931 field_addr.sub_location->number = i;
12932 #endif /* FREECIV_JSON_CONNECTION */
12933 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
12934 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
12935 }
12936 }
12937
12938 #ifdef FREECIV_JSON_CONNECTION
12939 /* Exit array. */
12940 free(field_addr.sub_location);
12941 field_addr.sub_location = NULL;
12942 #endif /* FREECIV_JSON_CONNECTION */
12943 }
12944 }
12945 if (BV_ISSET(fields, 12)) {
12946 log_packet_detailed(" got field 'specialists_size'");
12947 #ifdef FREECIV_JSON_CONNECTION
12948 field_addr.name = "specialists_size";
12949 #endif /* FREECIV_JSON_CONNECTION */
12950 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
12951 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
12952 }
12953 }
12954 if (BV_ISSET(fields, 13)) {
12955 log_packet_detailed(" got field 'specialists'");
12956 #ifdef FREECIV_JSON_CONNECTION
12957 field_addr.name = "specialists";
12958 #endif /* FREECIV_JSON_CONNECTION */
12959
12960 {
12961 int i;
12962
12963 #ifdef FREECIV_JSON_CONNECTION
12964 /* Enter array. */
12965 field_addr.sub_location = plocation_elem_new(0);
12966 #endif /* FREECIV_JSON_CONNECTION */
12967
12968 if (real_packet->specialists_size > SP_MAX) {
12969 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
12970 }
12971 for (i = 0; i < real_packet->specialists_size; i++) {
12972 #ifdef FREECIV_JSON_CONNECTION
12973 field_addr.sub_location->number = i;
12974 #endif /* FREECIV_JSON_CONNECTION */
12975 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
12976 RECEIVE_PACKET_FIELD_ERROR(specialists);
12977 }
12978 }
12979
12980 #ifdef FREECIV_JSON_CONNECTION
12981 /* Exit array. */
12982 free(field_addr.sub_location);
12983 field_addr.sub_location = NULL;
12984 #endif /* FREECIV_JSON_CONNECTION */
12985 }
12986 }
12987 if (BV_ISSET(fields, 14)) {
12988 log_packet_detailed(" got field 'history'");
12989 #ifdef FREECIV_JSON_CONNECTION
12990 field_addr.name = "history";
12991 #endif /* FREECIV_JSON_CONNECTION */
12992 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
12993 RECEIVE_PACKET_FIELD_ERROR(history);
12994 }
12995 }
12996 if (BV_ISSET(fields, 15)) {
12997 log_packet_detailed(" got field 'culture'");
12998 #ifdef FREECIV_JSON_CONNECTION
12999 field_addr.name = "culture";
13000 #endif /* FREECIV_JSON_CONNECTION */
13001 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
13002 RECEIVE_PACKET_FIELD_ERROR(culture);
13003 }
13004 }
13005 if (BV_ISSET(fields, 16)) {
13006 log_packet_detailed(" got field 'buy_cost'");
13007 #ifdef FREECIV_JSON_CONNECTION
13008 field_addr.name = "buy_cost";
13009 #endif /* FREECIV_JSON_CONNECTION */
13010 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->buy_cost)) {
13011 RECEIVE_PACKET_FIELD_ERROR(buy_cost);
13012 }
13013 }
13014 if (BV_ISSET(fields, 17)) {
13015 log_packet_detailed(" got field 'surplus'");
13016 #ifdef FREECIV_JSON_CONNECTION
13017 field_addr.name = "surplus";
13018 #endif /* FREECIV_JSON_CONNECTION */
13019
13020 {
13021 int i;
13022
13023 #ifdef FREECIV_JSON_CONNECTION
13024 /* Enter array. */
13025 field_addr.sub_location = plocation_elem_new(0);
13026 #endif /* FREECIV_JSON_CONNECTION */
13027
13028 for (i = 0; i < O_LAST; i++) {
13029 #ifdef FREECIV_JSON_CONNECTION
13030 field_addr.sub_location->number = i;
13031 #endif /* FREECIV_JSON_CONNECTION */
13032 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->surplus[i])) {
13033 RECEIVE_PACKET_FIELD_ERROR(surplus);
13034 }
13035 }
13036
13037 #ifdef FREECIV_JSON_CONNECTION
13038 /* Exit array. */
13039 free(field_addr.sub_location);
13040 field_addr.sub_location = NULL;
13041 #endif /* FREECIV_JSON_CONNECTION */
13042 }
13043 }
13044 if (BV_ISSET(fields, 18)) {
13045 log_packet_detailed(" got field 'waste'");
13046 #ifdef FREECIV_JSON_CONNECTION
13047 field_addr.name = "waste";
13048 #endif /* FREECIV_JSON_CONNECTION */
13049
13050 {
13051 int i;
13052
13053 #ifdef FREECIV_JSON_CONNECTION
13054 /* Enter array. */
13055 field_addr.sub_location = plocation_elem_new(0);
13056 #endif /* FREECIV_JSON_CONNECTION */
13057
13058 for (i = 0; i < O_LAST; i++) {
13059 #ifdef FREECIV_JSON_CONNECTION
13060 field_addr.sub_location->number = i;
13061 #endif /* FREECIV_JSON_CONNECTION */
13062 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->waste[i])) {
13063 RECEIVE_PACKET_FIELD_ERROR(waste);
13064 }
13065 }
13066
13067 #ifdef FREECIV_JSON_CONNECTION
13068 /* Exit array. */
13069 free(field_addr.sub_location);
13070 field_addr.sub_location = NULL;
13071 #endif /* FREECIV_JSON_CONNECTION */
13072 }
13073 }
13074 if (BV_ISSET(fields, 19)) {
13075 log_packet_detailed(" got field 'unhappy_penalty'");
13076 #ifdef FREECIV_JSON_CONNECTION
13077 field_addr.name = "unhappy_penalty";
13078 #endif /* FREECIV_JSON_CONNECTION */
13079
13080 {
13081 int i;
13082
13083 #ifdef FREECIV_JSON_CONNECTION
13084 /* Enter array. */
13085 field_addr.sub_location = plocation_elem_new(0);
13086 #endif /* FREECIV_JSON_CONNECTION */
13087
13088 for (i = 0; i < O_LAST; i++) {
13089 #ifdef FREECIV_JSON_CONNECTION
13090 field_addr.sub_location->number = i;
13091 #endif /* FREECIV_JSON_CONNECTION */
13092 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->unhappy_penalty[i])) {
13093 RECEIVE_PACKET_FIELD_ERROR(unhappy_penalty);
13094 }
13095 }
13096
13097 #ifdef FREECIV_JSON_CONNECTION
13098 /* Exit array. */
13099 free(field_addr.sub_location);
13100 field_addr.sub_location = NULL;
13101 #endif /* FREECIV_JSON_CONNECTION */
13102 }
13103 }
13104 if (BV_ISSET(fields, 20)) {
13105 log_packet_detailed(" got field 'prod'");
13106 #ifdef FREECIV_JSON_CONNECTION
13107 field_addr.name = "prod";
13108 #endif /* FREECIV_JSON_CONNECTION */
13109
13110 {
13111 int i;
13112
13113 #ifdef FREECIV_JSON_CONNECTION
13114 /* Enter array. */
13115 field_addr.sub_location = plocation_elem_new(0);
13116 #endif /* FREECIV_JSON_CONNECTION */
13117
13118 for (i = 0; i < O_LAST; i++) {
13119 #ifdef FREECIV_JSON_CONNECTION
13120 field_addr.sub_location->number = i;
13121 #endif /* FREECIV_JSON_CONNECTION */
13122 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->prod[i])) {
13123 RECEIVE_PACKET_FIELD_ERROR(prod);
13124 }
13125 }
13126
13127 #ifdef FREECIV_JSON_CONNECTION
13128 /* Exit array. */
13129 free(field_addr.sub_location);
13130 field_addr.sub_location = NULL;
13131 #endif /* FREECIV_JSON_CONNECTION */
13132 }
13133 }
13134 if (BV_ISSET(fields, 21)) {
13135 log_packet_detailed(" got field 'citizen_base'");
13136 #ifdef FREECIV_JSON_CONNECTION
13137 field_addr.name = "citizen_base";
13138 #endif /* FREECIV_JSON_CONNECTION */
13139
13140 {
13141 int i;
13142
13143 #ifdef FREECIV_JSON_CONNECTION
13144 /* Enter array. */
13145 field_addr.sub_location = plocation_elem_new(0);
13146 #endif /* FREECIV_JSON_CONNECTION */
13147
13148 for (i = 0; i < O_LAST; i++) {
13149 #ifdef FREECIV_JSON_CONNECTION
13150 field_addr.sub_location->number = i;
13151 #endif /* FREECIV_JSON_CONNECTION */
13152 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->citizen_base[i])) {
13153 RECEIVE_PACKET_FIELD_ERROR(citizen_base);
13154 }
13155 }
13156
13157 #ifdef FREECIV_JSON_CONNECTION
13158 /* Exit array. */
13159 free(field_addr.sub_location);
13160 field_addr.sub_location = NULL;
13161 #endif /* FREECIV_JSON_CONNECTION */
13162 }
13163 }
13164 if (BV_ISSET(fields, 22)) {
13165 log_packet_detailed(" got field 'usage'");
13166 #ifdef FREECIV_JSON_CONNECTION
13167 field_addr.name = "usage";
13168 #endif /* FREECIV_JSON_CONNECTION */
13169
13170 {
13171 int i;
13172
13173 #ifdef FREECIV_JSON_CONNECTION
13174 /* Enter array. */
13175 field_addr.sub_location = plocation_elem_new(0);
13176 #endif /* FREECIV_JSON_CONNECTION */
13177
13178 for (i = 0; i < O_LAST; i++) {
13179 #ifdef FREECIV_JSON_CONNECTION
13180 field_addr.sub_location->number = i;
13181 #endif /* FREECIV_JSON_CONNECTION */
13182 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->usage[i])) {
13183 RECEIVE_PACKET_FIELD_ERROR(usage);
13184 }
13185 }
13186
13187 #ifdef FREECIV_JSON_CONNECTION
13188 /* Exit array. */
13189 free(field_addr.sub_location);
13190 field_addr.sub_location = NULL;
13191 #endif /* FREECIV_JSON_CONNECTION */
13192 }
13193 }
13194 if (BV_ISSET(fields, 23)) {
13195 log_packet_detailed(" got field 'food_stock'");
13196 #ifdef FREECIV_JSON_CONNECTION
13197 field_addr.name = "food_stock";
13198 #endif /* FREECIV_JSON_CONNECTION */
13199 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->food_stock)) {
13200 RECEIVE_PACKET_FIELD_ERROR(food_stock);
13201 }
13202 }
13203 if (BV_ISSET(fields, 24)) {
13204 log_packet_detailed(" got field 'shield_stock'");
13205 #ifdef FREECIV_JSON_CONNECTION
13206 field_addr.name = "shield_stock";
13207 #endif /* FREECIV_JSON_CONNECTION */
13208 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
13209 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
13210 }
13211 }
13212 if (BV_ISSET(fields, 25)) {
13213 log_packet_detailed(" got field 'trade_route_count'");
13214 #ifdef FREECIV_JSON_CONNECTION
13215 field_addr.name = "trade_route_count";
13216 #endif /* FREECIV_JSON_CONNECTION */
13217 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_route_count)) {
13218 RECEIVE_PACKET_FIELD_ERROR(trade_route_count);
13219 }
13220 }
13221 if (BV_ISSET(fields, 26)) {
13222 log_packet_detailed(" got field 'pollution'");
13223 #ifdef FREECIV_JSON_CONNECTION
13224 field_addr.name = "pollution";
13225 #endif /* FREECIV_JSON_CONNECTION */
13226 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->pollution)) {
13227 RECEIVE_PACKET_FIELD_ERROR(pollution);
13228 }
13229 }
13230 if (BV_ISSET(fields, 27)) {
13231 log_packet_detailed(" got field 'illness_trade'");
13232 #ifdef FREECIV_JSON_CONNECTION
13233 field_addr.name = "illness_trade";
13234 #endif /* FREECIV_JSON_CONNECTION */
13235 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade)) {
13236 RECEIVE_PACKET_FIELD_ERROR(illness_trade);
13237 }
13238 }
13239 if (BV_ISSET(fields, 28)) {
13240 log_packet_detailed(" got field 'production_kind'");
13241 #ifdef FREECIV_JSON_CONNECTION
13242 field_addr.name = "production_kind";
13243 #endif /* FREECIV_JSON_CONNECTION */
13244 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
13245 RECEIVE_PACKET_FIELD_ERROR(production_kind);
13246 }
13247 }
13248 if (BV_ISSET(fields, 29)) {
13249 log_packet_detailed(" got field 'production_value'");
13250 #ifdef FREECIV_JSON_CONNECTION
13251 field_addr.name = "production_value";
13252 #endif /* FREECIV_JSON_CONNECTION */
13253 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
13254 RECEIVE_PACKET_FIELD_ERROR(production_value);
13255 }
13256 }
13257 if (BV_ISSET(fields, 30)) {
13258 log_packet_detailed(" got field 'turn_founded'");
13259 #ifdef FREECIV_JSON_CONNECTION
13260 field_addr.name = "turn_founded";
13261 #endif /* FREECIV_JSON_CONNECTION */
13262 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
13263 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
13264 }
13265 }
13266 if (BV_ISSET(fields, 31)) {
13267 log_packet_detailed(" got field 'turn_last_built'");
13268 #ifdef FREECIV_JSON_CONNECTION
13269 field_addr.name = "turn_last_built";
13270 #endif /* FREECIV_JSON_CONNECTION */
13271 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
13272 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
13273 }
13274 }
13275 if (BV_ISSET(fields, 32)) {
13276 log_packet_detailed(" got field 'changed_from_kind'");
13277 #ifdef FREECIV_JSON_CONNECTION
13278 field_addr.name = "changed_from_kind";
13279 #endif /* FREECIV_JSON_CONNECTION */
13280 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_kind)) {
13281 RECEIVE_PACKET_FIELD_ERROR(changed_from_kind);
13282 }
13283 }
13284 if (BV_ISSET(fields, 33)) {
13285 log_packet_detailed(" got field 'changed_from_value'");
13286 #ifdef FREECIV_JSON_CONNECTION
13287 field_addr.name = "changed_from_value";
13288 #endif /* FREECIV_JSON_CONNECTION */
13289 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_value)) {
13290 RECEIVE_PACKET_FIELD_ERROR(changed_from_value);
13291 }
13292 }
13293 if (BV_ISSET(fields, 34)) {
13294 log_packet_detailed(" got field 'before_change_shields'");
13295 #ifdef FREECIV_JSON_CONNECTION
13296 field_addr.name = "before_change_shields";
13297 #endif /* FREECIV_JSON_CONNECTION */
13298 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->before_change_shields)) {
13299 RECEIVE_PACKET_FIELD_ERROR(before_change_shields);
13300 }
13301 }
13302 if (BV_ISSET(fields, 35)) {
13303 log_packet_detailed(" got field 'disbanded_shields'");
13304 #ifdef FREECIV_JSON_CONNECTION
13305 field_addr.name = "disbanded_shields";
13306 #endif /* FREECIV_JSON_CONNECTION */
13307 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disbanded_shields)) {
13308 RECEIVE_PACKET_FIELD_ERROR(disbanded_shields);
13309 }
13310 }
13311 if (BV_ISSET(fields, 36)) {
13312 log_packet_detailed(" got field 'caravan_shields'");
13313 #ifdef FREECIV_JSON_CONNECTION
13314 field_addr.name = "caravan_shields";
13315 #endif /* FREECIV_JSON_CONNECTION */
13316 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->caravan_shields)) {
13317 RECEIVE_PACKET_FIELD_ERROR(caravan_shields);
13318 }
13319 }
13320 if (BV_ISSET(fields, 37)) {
13321 log_packet_detailed(" got field 'last_turns_shield_surplus'");
13322 #ifdef FREECIV_JSON_CONNECTION
13323 field_addr.name = "last_turns_shield_surplus";
13324 #endif /* FREECIV_JSON_CONNECTION */
13325 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->last_turns_shield_surplus)) {
13326 RECEIVE_PACKET_FIELD_ERROR(last_turns_shield_surplus);
13327 }
13328 }
13329 if (BV_ISSET(fields, 38)) {
13330 log_packet_detailed(" got field 'airlift'");
13331 #ifdef FREECIV_JSON_CONNECTION
13332 field_addr.name = "airlift";
13333 #endif /* FREECIV_JSON_CONNECTION */
13334 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->airlift)) {
13335 RECEIVE_PACKET_FIELD_ERROR(airlift);
13336 }
13337 }
13338 real_packet->did_buy = BV_ISSET(fields, 39);
13339 real_packet->did_sell = BV_ISSET(fields, 40);
13340 real_packet->was_happy = BV_ISSET(fields, 41);
13341 real_packet->diplomat_investigate = BV_ISSET(fields, 42);
13342 if (BV_ISSET(fields, 43)) {
13343 log_packet_detailed(" got field 'walls'");
13344 #ifdef FREECIV_JSON_CONNECTION
13345 field_addr.name = "walls";
13346 #endif /* FREECIV_JSON_CONNECTION */
13347 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
13348 RECEIVE_PACKET_FIELD_ERROR(walls);
13349 }
13350 }
13351 if (BV_ISSET(fields, 44)) {
13352 log_packet_detailed(" got field 'city_image'");
13353 #ifdef FREECIV_JSON_CONNECTION
13354 field_addr.name = "city_image";
13355 #endif /* FREECIV_JSON_CONNECTION */
13356 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
13357 RECEIVE_PACKET_FIELD_ERROR(city_image);
13358 }
13359 }
13360 if (BV_ISSET(fields, 45)) {
13361 log_packet_detailed(" got field 'steal'");
13362 #ifdef FREECIV_JSON_CONNECTION
13363 field_addr.name = "steal";
13364 #endif /* FREECIV_JSON_CONNECTION */
13365 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->steal)) {
13366 RECEIVE_PACKET_FIELD_ERROR(steal);
13367 }
13368 }
13369 if (BV_ISSET(fields, 46)) {
13370 log_packet_detailed(" got field 'worklist'");
13371 #ifdef FREECIV_JSON_CONNECTION
13372 field_addr.name = "worklist";
13373 #endif /* FREECIV_JSON_CONNECTION */
13374 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
13375 RECEIVE_PACKET_FIELD_ERROR(worklist);
13376 }
13377 }
13378 if (BV_ISSET(fields, 47)) {
13379 log_packet_detailed(" got field 'improvements'");
13380 #ifdef FREECIV_JSON_CONNECTION
13381 field_addr.name = "improvements";
13382 #endif /* FREECIV_JSON_CONNECTION */
13383 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
13384 RECEIVE_PACKET_FIELD_ERROR(improvements);
13385 }
13386 }
13387 if (BV_ISSET(fields, 48)) {
13388 log_packet_detailed(" got field 'city_options'");
13389 #ifdef FREECIV_JSON_CONNECTION
13390 field_addr.name = "city_options";
13391 #endif /* FREECIV_JSON_CONNECTION */
13392 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
13393 RECEIVE_PACKET_FIELD_ERROR(city_options);
13394 }
13395 }
13396 if (BV_ISSET(fields, 49)) {
13397 log_packet_detailed(" got field 'name'");
13398 #ifdef FREECIV_JSON_CONNECTION
13399 field_addr.name = "name";
13400 #endif /* FREECIV_JSON_CONNECTION */
13401 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
13402 RECEIVE_PACKET_FIELD_ERROR(name);
13403 }
13404 }
13405
13406 if (NULL == old) {
13407 old = fc_malloc(sizeof(*old));
13408 *old = *real_packet;
13409 genhash_insert(*hash, old, old);
13410 } else {
13411 *old = *real_packet;
13412 }
13413
13414 hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
13415 if (NULL != *hash) {
13416 genhash_remove(*hash, real_packet);
13417 }
13418
13419#endif /* FREECIV_DELTA_PROTOCOL */
13420 RECEIVE_PACKET_END(real_packet);
13421}
13422
13423 static int send_packet_city_info_100(struct connection *pc, const struct packet_city_info *packet, bool force_to_send)
13424{
13425 const struct packet_city_info *real_packet = packet;
13426#ifdef FREECIV_DELTA_PROTOCOL
13427 packet_city_info_100_fields fields;
13428 struct packet_city_info *old;
13429 bool differ;
13430 struct genhash **hash = pc->phs.sent + PACKET_CITY_INFO;
13431 int different = force_to_send;
13432#endif /* FREECIV_DELTA_PROTOCOL */
13433 SEND_PACKET_START(PACKET_CITY_INFO);
13434#ifdef FREECIV_JSON_CONNECTION
13435 struct plocation field_addr;
13436 {
13437 struct plocation *field_addr_tmp = plocation_field_new(NULL);
13438 field_addr = *field_addr_tmp;
13439 FC_FREE(field_addr_tmp);
13440 }
13441#endif /* FREECIV_JSON_CONNECTION */
13442
13443 log_packet_detailed("packet_city_info_100: sending info about ()");
13444
13445#ifdef FREECIV_DELTA_PROTOCOL
13446 if (NULL == *hash) {
13447 *hash = genhash_new_full(hash_packet_city_info_100, cmp_packet_city_info_100,
13448 NULL, NULL, NULL, free);
13449 }
13450 BV_CLR_ALL(fields);
13451
13452 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
13453 old = fc_malloc(sizeof(*old));
13454 *old = *real_packet;
13455 genhash_insert(*hash, old, old);
13456 memset(old, 0, sizeof(*old));
13457 different = 1; /* Force to send. */
13458 }
13459 differ = (old->id32 != real_packet->id32);
13460 if (differ) {
13461 different++;
13462 BV_SET(fields, 0);
13463 }
13464
13465 differ = (old->tile != real_packet->tile);
13466 if (differ) {
13467 different++;
13468 BV_SET(fields, 1);
13469 }
13470
13471 differ = (old->owner != real_packet->owner);
13472 if (differ) {
13473 different++;
13474 BV_SET(fields, 2);
13475 }
13476
13477 differ = (old->original != real_packet->original);
13478 if (differ) {
13479 different++;
13480 BV_SET(fields, 3);
13481 }
13482
13483 differ = (old->size != real_packet->size);
13484 if (differ) {
13485 different++;
13486 BV_SET(fields, 4);
13487 }
13488
13489 differ = (old->city_radius_sq != real_packet->city_radius_sq);
13490 if (differ) {
13491 different++;
13492 BV_SET(fields, 5);
13493 }
13494
13495 differ = (old->style != real_packet->style);
13496 if (differ) {
13497 different++;
13498 BV_SET(fields, 6);
13499 }
13500
13501 differ = (old->capital != real_packet->capital);
13502 if (differ) {
13503 different++;
13504 BV_SET(fields, 7);
13505 }
13506
13507
13508 {
13509 differ = FALSE;
13510 {
13511 int i;
13512
13513 for (i = 0; i < FEELING_LAST; i++) {
13514 if (old->ppl_happy[i] != real_packet->ppl_happy[i]) {
13515 differ = TRUE;
13516 break;
13517 }
13518 }
13519 }
13520 }
13521 if (differ) {
13522 different++;
13523 BV_SET(fields, 8);
13524 }
13525
13526
13527 {
13528 differ = FALSE;
13529 {
13530 int i;
13531
13532 for (i = 0; i < FEELING_LAST; i++) {
13533 if (old->ppl_content[i] != real_packet->ppl_content[i]) {
13534 differ = TRUE;
13535 break;
13536 }
13537 }
13538 }
13539 }
13540 if (differ) {
13541 different++;
13542 BV_SET(fields, 9);
13543 }
13544
13545
13546 {
13547 differ = FALSE;
13548 {
13549 int i;
13550
13551 for (i = 0; i < FEELING_LAST; i++) {
13552 if (old->ppl_unhappy[i] != real_packet->ppl_unhappy[i]) {
13553 differ = TRUE;
13554 break;
13555 }
13556 }
13557 }
13558 }
13559 if (differ) {
13560 different++;
13561 BV_SET(fields, 10);
13562 }
13563
13564
13565 {
13566 differ = FALSE;
13567 {
13568 int i;
13569
13570 for (i = 0; i < FEELING_LAST; i++) {
13571 if (old->ppl_angry[i] != real_packet->ppl_angry[i]) {
13572 differ = TRUE;
13573 break;
13574 }
13575 }
13576 }
13577 }
13578 if (differ) {
13579 different++;
13580 BV_SET(fields, 11);
13581 }
13582
13583 differ = (old->specialists_size != real_packet->specialists_size);
13584 if (differ) {
13585 different++;
13586 BV_SET(fields, 12);
13587 }
13588
13589
13590 {
13591 differ = (old->specialists_size != real_packet->specialists_size);
13592 if (!differ) {
13593 int i;
13594
13595 for (i = 0; i < real_packet->specialists_size; i++) {
13596 if (old->specialists[i] != real_packet->specialists[i]) {
13597 differ = TRUE;
13598 break;
13599 }
13600 }
13601 }
13602 }
13603 if (differ) {
13604 different++;
13605 BV_SET(fields, 13);
13606 }
13607
13608 differ = (old->history != real_packet->history);
13609 if (differ) {
13610 different++;
13611 BV_SET(fields, 14);
13612 }
13613
13614 differ = (old->culture != real_packet->culture);
13615 if (differ) {
13616 different++;
13617 BV_SET(fields, 15);
13618 }
13619
13620 differ = (old->buy_cost != real_packet->buy_cost);
13621 if (differ) {
13622 different++;
13623 BV_SET(fields, 16);
13624 }
13625
13626
13627 {
13628 differ = FALSE;
13629 {
13630 int i;
13631
13632 for (i = 0; i < O_LAST; i++) {
13633 if (old->surplus[i] != real_packet->surplus[i]) {
13634 differ = TRUE;
13635 break;
13636 }
13637 }
13638 }
13639 }
13640 if (differ) {
13641 different++;
13642 BV_SET(fields, 17);
13643 }
13644
13645
13646 {
13647 differ = FALSE;
13648 {
13649 int i;
13650
13651 for (i = 0; i < O_LAST; i++) {
13652 if (old->waste[i] != real_packet->waste[i]) {
13653 differ = TRUE;
13654 break;
13655 }
13656 }
13657 }
13658 }
13659 if (differ) {
13660 different++;
13661 BV_SET(fields, 18);
13662 }
13663
13664
13665 {
13666 differ = FALSE;
13667 {
13668 int i;
13669
13670 for (i = 0; i < O_LAST; i++) {
13671 if (old->unhappy_penalty[i] != real_packet->unhappy_penalty[i]) {
13672 differ = TRUE;
13673 break;
13674 }
13675 }
13676 }
13677 }
13678 if (differ) {
13679 different++;
13680 BV_SET(fields, 19);
13681 }
13682
13683
13684 {
13685 differ = FALSE;
13686 {
13687 int i;
13688
13689 for (i = 0; i < O_LAST; i++) {
13690 if (old->prod[i] != real_packet->prod[i]) {
13691 differ = TRUE;
13692 break;
13693 }
13694 }
13695 }
13696 }
13697 if (differ) {
13698 different++;
13699 BV_SET(fields, 20);
13700 }
13701
13702
13703 {
13704 differ = FALSE;
13705 {
13706 int i;
13707
13708 for (i = 0; i < O_LAST; i++) {
13709 if (old->citizen_base[i] != real_packet->citizen_base[i]) {
13710 differ = TRUE;
13711 break;
13712 }
13713 }
13714 }
13715 }
13716 if (differ) {
13717 different++;
13718 BV_SET(fields, 21);
13719 }
13720
13721
13722 {
13723 differ = FALSE;
13724 {
13725 int i;
13726
13727 for (i = 0; i < O_LAST; i++) {
13728 if (old->usage[i] != real_packet->usage[i]) {
13729 differ = TRUE;
13730 break;
13731 }
13732 }
13733 }
13734 }
13735 if (differ) {
13736 different++;
13737 BV_SET(fields, 22);
13738 }
13739
13740 differ = (old->food_stock != real_packet->food_stock);
13741 if (differ) {
13742 different++;
13743 BV_SET(fields, 23);
13744 }
13745
13746 differ = (old->shield_stock != real_packet->shield_stock);
13747 if (differ) {
13748 different++;
13749 BV_SET(fields, 24);
13750 }
13751
13752 differ = (old->trade_route_count != real_packet->trade_route_count);
13753 if (differ) {
13754 different++;
13755 BV_SET(fields, 25);
13756 }
13757
13758 differ = (old->pollution != real_packet->pollution);
13759 if (differ) {
13760 different++;
13761 BV_SET(fields, 26);
13762 }
13763
13764 differ = (old->illness_trade != real_packet->illness_trade);
13765 if (differ) {
13766 different++;
13767 BV_SET(fields, 27);
13768 }
13769
13770 differ = (old->production_kind != real_packet->production_kind);
13771 if (differ) {
13772 different++;
13773 BV_SET(fields, 28);
13774 }
13775
13776 differ = (old->production_value != real_packet->production_value);
13777 if (differ) {
13778 different++;
13779 BV_SET(fields, 29);
13780 }
13781
13782 differ = (old->turn_founded != real_packet->turn_founded);
13783 if (differ) {
13784 different++;
13785 BV_SET(fields, 30);
13786 }
13787
13788 differ = (old->turn_last_built != real_packet->turn_last_built);
13789 if (differ) {
13790 different++;
13791 BV_SET(fields, 31);
13792 }
13793
13794 differ = (old->changed_from_kind != real_packet->changed_from_kind);
13795 if (differ) {
13796 different++;
13797 BV_SET(fields, 32);
13798 }
13799
13800 differ = (old->changed_from_value != real_packet->changed_from_value);
13801 if (differ) {
13802 different++;
13803 BV_SET(fields, 33);
13804 }
13805
13806 differ = (old->before_change_shields != real_packet->before_change_shields);
13807 if (differ) {
13808 different++;
13809 BV_SET(fields, 34);
13810 }
13811
13812 differ = (old->disbanded_shields != real_packet->disbanded_shields);
13813 if (differ) {
13814 different++;
13815 BV_SET(fields, 35);
13816 }
13817
13818 differ = (old->caravan_shields != real_packet->caravan_shields);
13819 if (differ) {
13820 different++;
13821 BV_SET(fields, 36);
13822 }
13823
13824 differ = (old->last_turns_shield_surplus != real_packet->last_turns_shield_surplus);
13825 if (differ) {
13826 different++;
13827 BV_SET(fields, 37);
13828 }
13829
13830 differ = (old->airlift != real_packet->airlift);
13831 if (differ) {
13832 different++;
13833 BV_SET(fields, 38);
13834 }
13835
13836 differ = (old->did_buy != real_packet->did_buy);
13837 if (differ) {
13838 different++;
13839 }
13840 if (packet->did_buy) {
13841 BV_SET(fields, 39);
13842 }
13843
13844 differ = (old->did_sell != real_packet->did_sell);
13845 if (differ) {
13846 different++;
13847 }
13848 if (packet->did_sell) {
13849 BV_SET(fields, 40);
13850 }
13851
13852 differ = (old->was_happy != real_packet->was_happy);
13853 if (differ) {
13854 different++;
13855 }
13856 if (packet->was_happy) {
13857 BV_SET(fields, 41);
13858 }
13859
13860 differ = (old->diplomat_investigate != real_packet->diplomat_investigate);
13861 if (differ) {
13862 different++;
13863 }
13864 if (packet->diplomat_investigate) {
13865 BV_SET(fields, 42);
13866 }
13867
13868 differ = (old->walls != real_packet->walls);
13869 if (differ) {
13870 different++;
13871 BV_SET(fields, 43);
13872 }
13873
13874 differ = (old->city_image != real_packet->city_image);
13875 if (differ) {
13876 different++;
13877 BV_SET(fields, 44);
13878 }
13879
13880 differ = (old->steal != real_packet->steal);
13881 if (differ) {
13882 different++;
13883 BV_SET(fields, 45);
13884 }
13885
13886 differ = !are_worklists_equal(&old->worklist, &real_packet->worklist);
13887 if (differ) {
13888 different++;
13889 BV_SET(fields, 46);
13890 }
13891
13892 differ = !BV_ARE_EQUAL(old->improvements, real_packet->improvements);
13893 if (differ) {
13894 different++;
13895 BV_SET(fields, 47);
13896 }
13897
13898 differ = !BV_ARE_EQUAL(old->city_options, real_packet->city_options);
13899 if (differ) {
13900 different++;
13901 BV_SET(fields, 48);
13902 }
13903
13904 differ = (strcmp(old->name, real_packet->name) != 0);
13905 if (differ) {
13906 different++;
13907 BV_SET(fields, 49);
13908 }
13909
13910
13911 if (different == 0) {
13912 log_packet_detailed(" no change -> discard");
13913 return 0;
13914 }
13915
13916#ifdef FREECIV_JSON_CONNECTION
13917 field_addr.name = "fields";
13918#endif /* FREECIV_JSON_CONNECTION */
13919 DIO_BV_PUT(&dout, &field_addr, fields);
13920
13921 if (BV_ISSET(fields, 0)) {
13922 log_packet_detailed(" field 'id32' has changed");
13923 #ifdef FREECIV_JSON_CONNECTION
13924 field_addr.name = "id32";
13925#endif /* FREECIV_JSON_CONNECTION */
13926 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
13927 }
13928 if (BV_ISSET(fields, 1)) {
13929 log_packet_detailed(" field 'tile' has changed");
13930 #ifdef FREECIV_JSON_CONNECTION
13931 field_addr.name = "tile";
13932#endif /* FREECIV_JSON_CONNECTION */
13933 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
13934 }
13935 if (BV_ISSET(fields, 2)) {
13936 log_packet_detailed(" field 'owner' has changed");
13937 #ifdef FREECIV_JSON_CONNECTION
13938 field_addr.name = "owner";
13939#endif /* FREECIV_JSON_CONNECTION */
13940 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
13941 }
13942 if (BV_ISSET(fields, 3)) {
13943 log_packet_detailed(" field 'original' has changed");
13944 #ifdef FREECIV_JSON_CONNECTION
13945 field_addr.name = "original";
13946#endif /* FREECIV_JSON_CONNECTION */
13947 DIO_PUT(uint16, &dout, &field_addr, real_packet->original);
13948 }
13949 if (BV_ISSET(fields, 4)) {
13950 log_packet_detailed(" field 'size' has changed");
13951 #ifdef FREECIV_JSON_CONNECTION
13952 field_addr.name = "size";
13953#endif /* FREECIV_JSON_CONNECTION */
13954 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
13955 }
13956 if (BV_ISSET(fields, 5)) {
13957 log_packet_detailed(" field 'city_radius_sq' has changed");
13958 #ifdef FREECIV_JSON_CONNECTION
13959 field_addr.name = "city_radius_sq";
13960#endif /* FREECIV_JSON_CONNECTION */
13961 DIO_PUT(uint8, &dout, &field_addr, real_packet->city_radius_sq);
13962 }
13963 if (BV_ISSET(fields, 6)) {
13964 log_packet_detailed(" field 'style' has changed");
13965 #ifdef FREECIV_JSON_CONNECTION
13966 field_addr.name = "style";
13967#endif /* FREECIV_JSON_CONNECTION */
13968 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
13969 }
13970 if (BV_ISSET(fields, 7)) {
13971 log_packet_detailed(" field 'capital' has changed");
13972 #ifdef FREECIV_JSON_CONNECTION
13973 field_addr.name = "capital";
13974#endif /* FREECIV_JSON_CONNECTION */
13975 DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
13976 }
13977 if (BV_ISSET(fields, 8)) {
13978 log_packet_detailed(" field 'ppl_happy' has changed");
13979 #ifdef FREECIV_JSON_CONNECTION
13980 field_addr.name = "ppl_happy";
13981#endif /* FREECIV_JSON_CONNECTION */
13982
13983 {
13984 int i;
13985
13986#ifdef FREECIV_JSON_CONNECTION
13987 /* Create the array. */
13988 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
13989
13990 /* Enter the array. */
13991 field_addr.sub_location = plocation_elem_new(0);
13992#endif /* FREECIV_JSON_CONNECTION */
13993
13994 for (i = 0; i < FEELING_LAST; i++) {
13995#ifdef FREECIV_JSON_CONNECTION
13996 /* Next array element. */
13997 field_addr.sub_location->number = i;
13998#endif /* FREECIV_JSON_CONNECTION */
13999 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
14000 }
14001
14002#ifdef FREECIV_JSON_CONNECTION
14003 /* Exit array. */
14004 free(field_addr.sub_location);
14005 field_addr.sub_location = NULL;
14006#endif /* FREECIV_JSON_CONNECTION */
14007 }
14008 }
14009 if (BV_ISSET(fields, 9)) {
14010 log_packet_detailed(" field 'ppl_content' has changed");
14011 #ifdef FREECIV_JSON_CONNECTION
14012 field_addr.name = "ppl_content";
14013#endif /* FREECIV_JSON_CONNECTION */
14014
14015 {
14016 int i;
14017
14018#ifdef FREECIV_JSON_CONNECTION
14019 /* Create the array. */
14020 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
14021
14022 /* Enter the array. */
14023 field_addr.sub_location = plocation_elem_new(0);
14024#endif /* FREECIV_JSON_CONNECTION */
14025
14026 for (i = 0; i < FEELING_LAST; i++) {
14027#ifdef FREECIV_JSON_CONNECTION
14028 /* Next array element. */
14029 field_addr.sub_location->number = i;
14030#endif /* FREECIV_JSON_CONNECTION */
14031 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
14032 }
14033
14034#ifdef FREECIV_JSON_CONNECTION
14035 /* Exit array. */
14036 free(field_addr.sub_location);
14037 field_addr.sub_location = NULL;
14038#endif /* FREECIV_JSON_CONNECTION */
14039 }
14040 }
14041 if (BV_ISSET(fields, 10)) {
14042 log_packet_detailed(" field 'ppl_unhappy' has changed");
14043 #ifdef FREECIV_JSON_CONNECTION
14044 field_addr.name = "ppl_unhappy";
14045#endif /* FREECIV_JSON_CONNECTION */
14046
14047 {
14048 int i;
14049
14050#ifdef FREECIV_JSON_CONNECTION
14051 /* Create the array. */
14052 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
14053
14054 /* Enter the array. */
14055 field_addr.sub_location = plocation_elem_new(0);
14056#endif /* FREECIV_JSON_CONNECTION */
14057
14058 for (i = 0; i < FEELING_LAST; i++) {
14059#ifdef FREECIV_JSON_CONNECTION
14060 /* Next array element. */
14061 field_addr.sub_location->number = i;
14062#endif /* FREECIV_JSON_CONNECTION */
14063 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
14064 }
14065
14066#ifdef FREECIV_JSON_CONNECTION
14067 /* Exit array. */
14068 free(field_addr.sub_location);
14069 field_addr.sub_location = NULL;
14070#endif /* FREECIV_JSON_CONNECTION */
14071 }
14072 }
14073 if (BV_ISSET(fields, 11)) {
14074 log_packet_detailed(" field 'ppl_angry' has changed");
14075 #ifdef FREECIV_JSON_CONNECTION
14076 field_addr.name = "ppl_angry";
14077#endif /* FREECIV_JSON_CONNECTION */
14078
14079 {
14080 int i;
14081
14082#ifdef FREECIV_JSON_CONNECTION
14083 /* Create the array. */
14084 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
14085
14086 /* Enter the array. */
14087 field_addr.sub_location = plocation_elem_new(0);
14088#endif /* FREECIV_JSON_CONNECTION */
14089
14090 for (i = 0; i < FEELING_LAST; i++) {
14091#ifdef FREECIV_JSON_CONNECTION
14092 /* Next array element. */
14093 field_addr.sub_location->number = i;
14094#endif /* FREECIV_JSON_CONNECTION */
14095 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
14096 }
14097
14098#ifdef FREECIV_JSON_CONNECTION
14099 /* Exit array. */
14100 free(field_addr.sub_location);
14101 field_addr.sub_location = NULL;
14102#endif /* FREECIV_JSON_CONNECTION */
14103 }
14104 }
14105 if (BV_ISSET(fields, 12)) {
14106 log_packet_detailed(" field 'specialists_size' has changed");
14107 #ifdef FREECIV_JSON_CONNECTION
14108 field_addr.name = "specialists_size";
14109#endif /* FREECIV_JSON_CONNECTION */
14110 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
14111 }
14112 if (BV_ISSET(fields, 13)) {
14113 log_packet_detailed(" field 'specialists' has changed");
14114 #ifdef FREECIV_JSON_CONNECTION
14115 field_addr.name = "specialists";
14116#endif /* FREECIV_JSON_CONNECTION */
14117
14118 {
14119 int i;
14120
14121#ifdef FREECIV_JSON_CONNECTION
14122 /* Create the array. */
14123 DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
14124
14125 /* Enter the array. */
14126 field_addr.sub_location = plocation_elem_new(0);
14127#endif /* FREECIV_JSON_CONNECTION */
14128
14129 for (i = 0; i < real_packet->specialists_size; i++) {
14130#ifdef FREECIV_JSON_CONNECTION
14131 /* Next array element. */
14132 field_addr.sub_location->number = i;
14133#endif /* FREECIV_JSON_CONNECTION */
14134 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
14135 }
14136
14137#ifdef FREECIV_JSON_CONNECTION
14138 /* Exit array. */
14139 free(field_addr.sub_location);
14140 field_addr.sub_location = NULL;
14141#endif /* FREECIV_JSON_CONNECTION */
14142 }
14143 }
14144 if (BV_ISSET(fields, 14)) {
14145 log_packet_detailed(" field 'history' has changed");
14146 #ifdef FREECIV_JSON_CONNECTION
14147 field_addr.name = "history";
14148#endif /* FREECIV_JSON_CONNECTION */
14149 DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
14150 }
14151 if (BV_ISSET(fields, 15)) {
14152 log_packet_detailed(" field 'culture' has changed");
14153 #ifdef FREECIV_JSON_CONNECTION
14154 field_addr.name = "culture";
14155#endif /* FREECIV_JSON_CONNECTION */
14156 DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
14157 }
14158 if (BV_ISSET(fields, 16)) {
14159 log_packet_detailed(" field 'buy_cost' has changed");
14160 #ifdef FREECIV_JSON_CONNECTION
14161 field_addr.name = "buy_cost";
14162#endif /* FREECIV_JSON_CONNECTION */
14163 DIO_PUT(uint32, &dout, &field_addr, real_packet->buy_cost);
14164 }
14165 if (BV_ISSET(fields, 17)) {
14166 log_packet_detailed(" field 'surplus' has changed");
14167 #ifdef FREECIV_JSON_CONNECTION
14168 field_addr.name = "surplus";
14169#endif /* FREECIV_JSON_CONNECTION */
14170
14171 {
14172 int i;
14173
14174#ifdef FREECIV_JSON_CONNECTION
14175 /* Create the array. */
14176 DIO_PUT(farray, &dout, &field_addr, O_LAST);
14177
14178 /* Enter the array. */
14179 field_addr.sub_location = plocation_elem_new(0);
14180#endif /* FREECIV_JSON_CONNECTION */
14181
14182 for (i = 0; i < O_LAST; i++) {
14183#ifdef FREECIV_JSON_CONNECTION
14184 /* Next array element. */
14185 field_addr.sub_location->number = i;
14186#endif /* FREECIV_JSON_CONNECTION */
14187 DIO_PUT(sint16, &dout, &field_addr, real_packet->surplus[i]);
14188 }
14189
14190#ifdef FREECIV_JSON_CONNECTION
14191 /* Exit array. */
14192 free(field_addr.sub_location);
14193 field_addr.sub_location = NULL;
14194#endif /* FREECIV_JSON_CONNECTION */
14195 }
14196 }
14197 if (BV_ISSET(fields, 18)) {
14198 log_packet_detailed(" field 'waste' has changed");
14199 #ifdef FREECIV_JSON_CONNECTION
14200 field_addr.name = "waste";
14201#endif /* FREECIV_JSON_CONNECTION */
14202
14203 {
14204 int i;
14205
14206#ifdef FREECIV_JSON_CONNECTION
14207 /* Create the array. */
14208 DIO_PUT(farray, &dout, &field_addr, O_LAST);
14209
14210 /* Enter the array. */
14211 field_addr.sub_location = plocation_elem_new(0);
14212#endif /* FREECIV_JSON_CONNECTION */
14213
14214 for (i = 0; i < O_LAST; i++) {
14215#ifdef FREECIV_JSON_CONNECTION
14216 /* Next array element. */
14217 field_addr.sub_location->number = i;
14218#endif /* FREECIV_JSON_CONNECTION */
14219 DIO_PUT(uint16, &dout, &field_addr, real_packet->waste[i]);
14220 }
14221
14222#ifdef FREECIV_JSON_CONNECTION
14223 /* Exit array. */
14224 free(field_addr.sub_location);
14225 field_addr.sub_location = NULL;
14226#endif /* FREECIV_JSON_CONNECTION */
14227 }
14228 }
14229 if (BV_ISSET(fields, 19)) {
14230 log_packet_detailed(" field 'unhappy_penalty' has changed");
14231 #ifdef FREECIV_JSON_CONNECTION
14232 field_addr.name = "unhappy_penalty";
14233#endif /* FREECIV_JSON_CONNECTION */
14234
14235 {
14236 int i;
14237
14238#ifdef FREECIV_JSON_CONNECTION
14239 /* Create the array. */
14240 DIO_PUT(farray, &dout, &field_addr, O_LAST);
14241
14242 /* Enter the array. */
14243 field_addr.sub_location = plocation_elem_new(0);
14244#endif /* FREECIV_JSON_CONNECTION */
14245
14246 for (i = 0; i < O_LAST; i++) {
14247#ifdef FREECIV_JSON_CONNECTION
14248 /* Next array element. */
14249 field_addr.sub_location->number = i;
14250#endif /* FREECIV_JSON_CONNECTION */
14251 DIO_PUT(sint16, &dout, &field_addr, real_packet->unhappy_penalty[i]);
14252 }
14253
14254#ifdef FREECIV_JSON_CONNECTION
14255 /* Exit array. */
14256 free(field_addr.sub_location);
14257 field_addr.sub_location = NULL;
14258#endif /* FREECIV_JSON_CONNECTION */
14259 }
14260 }
14261 if (BV_ISSET(fields, 20)) {
14262 log_packet_detailed(" field 'prod' has changed");
14263 #ifdef FREECIV_JSON_CONNECTION
14264 field_addr.name = "prod";
14265#endif /* FREECIV_JSON_CONNECTION */
14266
14267 {
14268 int i;
14269
14270#ifdef FREECIV_JSON_CONNECTION
14271 /* Create the array. */
14272 DIO_PUT(farray, &dout, &field_addr, O_LAST);
14273
14274 /* Enter the array. */
14275 field_addr.sub_location = plocation_elem_new(0);
14276#endif /* FREECIV_JSON_CONNECTION */
14277
14278 for (i = 0; i < O_LAST; i++) {
14279#ifdef FREECIV_JSON_CONNECTION
14280 /* Next array element. */
14281 field_addr.sub_location->number = i;
14282#endif /* FREECIV_JSON_CONNECTION */
14283 DIO_PUT(uint16, &dout, &field_addr, real_packet->prod[i]);
14284 }
14285
14286#ifdef FREECIV_JSON_CONNECTION
14287 /* Exit array. */
14288 free(field_addr.sub_location);
14289 field_addr.sub_location = NULL;
14290#endif /* FREECIV_JSON_CONNECTION */
14291 }
14292 }
14293 if (BV_ISSET(fields, 21)) {
14294 log_packet_detailed(" field 'citizen_base' has changed");
14295 #ifdef FREECIV_JSON_CONNECTION
14296 field_addr.name = "citizen_base";
14297#endif /* FREECIV_JSON_CONNECTION */
14298
14299 {
14300 int i;
14301
14302#ifdef FREECIV_JSON_CONNECTION
14303 /* Create the array. */
14304 DIO_PUT(farray, &dout, &field_addr, O_LAST);
14305
14306 /* Enter the array. */
14307 field_addr.sub_location = plocation_elem_new(0);
14308#endif /* FREECIV_JSON_CONNECTION */
14309
14310 for (i = 0; i < O_LAST; i++) {
14311#ifdef FREECIV_JSON_CONNECTION
14312 /* Next array element. */
14313 field_addr.sub_location->number = i;
14314#endif /* FREECIV_JSON_CONNECTION */
14315 DIO_PUT(sint16, &dout, &field_addr, real_packet->citizen_base[i]);
14316 }
14317
14318#ifdef FREECIV_JSON_CONNECTION
14319 /* Exit array. */
14320 free(field_addr.sub_location);
14321 field_addr.sub_location = NULL;
14322#endif /* FREECIV_JSON_CONNECTION */
14323 }
14324 }
14325 if (BV_ISSET(fields, 22)) {
14326 log_packet_detailed(" field 'usage' has changed");
14327 #ifdef FREECIV_JSON_CONNECTION
14328 field_addr.name = "usage";
14329#endif /* FREECIV_JSON_CONNECTION */
14330
14331 {
14332 int i;
14333
14334#ifdef FREECIV_JSON_CONNECTION
14335 /* Create the array. */
14336 DIO_PUT(farray, &dout, &field_addr, O_LAST);
14337
14338 /* Enter the array. */
14339 field_addr.sub_location = plocation_elem_new(0);
14340#endif /* FREECIV_JSON_CONNECTION */
14341
14342 for (i = 0; i < O_LAST; i++) {
14343#ifdef FREECIV_JSON_CONNECTION
14344 /* Next array element. */
14345 field_addr.sub_location->number = i;
14346#endif /* FREECIV_JSON_CONNECTION */
14347 DIO_PUT(sint16, &dout, &field_addr, real_packet->usage[i]);
14348 }
14349
14350#ifdef FREECIV_JSON_CONNECTION
14351 /* Exit array. */
14352 free(field_addr.sub_location);
14353 field_addr.sub_location = NULL;
14354#endif /* FREECIV_JSON_CONNECTION */
14355 }
14356 }
14357 if (BV_ISSET(fields, 23)) {
14358 log_packet_detailed(" field 'food_stock' has changed");
14359 #ifdef FREECIV_JSON_CONNECTION
14360 field_addr.name = "food_stock";
14361#endif /* FREECIV_JSON_CONNECTION */
14362 DIO_PUT(sint16, &dout, &field_addr, real_packet->food_stock);
14363 }
14364 if (BV_ISSET(fields, 24)) {
14365 log_packet_detailed(" field 'shield_stock' has changed");
14366 #ifdef FREECIV_JSON_CONNECTION
14367 field_addr.name = "shield_stock";
14368#endif /* FREECIV_JSON_CONNECTION */
14369 DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
14370 }
14371 if (BV_ISSET(fields, 25)) {
14372 log_packet_detailed(" field 'trade_route_count' has changed");
14373 #ifdef FREECIV_JSON_CONNECTION
14374 field_addr.name = "trade_route_count";
14375#endif /* FREECIV_JSON_CONNECTION */
14376 DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_route_count);
14377 }
14378 if (BV_ISSET(fields, 26)) {
14379 log_packet_detailed(" field 'pollution' has changed");
14380 #ifdef FREECIV_JSON_CONNECTION
14381 field_addr.name = "pollution";
14382#endif /* FREECIV_JSON_CONNECTION */
14383 DIO_PUT(uint16, &dout, &field_addr, real_packet->pollution);
14384 }
14385 if (BV_ISSET(fields, 27)) {
14386 log_packet_detailed(" field 'illness_trade' has changed");
14387 #ifdef FREECIV_JSON_CONNECTION
14388 field_addr.name = "illness_trade";
14389#endif /* FREECIV_JSON_CONNECTION */
14390 DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade);
14391 }
14392 if (BV_ISSET(fields, 28)) {
14393 log_packet_detailed(" field 'production_kind' has changed");
14394 #ifdef FREECIV_JSON_CONNECTION
14395 field_addr.name = "production_kind";
14396#endif /* FREECIV_JSON_CONNECTION */
14397 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
14398 }
14399 if (BV_ISSET(fields, 29)) {
14400 log_packet_detailed(" field 'production_value' has changed");
14401 #ifdef FREECIV_JSON_CONNECTION
14402 field_addr.name = "production_value";
14403#endif /* FREECIV_JSON_CONNECTION */
14404 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
14405 }
14406 if (BV_ISSET(fields, 30)) {
14407 log_packet_detailed(" field 'turn_founded' has changed");
14408 #ifdef FREECIV_JSON_CONNECTION
14409 field_addr.name = "turn_founded";
14410#endif /* FREECIV_JSON_CONNECTION */
14411 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
14412 }
14413 if (BV_ISSET(fields, 31)) {
14414 log_packet_detailed(" field 'turn_last_built' has changed");
14415 #ifdef FREECIV_JSON_CONNECTION
14416 field_addr.name = "turn_last_built";
14417#endif /* FREECIV_JSON_CONNECTION */
14418 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
14419 }
14420 if (BV_ISSET(fields, 32)) {
14421 log_packet_detailed(" field 'changed_from_kind' has changed");
14422 #ifdef FREECIV_JSON_CONNECTION
14423 field_addr.name = "changed_from_kind";
14424#endif /* FREECIV_JSON_CONNECTION */
14425 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_kind);
14426 }
14427 if (BV_ISSET(fields, 33)) {
14428 log_packet_detailed(" field 'changed_from_value' has changed");
14429 #ifdef FREECIV_JSON_CONNECTION
14430 field_addr.name = "changed_from_value";
14431#endif /* FREECIV_JSON_CONNECTION */
14432 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_value);
14433 }
14434 if (BV_ISSET(fields, 34)) {
14435 log_packet_detailed(" field 'before_change_shields' has changed");
14436 #ifdef FREECIV_JSON_CONNECTION
14437 field_addr.name = "before_change_shields";
14438#endif /* FREECIV_JSON_CONNECTION */
14439 DIO_PUT(uint16, &dout, &field_addr, real_packet->before_change_shields);
14440 }
14441 if (BV_ISSET(fields, 35)) {
14442 log_packet_detailed(" field 'disbanded_shields' has changed");
14443 #ifdef FREECIV_JSON_CONNECTION
14444 field_addr.name = "disbanded_shields";
14445#endif /* FREECIV_JSON_CONNECTION */
14446 DIO_PUT(uint16, &dout, &field_addr, real_packet->disbanded_shields);
14447 }
14448 if (BV_ISSET(fields, 36)) {
14449 log_packet_detailed(" field 'caravan_shields' has changed");
14450 #ifdef FREECIV_JSON_CONNECTION
14451 field_addr.name = "caravan_shields";
14452#endif /* FREECIV_JSON_CONNECTION */
14453 DIO_PUT(uint16, &dout, &field_addr, real_packet->caravan_shields);
14454 }
14455 if (BV_ISSET(fields, 37)) {
14456 log_packet_detailed(" field 'last_turns_shield_surplus' has changed");
14457 #ifdef FREECIV_JSON_CONNECTION
14458 field_addr.name = "last_turns_shield_surplus";
14459#endif /* FREECIV_JSON_CONNECTION */
14460 DIO_PUT(uint16, &dout, &field_addr, real_packet->last_turns_shield_surplus);
14461 }
14462 if (BV_ISSET(fields, 38)) {
14463 log_packet_detailed(" field 'airlift' has changed");
14464 #ifdef FREECIV_JSON_CONNECTION
14465 field_addr.name = "airlift";
14466#endif /* FREECIV_JSON_CONNECTION */
14467 DIO_PUT(uint8, &dout, &field_addr, real_packet->airlift);
14468 }
14469 /* field 39 is folded into the header */
14470 /* field 40 is folded into the header */
14471 /* field 41 is folded into the header */
14472 /* field 42 is folded into the header */
14473 if (BV_ISSET(fields, 43)) {
14474 log_packet_detailed(" field 'walls' has changed");
14475 #ifdef FREECIV_JSON_CONNECTION
14476 field_addr.name = "walls";
14477#endif /* FREECIV_JSON_CONNECTION */
14478 DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
14479 }
14480 if (BV_ISSET(fields, 44)) {
14481 log_packet_detailed(" field 'city_image' has changed");
14482 #ifdef FREECIV_JSON_CONNECTION
14483 field_addr.name = "city_image";
14484#endif /* FREECIV_JSON_CONNECTION */
14485 DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
14486 }
14487 if (BV_ISSET(fields, 45)) {
14488 log_packet_detailed(" field 'steal' has changed");
14489 #ifdef FREECIV_JSON_CONNECTION
14490 field_addr.name = "steal";
14491#endif /* FREECIV_JSON_CONNECTION */
14492 DIO_PUT(uint16, &dout, &field_addr, real_packet->steal);
14493 }
14494 if (BV_ISSET(fields, 46)) {
14495 log_packet_detailed(" field 'worklist' has changed");
14496 #ifdef FREECIV_JSON_CONNECTION
14497 field_addr.name = "worklist";
14498#endif /* FREECIV_JSON_CONNECTION */
14499 DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
14500 }
14501 if (BV_ISSET(fields, 47)) {
14502 log_packet_detailed(" field 'improvements' has changed");
14503 #ifdef FREECIV_JSON_CONNECTION
14504 field_addr.name = "improvements";
14505#endif /* FREECIV_JSON_CONNECTION */
14506 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
14507 }
14508 if (BV_ISSET(fields, 48)) {
14509 log_packet_detailed(" field 'city_options' has changed");
14510 #ifdef FREECIV_JSON_CONNECTION
14511 field_addr.name = "city_options";
14512#endif /* FREECIV_JSON_CONNECTION */
14513 DIO_BV_PUT(&dout, &field_addr, packet->city_options);
14514 }
14515 if (BV_ISSET(fields, 49)) {
14516 log_packet_detailed(" field 'name' has changed");
14517 #ifdef FREECIV_JSON_CONNECTION
14518 field_addr.name = "name";
14519#endif /* FREECIV_JSON_CONNECTION */
14520 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
14521 }
14522
14523 *old = *real_packet;
14524
14525 hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
14526 if (NULL != *hash) {
14527 genhash_remove(*hash, real_packet);
14528 }
14529#endif /* FREECIV_DELTA_PROTOCOL */
14530#ifndef FREECIV_DELTA_PROTOCOL
14531#ifdef FREECIV_JSON_CONNECTION
14532 field_addr.name = "id32";
14533#endif /* FREECIV_JSON_CONNECTION */
14534 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
14535#ifdef FREECIV_JSON_CONNECTION
14536 field_addr.name = "tile";
14537#endif /* FREECIV_JSON_CONNECTION */
14538 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
14539#ifdef FREECIV_JSON_CONNECTION
14540 field_addr.name = "owner";
14541#endif /* FREECIV_JSON_CONNECTION */
14542 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
14543#ifdef FREECIV_JSON_CONNECTION
14544 field_addr.name = "original";
14545#endif /* FREECIV_JSON_CONNECTION */
14546 DIO_PUT(uint16, &dout, &field_addr, real_packet->original);
14547#ifdef FREECIV_JSON_CONNECTION
14548 field_addr.name = "size";
14549#endif /* FREECIV_JSON_CONNECTION */
14550 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
14551#ifdef FREECIV_JSON_CONNECTION
14552 field_addr.name = "city_radius_sq";
14553#endif /* FREECIV_JSON_CONNECTION */
14554 DIO_PUT(uint8, &dout, &field_addr, real_packet->city_radius_sq);
14555#ifdef FREECIV_JSON_CONNECTION
14556 field_addr.name = "style";
14557#endif /* FREECIV_JSON_CONNECTION */
14558 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
14559#ifdef FREECIV_JSON_CONNECTION
14560 field_addr.name = "capital";
14561#endif /* FREECIV_JSON_CONNECTION */
14562 DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
14563#ifdef FREECIV_JSON_CONNECTION
14564 field_addr.name = "ppl_happy";
14565#endif /* FREECIV_JSON_CONNECTION */
14566
14567 {
14568 int i;
14569
14570#ifdef FREECIV_JSON_CONNECTION
14571 /* Create the array. */
14572 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
14573
14574 /* Enter the array. */
14575 field_addr.sub_location = plocation_elem_new(0);
14576#endif /* FREECIV_JSON_CONNECTION */
14577
14578 for (i = 0; i < FEELING_LAST; i++) {
14579#ifdef FREECIV_JSON_CONNECTION
14580 /* Next array element. */
14581 field_addr.sub_location->number = i;
14582#endif /* FREECIV_JSON_CONNECTION */
14583 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
14584 }
14585
14586#ifdef FREECIV_JSON_CONNECTION
14587 /* Exit array. */
14588 free(field_addr.sub_location);
14589 field_addr.sub_location = NULL;
14590#endif /* FREECIV_JSON_CONNECTION */
14591 }
14592#ifdef FREECIV_JSON_CONNECTION
14593 field_addr.name = "ppl_content";
14594#endif /* FREECIV_JSON_CONNECTION */
14595
14596 {
14597 int i;
14598
14599#ifdef FREECIV_JSON_CONNECTION
14600 /* Create the array. */
14601 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
14602
14603 /* Enter the array. */
14604 field_addr.sub_location = plocation_elem_new(0);
14605#endif /* FREECIV_JSON_CONNECTION */
14606
14607 for (i = 0; i < FEELING_LAST; i++) {
14608#ifdef FREECIV_JSON_CONNECTION
14609 /* Next array element. */
14610 field_addr.sub_location->number = i;
14611#endif /* FREECIV_JSON_CONNECTION */
14612 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
14613 }
14614
14615#ifdef FREECIV_JSON_CONNECTION
14616 /* Exit array. */
14617 free(field_addr.sub_location);
14618 field_addr.sub_location = NULL;
14619#endif /* FREECIV_JSON_CONNECTION */
14620 }
14621#ifdef FREECIV_JSON_CONNECTION
14622 field_addr.name = "ppl_unhappy";
14623#endif /* FREECIV_JSON_CONNECTION */
14624
14625 {
14626 int i;
14627
14628#ifdef FREECIV_JSON_CONNECTION
14629 /* Create the array. */
14630 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
14631
14632 /* Enter the array. */
14633 field_addr.sub_location = plocation_elem_new(0);
14634#endif /* FREECIV_JSON_CONNECTION */
14635
14636 for (i = 0; i < FEELING_LAST; i++) {
14637#ifdef FREECIV_JSON_CONNECTION
14638 /* Next array element. */
14639 field_addr.sub_location->number = i;
14640#endif /* FREECIV_JSON_CONNECTION */
14641 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
14642 }
14643
14644#ifdef FREECIV_JSON_CONNECTION
14645 /* Exit array. */
14646 free(field_addr.sub_location);
14647 field_addr.sub_location = NULL;
14648#endif /* FREECIV_JSON_CONNECTION */
14649 }
14650#ifdef FREECIV_JSON_CONNECTION
14651 field_addr.name = "ppl_angry";
14652#endif /* FREECIV_JSON_CONNECTION */
14653
14654 {
14655 int i;
14656
14657#ifdef FREECIV_JSON_CONNECTION
14658 /* Create the array. */
14659 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
14660
14661 /* Enter the array. */
14662 field_addr.sub_location = plocation_elem_new(0);
14663#endif /* FREECIV_JSON_CONNECTION */
14664
14665 for (i = 0; i < FEELING_LAST; i++) {
14666#ifdef FREECIV_JSON_CONNECTION
14667 /* Next array element. */
14668 field_addr.sub_location->number = i;
14669#endif /* FREECIV_JSON_CONNECTION */
14670 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
14671 }
14672
14673#ifdef FREECIV_JSON_CONNECTION
14674 /* Exit array. */
14675 free(field_addr.sub_location);
14676 field_addr.sub_location = NULL;
14677#endif /* FREECIV_JSON_CONNECTION */
14678 }
14679#ifdef FREECIV_JSON_CONNECTION
14680 field_addr.name = "specialists_size";
14681#endif /* FREECIV_JSON_CONNECTION */
14682 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
14683#ifdef FREECIV_JSON_CONNECTION
14684 field_addr.name = "specialists";
14685#endif /* FREECIV_JSON_CONNECTION */
14686
14687 {
14688 int i;
14689
14690#ifdef FREECIV_JSON_CONNECTION
14691 /* Create the array. */
14692 DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
14693
14694 /* Enter the array. */
14695 field_addr.sub_location = plocation_elem_new(0);
14696#endif /* FREECIV_JSON_CONNECTION */
14697
14698 for (i = 0; i < real_packet->specialists_size; i++) {
14699#ifdef FREECIV_JSON_CONNECTION
14700 /* Next array element. */
14701 field_addr.sub_location->number = i;
14702#endif /* FREECIV_JSON_CONNECTION */
14703 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
14704 }
14705
14706#ifdef FREECIV_JSON_CONNECTION
14707 /* Exit array. */
14708 free(field_addr.sub_location);
14709 field_addr.sub_location = NULL;
14710#endif /* FREECIV_JSON_CONNECTION */
14711 }
14712#ifdef FREECIV_JSON_CONNECTION
14713 field_addr.name = "history";
14714#endif /* FREECIV_JSON_CONNECTION */
14715 DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
14716#ifdef FREECIV_JSON_CONNECTION
14717 field_addr.name = "culture";
14718#endif /* FREECIV_JSON_CONNECTION */
14719 DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
14720#ifdef FREECIV_JSON_CONNECTION
14721 field_addr.name = "buy_cost";
14722#endif /* FREECIV_JSON_CONNECTION */
14723 DIO_PUT(uint32, &dout, &field_addr, real_packet->buy_cost);
14724#ifdef FREECIV_JSON_CONNECTION
14725 field_addr.name = "surplus";
14726#endif /* FREECIV_JSON_CONNECTION */
14727
14728 {
14729 int i;
14730
14731#ifdef FREECIV_JSON_CONNECTION
14732 /* Create the array. */
14733 DIO_PUT(farray, &dout, &field_addr, O_LAST);
14734
14735 /* Enter the array. */
14736 field_addr.sub_location = plocation_elem_new(0);
14737#endif /* FREECIV_JSON_CONNECTION */
14738
14739 for (i = 0; i < O_LAST; i++) {
14740#ifdef FREECIV_JSON_CONNECTION
14741 /* Next array element. */
14742 field_addr.sub_location->number = i;
14743#endif /* FREECIV_JSON_CONNECTION */
14744 DIO_PUT(sint16, &dout, &field_addr, real_packet->surplus[i]);
14745 }
14746
14747#ifdef FREECIV_JSON_CONNECTION
14748 /* Exit array. */
14749 free(field_addr.sub_location);
14750 field_addr.sub_location = NULL;
14751#endif /* FREECIV_JSON_CONNECTION */
14752 }
14753#ifdef FREECIV_JSON_CONNECTION
14754 field_addr.name = "waste";
14755#endif /* FREECIV_JSON_CONNECTION */
14756
14757 {
14758 int i;
14759
14760#ifdef FREECIV_JSON_CONNECTION
14761 /* Create the array. */
14762 DIO_PUT(farray, &dout, &field_addr, O_LAST);
14763
14764 /* Enter the array. */
14765 field_addr.sub_location = plocation_elem_new(0);
14766#endif /* FREECIV_JSON_CONNECTION */
14767
14768 for (i = 0; i < O_LAST; i++) {
14769#ifdef FREECIV_JSON_CONNECTION
14770 /* Next array element. */
14771 field_addr.sub_location->number = i;
14772#endif /* FREECIV_JSON_CONNECTION */
14773 DIO_PUT(uint16, &dout, &field_addr, real_packet->waste[i]);
14774 }
14775
14776#ifdef FREECIV_JSON_CONNECTION
14777 /* Exit array. */
14778 free(field_addr.sub_location);
14779 field_addr.sub_location = NULL;
14780#endif /* FREECIV_JSON_CONNECTION */
14781 }
14782#ifdef FREECIV_JSON_CONNECTION
14783 field_addr.name = "unhappy_penalty";
14784#endif /* FREECIV_JSON_CONNECTION */
14785
14786 {
14787 int i;
14788
14789#ifdef FREECIV_JSON_CONNECTION
14790 /* Create the array. */
14791 DIO_PUT(farray, &dout, &field_addr, O_LAST);
14792
14793 /* Enter the array. */
14794 field_addr.sub_location = plocation_elem_new(0);
14795#endif /* FREECIV_JSON_CONNECTION */
14796
14797 for (i = 0; i < O_LAST; i++) {
14798#ifdef FREECIV_JSON_CONNECTION
14799 /* Next array element. */
14800 field_addr.sub_location->number = i;
14801#endif /* FREECIV_JSON_CONNECTION */
14802 DIO_PUT(sint16, &dout, &field_addr, real_packet->unhappy_penalty[i]);
14803 }
14804
14805#ifdef FREECIV_JSON_CONNECTION
14806 /* Exit array. */
14807 free(field_addr.sub_location);
14808 field_addr.sub_location = NULL;
14809#endif /* FREECIV_JSON_CONNECTION */
14810 }
14811#ifdef FREECIV_JSON_CONNECTION
14812 field_addr.name = "prod";
14813#endif /* FREECIV_JSON_CONNECTION */
14814
14815 {
14816 int i;
14817
14818#ifdef FREECIV_JSON_CONNECTION
14819 /* Create the array. */
14820 DIO_PUT(farray, &dout, &field_addr, O_LAST);
14821
14822 /* Enter the array. */
14823 field_addr.sub_location = plocation_elem_new(0);
14824#endif /* FREECIV_JSON_CONNECTION */
14825
14826 for (i = 0; i < O_LAST; i++) {
14827#ifdef FREECIV_JSON_CONNECTION
14828 /* Next array element. */
14829 field_addr.sub_location->number = i;
14830#endif /* FREECIV_JSON_CONNECTION */
14831 DIO_PUT(uint16, &dout, &field_addr, real_packet->prod[i]);
14832 }
14833
14834#ifdef FREECIV_JSON_CONNECTION
14835 /* Exit array. */
14836 free(field_addr.sub_location);
14837 field_addr.sub_location = NULL;
14838#endif /* FREECIV_JSON_CONNECTION */
14839 }
14840#ifdef FREECIV_JSON_CONNECTION
14841 field_addr.name = "citizen_base";
14842#endif /* FREECIV_JSON_CONNECTION */
14843
14844 {
14845 int i;
14846
14847#ifdef FREECIV_JSON_CONNECTION
14848 /* Create the array. */
14849 DIO_PUT(farray, &dout, &field_addr, O_LAST);
14850
14851 /* Enter the array. */
14852 field_addr.sub_location = plocation_elem_new(0);
14853#endif /* FREECIV_JSON_CONNECTION */
14854
14855 for (i = 0; i < O_LAST; i++) {
14856#ifdef FREECIV_JSON_CONNECTION
14857 /* Next array element. */
14858 field_addr.sub_location->number = i;
14859#endif /* FREECIV_JSON_CONNECTION */
14860 DIO_PUT(sint16, &dout, &field_addr, real_packet->citizen_base[i]);
14861 }
14862
14863#ifdef FREECIV_JSON_CONNECTION
14864 /* Exit array. */
14865 free(field_addr.sub_location);
14866 field_addr.sub_location = NULL;
14867#endif /* FREECIV_JSON_CONNECTION */
14868 }
14869#ifdef FREECIV_JSON_CONNECTION
14870 field_addr.name = "usage";
14871#endif /* FREECIV_JSON_CONNECTION */
14872
14873 {
14874 int i;
14875
14876#ifdef FREECIV_JSON_CONNECTION
14877 /* Create the array. */
14878 DIO_PUT(farray, &dout, &field_addr, O_LAST);
14879
14880 /* Enter the array. */
14881 field_addr.sub_location = plocation_elem_new(0);
14882#endif /* FREECIV_JSON_CONNECTION */
14883
14884 for (i = 0; i < O_LAST; i++) {
14885#ifdef FREECIV_JSON_CONNECTION
14886 /* Next array element. */
14887 field_addr.sub_location->number = i;
14888#endif /* FREECIV_JSON_CONNECTION */
14889 DIO_PUT(sint16, &dout, &field_addr, real_packet->usage[i]);
14890 }
14891
14892#ifdef FREECIV_JSON_CONNECTION
14893 /* Exit array. */
14894 free(field_addr.sub_location);
14895 field_addr.sub_location = NULL;
14896#endif /* FREECIV_JSON_CONNECTION */
14897 }
14898#ifdef FREECIV_JSON_CONNECTION
14899 field_addr.name = "food_stock";
14900#endif /* FREECIV_JSON_CONNECTION */
14901 DIO_PUT(sint16, &dout, &field_addr, real_packet->food_stock);
14902#ifdef FREECIV_JSON_CONNECTION
14903 field_addr.name = "shield_stock";
14904#endif /* FREECIV_JSON_CONNECTION */
14905 DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
14906#ifdef FREECIV_JSON_CONNECTION
14907 field_addr.name = "trade_route_count";
14908#endif /* FREECIV_JSON_CONNECTION */
14909 DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_route_count);
14910#ifdef FREECIV_JSON_CONNECTION
14911 field_addr.name = "pollution";
14912#endif /* FREECIV_JSON_CONNECTION */
14913 DIO_PUT(uint16, &dout, &field_addr, real_packet->pollution);
14914#ifdef FREECIV_JSON_CONNECTION
14915 field_addr.name = "illness_trade";
14916#endif /* FREECIV_JSON_CONNECTION */
14917 DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade);
14918#ifdef FREECIV_JSON_CONNECTION
14919 field_addr.name = "production_kind";
14920#endif /* FREECIV_JSON_CONNECTION */
14921 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
14922#ifdef FREECIV_JSON_CONNECTION
14923 field_addr.name = "production_value";
14924#endif /* FREECIV_JSON_CONNECTION */
14925 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
14926#ifdef FREECIV_JSON_CONNECTION
14927 field_addr.name = "turn_founded";
14928#endif /* FREECIV_JSON_CONNECTION */
14929 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
14930#ifdef FREECIV_JSON_CONNECTION
14931 field_addr.name = "turn_last_built";
14932#endif /* FREECIV_JSON_CONNECTION */
14933 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
14934#ifdef FREECIV_JSON_CONNECTION
14935 field_addr.name = "changed_from_kind";
14936#endif /* FREECIV_JSON_CONNECTION */
14937 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_kind);
14938#ifdef FREECIV_JSON_CONNECTION
14939 field_addr.name = "changed_from_value";
14940#endif /* FREECIV_JSON_CONNECTION */
14941 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_value);
14942#ifdef FREECIV_JSON_CONNECTION
14943 field_addr.name = "before_change_shields";
14944#endif /* FREECIV_JSON_CONNECTION */
14945 DIO_PUT(uint16, &dout, &field_addr, real_packet->before_change_shields);
14946#ifdef FREECIV_JSON_CONNECTION
14947 field_addr.name = "disbanded_shields";
14948#endif /* FREECIV_JSON_CONNECTION */
14949 DIO_PUT(uint16, &dout, &field_addr, real_packet->disbanded_shields);
14950#ifdef FREECIV_JSON_CONNECTION
14951 field_addr.name = "caravan_shields";
14952#endif /* FREECIV_JSON_CONNECTION */
14953 DIO_PUT(uint16, &dout, &field_addr, real_packet->caravan_shields);
14954#ifdef FREECIV_JSON_CONNECTION
14955 field_addr.name = "last_turns_shield_surplus";
14956#endif /* FREECIV_JSON_CONNECTION */
14957 DIO_PUT(uint16, &dout, &field_addr, real_packet->last_turns_shield_surplus);
14958#ifdef FREECIV_JSON_CONNECTION
14959 field_addr.name = "airlift";
14960#endif /* FREECIV_JSON_CONNECTION */
14961 DIO_PUT(uint8, &dout, &field_addr, real_packet->airlift);
14962#ifdef FREECIV_JSON_CONNECTION
14963 field_addr.name = "did_buy";
14964#endif /* FREECIV_JSON_CONNECTION */
14965 DIO_PUT(bool8, &dout, &field_addr, real_packet->did_buy);
14966#ifdef FREECIV_JSON_CONNECTION
14967 field_addr.name = "did_sell";
14968#endif /* FREECIV_JSON_CONNECTION */
14969 DIO_PUT(bool8, &dout, &field_addr, real_packet->did_sell);
14970#ifdef FREECIV_JSON_CONNECTION
14971 field_addr.name = "was_happy";
14972#endif /* FREECIV_JSON_CONNECTION */
14973 DIO_PUT(bool8, &dout, &field_addr, real_packet->was_happy);
14974#ifdef FREECIV_JSON_CONNECTION
14975 field_addr.name = "diplomat_investigate";
14976#endif /* FREECIV_JSON_CONNECTION */
14977 DIO_PUT(bool8, &dout, &field_addr, real_packet->diplomat_investigate);
14978#ifdef FREECIV_JSON_CONNECTION
14979 field_addr.name = "walls";
14980#endif /* FREECIV_JSON_CONNECTION */
14981 DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
14982#ifdef FREECIV_JSON_CONNECTION
14983 field_addr.name = "city_image";
14984#endif /* FREECIV_JSON_CONNECTION */
14985 DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
14986#ifdef FREECIV_JSON_CONNECTION
14987 field_addr.name = "steal";
14988#endif /* FREECIV_JSON_CONNECTION */
14989 DIO_PUT(uint16, &dout, &field_addr, real_packet->steal);
14990#ifdef FREECIV_JSON_CONNECTION
14991 field_addr.name = "worklist";
14992#endif /* FREECIV_JSON_CONNECTION */
14993 DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
14994#ifdef FREECIV_JSON_CONNECTION
14995 field_addr.name = "improvements";
14996#endif /* FREECIV_JSON_CONNECTION */
14997 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
14998#ifdef FREECIV_JSON_CONNECTION
14999 field_addr.name = "city_options";
15000#endif /* FREECIV_JSON_CONNECTION */
15001 DIO_BV_PUT(&dout, &field_addr, packet->city_options);
15002#ifdef FREECIV_JSON_CONNECTION
15003 field_addr.name = "name";
15004#endif /* FREECIV_JSON_CONNECTION */
15005 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
15006
15007#endif
15008 SEND_PACKET_END(PACKET_CITY_INFO);
15009}
15010
15011#ifdef FREECIV_DELTA_PROTOCOL
15012#define hash_packet_city_info_101 hash_const
15013
15014#define cmp_packet_city_info_101 cmp_const
15015
15016 BV_DEFINE(packet_city_info_101_fields, 49);
15017#endif /* FREECIV_DELTA_PROTOCOL */
15018
15019 static struct packet_city_info *receive_packet_city_info_101(struct connection *pc)
15020{
15021#ifdef FREECIV_DELTA_PROTOCOL
15022 packet_city_info_101_fields fields;
15023 struct packet_city_info *old;
15024 struct genhash **hash = pc->phs.received + PACKET_CITY_INFO;
15025#endif /* FREECIV_DELTA_PROTOCOL */
15026 RECEIVE_PACKET_START(packet_city_info, real_packet);
15027#ifdef FREECIV_JSON_CONNECTION
15028 struct plocation field_addr;
15029 {
15030 struct plocation *field_addr_tmp = plocation_field_new(NULL);
15031 field_addr = *field_addr_tmp;
15032 FC_FREE(field_addr_tmp);
15033 }
15034#endif /* FREECIV_JSON_CONNECTION */
15035
15036#ifdef FREECIV_DELTA_PROTOCOL
15037#ifdef FREECIV_JSON_CONNECTION
15038 field_addr.name = "fields";
15039#endif /* FREECIV_JSON_CONNECTION */
15040 DIO_BV_GET(&din, &field_addr, fields);
15041
15042#else /* FREECIV_DELTA_PROTOCOL */
15043 #ifdef FREECIV_JSON_CONNECTION
15044 field_addr.name = "id32";
15045 #endif /* FREECIV_JSON_CONNECTION */
15046 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
15047 RECEIVE_PACKET_FIELD_ERROR(id32);
15048 }
15049 #ifdef FREECIV_JSON_CONNECTION
15050 field_addr.name = "tile";
15051 #endif /* FREECIV_JSON_CONNECTION */
15052 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
15053 RECEIVE_PACKET_FIELD_ERROR(tile);
15054 }
15055 #ifdef FREECIV_JSON_CONNECTION
15056 field_addr.name = "owner";
15057 #endif /* FREECIV_JSON_CONNECTION */
15058 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
15059 RECEIVE_PACKET_FIELD_ERROR(owner);
15060 }
15061 #ifdef FREECIV_JSON_CONNECTION
15062 field_addr.name = "size";
15063 #endif /* FREECIV_JSON_CONNECTION */
15064 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
15065 RECEIVE_PACKET_FIELD_ERROR(size);
15066 }
15067 #ifdef FREECIV_JSON_CONNECTION
15068 field_addr.name = "city_radius_sq";
15069 #endif /* FREECIV_JSON_CONNECTION */
15070 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_radius_sq)) {
15071 RECEIVE_PACKET_FIELD_ERROR(city_radius_sq);
15072 }
15073 #ifdef FREECIV_JSON_CONNECTION
15074 field_addr.name = "style";
15075 #endif /* FREECIV_JSON_CONNECTION */
15076 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
15077 RECEIVE_PACKET_FIELD_ERROR(style);
15078 }
15079 #ifdef FREECIV_JSON_CONNECTION
15080 field_addr.name = "capital";
15081 #endif /* FREECIV_JSON_CONNECTION */
15082 {
15083 int readin;
15084
15085 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
15086 RECEIVE_PACKET_FIELD_ERROR(capital);
15087 }
15088 real_packet->capital = readin;
15089 }
15090 #ifdef FREECIV_JSON_CONNECTION
15091 field_addr.name = "ppl_happy";
15092 #endif /* FREECIV_JSON_CONNECTION */
15093
15094 {
15095 int i;
15096
15097 #ifdef FREECIV_JSON_CONNECTION
15098 /* Enter array. */
15099 field_addr.sub_location = plocation_elem_new(0);
15100 #endif /* FREECIV_JSON_CONNECTION */
15101
15102 for (i = 0; i < FEELING_LAST; i++) {
15103 #ifdef FREECIV_JSON_CONNECTION
15104 field_addr.sub_location->number = i;
15105 #endif /* FREECIV_JSON_CONNECTION */
15106 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
15107 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
15108 }
15109 }
15110
15111 #ifdef FREECIV_JSON_CONNECTION
15112 /* Exit array. */
15113 free(field_addr.sub_location);
15114 field_addr.sub_location = NULL;
15115 #endif /* FREECIV_JSON_CONNECTION */
15116 }
15117 #ifdef FREECIV_JSON_CONNECTION
15118 field_addr.name = "ppl_content";
15119 #endif /* FREECIV_JSON_CONNECTION */
15120
15121 {
15122 int i;
15123
15124 #ifdef FREECIV_JSON_CONNECTION
15125 /* Enter array. */
15126 field_addr.sub_location = plocation_elem_new(0);
15127 #endif /* FREECIV_JSON_CONNECTION */
15128
15129 for (i = 0; i < FEELING_LAST; i++) {
15130 #ifdef FREECIV_JSON_CONNECTION
15131 field_addr.sub_location->number = i;
15132 #endif /* FREECIV_JSON_CONNECTION */
15133 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
15134 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
15135 }
15136 }
15137
15138 #ifdef FREECIV_JSON_CONNECTION
15139 /* Exit array. */
15140 free(field_addr.sub_location);
15141 field_addr.sub_location = NULL;
15142 #endif /* FREECIV_JSON_CONNECTION */
15143 }
15144 #ifdef FREECIV_JSON_CONNECTION
15145 field_addr.name = "ppl_unhappy";
15146 #endif /* FREECIV_JSON_CONNECTION */
15147
15148 {
15149 int i;
15150
15151 #ifdef FREECIV_JSON_CONNECTION
15152 /* Enter array. */
15153 field_addr.sub_location = plocation_elem_new(0);
15154 #endif /* FREECIV_JSON_CONNECTION */
15155
15156 for (i = 0; i < FEELING_LAST; i++) {
15157 #ifdef FREECIV_JSON_CONNECTION
15158 field_addr.sub_location->number = i;
15159 #endif /* FREECIV_JSON_CONNECTION */
15160 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
15161 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
15162 }
15163 }
15164
15165 #ifdef FREECIV_JSON_CONNECTION
15166 /* Exit array. */
15167 free(field_addr.sub_location);
15168 field_addr.sub_location = NULL;
15169 #endif /* FREECIV_JSON_CONNECTION */
15170 }
15171 #ifdef FREECIV_JSON_CONNECTION
15172 field_addr.name = "ppl_angry";
15173 #endif /* FREECIV_JSON_CONNECTION */
15174
15175 {
15176 int i;
15177
15178 #ifdef FREECIV_JSON_CONNECTION
15179 /* Enter array. */
15180 field_addr.sub_location = plocation_elem_new(0);
15181 #endif /* FREECIV_JSON_CONNECTION */
15182
15183 for (i = 0; i < FEELING_LAST; i++) {
15184 #ifdef FREECIV_JSON_CONNECTION
15185 field_addr.sub_location->number = i;
15186 #endif /* FREECIV_JSON_CONNECTION */
15187 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
15188 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
15189 }
15190 }
15191
15192 #ifdef FREECIV_JSON_CONNECTION
15193 /* Exit array. */
15194 free(field_addr.sub_location);
15195 field_addr.sub_location = NULL;
15196 #endif /* FREECIV_JSON_CONNECTION */
15197 }
15198 #ifdef FREECIV_JSON_CONNECTION
15199 field_addr.name = "specialists_size";
15200 #endif /* FREECIV_JSON_CONNECTION */
15201 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
15202 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
15203 }
15204 #ifdef FREECIV_JSON_CONNECTION
15205 field_addr.name = "specialists";
15206 #endif /* FREECIV_JSON_CONNECTION */
15207
15208 {
15209 int i;
15210
15211 #ifdef FREECIV_JSON_CONNECTION
15212 /* Enter array. */
15213 field_addr.sub_location = plocation_elem_new(0);
15214 #endif /* FREECIV_JSON_CONNECTION */
15215
15216 if (real_packet->specialists_size > SP_MAX) {
15217 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
15218 }
15219 for (i = 0; i < real_packet->specialists_size; i++) {
15220 #ifdef FREECIV_JSON_CONNECTION
15221 field_addr.sub_location->number = i;
15222 #endif /* FREECIV_JSON_CONNECTION */
15223 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
15224 RECEIVE_PACKET_FIELD_ERROR(specialists);
15225 }
15226 }
15227
15228 #ifdef FREECIV_JSON_CONNECTION
15229 /* Exit array. */
15230 free(field_addr.sub_location);
15231 field_addr.sub_location = NULL;
15232 #endif /* FREECIV_JSON_CONNECTION */
15233 }
15234 #ifdef FREECIV_JSON_CONNECTION
15235 field_addr.name = "history";
15236 #endif /* FREECIV_JSON_CONNECTION */
15237 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
15238 RECEIVE_PACKET_FIELD_ERROR(history);
15239 }
15240 #ifdef FREECIV_JSON_CONNECTION
15241 field_addr.name = "culture";
15242 #endif /* FREECIV_JSON_CONNECTION */
15243 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
15244 RECEIVE_PACKET_FIELD_ERROR(culture);
15245 }
15246 #ifdef FREECIV_JSON_CONNECTION
15247 field_addr.name = "buy_cost";
15248 #endif /* FREECIV_JSON_CONNECTION */
15249 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->buy_cost)) {
15250 RECEIVE_PACKET_FIELD_ERROR(buy_cost);
15251 }
15252 #ifdef FREECIV_JSON_CONNECTION
15253 field_addr.name = "surplus";
15254 #endif /* FREECIV_JSON_CONNECTION */
15255
15256 {
15257 int i;
15258
15259 #ifdef FREECIV_JSON_CONNECTION
15260 /* Enter array. */
15261 field_addr.sub_location = plocation_elem_new(0);
15262 #endif /* FREECIV_JSON_CONNECTION */
15263
15264 for (i = 0; i < O_LAST; i++) {
15265 #ifdef FREECIV_JSON_CONNECTION
15266 field_addr.sub_location->number = i;
15267 #endif /* FREECIV_JSON_CONNECTION */
15268 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->surplus[i])) {
15269 RECEIVE_PACKET_FIELD_ERROR(surplus);
15270 }
15271 }
15272
15273 #ifdef FREECIV_JSON_CONNECTION
15274 /* Exit array. */
15275 free(field_addr.sub_location);
15276 field_addr.sub_location = NULL;
15277 #endif /* FREECIV_JSON_CONNECTION */
15278 }
15279 #ifdef FREECIV_JSON_CONNECTION
15280 field_addr.name = "waste";
15281 #endif /* FREECIV_JSON_CONNECTION */
15282
15283 {
15284 int i;
15285
15286 #ifdef FREECIV_JSON_CONNECTION
15287 /* Enter array. */
15288 field_addr.sub_location = plocation_elem_new(0);
15289 #endif /* FREECIV_JSON_CONNECTION */
15290
15291 for (i = 0; i < O_LAST; i++) {
15292 #ifdef FREECIV_JSON_CONNECTION
15293 field_addr.sub_location->number = i;
15294 #endif /* FREECIV_JSON_CONNECTION */
15295 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->waste[i])) {
15296 RECEIVE_PACKET_FIELD_ERROR(waste);
15297 }
15298 }
15299
15300 #ifdef FREECIV_JSON_CONNECTION
15301 /* Exit array. */
15302 free(field_addr.sub_location);
15303 field_addr.sub_location = NULL;
15304 #endif /* FREECIV_JSON_CONNECTION */
15305 }
15306 #ifdef FREECIV_JSON_CONNECTION
15307 field_addr.name = "unhappy_penalty";
15308 #endif /* FREECIV_JSON_CONNECTION */
15309
15310 {
15311 int i;
15312
15313 #ifdef FREECIV_JSON_CONNECTION
15314 /* Enter array. */
15315 field_addr.sub_location = plocation_elem_new(0);
15316 #endif /* FREECIV_JSON_CONNECTION */
15317
15318 for (i = 0; i < O_LAST; i++) {
15319 #ifdef FREECIV_JSON_CONNECTION
15320 field_addr.sub_location->number = i;
15321 #endif /* FREECIV_JSON_CONNECTION */
15322 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->unhappy_penalty[i])) {
15323 RECEIVE_PACKET_FIELD_ERROR(unhappy_penalty);
15324 }
15325 }
15326
15327 #ifdef FREECIV_JSON_CONNECTION
15328 /* Exit array. */
15329 free(field_addr.sub_location);
15330 field_addr.sub_location = NULL;
15331 #endif /* FREECIV_JSON_CONNECTION */
15332 }
15333 #ifdef FREECIV_JSON_CONNECTION
15334 field_addr.name = "prod";
15335 #endif /* FREECIV_JSON_CONNECTION */
15336
15337 {
15338 int i;
15339
15340 #ifdef FREECIV_JSON_CONNECTION
15341 /* Enter array. */
15342 field_addr.sub_location = plocation_elem_new(0);
15343 #endif /* FREECIV_JSON_CONNECTION */
15344
15345 for (i = 0; i < O_LAST; i++) {
15346 #ifdef FREECIV_JSON_CONNECTION
15347 field_addr.sub_location->number = i;
15348 #endif /* FREECIV_JSON_CONNECTION */
15349 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->prod[i])) {
15350 RECEIVE_PACKET_FIELD_ERROR(prod);
15351 }
15352 }
15353
15354 #ifdef FREECIV_JSON_CONNECTION
15355 /* Exit array. */
15356 free(field_addr.sub_location);
15357 field_addr.sub_location = NULL;
15358 #endif /* FREECIV_JSON_CONNECTION */
15359 }
15360 #ifdef FREECIV_JSON_CONNECTION
15361 field_addr.name = "citizen_base";
15362 #endif /* FREECIV_JSON_CONNECTION */
15363
15364 {
15365 int i;
15366
15367 #ifdef FREECIV_JSON_CONNECTION
15368 /* Enter array. */
15369 field_addr.sub_location = plocation_elem_new(0);
15370 #endif /* FREECIV_JSON_CONNECTION */
15371
15372 for (i = 0; i < O_LAST; i++) {
15373 #ifdef FREECIV_JSON_CONNECTION
15374 field_addr.sub_location->number = i;
15375 #endif /* FREECIV_JSON_CONNECTION */
15376 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->citizen_base[i])) {
15377 RECEIVE_PACKET_FIELD_ERROR(citizen_base);
15378 }
15379 }
15380
15381 #ifdef FREECIV_JSON_CONNECTION
15382 /* Exit array. */
15383 free(field_addr.sub_location);
15384 field_addr.sub_location = NULL;
15385 #endif /* FREECIV_JSON_CONNECTION */
15386 }
15387 #ifdef FREECIV_JSON_CONNECTION
15388 field_addr.name = "usage";
15389 #endif /* FREECIV_JSON_CONNECTION */
15390
15391 {
15392 int i;
15393
15394 #ifdef FREECIV_JSON_CONNECTION
15395 /* Enter array. */
15396 field_addr.sub_location = plocation_elem_new(0);
15397 #endif /* FREECIV_JSON_CONNECTION */
15398
15399 for (i = 0; i < O_LAST; i++) {
15400 #ifdef FREECIV_JSON_CONNECTION
15401 field_addr.sub_location->number = i;
15402 #endif /* FREECIV_JSON_CONNECTION */
15403 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->usage[i])) {
15404 RECEIVE_PACKET_FIELD_ERROR(usage);
15405 }
15406 }
15407
15408 #ifdef FREECIV_JSON_CONNECTION
15409 /* Exit array. */
15410 free(field_addr.sub_location);
15411 field_addr.sub_location = NULL;
15412 #endif /* FREECIV_JSON_CONNECTION */
15413 }
15414 #ifdef FREECIV_JSON_CONNECTION
15415 field_addr.name = "food_stock";
15416 #endif /* FREECIV_JSON_CONNECTION */
15417 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->food_stock)) {
15418 RECEIVE_PACKET_FIELD_ERROR(food_stock);
15419 }
15420 #ifdef FREECIV_JSON_CONNECTION
15421 field_addr.name = "shield_stock";
15422 #endif /* FREECIV_JSON_CONNECTION */
15423 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
15424 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
15425 }
15426 #ifdef FREECIV_JSON_CONNECTION
15427 field_addr.name = "trade_route_count";
15428 #endif /* FREECIV_JSON_CONNECTION */
15429 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_route_count)) {
15430 RECEIVE_PACKET_FIELD_ERROR(trade_route_count);
15431 }
15432 #ifdef FREECIV_JSON_CONNECTION
15433 field_addr.name = "pollution";
15434 #endif /* FREECIV_JSON_CONNECTION */
15435 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->pollution)) {
15436 RECEIVE_PACKET_FIELD_ERROR(pollution);
15437 }
15438 #ifdef FREECIV_JSON_CONNECTION
15439 field_addr.name = "illness_trade";
15440 #endif /* FREECIV_JSON_CONNECTION */
15441 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade)) {
15442 RECEIVE_PACKET_FIELD_ERROR(illness_trade);
15443 }
15444 #ifdef FREECIV_JSON_CONNECTION
15445 field_addr.name = "production_kind";
15446 #endif /* FREECIV_JSON_CONNECTION */
15447 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
15448 RECEIVE_PACKET_FIELD_ERROR(production_kind);
15449 }
15450 #ifdef FREECIV_JSON_CONNECTION
15451 field_addr.name = "production_value";
15452 #endif /* FREECIV_JSON_CONNECTION */
15453 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
15454 RECEIVE_PACKET_FIELD_ERROR(production_value);
15455 }
15456 #ifdef FREECIV_JSON_CONNECTION
15457 field_addr.name = "turn_founded";
15458 #endif /* FREECIV_JSON_CONNECTION */
15459 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
15460 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
15461 }
15462 #ifdef FREECIV_JSON_CONNECTION
15463 field_addr.name = "turn_last_built";
15464 #endif /* FREECIV_JSON_CONNECTION */
15465 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
15466 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
15467 }
15468 #ifdef FREECIV_JSON_CONNECTION
15469 field_addr.name = "changed_from_kind";
15470 #endif /* FREECIV_JSON_CONNECTION */
15471 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_kind)) {
15472 RECEIVE_PACKET_FIELD_ERROR(changed_from_kind);
15473 }
15474 #ifdef FREECIV_JSON_CONNECTION
15475 field_addr.name = "changed_from_value";
15476 #endif /* FREECIV_JSON_CONNECTION */
15477 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_value)) {
15478 RECEIVE_PACKET_FIELD_ERROR(changed_from_value);
15479 }
15480 #ifdef FREECIV_JSON_CONNECTION
15481 field_addr.name = "before_change_shields";
15482 #endif /* FREECIV_JSON_CONNECTION */
15483 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->before_change_shields)) {
15484 RECEIVE_PACKET_FIELD_ERROR(before_change_shields);
15485 }
15486 #ifdef FREECIV_JSON_CONNECTION
15487 field_addr.name = "disbanded_shields";
15488 #endif /* FREECIV_JSON_CONNECTION */
15489 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disbanded_shields)) {
15490 RECEIVE_PACKET_FIELD_ERROR(disbanded_shields);
15491 }
15492 #ifdef FREECIV_JSON_CONNECTION
15493 field_addr.name = "caravan_shields";
15494 #endif /* FREECIV_JSON_CONNECTION */
15495 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->caravan_shields)) {
15496 RECEIVE_PACKET_FIELD_ERROR(caravan_shields);
15497 }
15498 #ifdef FREECIV_JSON_CONNECTION
15499 field_addr.name = "last_turns_shield_surplus";
15500 #endif /* FREECIV_JSON_CONNECTION */
15501 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->last_turns_shield_surplus)) {
15502 RECEIVE_PACKET_FIELD_ERROR(last_turns_shield_surplus);
15503 }
15504 #ifdef FREECIV_JSON_CONNECTION
15505 field_addr.name = "airlift";
15506 #endif /* FREECIV_JSON_CONNECTION */
15507 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->airlift)) {
15508 RECEIVE_PACKET_FIELD_ERROR(airlift);
15509 }
15510 #ifdef FREECIV_JSON_CONNECTION
15511 field_addr.name = "did_buy";
15512 #endif /* FREECIV_JSON_CONNECTION */
15513 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_buy)) {
15514 RECEIVE_PACKET_FIELD_ERROR(did_buy);
15515 }
15516 #ifdef FREECIV_JSON_CONNECTION
15517 field_addr.name = "did_sell";
15518 #endif /* FREECIV_JSON_CONNECTION */
15519 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_sell)) {
15520 RECEIVE_PACKET_FIELD_ERROR(did_sell);
15521 }
15522 #ifdef FREECIV_JSON_CONNECTION
15523 field_addr.name = "was_happy";
15524 #endif /* FREECIV_JSON_CONNECTION */
15525 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->was_happy)) {
15526 RECEIVE_PACKET_FIELD_ERROR(was_happy);
15527 }
15528 #ifdef FREECIV_JSON_CONNECTION
15529 field_addr.name = "diplomat_investigate";
15530 #endif /* FREECIV_JSON_CONNECTION */
15531 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->diplomat_investigate)) {
15532 RECEIVE_PACKET_FIELD_ERROR(diplomat_investigate);
15533 }
15534 #ifdef FREECIV_JSON_CONNECTION
15535 field_addr.name = "walls";
15536 #endif /* FREECIV_JSON_CONNECTION */
15537 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
15538 RECEIVE_PACKET_FIELD_ERROR(walls);
15539 }
15540 #ifdef FREECIV_JSON_CONNECTION
15541 field_addr.name = "city_image";
15542 #endif /* FREECIV_JSON_CONNECTION */
15543 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
15544 RECEIVE_PACKET_FIELD_ERROR(city_image);
15545 }
15546 #ifdef FREECIV_JSON_CONNECTION
15547 field_addr.name = "steal";
15548 #endif /* FREECIV_JSON_CONNECTION */
15549 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->steal)) {
15550 RECEIVE_PACKET_FIELD_ERROR(steal);
15551 }
15552 #ifdef FREECIV_JSON_CONNECTION
15553 field_addr.name = "worklist";
15554 #endif /* FREECIV_JSON_CONNECTION */
15555 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
15556 RECEIVE_PACKET_FIELD_ERROR(worklist);
15557 }
15558 #ifdef FREECIV_JSON_CONNECTION
15559 field_addr.name = "improvements";
15560 #endif /* FREECIV_JSON_CONNECTION */
15561 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
15562 RECEIVE_PACKET_FIELD_ERROR(improvements);
15563 }
15564 #ifdef FREECIV_JSON_CONNECTION
15565 field_addr.name = "city_options";
15566 #endif /* FREECIV_JSON_CONNECTION */
15567 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
15568 RECEIVE_PACKET_FIELD_ERROR(city_options);
15569 }
15570 #ifdef FREECIV_JSON_CONNECTION
15571 field_addr.name = "name";
15572 #endif /* FREECIV_JSON_CONNECTION */
15573 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
15574 RECEIVE_PACKET_FIELD_ERROR(name);
15575 }
15576
15577#endif
15578 log_packet_detailed("packet_city_info_101: got info about ()");
15579
15580#ifdef FREECIV_DELTA_PROTOCOL
15581 if (NULL == *hash) {
15582 *hash = genhash_new_full(hash_packet_city_info_101, cmp_packet_city_info_101,
15583 NULL, NULL, NULL, free);
15584 }
15585
15586 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
15587 *real_packet = *old;
15588 } else {
15589 log_packet_detailed(" no old info");
15590 memset(real_packet, 0, sizeof(*real_packet));
15591 }
15592
15593 if (BV_ISSET(fields, 0)) {
15594 log_packet_detailed(" got field 'id32'");
15595 #ifdef FREECIV_JSON_CONNECTION
15596 field_addr.name = "id32";
15597 #endif /* FREECIV_JSON_CONNECTION */
15598 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
15599 RECEIVE_PACKET_FIELD_ERROR(id32);
15600 }
15601 }
15602 if (BV_ISSET(fields, 1)) {
15603 log_packet_detailed(" got field 'tile'");
15604 #ifdef FREECIV_JSON_CONNECTION
15605 field_addr.name = "tile";
15606 #endif /* FREECIV_JSON_CONNECTION */
15607 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
15608 RECEIVE_PACKET_FIELD_ERROR(tile);
15609 }
15610 }
15611 if (BV_ISSET(fields, 2)) {
15612 log_packet_detailed(" got field 'owner'");
15613 #ifdef FREECIV_JSON_CONNECTION
15614 field_addr.name = "owner";
15615 #endif /* FREECIV_JSON_CONNECTION */
15616 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
15617 RECEIVE_PACKET_FIELD_ERROR(owner);
15618 }
15619 }
15620 if (BV_ISSET(fields, 3)) {
15621 log_packet_detailed(" got field 'size'");
15622 #ifdef FREECIV_JSON_CONNECTION
15623 field_addr.name = "size";
15624 #endif /* FREECIV_JSON_CONNECTION */
15625 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
15626 RECEIVE_PACKET_FIELD_ERROR(size);
15627 }
15628 }
15629 if (BV_ISSET(fields, 4)) {
15630 log_packet_detailed(" got field 'city_radius_sq'");
15631 #ifdef FREECIV_JSON_CONNECTION
15632 field_addr.name = "city_radius_sq";
15633 #endif /* FREECIV_JSON_CONNECTION */
15634 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_radius_sq)) {
15635 RECEIVE_PACKET_FIELD_ERROR(city_radius_sq);
15636 }
15637 }
15638 if (BV_ISSET(fields, 5)) {
15639 log_packet_detailed(" got field 'style'");
15640 #ifdef FREECIV_JSON_CONNECTION
15641 field_addr.name = "style";
15642 #endif /* FREECIV_JSON_CONNECTION */
15643 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
15644 RECEIVE_PACKET_FIELD_ERROR(style);
15645 }
15646 }
15647 if (BV_ISSET(fields, 6)) {
15648 log_packet_detailed(" got field 'capital'");
15649 #ifdef FREECIV_JSON_CONNECTION
15650 field_addr.name = "capital";
15651 #endif /* FREECIV_JSON_CONNECTION */
15652 {
15653 int readin;
15654
15655 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
15656 RECEIVE_PACKET_FIELD_ERROR(capital);
15657 }
15658 real_packet->capital = readin;
15659 }
15660 }
15661 if (BV_ISSET(fields, 7)) {
15662 log_packet_detailed(" got field 'ppl_happy'");
15663 #ifdef FREECIV_JSON_CONNECTION
15664 field_addr.name = "ppl_happy";
15665 #endif /* FREECIV_JSON_CONNECTION */
15666
15667 {
15668 int i;
15669
15670 #ifdef FREECIV_JSON_CONNECTION
15671 /* Enter array. */
15672 field_addr.sub_location = plocation_elem_new(0);
15673 #endif /* FREECIV_JSON_CONNECTION */
15674
15675 for (i = 0; i < FEELING_LAST; i++) {
15676 #ifdef FREECIV_JSON_CONNECTION
15677 field_addr.sub_location->number = i;
15678 #endif /* FREECIV_JSON_CONNECTION */
15679 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
15680 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
15681 }
15682 }
15683
15684 #ifdef FREECIV_JSON_CONNECTION
15685 /* Exit array. */
15686 free(field_addr.sub_location);
15687 field_addr.sub_location = NULL;
15688 #endif /* FREECIV_JSON_CONNECTION */
15689 }
15690 }
15691 if (BV_ISSET(fields, 8)) {
15692 log_packet_detailed(" got field 'ppl_content'");
15693 #ifdef FREECIV_JSON_CONNECTION
15694 field_addr.name = "ppl_content";
15695 #endif /* FREECIV_JSON_CONNECTION */
15696
15697 {
15698 int i;
15699
15700 #ifdef FREECIV_JSON_CONNECTION
15701 /* Enter array. */
15702 field_addr.sub_location = plocation_elem_new(0);
15703 #endif /* FREECIV_JSON_CONNECTION */
15704
15705 for (i = 0; i < FEELING_LAST; i++) {
15706 #ifdef FREECIV_JSON_CONNECTION
15707 field_addr.sub_location->number = i;
15708 #endif /* FREECIV_JSON_CONNECTION */
15709 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
15710 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
15711 }
15712 }
15713
15714 #ifdef FREECIV_JSON_CONNECTION
15715 /* Exit array. */
15716 free(field_addr.sub_location);
15717 field_addr.sub_location = NULL;
15718 #endif /* FREECIV_JSON_CONNECTION */
15719 }
15720 }
15721 if (BV_ISSET(fields, 9)) {
15722 log_packet_detailed(" got field 'ppl_unhappy'");
15723 #ifdef FREECIV_JSON_CONNECTION
15724 field_addr.name = "ppl_unhappy";
15725 #endif /* FREECIV_JSON_CONNECTION */
15726
15727 {
15728 int i;
15729
15730 #ifdef FREECIV_JSON_CONNECTION
15731 /* Enter array. */
15732 field_addr.sub_location = plocation_elem_new(0);
15733 #endif /* FREECIV_JSON_CONNECTION */
15734
15735 for (i = 0; i < FEELING_LAST; i++) {
15736 #ifdef FREECIV_JSON_CONNECTION
15737 field_addr.sub_location->number = i;
15738 #endif /* FREECIV_JSON_CONNECTION */
15739 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
15740 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
15741 }
15742 }
15743
15744 #ifdef FREECIV_JSON_CONNECTION
15745 /* Exit array. */
15746 free(field_addr.sub_location);
15747 field_addr.sub_location = NULL;
15748 #endif /* FREECIV_JSON_CONNECTION */
15749 }
15750 }
15751 if (BV_ISSET(fields, 10)) {
15752 log_packet_detailed(" got field 'ppl_angry'");
15753 #ifdef FREECIV_JSON_CONNECTION
15754 field_addr.name = "ppl_angry";
15755 #endif /* FREECIV_JSON_CONNECTION */
15756
15757 {
15758 int i;
15759
15760 #ifdef FREECIV_JSON_CONNECTION
15761 /* Enter array. */
15762 field_addr.sub_location = plocation_elem_new(0);
15763 #endif /* FREECIV_JSON_CONNECTION */
15764
15765 for (i = 0; i < FEELING_LAST; i++) {
15766 #ifdef FREECIV_JSON_CONNECTION
15767 field_addr.sub_location->number = i;
15768 #endif /* FREECIV_JSON_CONNECTION */
15769 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
15770 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
15771 }
15772 }
15773
15774 #ifdef FREECIV_JSON_CONNECTION
15775 /* Exit array. */
15776 free(field_addr.sub_location);
15777 field_addr.sub_location = NULL;
15778 #endif /* FREECIV_JSON_CONNECTION */
15779 }
15780 }
15781 if (BV_ISSET(fields, 11)) {
15782 log_packet_detailed(" got field 'specialists_size'");
15783 #ifdef FREECIV_JSON_CONNECTION
15784 field_addr.name = "specialists_size";
15785 #endif /* FREECIV_JSON_CONNECTION */
15786 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
15787 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
15788 }
15789 }
15790 if (BV_ISSET(fields, 12)) {
15791 log_packet_detailed(" got field 'specialists'");
15792 #ifdef FREECIV_JSON_CONNECTION
15793 field_addr.name = "specialists";
15794 #endif /* FREECIV_JSON_CONNECTION */
15795
15796 {
15797 int i;
15798
15799 #ifdef FREECIV_JSON_CONNECTION
15800 /* Enter array. */
15801 field_addr.sub_location = plocation_elem_new(0);
15802 #endif /* FREECIV_JSON_CONNECTION */
15803
15804 if (real_packet->specialists_size > SP_MAX) {
15805 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
15806 }
15807 for (i = 0; i < real_packet->specialists_size; i++) {
15808 #ifdef FREECIV_JSON_CONNECTION
15809 field_addr.sub_location->number = i;
15810 #endif /* FREECIV_JSON_CONNECTION */
15811 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
15812 RECEIVE_PACKET_FIELD_ERROR(specialists);
15813 }
15814 }
15815
15816 #ifdef FREECIV_JSON_CONNECTION
15817 /* Exit array. */
15818 free(field_addr.sub_location);
15819 field_addr.sub_location = NULL;
15820 #endif /* FREECIV_JSON_CONNECTION */
15821 }
15822 }
15823 if (BV_ISSET(fields, 13)) {
15824 log_packet_detailed(" got field 'history'");
15825 #ifdef FREECIV_JSON_CONNECTION
15826 field_addr.name = "history";
15827 #endif /* FREECIV_JSON_CONNECTION */
15828 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
15829 RECEIVE_PACKET_FIELD_ERROR(history);
15830 }
15831 }
15832 if (BV_ISSET(fields, 14)) {
15833 log_packet_detailed(" got field 'culture'");
15834 #ifdef FREECIV_JSON_CONNECTION
15835 field_addr.name = "culture";
15836 #endif /* FREECIV_JSON_CONNECTION */
15837 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
15838 RECEIVE_PACKET_FIELD_ERROR(culture);
15839 }
15840 }
15841 if (BV_ISSET(fields, 15)) {
15842 log_packet_detailed(" got field 'buy_cost'");
15843 #ifdef FREECIV_JSON_CONNECTION
15844 field_addr.name = "buy_cost";
15845 #endif /* FREECIV_JSON_CONNECTION */
15846 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->buy_cost)) {
15847 RECEIVE_PACKET_FIELD_ERROR(buy_cost);
15848 }
15849 }
15850 if (BV_ISSET(fields, 16)) {
15851 log_packet_detailed(" got field 'surplus'");
15852 #ifdef FREECIV_JSON_CONNECTION
15853 field_addr.name = "surplus";
15854 #endif /* FREECIV_JSON_CONNECTION */
15855
15856 {
15857 int i;
15858
15859 #ifdef FREECIV_JSON_CONNECTION
15860 /* Enter array. */
15861 field_addr.sub_location = plocation_elem_new(0);
15862 #endif /* FREECIV_JSON_CONNECTION */
15863
15864 for (i = 0; i < O_LAST; i++) {
15865 #ifdef FREECIV_JSON_CONNECTION
15866 field_addr.sub_location->number = i;
15867 #endif /* FREECIV_JSON_CONNECTION */
15868 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->surplus[i])) {
15869 RECEIVE_PACKET_FIELD_ERROR(surplus);
15870 }
15871 }
15872
15873 #ifdef FREECIV_JSON_CONNECTION
15874 /* Exit array. */
15875 free(field_addr.sub_location);
15876 field_addr.sub_location = NULL;
15877 #endif /* FREECIV_JSON_CONNECTION */
15878 }
15879 }
15880 if (BV_ISSET(fields, 17)) {
15881 log_packet_detailed(" got field 'waste'");
15882 #ifdef FREECIV_JSON_CONNECTION
15883 field_addr.name = "waste";
15884 #endif /* FREECIV_JSON_CONNECTION */
15885
15886 {
15887 int i;
15888
15889 #ifdef FREECIV_JSON_CONNECTION
15890 /* Enter array. */
15891 field_addr.sub_location = plocation_elem_new(0);
15892 #endif /* FREECIV_JSON_CONNECTION */
15893
15894 for (i = 0; i < O_LAST; i++) {
15895 #ifdef FREECIV_JSON_CONNECTION
15896 field_addr.sub_location->number = i;
15897 #endif /* FREECIV_JSON_CONNECTION */
15898 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->waste[i])) {
15899 RECEIVE_PACKET_FIELD_ERROR(waste);
15900 }
15901 }
15902
15903 #ifdef FREECIV_JSON_CONNECTION
15904 /* Exit array. */
15905 free(field_addr.sub_location);
15906 field_addr.sub_location = NULL;
15907 #endif /* FREECIV_JSON_CONNECTION */
15908 }
15909 }
15910 if (BV_ISSET(fields, 18)) {
15911 log_packet_detailed(" got field 'unhappy_penalty'");
15912 #ifdef FREECIV_JSON_CONNECTION
15913 field_addr.name = "unhappy_penalty";
15914 #endif /* FREECIV_JSON_CONNECTION */
15915
15916 {
15917 int i;
15918
15919 #ifdef FREECIV_JSON_CONNECTION
15920 /* Enter array. */
15921 field_addr.sub_location = plocation_elem_new(0);
15922 #endif /* FREECIV_JSON_CONNECTION */
15923
15924 for (i = 0; i < O_LAST; i++) {
15925 #ifdef FREECIV_JSON_CONNECTION
15926 field_addr.sub_location->number = i;
15927 #endif /* FREECIV_JSON_CONNECTION */
15928 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->unhappy_penalty[i])) {
15929 RECEIVE_PACKET_FIELD_ERROR(unhappy_penalty);
15930 }
15931 }
15932
15933 #ifdef FREECIV_JSON_CONNECTION
15934 /* Exit array. */
15935 free(field_addr.sub_location);
15936 field_addr.sub_location = NULL;
15937 #endif /* FREECIV_JSON_CONNECTION */
15938 }
15939 }
15940 if (BV_ISSET(fields, 19)) {
15941 log_packet_detailed(" got field 'prod'");
15942 #ifdef FREECIV_JSON_CONNECTION
15943 field_addr.name = "prod";
15944 #endif /* FREECIV_JSON_CONNECTION */
15945
15946 {
15947 int i;
15948
15949 #ifdef FREECIV_JSON_CONNECTION
15950 /* Enter array. */
15951 field_addr.sub_location = plocation_elem_new(0);
15952 #endif /* FREECIV_JSON_CONNECTION */
15953
15954 for (i = 0; i < O_LAST; i++) {
15955 #ifdef FREECIV_JSON_CONNECTION
15956 field_addr.sub_location->number = i;
15957 #endif /* FREECIV_JSON_CONNECTION */
15958 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->prod[i])) {
15959 RECEIVE_PACKET_FIELD_ERROR(prod);
15960 }
15961 }
15962
15963 #ifdef FREECIV_JSON_CONNECTION
15964 /* Exit array. */
15965 free(field_addr.sub_location);
15966 field_addr.sub_location = NULL;
15967 #endif /* FREECIV_JSON_CONNECTION */
15968 }
15969 }
15970 if (BV_ISSET(fields, 20)) {
15971 log_packet_detailed(" got field 'citizen_base'");
15972 #ifdef FREECIV_JSON_CONNECTION
15973 field_addr.name = "citizen_base";
15974 #endif /* FREECIV_JSON_CONNECTION */
15975
15976 {
15977 int i;
15978
15979 #ifdef FREECIV_JSON_CONNECTION
15980 /* Enter array. */
15981 field_addr.sub_location = plocation_elem_new(0);
15982 #endif /* FREECIV_JSON_CONNECTION */
15983
15984 for (i = 0; i < O_LAST; i++) {
15985 #ifdef FREECIV_JSON_CONNECTION
15986 field_addr.sub_location->number = i;
15987 #endif /* FREECIV_JSON_CONNECTION */
15988 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->citizen_base[i])) {
15989 RECEIVE_PACKET_FIELD_ERROR(citizen_base);
15990 }
15991 }
15992
15993 #ifdef FREECIV_JSON_CONNECTION
15994 /* Exit array. */
15995 free(field_addr.sub_location);
15996 field_addr.sub_location = NULL;
15997 #endif /* FREECIV_JSON_CONNECTION */
15998 }
15999 }
16000 if (BV_ISSET(fields, 21)) {
16001 log_packet_detailed(" got field 'usage'");
16002 #ifdef FREECIV_JSON_CONNECTION
16003 field_addr.name = "usage";
16004 #endif /* FREECIV_JSON_CONNECTION */
16005
16006 {
16007 int i;
16008
16009 #ifdef FREECIV_JSON_CONNECTION
16010 /* Enter array. */
16011 field_addr.sub_location = plocation_elem_new(0);
16012 #endif /* FREECIV_JSON_CONNECTION */
16013
16014 for (i = 0; i < O_LAST; i++) {
16015 #ifdef FREECIV_JSON_CONNECTION
16016 field_addr.sub_location->number = i;
16017 #endif /* FREECIV_JSON_CONNECTION */
16018 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->usage[i])) {
16019 RECEIVE_PACKET_FIELD_ERROR(usage);
16020 }
16021 }
16022
16023 #ifdef FREECIV_JSON_CONNECTION
16024 /* Exit array. */
16025 free(field_addr.sub_location);
16026 field_addr.sub_location = NULL;
16027 #endif /* FREECIV_JSON_CONNECTION */
16028 }
16029 }
16030 if (BV_ISSET(fields, 22)) {
16031 log_packet_detailed(" got field 'food_stock'");
16032 #ifdef FREECIV_JSON_CONNECTION
16033 field_addr.name = "food_stock";
16034 #endif /* FREECIV_JSON_CONNECTION */
16035 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->food_stock)) {
16036 RECEIVE_PACKET_FIELD_ERROR(food_stock);
16037 }
16038 }
16039 if (BV_ISSET(fields, 23)) {
16040 log_packet_detailed(" got field 'shield_stock'");
16041 #ifdef FREECIV_JSON_CONNECTION
16042 field_addr.name = "shield_stock";
16043 #endif /* FREECIV_JSON_CONNECTION */
16044 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
16045 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
16046 }
16047 }
16048 if (BV_ISSET(fields, 24)) {
16049 log_packet_detailed(" got field 'trade_route_count'");
16050 #ifdef FREECIV_JSON_CONNECTION
16051 field_addr.name = "trade_route_count";
16052 #endif /* FREECIV_JSON_CONNECTION */
16053 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_route_count)) {
16054 RECEIVE_PACKET_FIELD_ERROR(trade_route_count);
16055 }
16056 }
16057 if (BV_ISSET(fields, 25)) {
16058 log_packet_detailed(" got field 'pollution'");
16059 #ifdef FREECIV_JSON_CONNECTION
16060 field_addr.name = "pollution";
16061 #endif /* FREECIV_JSON_CONNECTION */
16062 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->pollution)) {
16063 RECEIVE_PACKET_FIELD_ERROR(pollution);
16064 }
16065 }
16066 if (BV_ISSET(fields, 26)) {
16067 log_packet_detailed(" got field 'illness_trade'");
16068 #ifdef FREECIV_JSON_CONNECTION
16069 field_addr.name = "illness_trade";
16070 #endif /* FREECIV_JSON_CONNECTION */
16071 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade)) {
16072 RECEIVE_PACKET_FIELD_ERROR(illness_trade);
16073 }
16074 }
16075 if (BV_ISSET(fields, 27)) {
16076 log_packet_detailed(" got field 'production_kind'");
16077 #ifdef FREECIV_JSON_CONNECTION
16078 field_addr.name = "production_kind";
16079 #endif /* FREECIV_JSON_CONNECTION */
16080 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
16081 RECEIVE_PACKET_FIELD_ERROR(production_kind);
16082 }
16083 }
16084 if (BV_ISSET(fields, 28)) {
16085 log_packet_detailed(" got field 'production_value'");
16086 #ifdef FREECIV_JSON_CONNECTION
16087 field_addr.name = "production_value";
16088 #endif /* FREECIV_JSON_CONNECTION */
16089 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
16090 RECEIVE_PACKET_FIELD_ERROR(production_value);
16091 }
16092 }
16093 if (BV_ISSET(fields, 29)) {
16094 log_packet_detailed(" got field 'turn_founded'");
16095 #ifdef FREECIV_JSON_CONNECTION
16096 field_addr.name = "turn_founded";
16097 #endif /* FREECIV_JSON_CONNECTION */
16098 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
16099 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
16100 }
16101 }
16102 if (BV_ISSET(fields, 30)) {
16103 log_packet_detailed(" got field 'turn_last_built'");
16104 #ifdef FREECIV_JSON_CONNECTION
16105 field_addr.name = "turn_last_built";
16106 #endif /* FREECIV_JSON_CONNECTION */
16107 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
16108 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
16109 }
16110 }
16111 if (BV_ISSET(fields, 31)) {
16112 log_packet_detailed(" got field 'changed_from_kind'");
16113 #ifdef FREECIV_JSON_CONNECTION
16114 field_addr.name = "changed_from_kind";
16115 #endif /* FREECIV_JSON_CONNECTION */
16116 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_kind)) {
16117 RECEIVE_PACKET_FIELD_ERROR(changed_from_kind);
16118 }
16119 }
16120 if (BV_ISSET(fields, 32)) {
16121 log_packet_detailed(" got field 'changed_from_value'");
16122 #ifdef FREECIV_JSON_CONNECTION
16123 field_addr.name = "changed_from_value";
16124 #endif /* FREECIV_JSON_CONNECTION */
16125 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_value)) {
16126 RECEIVE_PACKET_FIELD_ERROR(changed_from_value);
16127 }
16128 }
16129 if (BV_ISSET(fields, 33)) {
16130 log_packet_detailed(" got field 'before_change_shields'");
16131 #ifdef FREECIV_JSON_CONNECTION
16132 field_addr.name = "before_change_shields";
16133 #endif /* FREECIV_JSON_CONNECTION */
16134 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->before_change_shields)) {
16135 RECEIVE_PACKET_FIELD_ERROR(before_change_shields);
16136 }
16137 }
16138 if (BV_ISSET(fields, 34)) {
16139 log_packet_detailed(" got field 'disbanded_shields'");
16140 #ifdef FREECIV_JSON_CONNECTION
16141 field_addr.name = "disbanded_shields";
16142 #endif /* FREECIV_JSON_CONNECTION */
16143 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disbanded_shields)) {
16144 RECEIVE_PACKET_FIELD_ERROR(disbanded_shields);
16145 }
16146 }
16147 if (BV_ISSET(fields, 35)) {
16148 log_packet_detailed(" got field 'caravan_shields'");
16149 #ifdef FREECIV_JSON_CONNECTION
16150 field_addr.name = "caravan_shields";
16151 #endif /* FREECIV_JSON_CONNECTION */
16152 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->caravan_shields)) {
16153 RECEIVE_PACKET_FIELD_ERROR(caravan_shields);
16154 }
16155 }
16156 if (BV_ISSET(fields, 36)) {
16157 log_packet_detailed(" got field 'last_turns_shield_surplus'");
16158 #ifdef FREECIV_JSON_CONNECTION
16159 field_addr.name = "last_turns_shield_surplus";
16160 #endif /* FREECIV_JSON_CONNECTION */
16161 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->last_turns_shield_surplus)) {
16162 RECEIVE_PACKET_FIELD_ERROR(last_turns_shield_surplus);
16163 }
16164 }
16165 if (BV_ISSET(fields, 37)) {
16166 log_packet_detailed(" got field 'airlift'");
16167 #ifdef FREECIV_JSON_CONNECTION
16168 field_addr.name = "airlift";
16169 #endif /* FREECIV_JSON_CONNECTION */
16170 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->airlift)) {
16171 RECEIVE_PACKET_FIELD_ERROR(airlift);
16172 }
16173 }
16174 real_packet->did_buy = BV_ISSET(fields, 38);
16175 real_packet->did_sell = BV_ISSET(fields, 39);
16176 real_packet->was_happy = BV_ISSET(fields, 40);
16177 real_packet->diplomat_investigate = BV_ISSET(fields, 41);
16178 if (BV_ISSET(fields, 42)) {
16179 log_packet_detailed(" got field 'walls'");
16180 #ifdef FREECIV_JSON_CONNECTION
16181 field_addr.name = "walls";
16182 #endif /* FREECIV_JSON_CONNECTION */
16183 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
16184 RECEIVE_PACKET_FIELD_ERROR(walls);
16185 }
16186 }
16187 if (BV_ISSET(fields, 43)) {
16188 log_packet_detailed(" got field 'city_image'");
16189 #ifdef FREECIV_JSON_CONNECTION
16190 field_addr.name = "city_image";
16191 #endif /* FREECIV_JSON_CONNECTION */
16192 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
16193 RECEIVE_PACKET_FIELD_ERROR(city_image);
16194 }
16195 }
16196 if (BV_ISSET(fields, 44)) {
16197 log_packet_detailed(" got field 'steal'");
16198 #ifdef FREECIV_JSON_CONNECTION
16199 field_addr.name = "steal";
16200 #endif /* FREECIV_JSON_CONNECTION */
16201 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->steal)) {
16202 RECEIVE_PACKET_FIELD_ERROR(steal);
16203 }
16204 }
16205 if (BV_ISSET(fields, 45)) {
16206 log_packet_detailed(" got field 'worklist'");
16207 #ifdef FREECIV_JSON_CONNECTION
16208 field_addr.name = "worklist";
16209 #endif /* FREECIV_JSON_CONNECTION */
16210 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
16211 RECEIVE_PACKET_FIELD_ERROR(worklist);
16212 }
16213 }
16214 if (BV_ISSET(fields, 46)) {
16215 log_packet_detailed(" got field 'improvements'");
16216 #ifdef FREECIV_JSON_CONNECTION
16217 field_addr.name = "improvements";
16218 #endif /* FREECIV_JSON_CONNECTION */
16219 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
16220 RECEIVE_PACKET_FIELD_ERROR(improvements);
16221 }
16222 }
16223 if (BV_ISSET(fields, 47)) {
16224 log_packet_detailed(" got field 'city_options'");
16225 #ifdef FREECIV_JSON_CONNECTION
16226 field_addr.name = "city_options";
16227 #endif /* FREECIV_JSON_CONNECTION */
16228 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
16229 RECEIVE_PACKET_FIELD_ERROR(city_options);
16230 }
16231 }
16232 if (BV_ISSET(fields, 48)) {
16233 log_packet_detailed(" got field 'name'");
16234 #ifdef FREECIV_JSON_CONNECTION
16235 field_addr.name = "name";
16236 #endif /* FREECIV_JSON_CONNECTION */
16237 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
16238 RECEIVE_PACKET_FIELD_ERROR(name);
16239 }
16240 }
16241
16242 if (NULL == old) {
16243 old = fc_malloc(sizeof(*old));
16244 *old = *real_packet;
16245 genhash_insert(*hash, old, old);
16246 } else {
16247 *old = *real_packet;
16248 }
16249
16250 hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
16251 if (NULL != *hash) {
16252 genhash_remove(*hash, real_packet);
16253 }
16254
16255#endif /* FREECIV_DELTA_PROTOCOL */
16256 RECEIVE_PACKET_END(real_packet);
16257}
16258
16259 static int send_packet_city_info_101(struct connection *pc, const struct packet_city_info *packet, bool force_to_send)
16260{
16261 const struct packet_city_info *real_packet = packet;
16262#ifdef FREECIV_DELTA_PROTOCOL
16263 packet_city_info_101_fields fields;
16264 struct packet_city_info *old;
16265 bool differ;
16266 struct genhash **hash = pc->phs.sent + PACKET_CITY_INFO;
16267 int different = force_to_send;
16268#endif /* FREECIV_DELTA_PROTOCOL */
16269 SEND_PACKET_START(PACKET_CITY_INFO);
16270#ifdef FREECIV_JSON_CONNECTION
16271 struct plocation field_addr;
16272 {
16273 struct plocation *field_addr_tmp = plocation_field_new(NULL);
16274 field_addr = *field_addr_tmp;
16275 FC_FREE(field_addr_tmp);
16276 }
16277#endif /* FREECIV_JSON_CONNECTION */
16278
16279 log_packet_detailed("packet_city_info_101: sending info about ()");
16280
16281#ifdef FREECIV_DELTA_PROTOCOL
16282 if (NULL == *hash) {
16283 *hash = genhash_new_full(hash_packet_city_info_101, cmp_packet_city_info_101,
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->id32 != real_packet->id32);
16296 if (differ) {
16297 different++;
16298 BV_SET(fields, 0);
16299 }
16300
16301 differ = (old->tile != real_packet->tile);
16302 if (differ) {
16303 different++;
16304 BV_SET(fields, 1);
16305 }
16306
16307 differ = (old->owner != real_packet->owner);
16308 if (differ) {
16309 different++;
16310 BV_SET(fields, 2);
16311 }
16312
16313 differ = (old->size != real_packet->size);
16314 if (differ) {
16315 different++;
16316 BV_SET(fields, 3);
16317 }
16318
16319 differ = (old->city_radius_sq != real_packet->city_radius_sq);
16320 if (differ) {
16321 different++;
16322 BV_SET(fields, 4);
16323 }
16324
16325 differ = (old->style != real_packet->style);
16326 if (differ) {
16327 different++;
16328 BV_SET(fields, 5);
16329 }
16330
16331 differ = (old->capital != real_packet->capital);
16332 if (differ) {
16333 different++;
16334 BV_SET(fields, 6);
16335 }
16336
16337
16338 {
16339 differ = FALSE;
16340 {
16341 int i;
16342
16343 for (i = 0; i < FEELING_LAST; i++) {
16344 if (old->ppl_happy[i] != real_packet->ppl_happy[i]) {
16345 differ = TRUE;
16346 break;
16347 }
16348 }
16349 }
16350 }
16351 if (differ) {
16352 different++;
16353 BV_SET(fields, 7);
16354 }
16355
16356
16357 {
16358 differ = FALSE;
16359 {
16360 int i;
16361
16362 for (i = 0; i < FEELING_LAST; i++) {
16363 if (old->ppl_content[i] != real_packet->ppl_content[i]) {
16364 differ = TRUE;
16365 break;
16366 }
16367 }
16368 }
16369 }
16370 if (differ) {
16371 different++;
16372 BV_SET(fields, 8);
16373 }
16374
16375
16376 {
16377 differ = FALSE;
16378 {
16379 int i;
16380
16381 for (i = 0; i < FEELING_LAST; i++) {
16382 if (old->ppl_unhappy[i] != real_packet->ppl_unhappy[i]) {
16383 differ = TRUE;
16384 break;
16385 }
16386 }
16387 }
16388 }
16389 if (differ) {
16390 different++;
16391 BV_SET(fields, 9);
16392 }
16393
16394
16395 {
16396 differ = FALSE;
16397 {
16398 int i;
16399
16400 for (i = 0; i < FEELING_LAST; i++) {
16401 if (old->ppl_angry[i] != real_packet->ppl_angry[i]) {
16402 differ = TRUE;
16403 break;
16404 }
16405 }
16406 }
16407 }
16408 if (differ) {
16409 different++;
16410 BV_SET(fields, 10);
16411 }
16412
16413 differ = (old->specialists_size != real_packet->specialists_size);
16414 if (differ) {
16415 different++;
16416 BV_SET(fields, 11);
16417 }
16418
16419
16420 {
16421 differ = (old->specialists_size != real_packet->specialists_size);
16422 if (!differ) {
16423 int i;
16424
16425 for (i = 0; i < real_packet->specialists_size; i++) {
16426 if (old->specialists[i] != real_packet->specialists[i]) {
16427 differ = TRUE;
16428 break;
16429 }
16430 }
16431 }
16432 }
16433 if (differ) {
16434 different++;
16435 BV_SET(fields, 12);
16436 }
16437
16438 differ = (old->history != real_packet->history);
16439 if (differ) {
16440 different++;
16441 BV_SET(fields, 13);
16442 }
16443
16444 differ = (old->culture != real_packet->culture);
16445 if (differ) {
16446 different++;
16447 BV_SET(fields, 14);
16448 }
16449
16450 differ = (old->buy_cost != real_packet->buy_cost);
16451 if (differ) {
16452 different++;
16453 BV_SET(fields, 15);
16454 }
16455
16456
16457 {
16458 differ = FALSE;
16459 {
16460 int i;
16461
16462 for (i = 0; i < O_LAST; i++) {
16463 if (old->surplus[i] != real_packet->surplus[i]) {
16464 differ = TRUE;
16465 break;
16466 }
16467 }
16468 }
16469 }
16470 if (differ) {
16471 different++;
16472 BV_SET(fields, 16);
16473 }
16474
16475
16476 {
16477 differ = FALSE;
16478 {
16479 int i;
16480
16481 for (i = 0; i < O_LAST; i++) {
16482 if (old->waste[i] != real_packet->waste[i]) {
16483 differ = TRUE;
16484 break;
16485 }
16486 }
16487 }
16488 }
16489 if (differ) {
16490 different++;
16491 BV_SET(fields, 17);
16492 }
16493
16494
16495 {
16496 differ = FALSE;
16497 {
16498 int i;
16499
16500 for (i = 0; i < O_LAST; i++) {
16501 if (old->unhappy_penalty[i] != real_packet->unhappy_penalty[i]) {
16502 differ = TRUE;
16503 break;
16504 }
16505 }
16506 }
16507 }
16508 if (differ) {
16509 different++;
16510 BV_SET(fields, 18);
16511 }
16512
16513
16514 {
16515 differ = FALSE;
16516 {
16517 int i;
16518
16519 for (i = 0; i < O_LAST; i++) {
16520 if (old->prod[i] != real_packet->prod[i]) {
16521 differ = TRUE;
16522 break;
16523 }
16524 }
16525 }
16526 }
16527 if (differ) {
16528 different++;
16529 BV_SET(fields, 19);
16530 }
16531
16532
16533 {
16534 differ = FALSE;
16535 {
16536 int i;
16537
16538 for (i = 0; i < O_LAST; i++) {
16539 if (old->citizen_base[i] != real_packet->citizen_base[i]) {
16540 differ = TRUE;
16541 break;
16542 }
16543 }
16544 }
16545 }
16546 if (differ) {
16547 different++;
16548 BV_SET(fields, 20);
16549 }
16550
16551
16552 {
16553 differ = FALSE;
16554 {
16555 int i;
16556
16557 for (i = 0; i < O_LAST; i++) {
16558 if (old->usage[i] != real_packet->usage[i]) {
16559 differ = TRUE;
16560 break;
16561 }
16562 }
16563 }
16564 }
16565 if (differ) {
16566 different++;
16567 BV_SET(fields, 21);
16568 }
16569
16570 differ = (old->food_stock != real_packet->food_stock);
16571 if (differ) {
16572 different++;
16573 BV_SET(fields, 22);
16574 }
16575
16576 differ = (old->shield_stock != real_packet->shield_stock);
16577 if (differ) {
16578 different++;
16579 BV_SET(fields, 23);
16580 }
16581
16582 differ = (old->trade_route_count != real_packet->trade_route_count);
16583 if (differ) {
16584 different++;
16585 BV_SET(fields, 24);
16586 }
16587
16588 differ = (old->pollution != real_packet->pollution);
16589 if (differ) {
16590 different++;
16591 BV_SET(fields, 25);
16592 }
16593
16594 differ = (old->illness_trade != real_packet->illness_trade);
16595 if (differ) {
16596 different++;
16597 BV_SET(fields, 26);
16598 }
16599
16600 differ = (old->production_kind != real_packet->production_kind);
16601 if (differ) {
16602 different++;
16603 BV_SET(fields, 27);
16604 }
16605
16606 differ = (old->production_value != real_packet->production_value);
16607 if (differ) {
16608 different++;
16609 BV_SET(fields, 28);
16610 }
16611
16612 differ = (old->turn_founded != real_packet->turn_founded);
16613 if (differ) {
16614 different++;
16615 BV_SET(fields, 29);
16616 }
16617
16618 differ = (old->turn_last_built != real_packet->turn_last_built);
16619 if (differ) {
16620 different++;
16621 BV_SET(fields, 30);
16622 }
16623
16624 differ = (old->changed_from_kind != real_packet->changed_from_kind);
16625 if (differ) {
16626 different++;
16627 BV_SET(fields, 31);
16628 }
16629
16630 differ = (old->changed_from_value != real_packet->changed_from_value);
16631 if (differ) {
16632 different++;
16633 BV_SET(fields, 32);
16634 }
16635
16636 differ = (old->before_change_shields != real_packet->before_change_shields);
16637 if (differ) {
16638 different++;
16639 BV_SET(fields, 33);
16640 }
16641
16642 differ = (old->disbanded_shields != real_packet->disbanded_shields);
16643 if (differ) {
16644 different++;
16645 BV_SET(fields, 34);
16646 }
16647
16648 differ = (old->caravan_shields != real_packet->caravan_shields);
16649 if (differ) {
16650 different++;
16651 BV_SET(fields, 35);
16652 }
16653
16654 differ = (old->last_turns_shield_surplus != real_packet->last_turns_shield_surplus);
16655 if (differ) {
16656 different++;
16657 BV_SET(fields, 36);
16658 }
16659
16660 differ = (old->airlift != real_packet->airlift);
16661 if (differ) {
16662 different++;
16663 BV_SET(fields, 37);
16664 }
16665
16666 differ = (old->did_buy != real_packet->did_buy);
16667 if (differ) {
16668 different++;
16669 }
16670 if (packet->did_buy) {
16671 BV_SET(fields, 38);
16672 }
16673
16674 differ = (old->did_sell != real_packet->did_sell);
16675 if (differ) {
16676 different++;
16677 }
16678 if (packet->did_sell) {
16679 BV_SET(fields, 39);
16680 }
16681
16682 differ = (old->was_happy != real_packet->was_happy);
16683 if (differ) {
16684 different++;
16685 }
16686 if (packet->was_happy) {
16687 BV_SET(fields, 40);
16688 }
16689
16690 differ = (old->diplomat_investigate != real_packet->diplomat_investigate);
16691 if (differ) {
16692 different++;
16693 }
16694 if (packet->diplomat_investigate) {
16695 BV_SET(fields, 41);
16696 }
16697
16698 differ = (old->walls != real_packet->walls);
16699 if (differ) {
16700 different++;
16701 BV_SET(fields, 42);
16702 }
16703
16704 differ = (old->city_image != real_packet->city_image);
16705 if (differ) {
16706 different++;
16707 BV_SET(fields, 43);
16708 }
16709
16710 differ = (old->steal != real_packet->steal);
16711 if (differ) {
16712 different++;
16713 BV_SET(fields, 44);
16714 }
16715
16716 differ = !are_worklists_equal(&old->worklist, &real_packet->worklist);
16717 if (differ) {
16718 different++;
16719 BV_SET(fields, 45);
16720 }
16721
16722 differ = !BV_ARE_EQUAL(old->improvements, real_packet->improvements);
16723 if (differ) {
16724 different++;
16725 BV_SET(fields, 46);
16726 }
16727
16728 differ = !BV_ARE_EQUAL(old->city_options, real_packet->city_options);
16729 if (differ) {
16730 different++;
16731 BV_SET(fields, 47);
16732 }
16733
16734 differ = (strcmp(old->name, real_packet->name) != 0);
16735 if (differ) {
16736 different++;
16737 BV_SET(fields, 48);
16738 }
16739
16740
16741 if (different == 0) {
16742 log_packet_detailed(" no change -> discard");
16743 return 0;
16744 }
16745
16746#ifdef FREECIV_JSON_CONNECTION
16747 field_addr.name = "fields";
16748#endif /* FREECIV_JSON_CONNECTION */
16749 DIO_BV_PUT(&dout, &field_addr, fields);
16750
16751 if (BV_ISSET(fields, 0)) {
16752 log_packet_detailed(" field 'id32' has changed");
16753 #ifdef FREECIV_JSON_CONNECTION
16754 field_addr.name = "id32";
16755#endif /* FREECIV_JSON_CONNECTION */
16756 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
16757 }
16758 if (BV_ISSET(fields, 1)) {
16759 log_packet_detailed(" field 'tile' has changed");
16760 #ifdef FREECIV_JSON_CONNECTION
16761 field_addr.name = "tile";
16762#endif /* FREECIV_JSON_CONNECTION */
16763 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
16764 }
16765 if (BV_ISSET(fields, 2)) {
16766 log_packet_detailed(" field 'owner' has changed");
16767 #ifdef FREECIV_JSON_CONNECTION
16768 field_addr.name = "owner";
16769#endif /* FREECIV_JSON_CONNECTION */
16770 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
16771 }
16772 if (BV_ISSET(fields, 3)) {
16773 log_packet_detailed(" field 'size' has changed");
16774 #ifdef FREECIV_JSON_CONNECTION
16775 field_addr.name = "size";
16776#endif /* FREECIV_JSON_CONNECTION */
16777 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
16778 }
16779 if (BV_ISSET(fields, 4)) {
16780 log_packet_detailed(" field 'city_radius_sq' has changed");
16781 #ifdef FREECIV_JSON_CONNECTION
16782 field_addr.name = "city_radius_sq";
16783#endif /* FREECIV_JSON_CONNECTION */
16784 DIO_PUT(uint8, &dout, &field_addr, real_packet->city_radius_sq);
16785 }
16786 if (BV_ISSET(fields, 5)) {
16787 log_packet_detailed(" field 'style' has changed");
16788 #ifdef FREECIV_JSON_CONNECTION
16789 field_addr.name = "style";
16790#endif /* FREECIV_JSON_CONNECTION */
16791 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
16792 }
16793 if (BV_ISSET(fields, 6)) {
16794 log_packet_detailed(" field 'capital' has changed");
16795 #ifdef FREECIV_JSON_CONNECTION
16796 field_addr.name = "capital";
16797#endif /* FREECIV_JSON_CONNECTION */
16798 DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
16799 }
16800 if (BV_ISSET(fields, 7)) {
16801 log_packet_detailed(" field 'ppl_happy' has changed");
16802 #ifdef FREECIV_JSON_CONNECTION
16803 field_addr.name = "ppl_happy";
16804#endif /* FREECIV_JSON_CONNECTION */
16805
16806 {
16807 int i;
16808
16809#ifdef FREECIV_JSON_CONNECTION
16810 /* Create the array. */
16811 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
16812
16813 /* Enter the array. */
16814 field_addr.sub_location = plocation_elem_new(0);
16815#endif /* FREECIV_JSON_CONNECTION */
16816
16817 for (i = 0; i < FEELING_LAST; i++) {
16818#ifdef FREECIV_JSON_CONNECTION
16819 /* Next array element. */
16820 field_addr.sub_location->number = i;
16821#endif /* FREECIV_JSON_CONNECTION */
16822 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
16823 }
16824
16825#ifdef FREECIV_JSON_CONNECTION
16826 /* Exit array. */
16827 free(field_addr.sub_location);
16828 field_addr.sub_location = NULL;
16829#endif /* FREECIV_JSON_CONNECTION */
16830 }
16831 }
16832 if (BV_ISSET(fields, 8)) {
16833 log_packet_detailed(" field 'ppl_content' has changed");
16834 #ifdef FREECIV_JSON_CONNECTION
16835 field_addr.name = "ppl_content";
16836#endif /* FREECIV_JSON_CONNECTION */
16837
16838 {
16839 int i;
16840
16841#ifdef FREECIV_JSON_CONNECTION
16842 /* Create the array. */
16843 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
16844
16845 /* Enter the array. */
16846 field_addr.sub_location = plocation_elem_new(0);
16847#endif /* FREECIV_JSON_CONNECTION */
16848
16849 for (i = 0; i < FEELING_LAST; i++) {
16850#ifdef FREECIV_JSON_CONNECTION
16851 /* Next array element. */
16852 field_addr.sub_location->number = i;
16853#endif /* FREECIV_JSON_CONNECTION */
16854 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
16855 }
16856
16857#ifdef FREECIV_JSON_CONNECTION
16858 /* Exit array. */
16859 free(field_addr.sub_location);
16860 field_addr.sub_location = NULL;
16861#endif /* FREECIV_JSON_CONNECTION */
16862 }
16863 }
16864 if (BV_ISSET(fields, 9)) {
16865 log_packet_detailed(" field 'ppl_unhappy' has changed");
16866 #ifdef FREECIV_JSON_CONNECTION
16867 field_addr.name = "ppl_unhappy";
16868#endif /* FREECIV_JSON_CONNECTION */
16869
16870 {
16871 int i;
16872
16873#ifdef FREECIV_JSON_CONNECTION
16874 /* Create the array. */
16875 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
16876
16877 /* Enter the array. */
16878 field_addr.sub_location = plocation_elem_new(0);
16879#endif /* FREECIV_JSON_CONNECTION */
16880
16881 for (i = 0; i < FEELING_LAST; i++) {
16882#ifdef FREECIV_JSON_CONNECTION
16883 /* Next array element. */
16884 field_addr.sub_location->number = i;
16885#endif /* FREECIV_JSON_CONNECTION */
16886 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
16887 }
16888
16889#ifdef FREECIV_JSON_CONNECTION
16890 /* Exit array. */
16891 free(field_addr.sub_location);
16892 field_addr.sub_location = NULL;
16893#endif /* FREECIV_JSON_CONNECTION */
16894 }
16895 }
16896 if (BV_ISSET(fields, 10)) {
16897 log_packet_detailed(" field 'ppl_angry' has changed");
16898 #ifdef FREECIV_JSON_CONNECTION
16899 field_addr.name = "ppl_angry";
16900#endif /* FREECIV_JSON_CONNECTION */
16901
16902 {
16903 int i;
16904
16905#ifdef FREECIV_JSON_CONNECTION
16906 /* Create the array. */
16907 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
16908
16909 /* Enter the array. */
16910 field_addr.sub_location = plocation_elem_new(0);
16911#endif /* FREECIV_JSON_CONNECTION */
16912
16913 for (i = 0; i < FEELING_LAST; i++) {
16914#ifdef FREECIV_JSON_CONNECTION
16915 /* Next array element. */
16916 field_addr.sub_location->number = i;
16917#endif /* FREECIV_JSON_CONNECTION */
16918 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
16919 }
16920
16921#ifdef FREECIV_JSON_CONNECTION
16922 /* Exit array. */
16923 free(field_addr.sub_location);
16924 field_addr.sub_location = NULL;
16925#endif /* FREECIV_JSON_CONNECTION */
16926 }
16927 }
16928 if (BV_ISSET(fields, 11)) {
16929 log_packet_detailed(" field 'specialists_size' has changed");
16930 #ifdef FREECIV_JSON_CONNECTION
16931 field_addr.name = "specialists_size";
16932#endif /* FREECIV_JSON_CONNECTION */
16933 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
16934 }
16935 if (BV_ISSET(fields, 12)) {
16936 log_packet_detailed(" field 'specialists' has changed");
16937 #ifdef FREECIV_JSON_CONNECTION
16938 field_addr.name = "specialists";
16939#endif /* FREECIV_JSON_CONNECTION */
16940
16941 {
16942 int i;
16943
16944#ifdef FREECIV_JSON_CONNECTION
16945 /* Create the array. */
16946 DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
16947
16948 /* Enter the array. */
16949 field_addr.sub_location = plocation_elem_new(0);
16950#endif /* FREECIV_JSON_CONNECTION */
16951
16952 for (i = 0; i < real_packet->specialists_size; i++) {
16953#ifdef FREECIV_JSON_CONNECTION
16954 /* Next array element. */
16955 field_addr.sub_location->number = i;
16956#endif /* FREECIV_JSON_CONNECTION */
16957 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
16958 }
16959
16960#ifdef FREECIV_JSON_CONNECTION
16961 /* Exit array. */
16962 free(field_addr.sub_location);
16963 field_addr.sub_location = NULL;
16964#endif /* FREECIV_JSON_CONNECTION */
16965 }
16966 }
16967 if (BV_ISSET(fields, 13)) {
16968 log_packet_detailed(" field 'history' has changed");
16969 #ifdef FREECIV_JSON_CONNECTION
16970 field_addr.name = "history";
16971#endif /* FREECIV_JSON_CONNECTION */
16972 DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
16973 }
16974 if (BV_ISSET(fields, 14)) {
16975 log_packet_detailed(" field 'culture' has changed");
16976 #ifdef FREECIV_JSON_CONNECTION
16977 field_addr.name = "culture";
16978#endif /* FREECIV_JSON_CONNECTION */
16979 DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
16980 }
16981 if (BV_ISSET(fields, 15)) {
16982 log_packet_detailed(" field 'buy_cost' has changed");
16983 #ifdef FREECIV_JSON_CONNECTION
16984 field_addr.name = "buy_cost";
16985#endif /* FREECIV_JSON_CONNECTION */
16986 DIO_PUT(uint32, &dout, &field_addr, real_packet->buy_cost);
16987 }
16988 if (BV_ISSET(fields, 16)) {
16989 log_packet_detailed(" field 'surplus' has changed");
16990 #ifdef FREECIV_JSON_CONNECTION
16991 field_addr.name = "surplus";
16992#endif /* FREECIV_JSON_CONNECTION */
16993
16994 {
16995 int i;
16996
16997#ifdef FREECIV_JSON_CONNECTION
16998 /* Create the array. */
16999 DIO_PUT(farray, &dout, &field_addr, O_LAST);
17000
17001 /* Enter the array. */
17002 field_addr.sub_location = plocation_elem_new(0);
17003#endif /* FREECIV_JSON_CONNECTION */
17004
17005 for (i = 0; i < O_LAST; i++) {
17006#ifdef FREECIV_JSON_CONNECTION
17007 /* Next array element. */
17008 field_addr.sub_location->number = i;
17009#endif /* FREECIV_JSON_CONNECTION */
17010 DIO_PUT(sint16, &dout, &field_addr, real_packet->surplus[i]);
17011 }
17012
17013#ifdef FREECIV_JSON_CONNECTION
17014 /* Exit array. */
17015 free(field_addr.sub_location);
17016 field_addr.sub_location = NULL;
17017#endif /* FREECIV_JSON_CONNECTION */
17018 }
17019 }
17020 if (BV_ISSET(fields, 17)) {
17021 log_packet_detailed(" field 'waste' has changed");
17022 #ifdef FREECIV_JSON_CONNECTION
17023 field_addr.name = "waste";
17024#endif /* FREECIV_JSON_CONNECTION */
17025
17026 {
17027 int i;
17028
17029#ifdef FREECIV_JSON_CONNECTION
17030 /* Create the array. */
17031 DIO_PUT(farray, &dout, &field_addr, O_LAST);
17032
17033 /* Enter the array. */
17034 field_addr.sub_location = plocation_elem_new(0);
17035#endif /* FREECIV_JSON_CONNECTION */
17036
17037 for (i = 0; i < O_LAST; i++) {
17038#ifdef FREECIV_JSON_CONNECTION
17039 /* Next array element. */
17040 field_addr.sub_location->number = i;
17041#endif /* FREECIV_JSON_CONNECTION */
17042 DIO_PUT(uint16, &dout, &field_addr, real_packet->waste[i]);
17043 }
17044
17045#ifdef FREECIV_JSON_CONNECTION
17046 /* Exit array. */
17047 free(field_addr.sub_location);
17048 field_addr.sub_location = NULL;
17049#endif /* FREECIV_JSON_CONNECTION */
17050 }
17051 }
17052 if (BV_ISSET(fields, 18)) {
17053 log_packet_detailed(" field 'unhappy_penalty' has changed");
17054 #ifdef FREECIV_JSON_CONNECTION
17055 field_addr.name = "unhappy_penalty";
17056#endif /* FREECIV_JSON_CONNECTION */
17057
17058 {
17059 int i;
17060
17061#ifdef FREECIV_JSON_CONNECTION
17062 /* Create the array. */
17063 DIO_PUT(farray, &dout, &field_addr, O_LAST);
17064
17065 /* Enter the array. */
17066 field_addr.sub_location = plocation_elem_new(0);
17067#endif /* FREECIV_JSON_CONNECTION */
17068
17069 for (i = 0; i < O_LAST; i++) {
17070#ifdef FREECIV_JSON_CONNECTION
17071 /* Next array element. */
17072 field_addr.sub_location->number = i;
17073#endif /* FREECIV_JSON_CONNECTION */
17074 DIO_PUT(sint16, &dout, &field_addr, real_packet->unhappy_penalty[i]);
17075 }
17076
17077#ifdef FREECIV_JSON_CONNECTION
17078 /* Exit array. */
17079 free(field_addr.sub_location);
17080 field_addr.sub_location = NULL;
17081#endif /* FREECIV_JSON_CONNECTION */
17082 }
17083 }
17084 if (BV_ISSET(fields, 19)) {
17085 log_packet_detailed(" field 'prod' has changed");
17086 #ifdef FREECIV_JSON_CONNECTION
17087 field_addr.name = "prod";
17088#endif /* FREECIV_JSON_CONNECTION */
17089
17090 {
17091 int i;
17092
17093#ifdef FREECIV_JSON_CONNECTION
17094 /* Create the array. */
17095 DIO_PUT(farray, &dout, &field_addr, O_LAST);
17096
17097 /* Enter the array. */
17098 field_addr.sub_location = plocation_elem_new(0);
17099#endif /* FREECIV_JSON_CONNECTION */
17100
17101 for (i = 0; i < O_LAST; i++) {
17102#ifdef FREECIV_JSON_CONNECTION
17103 /* Next array element. */
17104 field_addr.sub_location->number = i;
17105#endif /* FREECIV_JSON_CONNECTION */
17106 DIO_PUT(uint16, &dout, &field_addr, real_packet->prod[i]);
17107 }
17108
17109#ifdef FREECIV_JSON_CONNECTION
17110 /* Exit array. */
17111 free(field_addr.sub_location);
17112 field_addr.sub_location = NULL;
17113#endif /* FREECIV_JSON_CONNECTION */
17114 }
17115 }
17116 if (BV_ISSET(fields, 20)) {
17117 log_packet_detailed(" field 'citizen_base' has changed");
17118 #ifdef FREECIV_JSON_CONNECTION
17119 field_addr.name = "citizen_base";
17120#endif /* FREECIV_JSON_CONNECTION */
17121
17122 {
17123 int i;
17124
17125#ifdef FREECIV_JSON_CONNECTION
17126 /* Create the array. */
17127 DIO_PUT(farray, &dout, &field_addr, O_LAST);
17128
17129 /* Enter the array. */
17130 field_addr.sub_location = plocation_elem_new(0);
17131#endif /* FREECIV_JSON_CONNECTION */
17132
17133 for (i = 0; i < O_LAST; i++) {
17134#ifdef FREECIV_JSON_CONNECTION
17135 /* Next array element. */
17136 field_addr.sub_location->number = i;
17137#endif /* FREECIV_JSON_CONNECTION */
17138 DIO_PUT(sint16, &dout, &field_addr, real_packet->citizen_base[i]);
17139 }
17140
17141#ifdef FREECIV_JSON_CONNECTION
17142 /* Exit array. */
17143 free(field_addr.sub_location);
17144 field_addr.sub_location = NULL;
17145#endif /* FREECIV_JSON_CONNECTION */
17146 }
17147 }
17148 if (BV_ISSET(fields, 21)) {
17149 log_packet_detailed(" field 'usage' has changed");
17150 #ifdef FREECIV_JSON_CONNECTION
17151 field_addr.name = "usage";
17152#endif /* FREECIV_JSON_CONNECTION */
17153
17154 {
17155 int i;
17156
17157#ifdef FREECIV_JSON_CONNECTION
17158 /* Create the array. */
17159 DIO_PUT(farray, &dout, &field_addr, O_LAST);
17160
17161 /* Enter the array. */
17162 field_addr.sub_location = plocation_elem_new(0);
17163#endif /* FREECIV_JSON_CONNECTION */
17164
17165 for (i = 0; i < O_LAST; i++) {
17166#ifdef FREECIV_JSON_CONNECTION
17167 /* Next array element. */
17168 field_addr.sub_location->number = i;
17169#endif /* FREECIV_JSON_CONNECTION */
17170 DIO_PUT(sint16, &dout, &field_addr, real_packet->usage[i]);
17171 }
17172
17173#ifdef FREECIV_JSON_CONNECTION
17174 /* Exit array. */
17175 free(field_addr.sub_location);
17176 field_addr.sub_location = NULL;
17177#endif /* FREECIV_JSON_CONNECTION */
17178 }
17179 }
17180 if (BV_ISSET(fields, 22)) {
17181 log_packet_detailed(" field 'food_stock' has changed");
17182 #ifdef FREECIV_JSON_CONNECTION
17183 field_addr.name = "food_stock";
17184#endif /* FREECIV_JSON_CONNECTION */
17185 DIO_PUT(sint16, &dout, &field_addr, real_packet->food_stock);
17186 }
17187 if (BV_ISSET(fields, 23)) {
17188 log_packet_detailed(" field 'shield_stock' has changed");
17189 #ifdef FREECIV_JSON_CONNECTION
17190 field_addr.name = "shield_stock";
17191#endif /* FREECIV_JSON_CONNECTION */
17192 DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
17193 }
17194 if (BV_ISSET(fields, 24)) {
17195 log_packet_detailed(" field 'trade_route_count' has changed");
17196 #ifdef FREECIV_JSON_CONNECTION
17197 field_addr.name = "trade_route_count";
17198#endif /* FREECIV_JSON_CONNECTION */
17199 DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_route_count);
17200 }
17201 if (BV_ISSET(fields, 25)) {
17202 log_packet_detailed(" field 'pollution' has changed");
17203 #ifdef FREECIV_JSON_CONNECTION
17204 field_addr.name = "pollution";
17205#endif /* FREECIV_JSON_CONNECTION */
17206 DIO_PUT(uint16, &dout, &field_addr, real_packet->pollution);
17207 }
17208 if (BV_ISSET(fields, 26)) {
17209 log_packet_detailed(" field 'illness_trade' has changed");
17210 #ifdef FREECIV_JSON_CONNECTION
17211 field_addr.name = "illness_trade";
17212#endif /* FREECIV_JSON_CONNECTION */
17213 DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade);
17214 }
17215 if (BV_ISSET(fields, 27)) {
17216 log_packet_detailed(" field 'production_kind' has changed");
17217 #ifdef FREECIV_JSON_CONNECTION
17218 field_addr.name = "production_kind";
17219#endif /* FREECIV_JSON_CONNECTION */
17220 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
17221 }
17222 if (BV_ISSET(fields, 28)) {
17223 log_packet_detailed(" field 'production_value' has changed");
17224 #ifdef FREECIV_JSON_CONNECTION
17225 field_addr.name = "production_value";
17226#endif /* FREECIV_JSON_CONNECTION */
17227 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
17228 }
17229 if (BV_ISSET(fields, 29)) {
17230 log_packet_detailed(" field 'turn_founded' has changed");
17231 #ifdef FREECIV_JSON_CONNECTION
17232 field_addr.name = "turn_founded";
17233#endif /* FREECIV_JSON_CONNECTION */
17234 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
17235 }
17236 if (BV_ISSET(fields, 30)) {
17237 log_packet_detailed(" field 'turn_last_built' has changed");
17238 #ifdef FREECIV_JSON_CONNECTION
17239 field_addr.name = "turn_last_built";
17240#endif /* FREECIV_JSON_CONNECTION */
17241 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
17242 }
17243 if (BV_ISSET(fields, 31)) {
17244 log_packet_detailed(" field 'changed_from_kind' has changed");
17245 #ifdef FREECIV_JSON_CONNECTION
17246 field_addr.name = "changed_from_kind";
17247#endif /* FREECIV_JSON_CONNECTION */
17248 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_kind);
17249 }
17250 if (BV_ISSET(fields, 32)) {
17251 log_packet_detailed(" field 'changed_from_value' has changed");
17252 #ifdef FREECIV_JSON_CONNECTION
17253 field_addr.name = "changed_from_value";
17254#endif /* FREECIV_JSON_CONNECTION */
17255 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_value);
17256 }
17257 if (BV_ISSET(fields, 33)) {
17258 log_packet_detailed(" field 'before_change_shields' has changed");
17259 #ifdef FREECIV_JSON_CONNECTION
17260 field_addr.name = "before_change_shields";
17261#endif /* FREECIV_JSON_CONNECTION */
17262 DIO_PUT(uint16, &dout, &field_addr, real_packet->before_change_shields);
17263 }
17264 if (BV_ISSET(fields, 34)) {
17265 log_packet_detailed(" field 'disbanded_shields' has changed");
17266 #ifdef FREECIV_JSON_CONNECTION
17267 field_addr.name = "disbanded_shields";
17268#endif /* FREECIV_JSON_CONNECTION */
17269 DIO_PUT(uint16, &dout, &field_addr, real_packet->disbanded_shields);
17270 }
17271 if (BV_ISSET(fields, 35)) {
17272 log_packet_detailed(" field 'caravan_shields' has changed");
17273 #ifdef FREECIV_JSON_CONNECTION
17274 field_addr.name = "caravan_shields";
17275#endif /* FREECIV_JSON_CONNECTION */
17276 DIO_PUT(uint16, &dout, &field_addr, real_packet->caravan_shields);
17277 }
17278 if (BV_ISSET(fields, 36)) {
17279 log_packet_detailed(" field 'last_turns_shield_surplus' has changed");
17280 #ifdef FREECIV_JSON_CONNECTION
17281 field_addr.name = "last_turns_shield_surplus";
17282#endif /* FREECIV_JSON_CONNECTION */
17283 DIO_PUT(uint16, &dout, &field_addr, real_packet->last_turns_shield_surplus);
17284 }
17285 if (BV_ISSET(fields, 37)) {
17286 log_packet_detailed(" field 'airlift' has changed");
17287 #ifdef FREECIV_JSON_CONNECTION
17288 field_addr.name = "airlift";
17289#endif /* FREECIV_JSON_CONNECTION */
17290 DIO_PUT(uint8, &dout, &field_addr, real_packet->airlift);
17291 }
17292 /* field 38 is folded into the header */
17293 /* field 39 is folded into the header */
17294 /* field 40 is folded into the header */
17295 /* field 41 is folded into the header */
17296 if (BV_ISSET(fields, 42)) {
17297 log_packet_detailed(" field 'walls' has changed");
17298 #ifdef FREECIV_JSON_CONNECTION
17299 field_addr.name = "walls";
17300#endif /* FREECIV_JSON_CONNECTION */
17301 DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
17302 }
17303 if (BV_ISSET(fields, 43)) {
17304 log_packet_detailed(" field 'city_image' has changed");
17305 #ifdef FREECIV_JSON_CONNECTION
17306 field_addr.name = "city_image";
17307#endif /* FREECIV_JSON_CONNECTION */
17308 DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
17309 }
17310 if (BV_ISSET(fields, 44)) {
17311 log_packet_detailed(" field 'steal' has changed");
17312 #ifdef FREECIV_JSON_CONNECTION
17313 field_addr.name = "steal";
17314#endif /* FREECIV_JSON_CONNECTION */
17315 DIO_PUT(uint16, &dout, &field_addr, real_packet->steal);
17316 }
17317 if (BV_ISSET(fields, 45)) {
17318 log_packet_detailed(" field 'worklist' has changed");
17319 #ifdef FREECIV_JSON_CONNECTION
17320 field_addr.name = "worklist";
17321#endif /* FREECIV_JSON_CONNECTION */
17322 DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
17323 }
17324 if (BV_ISSET(fields, 46)) {
17325 log_packet_detailed(" field 'improvements' has changed");
17326 #ifdef FREECIV_JSON_CONNECTION
17327 field_addr.name = "improvements";
17328#endif /* FREECIV_JSON_CONNECTION */
17329 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
17330 }
17331 if (BV_ISSET(fields, 47)) {
17332 log_packet_detailed(" field 'city_options' has changed");
17333 #ifdef FREECIV_JSON_CONNECTION
17334 field_addr.name = "city_options";
17335#endif /* FREECIV_JSON_CONNECTION */
17336 DIO_BV_PUT(&dout, &field_addr, packet->city_options);
17337 }
17338 if (BV_ISSET(fields, 48)) {
17339 log_packet_detailed(" field 'name' has changed");
17340 #ifdef FREECIV_JSON_CONNECTION
17341 field_addr.name = "name";
17342#endif /* FREECIV_JSON_CONNECTION */
17343 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
17344 }
17345
17346 *old = *real_packet;
17347
17348 hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
17349 if (NULL != *hash) {
17350 genhash_remove(*hash, real_packet);
17351 }
17352#endif /* FREECIV_DELTA_PROTOCOL */
17353#ifndef FREECIV_DELTA_PROTOCOL
17354#ifdef FREECIV_JSON_CONNECTION
17355 field_addr.name = "id32";
17356#endif /* FREECIV_JSON_CONNECTION */
17357 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
17358#ifdef FREECIV_JSON_CONNECTION
17359 field_addr.name = "tile";
17360#endif /* FREECIV_JSON_CONNECTION */
17361 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
17362#ifdef FREECIV_JSON_CONNECTION
17363 field_addr.name = "owner";
17364#endif /* FREECIV_JSON_CONNECTION */
17365 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
17366#ifdef FREECIV_JSON_CONNECTION
17367 field_addr.name = "size";
17368#endif /* FREECIV_JSON_CONNECTION */
17369 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
17370#ifdef FREECIV_JSON_CONNECTION
17371 field_addr.name = "city_radius_sq";
17372#endif /* FREECIV_JSON_CONNECTION */
17373 DIO_PUT(uint8, &dout, &field_addr, real_packet->city_radius_sq);
17374#ifdef FREECIV_JSON_CONNECTION
17375 field_addr.name = "style";
17376#endif /* FREECIV_JSON_CONNECTION */
17377 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
17378#ifdef FREECIV_JSON_CONNECTION
17379 field_addr.name = "capital";
17380#endif /* FREECIV_JSON_CONNECTION */
17381 DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
17382#ifdef FREECIV_JSON_CONNECTION
17383 field_addr.name = "ppl_happy";
17384#endif /* FREECIV_JSON_CONNECTION */
17385
17386 {
17387 int i;
17388
17389#ifdef FREECIV_JSON_CONNECTION
17390 /* Create the array. */
17391 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
17392
17393 /* Enter the array. */
17394 field_addr.sub_location = plocation_elem_new(0);
17395#endif /* FREECIV_JSON_CONNECTION */
17396
17397 for (i = 0; i < FEELING_LAST; i++) {
17398#ifdef FREECIV_JSON_CONNECTION
17399 /* Next array element. */
17400 field_addr.sub_location->number = i;
17401#endif /* FREECIV_JSON_CONNECTION */
17402 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
17403 }
17404
17405#ifdef FREECIV_JSON_CONNECTION
17406 /* Exit array. */
17407 free(field_addr.sub_location);
17408 field_addr.sub_location = NULL;
17409#endif /* FREECIV_JSON_CONNECTION */
17410 }
17411#ifdef FREECIV_JSON_CONNECTION
17412 field_addr.name = "ppl_content";
17413#endif /* FREECIV_JSON_CONNECTION */
17414
17415 {
17416 int i;
17417
17418#ifdef FREECIV_JSON_CONNECTION
17419 /* Create the array. */
17420 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
17421
17422 /* Enter the array. */
17423 field_addr.sub_location = plocation_elem_new(0);
17424#endif /* FREECIV_JSON_CONNECTION */
17425
17426 for (i = 0; i < FEELING_LAST; i++) {
17427#ifdef FREECIV_JSON_CONNECTION
17428 /* Next array element. */
17429 field_addr.sub_location->number = i;
17430#endif /* FREECIV_JSON_CONNECTION */
17431 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
17432 }
17433
17434#ifdef FREECIV_JSON_CONNECTION
17435 /* Exit array. */
17436 free(field_addr.sub_location);
17437 field_addr.sub_location = NULL;
17438#endif /* FREECIV_JSON_CONNECTION */
17439 }
17440#ifdef FREECIV_JSON_CONNECTION
17441 field_addr.name = "ppl_unhappy";
17442#endif /* FREECIV_JSON_CONNECTION */
17443
17444 {
17445 int i;
17446
17447#ifdef FREECIV_JSON_CONNECTION
17448 /* Create the array. */
17449 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
17450
17451 /* Enter the array. */
17452 field_addr.sub_location = plocation_elem_new(0);
17453#endif /* FREECIV_JSON_CONNECTION */
17454
17455 for (i = 0; i < FEELING_LAST; i++) {
17456#ifdef FREECIV_JSON_CONNECTION
17457 /* Next array element. */
17458 field_addr.sub_location->number = i;
17459#endif /* FREECIV_JSON_CONNECTION */
17460 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
17461 }
17462
17463#ifdef FREECIV_JSON_CONNECTION
17464 /* Exit array. */
17465 free(field_addr.sub_location);
17466 field_addr.sub_location = NULL;
17467#endif /* FREECIV_JSON_CONNECTION */
17468 }
17469#ifdef FREECIV_JSON_CONNECTION
17470 field_addr.name = "ppl_angry";
17471#endif /* FREECIV_JSON_CONNECTION */
17472
17473 {
17474 int i;
17475
17476#ifdef FREECIV_JSON_CONNECTION
17477 /* Create the array. */
17478 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
17479
17480 /* Enter the array. */
17481 field_addr.sub_location = plocation_elem_new(0);
17482#endif /* FREECIV_JSON_CONNECTION */
17483
17484 for (i = 0; i < FEELING_LAST; i++) {
17485#ifdef FREECIV_JSON_CONNECTION
17486 /* Next array element. */
17487 field_addr.sub_location->number = i;
17488#endif /* FREECIV_JSON_CONNECTION */
17489 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
17490 }
17491
17492#ifdef FREECIV_JSON_CONNECTION
17493 /* Exit array. */
17494 free(field_addr.sub_location);
17495 field_addr.sub_location = NULL;
17496#endif /* FREECIV_JSON_CONNECTION */
17497 }
17498#ifdef FREECIV_JSON_CONNECTION
17499 field_addr.name = "specialists_size";
17500#endif /* FREECIV_JSON_CONNECTION */
17501 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
17502#ifdef FREECIV_JSON_CONNECTION
17503 field_addr.name = "specialists";
17504#endif /* FREECIV_JSON_CONNECTION */
17505
17506 {
17507 int i;
17508
17509#ifdef FREECIV_JSON_CONNECTION
17510 /* Create the array. */
17511 DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
17512
17513 /* Enter the array. */
17514 field_addr.sub_location = plocation_elem_new(0);
17515#endif /* FREECIV_JSON_CONNECTION */
17516
17517 for (i = 0; i < real_packet->specialists_size; i++) {
17518#ifdef FREECIV_JSON_CONNECTION
17519 /* Next array element. */
17520 field_addr.sub_location->number = i;
17521#endif /* FREECIV_JSON_CONNECTION */
17522 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
17523 }
17524
17525#ifdef FREECIV_JSON_CONNECTION
17526 /* Exit array. */
17527 free(field_addr.sub_location);
17528 field_addr.sub_location = NULL;
17529#endif /* FREECIV_JSON_CONNECTION */
17530 }
17531#ifdef FREECIV_JSON_CONNECTION
17532 field_addr.name = "history";
17533#endif /* FREECIV_JSON_CONNECTION */
17534 DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
17535#ifdef FREECIV_JSON_CONNECTION
17536 field_addr.name = "culture";
17537#endif /* FREECIV_JSON_CONNECTION */
17538 DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
17539#ifdef FREECIV_JSON_CONNECTION
17540 field_addr.name = "buy_cost";
17541#endif /* FREECIV_JSON_CONNECTION */
17542 DIO_PUT(uint32, &dout, &field_addr, real_packet->buy_cost);
17543#ifdef FREECIV_JSON_CONNECTION
17544 field_addr.name = "surplus";
17545#endif /* FREECIV_JSON_CONNECTION */
17546
17547 {
17548 int i;
17549
17550#ifdef FREECIV_JSON_CONNECTION
17551 /* Create the array. */
17552 DIO_PUT(farray, &dout, &field_addr, O_LAST);
17553
17554 /* Enter the array. */
17555 field_addr.sub_location = plocation_elem_new(0);
17556#endif /* FREECIV_JSON_CONNECTION */
17557
17558 for (i = 0; i < O_LAST; i++) {
17559#ifdef FREECIV_JSON_CONNECTION
17560 /* Next array element. */
17561 field_addr.sub_location->number = i;
17562#endif /* FREECIV_JSON_CONNECTION */
17563 DIO_PUT(sint16, &dout, &field_addr, real_packet->surplus[i]);
17564 }
17565
17566#ifdef FREECIV_JSON_CONNECTION
17567 /* Exit array. */
17568 free(field_addr.sub_location);
17569 field_addr.sub_location = NULL;
17570#endif /* FREECIV_JSON_CONNECTION */
17571 }
17572#ifdef FREECIV_JSON_CONNECTION
17573 field_addr.name = "waste";
17574#endif /* FREECIV_JSON_CONNECTION */
17575
17576 {
17577 int i;
17578
17579#ifdef FREECIV_JSON_CONNECTION
17580 /* Create the array. */
17581 DIO_PUT(farray, &dout, &field_addr, O_LAST);
17582
17583 /* Enter the array. */
17584 field_addr.sub_location = plocation_elem_new(0);
17585#endif /* FREECIV_JSON_CONNECTION */
17586
17587 for (i = 0; i < O_LAST; i++) {
17588#ifdef FREECIV_JSON_CONNECTION
17589 /* Next array element. */
17590 field_addr.sub_location->number = i;
17591#endif /* FREECIV_JSON_CONNECTION */
17592 DIO_PUT(uint16, &dout, &field_addr, real_packet->waste[i]);
17593 }
17594
17595#ifdef FREECIV_JSON_CONNECTION
17596 /* Exit array. */
17597 free(field_addr.sub_location);
17598 field_addr.sub_location = NULL;
17599#endif /* FREECIV_JSON_CONNECTION */
17600 }
17601#ifdef FREECIV_JSON_CONNECTION
17602 field_addr.name = "unhappy_penalty";
17603#endif /* FREECIV_JSON_CONNECTION */
17604
17605 {
17606 int i;
17607
17608#ifdef FREECIV_JSON_CONNECTION
17609 /* Create the array. */
17610 DIO_PUT(farray, &dout, &field_addr, O_LAST);
17611
17612 /* Enter the array. */
17613 field_addr.sub_location = plocation_elem_new(0);
17614#endif /* FREECIV_JSON_CONNECTION */
17615
17616 for (i = 0; i < O_LAST; i++) {
17617#ifdef FREECIV_JSON_CONNECTION
17618 /* Next array element. */
17619 field_addr.sub_location->number = i;
17620#endif /* FREECIV_JSON_CONNECTION */
17621 DIO_PUT(sint16, &dout, &field_addr, real_packet->unhappy_penalty[i]);
17622 }
17623
17624#ifdef FREECIV_JSON_CONNECTION
17625 /* Exit array. */
17626 free(field_addr.sub_location);
17627 field_addr.sub_location = NULL;
17628#endif /* FREECIV_JSON_CONNECTION */
17629 }
17630#ifdef FREECIV_JSON_CONNECTION
17631 field_addr.name = "prod";
17632#endif /* FREECIV_JSON_CONNECTION */
17633
17634 {
17635 int i;
17636
17637#ifdef FREECIV_JSON_CONNECTION
17638 /* Create the array. */
17639 DIO_PUT(farray, &dout, &field_addr, O_LAST);
17640
17641 /* Enter the array. */
17642 field_addr.sub_location = plocation_elem_new(0);
17643#endif /* FREECIV_JSON_CONNECTION */
17644
17645 for (i = 0; i < O_LAST; i++) {
17646#ifdef FREECIV_JSON_CONNECTION
17647 /* Next array element. */
17648 field_addr.sub_location->number = i;
17649#endif /* FREECIV_JSON_CONNECTION */
17650 DIO_PUT(uint16, &dout, &field_addr, real_packet->prod[i]);
17651 }
17652
17653#ifdef FREECIV_JSON_CONNECTION
17654 /* Exit array. */
17655 free(field_addr.sub_location);
17656 field_addr.sub_location = NULL;
17657#endif /* FREECIV_JSON_CONNECTION */
17658 }
17659#ifdef FREECIV_JSON_CONNECTION
17660 field_addr.name = "citizen_base";
17661#endif /* FREECIV_JSON_CONNECTION */
17662
17663 {
17664 int i;
17665
17666#ifdef FREECIV_JSON_CONNECTION
17667 /* Create the array. */
17668 DIO_PUT(farray, &dout, &field_addr, O_LAST);
17669
17670 /* Enter the array. */
17671 field_addr.sub_location = plocation_elem_new(0);
17672#endif /* FREECIV_JSON_CONNECTION */
17673
17674 for (i = 0; i < O_LAST; i++) {
17675#ifdef FREECIV_JSON_CONNECTION
17676 /* Next array element. */
17677 field_addr.sub_location->number = i;
17678#endif /* FREECIV_JSON_CONNECTION */
17679 DIO_PUT(sint16, &dout, &field_addr, real_packet->citizen_base[i]);
17680 }
17681
17682#ifdef FREECIV_JSON_CONNECTION
17683 /* Exit array. */
17684 free(field_addr.sub_location);
17685 field_addr.sub_location = NULL;
17686#endif /* FREECIV_JSON_CONNECTION */
17687 }
17688#ifdef FREECIV_JSON_CONNECTION
17689 field_addr.name = "usage";
17690#endif /* FREECIV_JSON_CONNECTION */
17691
17692 {
17693 int i;
17694
17695#ifdef FREECIV_JSON_CONNECTION
17696 /* Create the array. */
17697 DIO_PUT(farray, &dout, &field_addr, O_LAST);
17698
17699 /* Enter the array. */
17700 field_addr.sub_location = plocation_elem_new(0);
17701#endif /* FREECIV_JSON_CONNECTION */
17702
17703 for (i = 0; i < O_LAST; i++) {
17704#ifdef FREECIV_JSON_CONNECTION
17705 /* Next array element. */
17706 field_addr.sub_location->number = i;
17707#endif /* FREECIV_JSON_CONNECTION */
17708 DIO_PUT(sint16, &dout, &field_addr, real_packet->usage[i]);
17709 }
17710
17711#ifdef FREECIV_JSON_CONNECTION
17712 /* Exit array. */
17713 free(field_addr.sub_location);
17714 field_addr.sub_location = NULL;
17715#endif /* FREECIV_JSON_CONNECTION */
17716 }
17717#ifdef FREECIV_JSON_CONNECTION
17718 field_addr.name = "food_stock";
17719#endif /* FREECIV_JSON_CONNECTION */
17720 DIO_PUT(sint16, &dout, &field_addr, real_packet->food_stock);
17721#ifdef FREECIV_JSON_CONNECTION
17722 field_addr.name = "shield_stock";
17723#endif /* FREECIV_JSON_CONNECTION */
17724 DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
17725#ifdef FREECIV_JSON_CONNECTION
17726 field_addr.name = "trade_route_count";
17727#endif /* FREECIV_JSON_CONNECTION */
17728 DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_route_count);
17729#ifdef FREECIV_JSON_CONNECTION
17730 field_addr.name = "pollution";
17731#endif /* FREECIV_JSON_CONNECTION */
17732 DIO_PUT(uint16, &dout, &field_addr, real_packet->pollution);
17733#ifdef FREECIV_JSON_CONNECTION
17734 field_addr.name = "illness_trade";
17735#endif /* FREECIV_JSON_CONNECTION */
17736 DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade);
17737#ifdef FREECIV_JSON_CONNECTION
17738 field_addr.name = "production_kind";
17739#endif /* FREECIV_JSON_CONNECTION */
17740 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
17741#ifdef FREECIV_JSON_CONNECTION
17742 field_addr.name = "production_value";
17743#endif /* FREECIV_JSON_CONNECTION */
17744 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
17745#ifdef FREECIV_JSON_CONNECTION
17746 field_addr.name = "turn_founded";
17747#endif /* FREECIV_JSON_CONNECTION */
17748 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
17749#ifdef FREECIV_JSON_CONNECTION
17750 field_addr.name = "turn_last_built";
17751#endif /* FREECIV_JSON_CONNECTION */
17752 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
17753#ifdef FREECIV_JSON_CONNECTION
17754 field_addr.name = "changed_from_kind";
17755#endif /* FREECIV_JSON_CONNECTION */
17756 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_kind);
17757#ifdef FREECIV_JSON_CONNECTION
17758 field_addr.name = "changed_from_value";
17759#endif /* FREECIV_JSON_CONNECTION */
17760 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_value);
17761#ifdef FREECIV_JSON_CONNECTION
17762 field_addr.name = "before_change_shields";
17763#endif /* FREECIV_JSON_CONNECTION */
17764 DIO_PUT(uint16, &dout, &field_addr, real_packet->before_change_shields);
17765#ifdef FREECIV_JSON_CONNECTION
17766 field_addr.name = "disbanded_shields";
17767#endif /* FREECIV_JSON_CONNECTION */
17768 DIO_PUT(uint16, &dout, &field_addr, real_packet->disbanded_shields);
17769#ifdef FREECIV_JSON_CONNECTION
17770 field_addr.name = "caravan_shields";
17771#endif /* FREECIV_JSON_CONNECTION */
17772 DIO_PUT(uint16, &dout, &field_addr, real_packet->caravan_shields);
17773#ifdef FREECIV_JSON_CONNECTION
17774 field_addr.name = "last_turns_shield_surplus";
17775#endif /* FREECIV_JSON_CONNECTION */
17776 DIO_PUT(uint16, &dout, &field_addr, real_packet->last_turns_shield_surplus);
17777#ifdef FREECIV_JSON_CONNECTION
17778 field_addr.name = "airlift";
17779#endif /* FREECIV_JSON_CONNECTION */
17780 DIO_PUT(uint8, &dout, &field_addr, real_packet->airlift);
17781#ifdef FREECIV_JSON_CONNECTION
17782 field_addr.name = "did_buy";
17783#endif /* FREECIV_JSON_CONNECTION */
17784 DIO_PUT(bool8, &dout, &field_addr, real_packet->did_buy);
17785#ifdef FREECIV_JSON_CONNECTION
17786 field_addr.name = "did_sell";
17787#endif /* FREECIV_JSON_CONNECTION */
17788 DIO_PUT(bool8, &dout, &field_addr, real_packet->did_sell);
17789#ifdef FREECIV_JSON_CONNECTION
17790 field_addr.name = "was_happy";
17791#endif /* FREECIV_JSON_CONNECTION */
17792 DIO_PUT(bool8, &dout, &field_addr, real_packet->was_happy);
17793#ifdef FREECIV_JSON_CONNECTION
17794 field_addr.name = "diplomat_investigate";
17795#endif /* FREECIV_JSON_CONNECTION */
17796 DIO_PUT(bool8, &dout, &field_addr, real_packet->diplomat_investigate);
17797#ifdef FREECIV_JSON_CONNECTION
17798 field_addr.name = "walls";
17799#endif /* FREECIV_JSON_CONNECTION */
17800 DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
17801#ifdef FREECIV_JSON_CONNECTION
17802 field_addr.name = "city_image";
17803#endif /* FREECIV_JSON_CONNECTION */
17804 DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
17805#ifdef FREECIV_JSON_CONNECTION
17806 field_addr.name = "steal";
17807#endif /* FREECIV_JSON_CONNECTION */
17808 DIO_PUT(uint16, &dout, &field_addr, real_packet->steal);
17809#ifdef FREECIV_JSON_CONNECTION
17810 field_addr.name = "worklist";
17811#endif /* FREECIV_JSON_CONNECTION */
17812 DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
17813#ifdef FREECIV_JSON_CONNECTION
17814 field_addr.name = "improvements";
17815#endif /* FREECIV_JSON_CONNECTION */
17816 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
17817#ifdef FREECIV_JSON_CONNECTION
17818 field_addr.name = "city_options";
17819#endif /* FREECIV_JSON_CONNECTION */
17820 DIO_BV_PUT(&dout, &field_addr, packet->city_options);
17821#ifdef FREECIV_JSON_CONNECTION
17822 field_addr.name = "name";
17823#endif /* FREECIV_JSON_CONNECTION */
17824 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
17825
17826#endif
17827 SEND_PACKET_END(PACKET_CITY_INFO);
17828}
17829
17830#ifdef FREECIV_DELTA_PROTOCOL
17831static genhash_val_t hash_packet_city_info_102(const void *vkey)
17832{
17833 const struct packet_city_info *key = (const struct packet_city_info *) vkey;
17834
17835 return key->id16;
17836}
17837
17838static bool cmp_packet_city_info_102(const void *vkey1, const void *vkey2)
17839{
17840 const struct packet_city_info *key1 = (const struct packet_city_info *) vkey1;
17841 const struct packet_city_info *key2 = (const struct packet_city_info *) vkey2;
17842
17843 return key1->id16 == key2->id16;
17844}
17845 BV_DEFINE(packet_city_info_102_fields, 49);
17846#endif /* FREECIV_DELTA_PROTOCOL */
17847
17848 static struct packet_city_info *receive_packet_city_info_102(struct connection *pc)
17849{
17850#ifdef FREECIV_DELTA_PROTOCOL
17851 packet_city_info_102_fields fields;
17852 struct packet_city_info *old;
17853 struct genhash **hash = pc->phs.received + PACKET_CITY_INFO;
17854#endif /* FREECIV_DELTA_PROTOCOL */
17855 RECEIVE_PACKET_START(packet_city_info, real_packet);
17856#ifdef FREECIV_JSON_CONNECTION
17857 struct plocation field_addr;
17858 {
17859 struct plocation *field_addr_tmp = plocation_field_new(NULL);
17860 field_addr = *field_addr_tmp;
17861 FC_FREE(field_addr_tmp);
17862 }
17863#endif /* FREECIV_JSON_CONNECTION */
17864
17865#ifdef FREECIV_DELTA_PROTOCOL
17866#ifdef FREECIV_JSON_CONNECTION
17867 field_addr.name = "fields";
17868#endif /* FREECIV_JSON_CONNECTION */
17869 DIO_BV_GET(&din, &field_addr, fields);
17870 #ifdef FREECIV_JSON_CONNECTION
17871 field_addr.name = "id16";
17872 #endif /* FREECIV_JSON_CONNECTION */
17873 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
17874 RECEIVE_PACKET_FIELD_ERROR(id16);
17875 }
17876
17877#else /* FREECIV_DELTA_PROTOCOL */
17878 #ifdef FREECIV_JSON_CONNECTION
17879 field_addr.name = "id16";
17880 #endif /* FREECIV_JSON_CONNECTION */
17881 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
17882 RECEIVE_PACKET_FIELD_ERROR(id16);
17883 }
17884 #ifdef FREECIV_JSON_CONNECTION
17885 field_addr.name = "tile";
17886 #endif /* FREECIV_JSON_CONNECTION */
17887 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
17888 RECEIVE_PACKET_FIELD_ERROR(tile);
17889 }
17890 #ifdef FREECIV_JSON_CONNECTION
17891 field_addr.name = "owner";
17892 #endif /* FREECIV_JSON_CONNECTION */
17893 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
17894 RECEIVE_PACKET_FIELD_ERROR(owner);
17895 }
17896 #ifdef FREECIV_JSON_CONNECTION
17897 field_addr.name = "original";
17898 #endif /* FREECIV_JSON_CONNECTION */
17899 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->original)) {
17900 RECEIVE_PACKET_FIELD_ERROR(original);
17901 }
17902 #ifdef FREECIV_JSON_CONNECTION
17903 field_addr.name = "size";
17904 #endif /* FREECIV_JSON_CONNECTION */
17905 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
17906 RECEIVE_PACKET_FIELD_ERROR(size);
17907 }
17908 #ifdef FREECIV_JSON_CONNECTION
17909 field_addr.name = "city_radius_sq";
17910 #endif /* FREECIV_JSON_CONNECTION */
17911 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_radius_sq)) {
17912 RECEIVE_PACKET_FIELD_ERROR(city_radius_sq);
17913 }
17914 #ifdef FREECIV_JSON_CONNECTION
17915 field_addr.name = "style";
17916 #endif /* FREECIV_JSON_CONNECTION */
17917 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
17918 RECEIVE_PACKET_FIELD_ERROR(style);
17919 }
17920 #ifdef FREECIV_JSON_CONNECTION
17921 field_addr.name = "capital";
17922 #endif /* FREECIV_JSON_CONNECTION */
17923 {
17924 int readin;
17925
17926 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
17927 RECEIVE_PACKET_FIELD_ERROR(capital);
17928 }
17929 real_packet->capital = readin;
17930 }
17931 #ifdef FREECIV_JSON_CONNECTION
17932 field_addr.name = "ppl_happy";
17933 #endif /* FREECIV_JSON_CONNECTION */
17934
17935 {
17936 int i;
17937
17938 #ifdef FREECIV_JSON_CONNECTION
17939 /* Enter array. */
17940 field_addr.sub_location = plocation_elem_new(0);
17941 #endif /* FREECIV_JSON_CONNECTION */
17942
17943 for (i = 0; i < FEELING_LAST; i++) {
17944 #ifdef FREECIV_JSON_CONNECTION
17945 field_addr.sub_location->number = i;
17946 #endif /* FREECIV_JSON_CONNECTION */
17947 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
17948 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
17949 }
17950 }
17951
17952 #ifdef FREECIV_JSON_CONNECTION
17953 /* Exit array. */
17954 free(field_addr.sub_location);
17955 field_addr.sub_location = NULL;
17956 #endif /* FREECIV_JSON_CONNECTION */
17957 }
17958 #ifdef FREECIV_JSON_CONNECTION
17959 field_addr.name = "ppl_content";
17960 #endif /* FREECIV_JSON_CONNECTION */
17961
17962 {
17963 int i;
17964
17965 #ifdef FREECIV_JSON_CONNECTION
17966 /* Enter array. */
17967 field_addr.sub_location = plocation_elem_new(0);
17968 #endif /* FREECIV_JSON_CONNECTION */
17969
17970 for (i = 0; i < FEELING_LAST; i++) {
17971 #ifdef FREECIV_JSON_CONNECTION
17972 field_addr.sub_location->number = i;
17973 #endif /* FREECIV_JSON_CONNECTION */
17974 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
17975 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
17976 }
17977 }
17978
17979 #ifdef FREECIV_JSON_CONNECTION
17980 /* Exit array. */
17981 free(field_addr.sub_location);
17982 field_addr.sub_location = NULL;
17983 #endif /* FREECIV_JSON_CONNECTION */
17984 }
17985 #ifdef FREECIV_JSON_CONNECTION
17986 field_addr.name = "ppl_unhappy";
17987 #endif /* FREECIV_JSON_CONNECTION */
17988
17989 {
17990 int i;
17991
17992 #ifdef FREECIV_JSON_CONNECTION
17993 /* Enter array. */
17994 field_addr.sub_location = plocation_elem_new(0);
17995 #endif /* FREECIV_JSON_CONNECTION */
17996
17997 for (i = 0; i < FEELING_LAST; i++) {
17998 #ifdef FREECIV_JSON_CONNECTION
17999 field_addr.sub_location->number = i;
18000 #endif /* FREECIV_JSON_CONNECTION */
18001 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
18002 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
18003 }
18004 }
18005
18006 #ifdef FREECIV_JSON_CONNECTION
18007 /* Exit array. */
18008 free(field_addr.sub_location);
18009 field_addr.sub_location = NULL;
18010 #endif /* FREECIV_JSON_CONNECTION */
18011 }
18012 #ifdef FREECIV_JSON_CONNECTION
18013 field_addr.name = "ppl_angry";
18014 #endif /* FREECIV_JSON_CONNECTION */
18015
18016 {
18017 int i;
18018
18019 #ifdef FREECIV_JSON_CONNECTION
18020 /* Enter array. */
18021 field_addr.sub_location = plocation_elem_new(0);
18022 #endif /* FREECIV_JSON_CONNECTION */
18023
18024 for (i = 0; i < FEELING_LAST; i++) {
18025 #ifdef FREECIV_JSON_CONNECTION
18026 field_addr.sub_location->number = i;
18027 #endif /* FREECIV_JSON_CONNECTION */
18028 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
18029 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
18030 }
18031 }
18032
18033 #ifdef FREECIV_JSON_CONNECTION
18034 /* Exit array. */
18035 free(field_addr.sub_location);
18036 field_addr.sub_location = NULL;
18037 #endif /* FREECIV_JSON_CONNECTION */
18038 }
18039 #ifdef FREECIV_JSON_CONNECTION
18040 field_addr.name = "specialists_size";
18041 #endif /* FREECIV_JSON_CONNECTION */
18042 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
18043 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
18044 }
18045 #ifdef FREECIV_JSON_CONNECTION
18046 field_addr.name = "specialists";
18047 #endif /* FREECIV_JSON_CONNECTION */
18048
18049 {
18050 int i;
18051
18052 #ifdef FREECIV_JSON_CONNECTION
18053 /* Enter array. */
18054 field_addr.sub_location = plocation_elem_new(0);
18055 #endif /* FREECIV_JSON_CONNECTION */
18056
18057 if (real_packet->specialists_size > SP_MAX) {
18058 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
18059 }
18060 for (i = 0; i < real_packet->specialists_size; i++) {
18061 #ifdef FREECIV_JSON_CONNECTION
18062 field_addr.sub_location->number = i;
18063 #endif /* FREECIV_JSON_CONNECTION */
18064 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
18065 RECEIVE_PACKET_FIELD_ERROR(specialists);
18066 }
18067 }
18068
18069 #ifdef FREECIV_JSON_CONNECTION
18070 /* Exit array. */
18071 free(field_addr.sub_location);
18072 field_addr.sub_location = NULL;
18073 #endif /* FREECIV_JSON_CONNECTION */
18074 }
18075 #ifdef FREECIV_JSON_CONNECTION
18076 field_addr.name = "history";
18077 #endif /* FREECIV_JSON_CONNECTION */
18078 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
18079 RECEIVE_PACKET_FIELD_ERROR(history);
18080 }
18081 #ifdef FREECIV_JSON_CONNECTION
18082 field_addr.name = "culture";
18083 #endif /* FREECIV_JSON_CONNECTION */
18084 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
18085 RECEIVE_PACKET_FIELD_ERROR(culture);
18086 }
18087 #ifdef FREECIV_JSON_CONNECTION
18088 field_addr.name = "buy_cost";
18089 #endif /* FREECIV_JSON_CONNECTION */
18090 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->buy_cost)) {
18091 RECEIVE_PACKET_FIELD_ERROR(buy_cost);
18092 }
18093 #ifdef FREECIV_JSON_CONNECTION
18094 field_addr.name = "surplus";
18095 #endif /* FREECIV_JSON_CONNECTION */
18096
18097 {
18098 int i;
18099
18100 #ifdef FREECIV_JSON_CONNECTION
18101 /* Enter array. */
18102 field_addr.sub_location = plocation_elem_new(0);
18103 #endif /* FREECIV_JSON_CONNECTION */
18104
18105 for (i = 0; i < O_LAST; i++) {
18106 #ifdef FREECIV_JSON_CONNECTION
18107 field_addr.sub_location->number = i;
18108 #endif /* FREECIV_JSON_CONNECTION */
18109 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->surplus[i])) {
18110 RECEIVE_PACKET_FIELD_ERROR(surplus);
18111 }
18112 }
18113
18114 #ifdef FREECIV_JSON_CONNECTION
18115 /* Exit array. */
18116 free(field_addr.sub_location);
18117 field_addr.sub_location = NULL;
18118 #endif /* FREECIV_JSON_CONNECTION */
18119 }
18120 #ifdef FREECIV_JSON_CONNECTION
18121 field_addr.name = "waste";
18122 #endif /* FREECIV_JSON_CONNECTION */
18123
18124 {
18125 int i;
18126
18127 #ifdef FREECIV_JSON_CONNECTION
18128 /* Enter array. */
18129 field_addr.sub_location = plocation_elem_new(0);
18130 #endif /* FREECIV_JSON_CONNECTION */
18131
18132 for (i = 0; i < O_LAST; i++) {
18133 #ifdef FREECIV_JSON_CONNECTION
18134 field_addr.sub_location->number = i;
18135 #endif /* FREECIV_JSON_CONNECTION */
18136 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->waste[i])) {
18137 RECEIVE_PACKET_FIELD_ERROR(waste);
18138 }
18139 }
18140
18141 #ifdef FREECIV_JSON_CONNECTION
18142 /* Exit array. */
18143 free(field_addr.sub_location);
18144 field_addr.sub_location = NULL;
18145 #endif /* FREECIV_JSON_CONNECTION */
18146 }
18147 #ifdef FREECIV_JSON_CONNECTION
18148 field_addr.name = "unhappy_penalty";
18149 #endif /* FREECIV_JSON_CONNECTION */
18150
18151 {
18152 int i;
18153
18154 #ifdef FREECIV_JSON_CONNECTION
18155 /* Enter array. */
18156 field_addr.sub_location = plocation_elem_new(0);
18157 #endif /* FREECIV_JSON_CONNECTION */
18158
18159 for (i = 0; i < O_LAST; i++) {
18160 #ifdef FREECIV_JSON_CONNECTION
18161 field_addr.sub_location->number = i;
18162 #endif /* FREECIV_JSON_CONNECTION */
18163 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->unhappy_penalty[i])) {
18164 RECEIVE_PACKET_FIELD_ERROR(unhappy_penalty);
18165 }
18166 }
18167
18168 #ifdef FREECIV_JSON_CONNECTION
18169 /* Exit array. */
18170 free(field_addr.sub_location);
18171 field_addr.sub_location = NULL;
18172 #endif /* FREECIV_JSON_CONNECTION */
18173 }
18174 #ifdef FREECIV_JSON_CONNECTION
18175 field_addr.name = "prod";
18176 #endif /* FREECIV_JSON_CONNECTION */
18177
18178 {
18179 int i;
18180
18181 #ifdef FREECIV_JSON_CONNECTION
18182 /* Enter array. */
18183 field_addr.sub_location = plocation_elem_new(0);
18184 #endif /* FREECIV_JSON_CONNECTION */
18185
18186 for (i = 0; i < O_LAST; i++) {
18187 #ifdef FREECIV_JSON_CONNECTION
18188 field_addr.sub_location->number = i;
18189 #endif /* FREECIV_JSON_CONNECTION */
18190 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->prod[i])) {
18191 RECEIVE_PACKET_FIELD_ERROR(prod);
18192 }
18193 }
18194
18195 #ifdef FREECIV_JSON_CONNECTION
18196 /* Exit array. */
18197 free(field_addr.sub_location);
18198 field_addr.sub_location = NULL;
18199 #endif /* FREECIV_JSON_CONNECTION */
18200 }
18201 #ifdef FREECIV_JSON_CONNECTION
18202 field_addr.name = "citizen_base";
18203 #endif /* FREECIV_JSON_CONNECTION */
18204
18205 {
18206 int i;
18207
18208 #ifdef FREECIV_JSON_CONNECTION
18209 /* Enter array. */
18210 field_addr.sub_location = plocation_elem_new(0);
18211 #endif /* FREECIV_JSON_CONNECTION */
18212
18213 for (i = 0; i < O_LAST; i++) {
18214 #ifdef FREECIV_JSON_CONNECTION
18215 field_addr.sub_location->number = i;
18216 #endif /* FREECIV_JSON_CONNECTION */
18217 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->citizen_base[i])) {
18218 RECEIVE_PACKET_FIELD_ERROR(citizen_base);
18219 }
18220 }
18221
18222 #ifdef FREECIV_JSON_CONNECTION
18223 /* Exit array. */
18224 free(field_addr.sub_location);
18225 field_addr.sub_location = NULL;
18226 #endif /* FREECIV_JSON_CONNECTION */
18227 }
18228 #ifdef FREECIV_JSON_CONNECTION
18229 field_addr.name = "usage";
18230 #endif /* FREECIV_JSON_CONNECTION */
18231
18232 {
18233 int i;
18234
18235 #ifdef FREECIV_JSON_CONNECTION
18236 /* Enter array. */
18237 field_addr.sub_location = plocation_elem_new(0);
18238 #endif /* FREECIV_JSON_CONNECTION */
18239
18240 for (i = 0; i < O_LAST; i++) {
18241 #ifdef FREECIV_JSON_CONNECTION
18242 field_addr.sub_location->number = i;
18243 #endif /* FREECIV_JSON_CONNECTION */
18244 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->usage[i])) {
18245 RECEIVE_PACKET_FIELD_ERROR(usage);
18246 }
18247 }
18248
18249 #ifdef FREECIV_JSON_CONNECTION
18250 /* Exit array. */
18251 free(field_addr.sub_location);
18252 field_addr.sub_location = NULL;
18253 #endif /* FREECIV_JSON_CONNECTION */
18254 }
18255 #ifdef FREECIV_JSON_CONNECTION
18256 field_addr.name = "food_stock";
18257 #endif /* FREECIV_JSON_CONNECTION */
18258 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->food_stock)) {
18259 RECEIVE_PACKET_FIELD_ERROR(food_stock);
18260 }
18261 #ifdef FREECIV_JSON_CONNECTION
18262 field_addr.name = "shield_stock";
18263 #endif /* FREECIV_JSON_CONNECTION */
18264 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
18265 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
18266 }
18267 #ifdef FREECIV_JSON_CONNECTION
18268 field_addr.name = "trade_route_count";
18269 #endif /* FREECIV_JSON_CONNECTION */
18270 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_route_count)) {
18271 RECEIVE_PACKET_FIELD_ERROR(trade_route_count);
18272 }
18273 #ifdef FREECIV_JSON_CONNECTION
18274 field_addr.name = "pollution";
18275 #endif /* FREECIV_JSON_CONNECTION */
18276 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->pollution)) {
18277 RECEIVE_PACKET_FIELD_ERROR(pollution);
18278 }
18279 #ifdef FREECIV_JSON_CONNECTION
18280 field_addr.name = "illness_trade";
18281 #endif /* FREECIV_JSON_CONNECTION */
18282 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade)) {
18283 RECEIVE_PACKET_FIELD_ERROR(illness_trade);
18284 }
18285 #ifdef FREECIV_JSON_CONNECTION
18286 field_addr.name = "production_kind";
18287 #endif /* FREECIV_JSON_CONNECTION */
18288 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
18289 RECEIVE_PACKET_FIELD_ERROR(production_kind);
18290 }
18291 #ifdef FREECIV_JSON_CONNECTION
18292 field_addr.name = "production_value";
18293 #endif /* FREECIV_JSON_CONNECTION */
18294 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
18295 RECEIVE_PACKET_FIELD_ERROR(production_value);
18296 }
18297 #ifdef FREECIV_JSON_CONNECTION
18298 field_addr.name = "turn_founded";
18299 #endif /* FREECIV_JSON_CONNECTION */
18300 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
18301 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
18302 }
18303 #ifdef FREECIV_JSON_CONNECTION
18304 field_addr.name = "turn_last_built";
18305 #endif /* FREECIV_JSON_CONNECTION */
18306 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
18307 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
18308 }
18309 #ifdef FREECIV_JSON_CONNECTION
18310 field_addr.name = "changed_from_kind";
18311 #endif /* FREECIV_JSON_CONNECTION */
18312 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_kind)) {
18313 RECEIVE_PACKET_FIELD_ERROR(changed_from_kind);
18314 }
18315 #ifdef FREECIV_JSON_CONNECTION
18316 field_addr.name = "changed_from_value";
18317 #endif /* FREECIV_JSON_CONNECTION */
18318 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_value)) {
18319 RECEIVE_PACKET_FIELD_ERROR(changed_from_value);
18320 }
18321 #ifdef FREECIV_JSON_CONNECTION
18322 field_addr.name = "before_change_shields";
18323 #endif /* FREECIV_JSON_CONNECTION */
18324 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->before_change_shields)) {
18325 RECEIVE_PACKET_FIELD_ERROR(before_change_shields);
18326 }
18327 #ifdef FREECIV_JSON_CONNECTION
18328 field_addr.name = "disbanded_shields";
18329 #endif /* FREECIV_JSON_CONNECTION */
18330 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disbanded_shields)) {
18331 RECEIVE_PACKET_FIELD_ERROR(disbanded_shields);
18332 }
18333 #ifdef FREECIV_JSON_CONNECTION
18334 field_addr.name = "caravan_shields";
18335 #endif /* FREECIV_JSON_CONNECTION */
18336 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->caravan_shields)) {
18337 RECEIVE_PACKET_FIELD_ERROR(caravan_shields);
18338 }
18339 #ifdef FREECIV_JSON_CONNECTION
18340 field_addr.name = "last_turns_shield_surplus";
18341 #endif /* FREECIV_JSON_CONNECTION */
18342 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->last_turns_shield_surplus)) {
18343 RECEIVE_PACKET_FIELD_ERROR(last_turns_shield_surplus);
18344 }
18345 #ifdef FREECIV_JSON_CONNECTION
18346 field_addr.name = "airlift";
18347 #endif /* FREECIV_JSON_CONNECTION */
18348 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->airlift)) {
18349 RECEIVE_PACKET_FIELD_ERROR(airlift);
18350 }
18351 #ifdef FREECIV_JSON_CONNECTION
18352 field_addr.name = "did_buy";
18353 #endif /* FREECIV_JSON_CONNECTION */
18354 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_buy)) {
18355 RECEIVE_PACKET_FIELD_ERROR(did_buy);
18356 }
18357 #ifdef FREECIV_JSON_CONNECTION
18358 field_addr.name = "did_sell";
18359 #endif /* FREECIV_JSON_CONNECTION */
18360 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_sell)) {
18361 RECEIVE_PACKET_FIELD_ERROR(did_sell);
18362 }
18363 #ifdef FREECIV_JSON_CONNECTION
18364 field_addr.name = "was_happy";
18365 #endif /* FREECIV_JSON_CONNECTION */
18366 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->was_happy)) {
18367 RECEIVE_PACKET_FIELD_ERROR(was_happy);
18368 }
18369 #ifdef FREECIV_JSON_CONNECTION
18370 field_addr.name = "diplomat_investigate";
18371 #endif /* FREECIV_JSON_CONNECTION */
18372 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->diplomat_investigate)) {
18373 RECEIVE_PACKET_FIELD_ERROR(diplomat_investigate);
18374 }
18375 #ifdef FREECIV_JSON_CONNECTION
18376 field_addr.name = "walls";
18377 #endif /* FREECIV_JSON_CONNECTION */
18378 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
18379 RECEIVE_PACKET_FIELD_ERROR(walls);
18380 }
18381 #ifdef FREECIV_JSON_CONNECTION
18382 field_addr.name = "city_image";
18383 #endif /* FREECIV_JSON_CONNECTION */
18384 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
18385 RECEIVE_PACKET_FIELD_ERROR(city_image);
18386 }
18387 #ifdef FREECIV_JSON_CONNECTION
18388 field_addr.name = "steal";
18389 #endif /* FREECIV_JSON_CONNECTION */
18390 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->steal)) {
18391 RECEIVE_PACKET_FIELD_ERROR(steal);
18392 }
18393 #ifdef FREECIV_JSON_CONNECTION
18394 field_addr.name = "worklist";
18395 #endif /* FREECIV_JSON_CONNECTION */
18396 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
18397 RECEIVE_PACKET_FIELD_ERROR(worklist);
18398 }
18399 #ifdef FREECIV_JSON_CONNECTION
18400 field_addr.name = "improvements";
18401 #endif /* FREECIV_JSON_CONNECTION */
18402 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
18403 RECEIVE_PACKET_FIELD_ERROR(improvements);
18404 }
18405 #ifdef FREECIV_JSON_CONNECTION
18406 field_addr.name = "city_options";
18407 #endif /* FREECIV_JSON_CONNECTION */
18408 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
18409 RECEIVE_PACKET_FIELD_ERROR(city_options);
18410 }
18411 #ifdef FREECIV_JSON_CONNECTION
18412 field_addr.name = "name";
18413 #endif /* FREECIV_JSON_CONNECTION */
18414 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
18415 RECEIVE_PACKET_FIELD_ERROR(name);
18416 }
18417
18418#endif
18419 log_packet_detailed("packet_city_info_102: got info about (%d)",
18420 real_packet->id16);
18421
18422#ifdef FREECIV_DELTA_PROTOCOL
18423 if (NULL == *hash) {
18424 *hash = genhash_new_full(hash_packet_city_info_102, cmp_packet_city_info_102,
18425 NULL, NULL, NULL, free);
18426 }
18427
18428 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
18429 *real_packet = *old;
18430 } else {
18431 int id16 = real_packet->id16;
18432
18433 log_packet_detailed(" no old info");
18434 memset(real_packet, 0, sizeof(*real_packet));
18435
18436 real_packet->id16 = id16;
18437 }
18438
18439 if (BV_ISSET(fields, 0)) {
18440 log_packet_detailed(" got field 'tile'");
18441 #ifdef FREECIV_JSON_CONNECTION
18442 field_addr.name = "tile";
18443 #endif /* FREECIV_JSON_CONNECTION */
18444 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
18445 RECEIVE_PACKET_FIELD_ERROR(tile);
18446 }
18447 }
18448 if (BV_ISSET(fields, 1)) {
18449 log_packet_detailed(" got field 'owner'");
18450 #ifdef FREECIV_JSON_CONNECTION
18451 field_addr.name = "owner";
18452 #endif /* FREECIV_JSON_CONNECTION */
18453 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
18454 RECEIVE_PACKET_FIELD_ERROR(owner);
18455 }
18456 }
18457 if (BV_ISSET(fields, 2)) {
18458 log_packet_detailed(" got field 'original'");
18459 #ifdef FREECIV_JSON_CONNECTION
18460 field_addr.name = "original";
18461 #endif /* FREECIV_JSON_CONNECTION */
18462 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->original)) {
18463 RECEIVE_PACKET_FIELD_ERROR(original);
18464 }
18465 }
18466 if (BV_ISSET(fields, 3)) {
18467 log_packet_detailed(" got field 'size'");
18468 #ifdef FREECIV_JSON_CONNECTION
18469 field_addr.name = "size";
18470 #endif /* FREECIV_JSON_CONNECTION */
18471 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
18472 RECEIVE_PACKET_FIELD_ERROR(size);
18473 }
18474 }
18475 if (BV_ISSET(fields, 4)) {
18476 log_packet_detailed(" got field 'city_radius_sq'");
18477 #ifdef FREECIV_JSON_CONNECTION
18478 field_addr.name = "city_radius_sq";
18479 #endif /* FREECIV_JSON_CONNECTION */
18480 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_radius_sq)) {
18481 RECEIVE_PACKET_FIELD_ERROR(city_radius_sq);
18482 }
18483 }
18484 if (BV_ISSET(fields, 5)) {
18485 log_packet_detailed(" got field 'style'");
18486 #ifdef FREECIV_JSON_CONNECTION
18487 field_addr.name = "style";
18488 #endif /* FREECIV_JSON_CONNECTION */
18489 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
18490 RECEIVE_PACKET_FIELD_ERROR(style);
18491 }
18492 }
18493 if (BV_ISSET(fields, 6)) {
18494 log_packet_detailed(" got field 'capital'");
18495 #ifdef FREECIV_JSON_CONNECTION
18496 field_addr.name = "capital";
18497 #endif /* FREECIV_JSON_CONNECTION */
18498 {
18499 int readin;
18500
18501 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
18502 RECEIVE_PACKET_FIELD_ERROR(capital);
18503 }
18504 real_packet->capital = readin;
18505 }
18506 }
18507 if (BV_ISSET(fields, 7)) {
18508 log_packet_detailed(" got field 'ppl_happy'");
18509 #ifdef FREECIV_JSON_CONNECTION
18510 field_addr.name = "ppl_happy";
18511 #endif /* FREECIV_JSON_CONNECTION */
18512
18513 {
18514 int i;
18515
18516 #ifdef FREECIV_JSON_CONNECTION
18517 /* Enter array. */
18518 field_addr.sub_location = plocation_elem_new(0);
18519 #endif /* FREECIV_JSON_CONNECTION */
18520
18521 for (i = 0; i < FEELING_LAST; i++) {
18522 #ifdef FREECIV_JSON_CONNECTION
18523 field_addr.sub_location->number = i;
18524 #endif /* FREECIV_JSON_CONNECTION */
18525 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
18526 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
18527 }
18528 }
18529
18530 #ifdef FREECIV_JSON_CONNECTION
18531 /* Exit array. */
18532 free(field_addr.sub_location);
18533 field_addr.sub_location = NULL;
18534 #endif /* FREECIV_JSON_CONNECTION */
18535 }
18536 }
18537 if (BV_ISSET(fields, 8)) {
18538 log_packet_detailed(" got field 'ppl_content'");
18539 #ifdef FREECIV_JSON_CONNECTION
18540 field_addr.name = "ppl_content";
18541 #endif /* FREECIV_JSON_CONNECTION */
18542
18543 {
18544 int i;
18545
18546 #ifdef FREECIV_JSON_CONNECTION
18547 /* Enter array. */
18548 field_addr.sub_location = plocation_elem_new(0);
18549 #endif /* FREECIV_JSON_CONNECTION */
18550
18551 for (i = 0; i < FEELING_LAST; i++) {
18552 #ifdef FREECIV_JSON_CONNECTION
18553 field_addr.sub_location->number = i;
18554 #endif /* FREECIV_JSON_CONNECTION */
18555 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
18556 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
18557 }
18558 }
18559
18560 #ifdef FREECIV_JSON_CONNECTION
18561 /* Exit array. */
18562 free(field_addr.sub_location);
18563 field_addr.sub_location = NULL;
18564 #endif /* FREECIV_JSON_CONNECTION */
18565 }
18566 }
18567 if (BV_ISSET(fields, 9)) {
18568 log_packet_detailed(" got field 'ppl_unhappy'");
18569 #ifdef FREECIV_JSON_CONNECTION
18570 field_addr.name = "ppl_unhappy";
18571 #endif /* FREECIV_JSON_CONNECTION */
18572
18573 {
18574 int i;
18575
18576 #ifdef FREECIV_JSON_CONNECTION
18577 /* Enter array. */
18578 field_addr.sub_location = plocation_elem_new(0);
18579 #endif /* FREECIV_JSON_CONNECTION */
18580
18581 for (i = 0; i < FEELING_LAST; i++) {
18582 #ifdef FREECIV_JSON_CONNECTION
18583 field_addr.sub_location->number = i;
18584 #endif /* FREECIV_JSON_CONNECTION */
18585 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
18586 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
18587 }
18588 }
18589
18590 #ifdef FREECIV_JSON_CONNECTION
18591 /* Exit array. */
18592 free(field_addr.sub_location);
18593 field_addr.sub_location = NULL;
18594 #endif /* FREECIV_JSON_CONNECTION */
18595 }
18596 }
18597 if (BV_ISSET(fields, 10)) {
18598 log_packet_detailed(" got field 'ppl_angry'");
18599 #ifdef FREECIV_JSON_CONNECTION
18600 field_addr.name = "ppl_angry";
18601 #endif /* FREECIV_JSON_CONNECTION */
18602
18603 {
18604 int i;
18605
18606 #ifdef FREECIV_JSON_CONNECTION
18607 /* Enter array. */
18608 field_addr.sub_location = plocation_elem_new(0);
18609 #endif /* FREECIV_JSON_CONNECTION */
18610
18611 for (i = 0; i < FEELING_LAST; i++) {
18612 #ifdef FREECIV_JSON_CONNECTION
18613 field_addr.sub_location->number = i;
18614 #endif /* FREECIV_JSON_CONNECTION */
18615 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
18616 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
18617 }
18618 }
18619
18620 #ifdef FREECIV_JSON_CONNECTION
18621 /* Exit array. */
18622 free(field_addr.sub_location);
18623 field_addr.sub_location = NULL;
18624 #endif /* FREECIV_JSON_CONNECTION */
18625 }
18626 }
18627 if (BV_ISSET(fields, 11)) {
18628 log_packet_detailed(" got field 'specialists_size'");
18629 #ifdef FREECIV_JSON_CONNECTION
18630 field_addr.name = "specialists_size";
18631 #endif /* FREECIV_JSON_CONNECTION */
18632 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
18633 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
18634 }
18635 }
18636 if (BV_ISSET(fields, 12)) {
18637 log_packet_detailed(" got field 'specialists'");
18638 #ifdef FREECIV_JSON_CONNECTION
18639 field_addr.name = "specialists";
18640 #endif /* FREECIV_JSON_CONNECTION */
18641
18642 {
18643 int i;
18644
18645 #ifdef FREECIV_JSON_CONNECTION
18646 /* Enter array. */
18647 field_addr.sub_location = plocation_elem_new(0);
18648 #endif /* FREECIV_JSON_CONNECTION */
18649
18650 if (real_packet->specialists_size > SP_MAX) {
18651 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
18652 }
18653 for (i = 0; i < real_packet->specialists_size; i++) {
18654 #ifdef FREECIV_JSON_CONNECTION
18655 field_addr.sub_location->number = i;
18656 #endif /* FREECIV_JSON_CONNECTION */
18657 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
18658 RECEIVE_PACKET_FIELD_ERROR(specialists);
18659 }
18660 }
18661
18662 #ifdef FREECIV_JSON_CONNECTION
18663 /* Exit array. */
18664 free(field_addr.sub_location);
18665 field_addr.sub_location = NULL;
18666 #endif /* FREECIV_JSON_CONNECTION */
18667 }
18668 }
18669 if (BV_ISSET(fields, 13)) {
18670 log_packet_detailed(" got field 'history'");
18671 #ifdef FREECIV_JSON_CONNECTION
18672 field_addr.name = "history";
18673 #endif /* FREECIV_JSON_CONNECTION */
18674 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
18675 RECEIVE_PACKET_FIELD_ERROR(history);
18676 }
18677 }
18678 if (BV_ISSET(fields, 14)) {
18679 log_packet_detailed(" got field 'culture'");
18680 #ifdef FREECIV_JSON_CONNECTION
18681 field_addr.name = "culture";
18682 #endif /* FREECIV_JSON_CONNECTION */
18683 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
18684 RECEIVE_PACKET_FIELD_ERROR(culture);
18685 }
18686 }
18687 if (BV_ISSET(fields, 15)) {
18688 log_packet_detailed(" got field 'buy_cost'");
18689 #ifdef FREECIV_JSON_CONNECTION
18690 field_addr.name = "buy_cost";
18691 #endif /* FREECIV_JSON_CONNECTION */
18692 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->buy_cost)) {
18693 RECEIVE_PACKET_FIELD_ERROR(buy_cost);
18694 }
18695 }
18696 if (BV_ISSET(fields, 16)) {
18697 log_packet_detailed(" got field 'surplus'");
18698 #ifdef FREECIV_JSON_CONNECTION
18699 field_addr.name = "surplus";
18700 #endif /* FREECIV_JSON_CONNECTION */
18701
18702 {
18703 int i;
18704
18705 #ifdef FREECIV_JSON_CONNECTION
18706 /* Enter array. */
18707 field_addr.sub_location = plocation_elem_new(0);
18708 #endif /* FREECIV_JSON_CONNECTION */
18709
18710 for (i = 0; i < O_LAST; i++) {
18711 #ifdef FREECIV_JSON_CONNECTION
18712 field_addr.sub_location->number = i;
18713 #endif /* FREECIV_JSON_CONNECTION */
18714 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->surplus[i])) {
18715 RECEIVE_PACKET_FIELD_ERROR(surplus);
18716 }
18717 }
18718
18719 #ifdef FREECIV_JSON_CONNECTION
18720 /* Exit array. */
18721 free(field_addr.sub_location);
18722 field_addr.sub_location = NULL;
18723 #endif /* FREECIV_JSON_CONNECTION */
18724 }
18725 }
18726 if (BV_ISSET(fields, 17)) {
18727 log_packet_detailed(" got field 'waste'");
18728 #ifdef FREECIV_JSON_CONNECTION
18729 field_addr.name = "waste";
18730 #endif /* FREECIV_JSON_CONNECTION */
18731
18732 {
18733 int i;
18734
18735 #ifdef FREECIV_JSON_CONNECTION
18736 /* Enter array. */
18737 field_addr.sub_location = plocation_elem_new(0);
18738 #endif /* FREECIV_JSON_CONNECTION */
18739
18740 for (i = 0; i < O_LAST; i++) {
18741 #ifdef FREECIV_JSON_CONNECTION
18742 field_addr.sub_location->number = i;
18743 #endif /* FREECIV_JSON_CONNECTION */
18744 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->waste[i])) {
18745 RECEIVE_PACKET_FIELD_ERROR(waste);
18746 }
18747 }
18748
18749 #ifdef FREECIV_JSON_CONNECTION
18750 /* Exit array. */
18751 free(field_addr.sub_location);
18752 field_addr.sub_location = NULL;
18753 #endif /* FREECIV_JSON_CONNECTION */
18754 }
18755 }
18756 if (BV_ISSET(fields, 18)) {
18757 log_packet_detailed(" got field 'unhappy_penalty'");
18758 #ifdef FREECIV_JSON_CONNECTION
18759 field_addr.name = "unhappy_penalty";
18760 #endif /* FREECIV_JSON_CONNECTION */
18761
18762 {
18763 int i;
18764
18765 #ifdef FREECIV_JSON_CONNECTION
18766 /* Enter array. */
18767 field_addr.sub_location = plocation_elem_new(0);
18768 #endif /* FREECIV_JSON_CONNECTION */
18769
18770 for (i = 0; i < O_LAST; i++) {
18771 #ifdef FREECIV_JSON_CONNECTION
18772 field_addr.sub_location->number = i;
18773 #endif /* FREECIV_JSON_CONNECTION */
18774 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->unhappy_penalty[i])) {
18775 RECEIVE_PACKET_FIELD_ERROR(unhappy_penalty);
18776 }
18777 }
18778
18779 #ifdef FREECIV_JSON_CONNECTION
18780 /* Exit array. */
18781 free(field_addr.sub_location);
18782 field_addr.sub_location = NULL;
18783 #endif /* FREECIV_JSON_CONNECTION */
18784 }
18785 }
18786 if (BV_ISSET(fields, 19)) {
18787 log_packet_detailed(" got field 'prod'");
18788 #ifdef FREECIV_JSON_CONNECTION
18789 field_addr.name = "prod";
18790 #endif /* FREECIV_JSON_CONNECTION */
18791
18792 {
18793 int i;
18794
18795 #ifdef FREECIV_JSON_CONNECTION
18796 /* Enter array. */
18797 field_addr.sub_location = plocation_elem_new(0);
18798 #endif /* FREECIV_JSON_CONNECTION */
18799
18800 for (i = 0; i < O_LAST; i++) {
18801 #ifdef FREECIV_JSON_CONNECTION
18802 field_addr.sub_location->number = i;
18803 #endif /* FREECIV_JSON_CONNECTION */
18804 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->prod[i])) {
18805 RECEIVE_PACKET_FIELD_ERROR(prod);
18806 }
18807 }
18808
18809 #ifdef FREECIV_JSON_CONNECTION
18810 /* Exit array. */
18811 free(field_addr.sub_location);
18812 field_addr.sub_location = NULL;
18813 #endif /* FREECIV_JSON_CONNECTION */
18814 }
18815 }
18816 if (BV_ISSET(fields, 20)) {
18817 log_packet_detailed(" got field 'citizen_base'");
18818 #ifdef FREECIV_JSON_CONNECTION
18819 field_addr.name = "citizen_base";
18820 #endif /* FREECIV_JSON_CONNECTION */
18821
18822 {
18823 int i;
18824
18825 #ifdef FREECIV_JSON_CONNECTION
18826 /* Enter array. */
18827 field_addr.sub_location = plocation_elem_new(0);
18828 #endif /* FREECIV_JSON_CONNECTION */
18829
18830 for (i = 0; i < O_LAST; i++) {
18831 #ifdef FREECIV_JSON_CONNECTION
18832 field_addr.sub_location->number = i;
18833 #endif /* FREECIV_JSON_CONNECTION */
18834 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->citizen_base[i])) {
18835 RECEIVE_PACKET_FIELD_ERROR(citizen_base);
18836 }
18837 }
18838
18839 #ifdef FREECIV_JSON_CONNECTION
18840 /* Exit array. */
18841 free(field_addr.sub_location);
18842 field_addr.sub_location = NULL;
18843 #endif /* FREECIV_JSON_CONNECTION */
18844 }
18845 }
18846 if (BV_ISSET(fields, 21)) {
18847 log_packet_detailed(" got field 'usage'");
18848 #ifdef FREECIV_JSON_CONNECTION
18849 field_addr.name = "usage";
18850 #endif /* FREECIV_JSON_CONNECTION */
18851
18852 {
18853 int i;
18854
18855 #ifdef FREECIV_JSON_CONNECTION
18856 /* Enter array. */
18857 field_addr.sub_location = plocation_elem_new(0);
18858 #endif /* FREECIV_JSON_CONNECTION */
18859
18860 for (i = 0; i < O_LAST; i++) {
18861 #ifdef FREECIV_JSON_CONNECTION
18862 field_addr.sub_location->number = i;
18863 #endif /* FREECIV_JSON_CONNECTION */
18864 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->usage[i])) {
18865 RECEIVE_PACKET_FIELD_ERROR(usage);
18866 }
18867 }
18868
18869 #ifdef FREECIV_JSON_CONNECTION
18870 /* Exit array. */
18871 free(field_addr.sub_location);
18872 field_addr.sub_location = NULL;
18873 #endif /* FREECIV_JSON_CONNECTION */
18874 }
18875 }
18876 if (BV_ISSET(fields, 22)) {
18877 log_packet_detailed(" got field 'food_stock'");
18878 #ifdef FREECIV_JSON_CONNECTION
18879 field_addr.name = "food_stock";
18880 #endif /* FREECIV_JSON_CONNECTION */
18881 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->food_stock)) {
18882 RECEIVE_PACKET_FIELD_ERROR(food_stock);
18883 }
18884 }
18885 if (BV_ISSET(fields, 23)) {
18886 log_packet_detailed(" got field 'shield_stock'");
18887 #ifdef FREECIV_JSON_CONNECTION
18888 field_addr.name = "shield_stock";
18889 #endif /* FREECIV_JSON_CONNECTION */
18890 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
18891 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
18892 }
18893 }
18894 if (BV_ISSET(fields, 24)) {
18895 log_packet_detailed(" got field 'trade_route_count'");
18896 #ifdef FREECIV_JSON_CONNECTION
18897 field_addr.name = "trade_route_count";
18898 #endif /* FREECIV_JSON_CONNECTION */
18899 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_route_count)) {
18900 RECEIVE_PACKET_FIELD_ERROR(trade_route_count);
18901 }
18902 }
18903 if (BV_ISSET(fields, 25)) {
18904 log_packet_detailed(" got field 'pollution'");
18905 #ifdef FREECIV_JSON_CONNECTION
18906 field_addr.name = "pollution";
18907 #endif /* FREECIV_JSON_CONNECTION */
18908 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->pollution)) {
18909 RECEIVE_PACKET_FIELD_ERROR(pollution);
18910 }
18911 }
18912 if (BV_ISSET(fields, 26)) {
18913 log_packet_detailed(" got field 'illness_trade'");
18914 #ifdef FREECIV_JSON_CONNECTION
18915 field_addr.name = "illness_trade";
18916 #endif /* FREECIV_JSON_CONNECTION */
18917 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade)) {
18918 RECEIVE_PACKET_FIELD_ERROR(illness_trade);
18919 }
18920 }
18921 if (BV_ISSET(fields, 27)) {
18922 log_packet_detailed(" got field 'production_kind'");
18923 #ifdef FREECIV_JSON_CONNECTION
18924 field_addr.name = "production_kind";
18925 #endif /* FREECIV_JSON_CONNECTION */
18926 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
18927 RECEIVE_PACKET_FIELD_ERROR(production_kind);
18928 }
18929 }
18930 if (BV_ISSET(fields, 28)) {
18931 log_packet_detailed(" got field 'production_value'");
18932 #ifdef FREECIV_JSON_CONNECTION
18933 field_addr.name = "production_value";
18934 #endif /* FREECIV_JSON_CONNECTION */
18935 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
18936 RECEIVE_PACKET_FIELD_ERROR(production_value);
18937 }
18938 }
18939 if (BV_ISSET(fields, 29)) {
18940 log_packet_detailed(" got field 'turn_founded'");
18941 #ifdef FREECIV_JSON_CONNECTION
18942 field_addr.name = "turn_founded";
18943 #endif /* FREECIV_JSON_CONNECTION */
18944 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
18945 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
18946 }
18947 }
18948 if (BV_ISSET(fields, 30)) {
18949 log_packet_detailed(" got field 'turn_last_built'");
18950 #ifdef FREECIV_JSON_CONNECTION
18951 field_addr.name = "turn_last_built";
18952 #endif /* FREECIV_JSON_CONNECTION */
18953 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
18954 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
18955 }
18956 }
18957 if (BV_ISSET(fields, 31)) {
18958 log_packet_detailed(" got field 'changed_from_kind'");
18959 #ifdef FREECIV_JSON_CONNECTION
18960 field_addr.name = "changed_from_kind";
18961 #endif /* FREECIV_JSON_CONNECTION */
18962 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_kind)) {
18963 RECEIVE_PACKET_FIELD_ERROR(changed_from_kind);
18964 }
18965 }
18966 if (BV_ISSET(fields, 32)) {
18967 log_packet_detailed(" got field 'changed_from_value'");
18968 #ifdef FREECIV_JSON_CONNECTION
18969 field_addr.name = "changed_from_value";
18970 #endif /* FREECIV_JSON_CONNECTION */
18971 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_value)) {
18972 RECEIVE_PACKET_FIELD_ERROR(changed_from_value);
18973 }
18974 }
18975 if (BV_ISSET(fields, 33)) {
18976 log_packet_detailed(" got field 'before_change_shields'");
18977 #ifdef FREECIV_JSON_CONNECTION
18978 field_addr.name = "before_change_shields";
18979 #endif /* FREECIV_JSON_CONNECTION */
18980 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->before_change_shields)) {
18981 RECEIVE_PACKET_FIELD_ERROR(before_change_shields);
18982 }
18983 }
18984 if (BV_ISSET(fields, 34)) {
18985 log_packet_detailed(" got field 'disbanded_shields'");
18986 #ifdef FREECIV_JSON_CONNECTION
18987 field_addr.name = "disbanded_shields";
18988 #endif /* FREECIV_JSON_CONNECTION */
18989 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disbanded_shields)) {
18990 RECEIVE_PACKET_FIELD_ERROR(disbanded_shields);
18991 }
18992 }
18993 if (BV_ISSET(fields, 35)) {
18994 log_packet_detailed(" got field 'caravan_shields'");
18995 #ifdef FREECIV_JSON_CONNECTION
18996 field_addr.name = "caravan_shields";
18997 #endif /* FREECIV_JSON_CONNECTION */
18998 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->caravan_shields)) {
18999 RECEIVE_PACKET_FIELD_ERROR(caravan_shields);
19000 }
19001 }
19002 if (BV_ISSET(fields, 36)) {
19003 log_packet_detailed(" got field 'last_turns_shield_surplus'");
19004 #ifdef FREECIV_JSON_CONNECTION
19005 field_addr.name = "last_turns_shield_surplus";
19006 #endif /* FREECIV_JSON_CONNECTION */
19007 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->last_turns_shield_surplus)) {
19008 RECEIVE_PACKET_FIELD_ERROR(last_turns_shield_surplus);
19009 }
19010 }
19011 if (BV_ISSET(fields, 37)) {
19012 log_packet_detailed(" got field 'airlift'");
19013 #ifdef FREECIV_JSON_CONNECTION
19014 field_addr.name = "airlift";
19015 #endif /* FREECIV_JSON_CONNECTION */
19016 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->airlift)) {
19017 RECEIVE_PACKET_FIELD_ERROR(airlift);
19018 }
19019 }
19020 real_packet->did_buy = BV_ISSET(fields, 38);
19021 real_packet->did_sell = BV_ISSET(fields, 39);
19022 real_packet->was_happy = BV_ISSET(fields, 40);
19023 real_packet->diplomat_investigate = BV_ISSET(fields, 41);
19024 if (BV_ISSET(fields, 42)) {
19025 log_packet_detailed(" got field 'walls'");
19026 #ifdef FREECIV_JSON_CONNECTION
19027 field_addr.name = "walls";
19028 #endif /* FREECIV_JSON_CONNECTION */
19029 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
19030 RECEIVE_PACKET_FIELD_ERROR(walls);
19031 }
19032 }
19033 if (BV_ISSET(fields, 43)) {
19034 log_packet_detailed(" got field 'city_image'");
19035 #ifdef FREECIV_JSON_CONNECTION
19036 field_addr.name = "city_image";
19037 #endif /* FREECIV_JSON_CONNECTION */
19038 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
19039 RECEIVE_PACKET_FIELD_ERROR(city_image);
19040 }
19041 }
19042 if (BV_ISSET(fields, 44)) {
19043 log_packet_detailed(" got field 'steal'");
19044 #ifdef FREECIV_JSON_CONNECTION
19045 field_addr.name = "steal";
19046 #endif /* FREECIV_JSON_CONNECTION */
19047 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->steal)) {
19048 RECEIVE_PACKET_FIELD_ERROR(steal);
19049 }
19050 }
19051 if (BV_ISSET(fields, 45)) {
19052 log_packet_detailed(" got field 'worklist'");
19053 #ifdef FREECIV_JSON_CONNECTION
19054 field_addr.name = "worklist";
19055 #endif /* FREECIV_JSON_CONNECTION */
19056 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
19057 RECEIVE_PACKET_FIELD_ERROR(worklist);
19058 }
19059 }
19060 if (BV_ISSET(fields, 46)) {
19061 log_packet_detailed(" got field 'improvements'");
19062 #ifdef FREECIV_JSON_CONNECTION
19063 field_addr.name = "improvements";
19064 #endif /* FREECIV_JSON_CONNECTION */
19065 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
19066 RECEIVE_PACKET_FIELD_ERROR(improvements);
19067 }
19068 }
19069 if (BV_ISSET(fields, 47)) {
19070 log_packet_detailed(" got field 'city_options'");
19071 #ifdef FREECIV_JSON_CONNECTION
19072 field_addr.name = "city_options";
19073 #endif /* FREECIV_JSON_CONNECTION */
19074 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
19075 RECEIVE_PACKET_FIELD_ERROR(city_options);
19076 }
19077 }
19078 if (BV_ISSET(fields, 48)) {
19079 log_packet_detailed(" got field 'name'");
19080 #ifdef FREECIV_JSON_CONNECTION
19081 field_addr.name = "name";
19082 #endif /* FREECIV_JSON_CONNECTION */
19083 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
19084 RECEIVE_PACKET_FIELD_ERROR(name);
19085 }
19086 }
19087
19088 if (NULL == old) {
19089 old = fc_malloc(sizeof(*old));
19090 *old = *real_packet;
19091 genhash_insert(*hash, old, old);
19092 } else {
19093 *old = *real_packet;
19094 }
19095
19096 hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
19097 if (NULL != *hash) {
19098 genhash_remove(*hash, real_packet);
19099 }
19100
19101#endif /* FREECIV_DELTA_PROTOCOL */
19102 RECEIVE_PACKET_END(real_packet);
19103}
19104
19105 static int send_packet_city_info_102(struct connection *pc, const struct packet_city_info *packet, bool force_to_send)
19106{
19107 const struct packet_city_info *real_packet = packet;
19108#ifdef FREECIV_DELTA_PROTOCOL
19109 packet_city_info_102_fields fields;
19110 struct packet_city_info *old;
19111 bool differ;
19112 struct genhash **hash = pc->phs.sent + PACKET_CITY_INFO;
19113 int different = force_to_send;
19114#endif /* FREECIV_DELTA_PROTOCOL */
19115 SEND_PACKET_START(PACKET_CITY_INFO);
19116#ifdef FREECIV_JSON_CONNECTION
19117 struct plocation field_addr;
19118 {
19119 struct plocation *field_addr_tmp = plocation_field_new(NULL);
19120 field_addr = *field_addr_tmp;
19121 FC_FREE(field_addr_tmp);
19122 }
19123#endif /* FREECIV_JSON_CONNECTION */
19124
19125 log_packet_detailed("packet_city_info_102: sending info about (%d)",
19126 real_packet->id16);
19127
19128#ifdef FREECIV_DELTA_PROTOCOL
19129 if (NULL == *hash) {
19130 *hash = genhash_new_full(hash_packet_city_info_102, cmp_packet_city_info_102,
19131 NULL, NULL, NULL, free);
19132 }
19133 BV_CLR_ALL(fields);
19134
19135 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
19136 old = fc_malloc(sizeof(*old));
19137 *old = *real_packet;
19138 genhash_insert(*hash, old, old);
19139 memset(old, 0, sizeof(*old));
19140 different = 1; /* Force to send. */
19141 }
19142 differ = (old->tile != real_packet->tile);
19143 if (differ) {
19144 different++;
19145 BV_SET(fields, 0);
19146 }
19147
19148 differ = (old->owner != real_packet->owner);
19149 if (differ) {
19150 different++;
19151 BV_SET(fields, 1);
19152 }
19153
19154 differ = (old->original != real_packet->original);
19155 if (differ) {
19156 different++;
19157 BV_SET(fields, 2);
19158 }
19159
19160 differ = (old->size != real_packet->size);
19161 if (differ) {
19162 different++;
19163 BV_SET(fields, 3);
19164 }
19165
19166 differ = (old->city_radius_sq != real_packet->city_radius_sq);
19167 if (differ) {
19168 different++;
19169 BV_SET(fields, 4);
19170 }
19171
19172 differ = (old->style != real_packet->style);
19173 if (differ) {
19174 different++;
19175 BV_SET(fields, 5);
19176 }
19177
19178 differ = (old->capital != real_packet->capital);
19179 if (differ) {
19180 different++;
19181 BV_SET(fields, 6);
19182 }
19183
19184
19185 {
19186 differ = FALSE;
19187 {
19188 int i;
19189
19190 for (i = 0; i < FEELING_LAST; i++) {
19191 if (old->ppl_happy[i] != real_packet->ppl_happy[i]) {
19192 differ = TRUE;
19193 break;
19194 }
19195 }
19196 }
19197 }
19198 if (differ) {
19199 different++;
19200 BV_SET(fields, 7);
19201 }
19202
19203
19204 {
19205 differ = FALSE;
19206 {
19207 int i;
19208
19209 for (i = 0; i < FEELING_LAST; i++) {
19210 if (old->ppl_content[i] != real_packet->ppl_content[i]) {
19211 differ = TRUE;
19212 break;
19213 }
19214 }
19215 }
19216 }
19217 if (differ) {
19218 different++;
19219 BV_SET(fields, 8);
19220 }
19221
19222
19223 {
19224 differ = FALSE;
19225 {
19226 int i;
19227
19228 for (i = 0; i < FEELING_LAST; i++) {
19229 if (old->ppl_unhappy[i] != real_packet->ppl_unhappy[i]) {
19230 differ = TRUE;
19231 break;
19232 }
19233 }
19234 }
19235 }
19236 if (differ) {
19237 different++;
19238 BV_SET(fields, 9);
19239 }
19240
19241
19242 {
19243 differ = FALSE;
19244 {
19245 int i;
19246
19247 for (i = 0; i < FEELING_LAST; i++) {
19248 if (old->ppl_angry[i] != real_packet->ppl_angry[i]) {
19249 differ = TRUE;
19250 break;
19251 }
19252 }
19253 }
19254 }
19255 if (differ) {
19256 different++;
19257 BV_SET(fields, 10);
19258 }
19259
19260 differ = (old->specialists_size != real_packet->specialists_size);
19261 if (differ) {
19262 different++;
19263 BV_SET(fields, 11);
19264 }
19265
19266
19267 {
19268 differ = (old->specialists_size != real_packet->specialists_size);
19269 if (!differ) {
19270 int i;
19271
19272 for (i = 0; i < real_packet->specialists_size; i++) {
19273 if (old->specialists[i] != real_packet->specialists[i]) {
19274 differ = TRUE;
19275 break;
19276 }
19277 }
19278 }
19279 }
19280 if (differ) {
19281 different++;
19282 BV_SET(fields, 12);
19283 }
19284
19285 differ = (old->history != real_packet->history);
19286 if (differ) {
19287 different++;
19288 BV_SET(fields, 13);
19289 }
19290
19291 differ = (old->culture != real_packet->culture);
19292 if (differ) {
19293 different++;
19294 BV_SET(fields, 14);
19295 }
19296
19297 differ = (old->buy_cost != real_packet->buy_cost);
19298 if (differ) {
19299 different++;
19300 BV_SET(fields, 15);
19301 }
19302
19303
19304 {
19305 differ = FALSE;
19306 {
19307 int i;
19308
19309 for (i = 0; i < O_LAST; i++) {
19310 if (old->surplus[i] != real_packet->surplus[i]) {
19311 differ = TRUE;
19312 break;
19313 }
19314 }
19315 }
19316 }
19317 if (differ) {
19318 different++;
19319 BV_SET(fields, 16);
19320 }
19321
19322
19323 {
19324 differ = FALSE;
19325 {
19326 int i;
19327
19328 for (i = 0; i < O_LAST; i++) {
19329 if (old->waste[i] != real_packet->waste[i]) {
19330 differ = TRUE;
19331 break;
19332 }
19333 }
19334 }
19335 }
19336 if (differ) {
19337 different++;
19338 BV_SET(fields, 17);
19339 }
19340
19341
19342 {
19343 differ = FALSE;
19344 {
19345 int i;
19346
19347 for (i = 0; i < O_LAST; i++) {
19348 if (old->unhappy_penalty[i] != real_packet->unhappy_penalty[i]) {
19349 differ = TRUE;
19350 break;
19351 }
19352 }
19353 }
19354 }
19355 if (differ) {
19356 different++;
19357 BV_SET(fields, 18);
19358 }
19359
19360
19361 {
19362 differ = FALSE;
19363 {
19364 int i;
19365
19366 for (i = 0; i < O_LAST; i++) {
19367 if (old->prod[i] != real_packet->prod[i]) {
19368 differ = TRUE;
19369 break;
19370 }
19371 }
19372 }
19373 }
19374 if (differ) {
19375 different++;
19376 BV_SET(fields, 19);
19377 }
19378
19379
19380 {
19381 differ = FALSE;
19382 {
19383 int i;
19384
19385 for (i = 0; i < O_LAST; i++) {
19386 if (old->citizen_base[i] != real_packet->citizen_base[i]) {
19387 differ = TRUE;
19388 break;
19389 }
19390 }
19391 }
19392 }
19393 if (differ) {
19394 different++;
19395 BV_SET(fields, 20);
19396 }
19397
19398
19399 {
19400 differ = FALSE;
19401 {
19402 int i;
19403
19404 for (i = 0; i < O_LAST; i++) {
19405 if (old->usage[i] != real_packet->usage[i]) {
19406 differ = TRUE;
19407 break;
19408 }
19409 }
19410 }
19411 }
19412 if (differ) {
19413 different++;
19414 BV_SET(fields, 21);
19415 }
19416
19417 differ = (old->food_stock != real_packet->food_stock);
19418 if (differ) {
19419 different++;
19420 BV_SET(fields, 22);
19421 }
19422
19423 differ = (old->shield_stock != real_packet->shield_stock);
19424 if (differ) {
19425 different++;
19426 BV_SET(fields, 23);
19427 }
19428
19429 differ = (old->trade_route_count != real_packet->trade_route_count);
19430 if (differ) {
19431 different++;
19432 BV_SET(fields, 24);
19433 }
19434
19435 differ = (old->pollution != real_packet->pollution);
19436 if (differ) {
19437 different++;
19438 BV_SET(fields, 25);
19439 }
19440
19441 differ = (old->illness_trade != real_packet->illness_trade);
19442 if (differ) {
19443 different++;
19444 BV_SET(fields, 26);
19445 }
19446
19447 differ = (old->production_kind != real_packet->production_kind);
19448 if (differ) {
19449 different++;
19450 BV_SET(fields, 27);
19451 }
19452
19453 differ = (old->production_value != real_packet->production_value);
19454 if (differ) {
19455 different++;
19456 BV_SET(fields, 28);
19457 }
19458
19459 differ = (old->turn_founded != real_packet->turn_founded);
19460 if (differ) {
19461 different++;
19462 BV_SET(fields, 29);
19463 }
19464
19465 differ = (old->turn_last_built != real_packet->turn_last_built);
19466 if (differ) {
19467 different++;
19468 BV_SET(fields, 30);
19469 }
19470
19471 differ = (old->changed_from_kind != real_packet->changed_from_kind);
19472 if (differ) {
19473 different++;
19474 BV_SET(fields, 31);
19475 }
19476
19477 differ = (old->changed_from_value != real_packet->changed_from_value);
19478 if (differ) {
19479 different++;
19480 BV_SET(fields, 32);
19481 }
19482
19483 differ = (old->before_change_shields != real_packet->before_change_shields);
19484 if (differ) {
19485 different++;
19486 BV_SET(fields, 33);
19487 }
19488
19489 differ = (old->disbanded_shields != real_packet->disbanded_shields);
19490 if (differ) {
19491 different++;
19492 BV_SET(fields, 34);
19493 }
19494
19495 differ = (old->caravan_shields != real_packet->caravan_shields);
19496 if (differ) {
19497 different++;
19498 BV_SET(fields, 35);
19499 }
19500
19501 differ = (old->last_turns_shield_surplus != real_packet->last_turns_shield_surplus);
19502 if (differ) {
19503 different++;
19504 BV_SET(fields, 36);
19505 }
19506
19507 differ = (old->airlift != real_packet->airlift);
19508 if (differ) {
19509 different++;
19510 BV_SET(fields, 37);
19511 }
19512
19513 differ = (old->did_buy != real_packet->did_buy);
19514 if (differ) {
19515 different++;
19516 }
19517 if (packet->did_buy) {
19518 BV_SET(fields, 38);
19519 }
19520
19521 differ = (old->did_sell != real_packet->did_sell);
19522 if (differ) {
19523 different++;
19524 }
19525 if (packet->did_sell) {
19526 BV_SET(fields, 39);
19527 }
19528
19529 differ = (old->was_happy != real_packet->was_happy);
19530 if (differ) {
19531 different++;
19532 }
19533 if (packet->was_happy) {
19534 BV_SET(fields, 40);
19535 }
19536
19537 differ = (old->diplomat_investigate != real_packet->diplomat_investigate);
19538 if (differ) {
19539 different++;
19540 }
19541 if (packet->diplomat_investigate) {
19542 BV_SET(fields, 41);
19543 }
19544
19545 differ = (old->walls != real_packet->walls);
19546 if (differ) {
19547 different++;
19548 BV_SET(fields, 42);
19549 }
19550
19551 differ = (old->city_image != real_packet->city_image);
19552 if (differ) {
19553 different++;
19554 BV_SET(fields, 43);
19555 }
19556
19557 differ = (old->steal != real_packet->steal);
19558 if (differ) {
19559 different++;
19560 BV_SET(fields, 44);
19561 }
19562
19563 differ = !are_worklists_equal(&old->worklist, &real_packet->worklist);
19564 if (differ) {
19565 different++;
19566 BV_SET(fields, 45);
19567 }
19568
19569 differ = !BV_ARE_EQUAL(old->improvements, real_packet->improvements);
19570 if (differ) {
19571 different++;
19572 BV_SET(fields, 46);
19573 }
19574
19575 differ = !BV_ARE_EQUAL(old->city_options, real_packet->city_options);
19576 if (differ) {
19577 different++;
19578 BV_SET(fields, 47);
19579 }
19580
19581 differ = (strcmp(old->name, real_packet->name) != 0);
19582 if (differ) {
19583 different++;
19584 BV_SET(fields, 48);
19585 }
19586
19587
19588 if (different == 0) {
19589 log_packet_detailed(" no change -> discard");
19590 return 0;
19591 }
19592
19593#ifdef FREECIV_JSON_CONNECTION
19594 field_addr.name = "fields";
19595#endif /* FREECIV_JSON_CONNECTION */
19596 DIO_BV_PUT(&dout, &field_addr, fields);
19597#ifdef FREECIV_JSON_CONNECTION
19598 field_addr.name = "id16";
19599#endif /* FREECIV_JSON_CONNECTION */
19600 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
19601
19602 if (BV_ISSET(fields, 0)) {
19603 log_packet_detailed(" field 'tile' has changed");
19604 #ifdef FREECIV_JSON_CONNECTION
19605 field_addr.name = "tile";
19606#endif /* FREECIV_JSON_CONNECTION */
19607 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
19608 }
19609 if (BV_ISSET(fields, 1)) {
19610 log_packet_detailed(" field 'owner' has changed");
19611 #ifdef FREECIV_JSON_CONNECTION
19612 field_addr.name = "owner";
19613#endif /* FREECIV_JSON_CONNECTION */
19614 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
19615 }
19616 if (BV_ISSET(fields, 2)) {
19617 log_packet_detailed(" field 'original' has changed");
19618 #ifdef FREECIV_JSON_CONNECTION
19619 field_addr.name = "original";
19620#endif /* FREECIV_JSON_CONNECTION */
19621 DIO_PUT(uint16, &dout, &field_addr, real_packet->original);
19622 }
19623 if (BV_ISSET(fields, 3)) {
19624 log_packet_detailed(" field 'size' has changed");
19625 #ifdef FREECIV_JSON_CONNECTION
19626 field_addr.name = "size";
19627#endif /* FREECIV_JSON_CONNECTION */
19628 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
19629 }
19630 if (BV_ISSET(fields, 4)) {
19631 log_packet_detailed(" field 'city_radius_sq' has changed");
19632 #ifdef FREECIV_JSON_CONNECTION
19633 field_addr.name = "city_radius_sq";
19634#endif /* FREECIV_JSON_CONNECTION */
19635 DIO_PUT(uint8, &dout, &field_addr, real_packet->city_radius_sq);
19636 }
19637 if (BV_ISSET(fields, 5)) {
19638 log_packet_detailed(" field 'style' has changed");
19639 #ifdef FREECIV_JSON_CONNECTION
19640 field_addr.name = "style";
19641#endif /* FREECIV_JSON_CONNECTION */
19642 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
19643 }
19644 if (BV_ISSET(fields, 6)) {
19645 log_packet_detailed(" field 'capital' has changed");
19646 #ifdef FREECIV_JSON_CONNECTION
19647 field_addr.name = "capital";
19648#endif /* FREECIV_JSON_CONNECTION */
19649 DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
19650 }
19651 if (BV_ISSET(fields, 7)) {
19652 log_packet_detailed(" field 'ppl_happy' has changed");
19653 #ifdef FREECIV_JSON_CONNECTION
19654 field_addr.name = "ppl_happy";
19655#endif /* FREECIV_JSON_CONNECTION */
19656
19657 {
19658 int i;
19659
19660#ifdef FREECIV_JSON_CONNECTION
19661 /* Create the array. */
19662 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
19663
19664 /* Enter the array. */
19665 field_addr.sub_location = plocation_elem_new(0);
19666#endif /* FREECIV_JSON_CONNECTION */
19667
19668 for (i = 0; i < FEELING_LAST; i++) {
19669#ifdef FREECIV_JSON_CONNECTION
19670 /* Next array element. */
19671 field_addr.sub_location->number = i;
19672#endif /* FREECIV_JSON_CONNECTION */
19673 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
19674 }
19675
19676#ifdef FREECIV_JSON_CONNECTION
19677 /* Exit array. */
19678 free(field_addr.sub_location);
19679 field_addr.sub_location = NULL;
19680#endif /* FREECIV_JSON_CONNECTION */
19681 }
19682 }
19683 if (BV_ISSET(fields, 8)) {
19684 log_packet_detailed(" field 'ppl_content' has changed");
19685 #ifdef FREECIV_JSON_CONNECTION
19686 field_addr.name = "ppl_content";
19687#endif /* FREECIV_JSON_CONNECTION */
19688
19689 {
19690 int i;
19691
19692#ifdef FREECIV_JSON_CONNECTION
19693 /* Create the array. */
19694 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
19695
19696 /* Enter the array. */
19697 field_addr.sub_location = plocation_elem_new(0);
19698#endif /* FREECIV_JSON_CONNECTION */
19699
19700 for (i = 0; i < FEELING_LAST; i++) {
19701#ifdef FREECIV_JSON_CONNECTION
19702 /* Next array element. */
19703 field_addr.sub_location->number = i;
19704#endif /* FREECIV_JSON_CONNECTION */
19705 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
19706 }
19707
19708#ifdef FREECIV_JSON_CONNECTION
19709 /* Exit array. */
19710 free(field_addr.sub_location);
19711 field_addr.sub_location = NULL;
19712#endif /* FREECIV_JSON_CONNECTION */
19713 }
19714 }
19715 if (BV_ISSET(fields, 9)) {
19716 log_packet_detailed(" field 'ppl_unhappy' has changed");
19717 #ifdef FREECIV_JSON_CONNECTION
19718 field_addr.name = "ppl_unhappy";
19719#endif /* FREECIV_JSON_CONNECTION */
19720
19721 {
19722 int i;
19723
19724#ifdef FREECIV_JSON_CONNECTION
19725 /* Create the array. */
19726 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
19727
19728 /* Enter the array. */
19729 field_addr.sub_location = plocation_elem_new(0);
19730#endif /* FREECIV_JSON_CONNECTION */
19731
19732 for (i = 0; i < FEELING_LAST; i++) {
19733#ifdef FREECIV_JSON_CONNECTION
19734 /* Next array element. */
19735 field_addr.sub_location->number = i;
19736#endif /* FREECIV_JSON_CONNECTION */
19737 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
19738 }
19739
19740#ifdef FREECIV_JSON_CONNECTION
19741 /* Exit array. */
19742 free(field_addr.sub_location);
19743 field_addr.sub_location = NULL;
19744#endif /* FREECIV_JSON_CONNECTION */
19745 }
19746 }
19747 if (BV_ISSET(fields, 10)) {
19748 log_packet_detailed(" field 'ppl_angry' has changed");
19749 #ifdef FREECIV_JSON_CONNECTION
19750 field_addr.name = "ppl_angry";
19751#endif /* FREECIV_JSON_CONNECTION */
19752
19753 {
19754 int i;
19755
19756#ifdef FREECIV_JSON_CONNECTION
19757 /* Create the array. */
19758 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
19759
19760 /* Enter the array. */
19761 field_addr.sub_location = plocation_elem_new(0);
19762#endif /* FREECIV_JSON_CONNECTION */
19763
19764 for (i = 0; i < FEELING_LAST; i++) {
19765#ifdef FREECIV_JSON_CONNECTION
19766 /* Next array element. */
19767 field_addr.sub_location->number = i;
19768#endif /* FREECIV_JSON_CONNECTION */
19769 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
19770 }
19771
19772#ifdef FREECIV_JSON_CONNECTION
19773 /* Exit array. */
19774 free(field_addr.sub_location);
19775 field_addr.sub_location = NULL;
19776#endif /* FREECIV_JSON_CONNECTION */
19777 }
19778 }
19779 if (BV_ISSET(fields, 11)) {
19780 log_packet_detailed(" field 'specialists_size' has changed");
19781 #ifdef FREECIV_JSON_CONNECTION
19782 field_addr.name = "specialists_size";
19783#endif /* FREECIV_JSON_CONNECTION */
19784 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
19785 }
19786 if (BV_ISSET(fields, 12)) {
19787 log_packet_detailed(" field 'specialists' has changed");
19788 #ifdef FREECIV_JSON_CONNECTION
19789 field_addr.name = "specialists";
19790#endif /* FREECIV_JSON_CONNECTION */
19791
19792 {
19793 int i;
19794
19795#ifdef FREECIV_JSON_CONNECTION
19796 /* Create the array. */
19797 DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
19798
19799 /* Enter the array. */
19800 field_addr.sub_location = plocation_elem_new(0);
19801#endif /* FREECIV_JSON_CONNECTION */
19802
19803 for (i = 0; i < real_packet->specialists_size; i++) {
19804#ifdef FREECIV_JSON_CONNECTION
19805 /* Next array element. */
19806 field_addr.sub_location->number = i;
19807#endif /* FREECIV_JSON_CONNECTION */
19808 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
19809 }
19810
19811#ifdef FREECIV_JSON_CONNECTION
19812 /* Exit array. */
19813 free(field_addr.sub_location);
19814 field_addr.sub_location = NULL;
19815#endif /* FREECIV_JSON_CONNECTION */
19816 }
19817 }
19818 if (BV_ISSET(fields, 13)) {
19819 log_packet_detailed(" field 'history' has changed");
19820 #ifdef FREECIV_JSON_CONNECTION
19821 field_addr.name = "history";
19822#endif /* FREECIV_JSON_CONNECTION */
19823 DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
19824 }
19825 if (BV_ISSET(fields, 14)) {
19826 log_packet_detailed(" field 'culture' has changed");
19827 #ifdef FREECIV_JSON_CONNECTION
19828 field_addr.name = "culture";
19829#endif /* FREECIV_JSON_CONNECTION */
19830 DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
19831 }
19832 if (BV_ISSET(fields, 15)) {
19833 log_packet_detailed(" field 'buy_cost' has changed");
19834 #ifdef FREECIV_JSON_CONNECTION
19835 field_addr.name = "buy_cost";
19836#endif /* FREECIV_JSON_CONNECTION */
19837 DIO_PUT(uint32, &dout, &field_addr, real_packet->buy_cost);
19838 }
19839 if (BV_ISSET(fields, 16)) {
19840 log_packet_detailed(" field 'surplus' has changed");
19841 #ifdef FREECIV_JSON_CONNECTION
19842 field_addr.name = "surplus";
19843#endif /* FREECIV_JSON_CONNECTION */
19844
19845 {
19846 int i;
19847
19848#ifdef FREECIV_JSON_CONNECTION
19849 /* Create the array. */
19850 DIO_PUT(farray, &dout, &field_addr, O_LAST);
19851
19852 /* Enter the array. */
19853 field_addr.sub_location = plocation_elem_new(0);
19854#endif /* FREECIV_JSON_CONNECTION */
19855
19856 for (i = 0; i < O_LAST; i++) {
19857#ifdef FREECIV_JSON_CONNECTION
19858 /* Next array element. */
19859 field_addr.sub_location->number = i;
19860#endif /* FREECIV_JSON_CONNECTION */
19861 DIO_PUT(sint16, &dout, &field_addr, real_packet->surplus[i]);
19862 }
19863
19864#ifdef FREECIV_JSON_CONNECTION
19865 /* Exit array. */
19866 free(field_addr.sub_location);
19867 field_addr.sub_location = NULL;
19868#endif /* FREECIV_JSON_CONNECTION */
19869 }
19870 }
19871 if (BV_ISSET(fields, 17)) {
19872 log_packet_detailed(" field 'waste' has changed");
19873 #ifdef FREECIV_JSON_CONNECTION
19874 field_addr.name = "waste";
19875#endif /* FREECIV_JSON_CONNECTION */
19876
19877 {
19878 int i;
19879
19880#ifdef FREECIV_JSON_CONNECTION
19881 /* Create the array. */
19882 DIO_PUT(farray, &dout, &field_addr, O_LAST);
19883
19884 /* Enter the array. */
19885 field_addr.sub_location = plocation_elem_new(0);
19886#endif /* FREECIV_JSON_CONNECTION */
19887
19888 for (i = 0; i < O_LAST; i++) {
19889#ifdef FREECIV_JSON_CONNECTION
19890 /* Next array element. */
19891 field_addr.sub_location->number = i;
19892#endif /* FREECIV_JSON_CONNECTION */
19893 DIO_PUT(uint16, &dout, &field_addr, real_packet->waste[i]);
19894 }
19895
19896#ifdef FREECIV_JSON_CONNECTION
19897 /* Exit array. */
19898 free(field_addr.sub_location);
19899 field_addr.sub_location = NULL;
19900#endif /* FREECIV_JSON_CONNECTION */
19901 }
19902 }
19903 if (BV_ISSET(fields, 18)) {
19904 log_packet_detailed(" field 'unhappy_penalty' has changed");
19905 #ifdef FREECIV_JSON_CONNECTION
19906 field_addr.name = "unhappy_penalty";
19907#endif /* FREECIV_JSON_CONNECTION */
19908
19909 {
19910 int i;
19911
19912#ifdef FREECIV_JSON_CONNECTION
19913 /* Create the array. */
19914 DIO_PUT(farray, &dout, &field_addr, O_LAST);
19915
19916 /* Enter the array. */
19917 field_addr.sub_location = plocation_elem_new(0);
19918#endif /* FREECIV_JSON_CONNECTION */
19919
19920 for (i = 0; i < O_LAST; i++) {
19921#ifdef FREECIV_JSON_CONNECTION
19922 /* Next array element. */
19923 field_addr.sub_location->number = i;
19924#endif /* FREECIV_JSON_CONNECTION */
19925 DIO_PUT(sint16, &dout, &field_addr, real_packet->unhappy_penalty[i]);
19926 }
19927
19928#ifdef FREECIV_JSON_CONNECTION
19929 /* Exit array. */
19930 free(field_addr.sub_location);
19931 field_addr.sub_location = NULL;
19932#endif /* FREECIV_JSON_CONNECTION */
19933 }
19934 }
19935 if (BV_ISSET(fields, 19)) {
19936 log_packet_detailed(" field 'prod' has changed");
19937 #ifdef FREECIV_JSON_CONNECTION
19938 field_addr.name = "prod";
19939#endif /* FREECIV_JSON_CONNECTION */
19940
19941 {
19942 int i;
19943
19944#ifdef FREECIV_JSON_CONNECTION
19945 /* Create the array. */
19946 DIO_PUT(farray, &dout, &field_addr, O_LAST);
19947
19948 /* Enter the array. */
19949 field_addr.sub_location = plocation_elem_new(0);
19950#endif /* FREECIV_JSON_CONNECTION */
19951
19952 for (i = 0; i < O_LAST; i++) {
19953#ifdef FREECIV_JSON_CONNECTION
19954 /* Next array element. */
19955 field_addr.sub_location->number = i;
19956#endif /* FREECIV_JSON_CONNECTION */
19957 DIO_PUT(uint16, &dout, &field_addr, real_packet->prod[i]);
19958 }
19959
19960#ifdef FREECIV_JSON_CONNECTION
19961 /* Exit array. */
19962 free(field_addr.sub_location);
19963 field_addr.sub_location = NULL;
19964#endif /* FREECIV_JSON_CONNECTION */
19965 }
19966 }
19967 if (BV_ISSET(fields, 20)) {
19968 log_packet_detailed(" field 'citizen_base' has changed");
19969 #ifdef FREECIV_JSON_CONNECTION
19970 field_addr.name = "citizen_base";
19971#endif /* FREECIV_JSON_CONNECTION */
19972
19973 {
19974 int i;
19975
19976#ifdef FREECIV_JSON_CONNECTION
19977 /* Create the array. */
19978 DIO_PUT(farray, &dout, &field_addr, O_LAST);
19979
19980 /* Enter the array. */
19981 field_addr.sub_location = plocation_elem_new(0);
19982#endif /* FREECIV_JSON_CONNECTION */
19983
19984 for (i = 0; i < O_LAST; i++) {
19985#ifdef FREECIV_JSON_CONNECTION
19986 /* Next array element. */
19987 field_addr.sub_location->number = i;
19988#endif /* FREECIV_JSON_CONNECTION */
19989 DIO_PUT(sint16, &dout, &field_addr, real_packet->citizen_base[i]);
19990 }
19991
19992#ifdef FREECIV_JSON_CONNECTION
19993 /* Exit array. */
19994 free(field_addr.sub_location);
19995 field_addr.sub_location = NULL;
19996#endif /* FREECIV_JSON_CONNECTION */
19997 }
19998 }
19999 if (BV_ISSET(fields, 21)) {
20000 log_packet_detailed(" field 'usage' has changed");
20001 #ifdef FREECIV_JSON_CONNECTION
20002 field_addr.name = "usage";
20003#endif /* FREECIV_JSON_CONNECTION */
20004
20005 {
20006 int i;
20007
20008#ifdef FREECIV_JSON_CONNECTION
20009 /* Create the array. */
20010 DIO_PUT(farray, &dout, &field_addr, O_LAST);
20011
20012 /* Enter the array. */
20013 field_addr.sub_location = plocation_elem_new(0);
20014#endif /* FREECIV_JSON_CONNECTION */
20015
20016 for (i = 0; i < O_LAST; i++) {
20017#ifdef FREECIV_JSON_CONNECTION
20018 /* Next array element. */
20019 field_addr.sub_location->number = i;
20020#endif /* FREECIV_JSON_CONNECTION */
20021 DIO_PUT(sint16, &dout, &field_addr, real_packet->usage[i]);
20022 }
20023
20024#ifdef FREECIV_JSON_CONNECTION
20025 /* Exit array. */
20026 free(field_addr.sub_location);
20027 field_addr.sub_location = NULL;
20028#endif /* FREECIV_JSON_CONNECTION */
20029 }
20030 }
20031 if (BV_ISSET(fields, 22)) {
20032 log_packet_detailed(" field 'food_stock' has changed");
20033 #ifdef FREECIV_JSON_CONNECTION
20034 field_addr.name = "food_stock";
20035#endif /* FREECIV_JSON_CONNECTION */
20036 DIO_PUT(sint16, &dout, &field_addr, real_packet->food_stock);
20037 }
20038 if (BV_ISSET(fields, 23)) {
20039 log_packet_detailed(" field 'shield_stock' has changed");
20040 #ifdef FREECIV_JSON_CONNECTION
20041 field_addr.name = "shield_stock";
20042#endif /* FREECIV_JSON_CONNECTION */
20043 DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
20044 }
20045 if (BV_ISSET(fields, 24)) {
20046 log_packet_detailed(" field 'trade_route_count' has changed");
20047 #ifdef FREECIV_JSON_CONNECTION
20048 field_addr.name = "trade_route_count";
20049#endif /* FREECIV_JSON_CONNECTION */
20050 DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_route_count);
20051 }
20052 if (BV_ISSET(fields, 25)) {
20053 log_packet_detailed(" field 'pollution' has changed");
20054 #ifdef FREECIV_JSON_CONNECTION
20055 field_addr.name = "pollution";
20056#endif /* FREECIV_JSON_CONNECTION */
20057 DIO_PUT(uint16, &dout, &field_addr, real_packet->pollution);
20058 }
20059 if (BV_ISSET(fields, 26)) {
20060 log_packet_detailed(" field 'illness_trade' has changed");
20061 #ifdef FREECIV_JSON_CONNECTION
20062 field_addr.name = "illness_trade";
20063#endif /* FREECIV_JSON_CONNECTION */
20064 DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade);
20065 }
20066 if (BV_ISSET(fields, 27)) {
20067 log_packet_detailed(" field 'production_kind' has changed");
20068 #ifdef FREECIV_JSON_CONNECTION
20069 field_addr.name = "production_kind";
20070#endif /* FREECIV_JSON_CONNECTION */
20071 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
20072 }
20073 if (BV_ISSET(fields, 28)) {
20074 log_packet_detailed(" field 'production_value' has changed");
20075 #ifdef FREECIV_JSON_CONNECTION
20076 field_addr.name = "production_value";
20077#endif /* FREECIV_JSON_CONNECTION */
20078 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
20079 }
20080 if (BV_ISSET(fields, 29)) {
20081 log_packet_detailed(" field 'turn_founded' has changed");
20082 #ifdef FREECIV_JSON_CONNECTION
20083 field_addr.name = "turn_founded";
20084#endif /* FREECIV_JSON_CONNECTION */
20085 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
20086 }
20087 if (BV_ISSET(fields, 30)) {
20088 log_packet_detailed(" field 'turn_last_built' has changed");
20089 #ifdef FREECIV_JSON_CONNECTION
20090 field_addr.name = "turn_last_built";
20091#endif /* FREECIV_JSON_CONNECTION */
20092 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
20093 }
20094 if (BV_ISSET(fields, 31)) {
20095 log_packet_detailed(" field 'changed_from_kind' has changed");
20096 #ifdef FREECIV_JSON_CONNECTION
20097 field_addr.name = "changed_from_kind";
20098#endif /* FREECIV_JSON_CONNECTION */
20099 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_kind);
20100 }
20101 if (BV_ISSET(fields, 32)) {
20102 log_packet_detailed(" field 'changed_from_value' has changed");
20103 #ifdef FREECIV_JSON_CONNECTION
20104 field_addr.name = "changed_from_value";
20105#endif /* FREECIV_JSON_CONNECTION */
20106 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_value);
20107 }
20108 if (BV_ISSET(fields, 33)) {
20109 log_packet_detailed(" field 'before_change_shields' has changed");
20110 #ifdef FREECIV_JSON_CONNECTION
20111 field_addr.name = "before_change_shields";
20112#endif /* FREECIV_JSON_CONNECTION */
20113 DIO_PUT(uint16, &dout, &field_addr, real_packet->before_change_shields);
20114 }
20115 if (BV_ISSET(fields, 34)) {
20116 log_packet_detailed(" field 'disbanded_shields' has changed");
20117 #ifdef FREECIV_JSON_CONNECTION
20118 field_addr.name = "disbanded_shields";
20119#endif /* FREECIV_JSON_CONNECTION */
20120 DIO_PUT(uint16, &dout, &field_addr, real_packet->disbanded_shields);
20121 }
20122 if (BV_ISSET(fields, 35)) {
20123 log_packet_detailed(" field 'caravan_shields' has changed");
20124 #ifdef FREECIV_JSON_CONNECTION
20125 field_addr.name = "caravan_shields";
20126#endif /* FREECIV_JSON_CONNECTION */
20127 DIO_PUT(uint16, &dout, &field_addr, real_packet->caravan_shields);
20128 }
20129 if (BV_ISSET(fields, 36)) {
20130 log_packet_detailed(" field 'last_turns_shield_surplus' has changed");
20131 #ifdef FREECIV_JSON_CONNECTION
20132 field_addr.name = "last_turns_shield_surplus";
20133#endif /* FREECIV_JSON_CONNECTION */
20134 DIO_PUT(uint16, &dout, &field_addr, real_packet->last_turns_shield_surplus);
20135 }
20136 if (BV_ISSET(fields, 37)) {
20137 log_packet_detailed(" field 'airlift' has changed");
20138 #ifdef FREECIV_JSON_CONNECTION
20139 field_addr.name = "airlift";
20140#endif /* FREECIV_JSON_CONNECTION */
20141 DIO_PUT(uint8, &dout, &field_addr, real_packet->airlift);
20142 }
20143 /* field 38 is folded into the header */
20144 /* field 39 is folded into the header */
20145 /* field 40 is folded into the header */
20146 /* field 41 is folded into the header */
20147 if (BV_ISSET(fields, 42)) {
20148 log_packet_detailed(" field 'walls' has changed");
20149 #ifdef FREECIV_JSON_CONNECTION
20150 field_addr.name = "walls";
20151#endif /* FREECIV_JSON_CONNECTION */
20152 DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
20153 }
20154 if (BV_ISSET(fields, 43)) {
20155 log_packet_detailed(" field 'city_image' has changed");
20156 #ifdef FREECIV_JSON_CONNECTION
20157 field_addr.name = "city_image";
20158#endif /* FREECIV_JSON_CONNECTION */
20159 DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
20160 }
20161 if (BV_ISSET(fields, 44)) {
20162 log_packet_detailed(" field 'steal' has changed");
20163 #ifdef FREECIV_JSON_CONNECTION
20164 field_addr.name = "steal";
20165#endif /* FREECIV_JSON_CONNECTION */
20166 DIO_PUT(uint16, &dout, &field_addr, real_packet->steal);
20167 }
20168 if (BV_ISSET(fields, 45)) {
20169 log_packet_detailed(" field 'worklist' has changed");
20170 #ifdef FREECIV_JSON_CONNECTION
20171 field_addr.name = "worklist";
20172#endif /* FREECIV_JSON_CONNECTION */
20173 DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
20174 }
20175 if (BV_ISSET(fields, 46)) {
20176 log_packet_detailed(" field 'improvements' has changed");
20177 #ifdef FREECIV_JSON_CONNECTION
20178 field_addr.name = "improvements";
20179#endif /* FREECIV_JSON_CONNECTION */
20180 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
20181 }
20182 if (BV_ISSET(fields, 47)) {
20183 log_packet_detailed(" field 'city_options' has changed");
20184 #ifdef FREECIV_JSON_CONNECTION
20185 field_addr.name = "city_options";
20186#endif /* FREECIV_JSON_CONNECTION */
20187 DIO_BV_PUT(&dout, &field_addr, packet->city_options);
20188 }
20189 if (BV_ISSET(fields, 48)) {
20190 log_packet_detailed(" field 'name' has changed");
20191 #ifdef FREECIV_JSON_CONNECTION
20192 field_addr.name = "name";
20193#endif /* FREECIV_JSON_CONNECTION */
20194 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
20195 }
20196
20197 *old = *real_packet;
20198
20199 hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
20200 if (NULL != *hash) {
20201 genhash_remove(*hash, real_packet);
20202 }
20203#endif /* FREECIV_DELTA_PROTOCOL */
20204#ifndef FREECIV_DELTA_PROTOCOL
20205#ifdef FREECIV_JSON_CONNECTION
20206 field_addr.name = "id16";
20207#endif /* FREECIV_JSON_CONNECTION */
20208 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
20209#ifdef FREECIV_JSON_CONNECTION
20210 field_addr.name = "tile";
20211#endif /* FREECIV_JSON_CONNECTION */
20212 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
20213#ifdef FREECIV_JSON_CONNECTION
20214 field_addr.name = "owner";
20215#endif /* FREECIV_JSON_CONNECTION */
20216 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
20217#ifdef FREECIV_JSON_CONNECTION
20218 field_addr.name = "original";
20219#endif /* FREECIV_JSON_CONNECTION */
20220 DIO_PUT(uint16, &dout, &field_addr, real_packet->original);
20221#ifdef FREECIV_JSON_CONNECTION
20222 field_addr.name = "size";
20223#endif /* FREECIV_JSON_CONNECTION */
20224 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
20225#ifdef FREECIV_JSON_CONNECTION
20226 field_addr.name = "city_radius_sq";
20227#endif /* FREECIV_JSON_CONNECTION */
20228 DIO_PUT(uint8, &dout, &field_addr, real_packet->city_radius_sq);
20229#ifdef FREECIV_JSON_CONNECTION
20230 field_addr.name = "style";
20231#endif /* FREECIV_JSON_CONNECTION */
20232 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
20233#ifdef FREECIV_JSON_CONNECTION
20234 field_addr.name = "capital";
20235#endif /* FREECIV_JSON_CONNECTION */
20236 DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
20237#ifdef FREECIV_JSON_CONNECTION
20238 field_addr.name = "ppl_happy";
20239#endif /* FREECIV_JSON_CONNECTION */
20240
20241 {
20242 int i;
20243
20244#ifdef FREECIV_JSON_CONNECTION
20245 /* Create the array. */
20246 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
20247
20248 /* Enter the array. */
20249 field_addr.sub_location = plocation_elem_new(0);
20250#endif /* FREECIV_JSON_CONNECTION */
20251
20252 for (i = 0; i < FEELING_LAST; i++) {
20253#ifdef FREECIV_JSON_CONNECTION
20254 /* Next array element. */
20255 field_addr.sub_location->number = i;
20256#endif /* FREECIV_JSON_CONNECTION */
20257 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
20258 }
20259
20260#ifdef FREECIV_JSON_CONNECTION
20261 /* Exit array. */
20262 free(field_addr.sub_location);
20263 field_addr.sub_location = NULL;
20264#endif /* FREECIV_JSON_CONNECTION */
20265 }
20266#ifdef FREECIV_JSON_CONNECTION
20267 field_addr.name = "ppl_content";
20268#endif /* FREECIV_JSON_CONNECTION */
20269
20270 {
20271 int i;
20272
20273#ifdef FREECIV_JSON_CONNECTION
20274 /* Create the array. */
20275 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
20276
20277 /* Enter the array. */
20278 field_addr.sub_location = plocation_elem_new(0);
20279#endif /* FREECIV_JSON_CONNECTION */
20280
20281 for (i = 0; i < FEELING_LAST; i++) {
20282#ifdef FREECIV_JSON_CONNECTION
20283 /* Next array element. */
20284 field_addr.sub_location->number = i;
20285#endif /* FREECIV_JSON_CONNECTION */
20286 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
20287 }
20288
20289#ifdef FREECIV_JSON_CONNECTION
20290 /* Exit array. */
20291 free(field_addr.sub_location);
20292 field_addr.sub_location = NULL;
20293#endif /* FREECIV_JSON_CONNECTION */
20294 }
20295#ifdef FREECIV_JSON_CONNECTION
20296 field_addr.name = "ppl_unhappy";
20297#endif /* FREECIV_JSON_CONNECTION */
20298
20299 {
20300 int i;
20301
20302#ifdef FREECIV_JSON_CONNECTION
20303 /* Create the array. */
20304 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
20305
20306 /* Enter the array. */
20307 field_addr.sub_location = plocation_elem_new(0);
20308#endif /* FREECIV_JSON_CONNECTION */
20309
20310 for (i = 0; i < FEELING_LAST; i++) {
20311#ifdef FREECIV_JSON_CONNECTION
20312 /* Next array element. */
20313 field_addr.sub_location->number = i;
20314#endif /* FREECIV_JSON_CONNECTION */
20315 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
20316 }
20317
20318#ifdef FREECIV_JSON_CONNECTION
20319 /* Exit array. */
20320 free(field_addr.sub_location);
20321 field_addr.sub_location = NULL;
20322#endif /* FREECIV_JSON_CONNECTION */
20323 }
20324#ifdef FREECIV_JSON_CONNECTION
20325 field_addr.name = "ppl_angry";
20326#endif /* FREECIV_JSON_CONNECTION */
20327
20328 {
20329 int i;
20330
20331#ifdef FREECIV_JSON_CONNECTION
20332 /* Create the array. */
20333 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
20334
20335 /* Enter the array. */
20336 field_addr.sub_location = plocation_elem_new(0);
20337#endif /* FREECIV_JSON_CONNECTION */
20338
20339 for (i = 0; i < FEELING_LAST; i++) {
20340#ifdef FREECIV_JSON_CONNECTION
20341 /* Next array element. */
20342 field_addr.sub_location->number = i;
20343#endif /* FREECIV_JSON_CONNECTION */
20344 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
20345 }
20346
20347#ifdef FREECIV_JSON_CONNECTION
20348 /* Exit array. */
20349 free(field_addr.sub_location);
20350 field_addr.sub_location = NULL;
20351#endif /* FREECIV_JSON_CONNECTION */
20352 }
20353#ifdef FREECIV_JSON_CONNECTION
20354 field_addr.name = "specialists_size";
20355#endif /* FREECIV_JSON_CONNECTION */
20356 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
20357#ifdef FREECIV_JSON_CONNECTION
20358 field_addr.name = "specialists";
20359#endif /* FREECIV_JSON_CONNECTION */
20360
20361 {
20362 int i;
20363
20364#ifdef FREECIV_JSON_CONNECTION
20365 /* Create the array. */
20366 DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
20367
20368 /* Enter the array. */
20369 field_addr.sub_location = plocation_elem_new(0);
20370#endif /* FREECIV_JSON_CONNECTION */
20371
20372 for (i = 0; i < real_packet->specialists_size; i++) {
20373#ifdef FREECIV_JSON_CONNECTION
20374 /* Next array element. */
20375 field_addr.sub_location->number = i;
20376#endif /* FREECIV_JSON_CONNECTION */
20377 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
20378 }
20379
20380#ifdef FREECIV_JSON_CONNECTION
20381 /* Exit array. */
20382 free(field_addr.sub_location);
20383 field_addr.sub_location = NULL;
20384#endif /* FREECIV_JSON_CONNECTION */
20385 }
20386#ifdef FREECIV_JSON_CONNECTION
20387 field_addr.name = "history";
20388#endif /* FREECIV_JSON_CONNECTION */
20389 DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
20390#ifdef FREECIV_JSON_CONNECTION
20391 field_addr.name = "culture";
20392#endif /* FREECIV_JSON_CONNECTION */
20393 DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
20394#ifdef FREECIV_JSON_CONNECTION
20395 field_addr.name = "buy_cost";
20396#endif /* FREECIV_JSON_CONNECTION */
20397 DIO_PUT(uint32, &dout, &field_addr, real_packet->buy_cost);
20398#ifdef FREECIV_JSON_CONNECTION
20399 field_addr.name = "surplus";
20400#endif /* FREECIV_JSON_CONNECTION */
20401
20402 {
20403 int i;
20404
20405#ifdef FREECIV_JSON_CONNECTION
20406 /* Create the array. */
20407 DIO_PUT(farray, &dout, &field_addr, O_LAST);
20408
20409 /* Enter the array. */
20410 field_addr.sub_location = plocation_elem_new(0);
20411#endif /* FREECIV_JSON_CONNECTION */
20412
20413 for (i = 0; i < O_LAST; i++) {
20414#ifdef FREECIV_JSON_CONNECTION
20415 /* Next array element. */
20416 field_addr.sub_location->number = i;
20417#endif /* FREECIV_JSON_CONNECTION */
20418 DIO_PUT(sint16, &dout, &field_addr, real_packet->surplus[i]);
20419 }
20420
20421#ifdef FREECIV_JSON_CONNECTION
20422 /* Exit array. */
20423 free(field_addr.sub_location);
20424 field_addr.sub_location = NULL;
20425#endif /* FREECIV_JSON_CONNECTION */
20426 }
20427#ifdef FREECIV_JSON_CONNECTION
20428 field_addr.name = "waste";
20429#endif /* FREECIV_JSON_CONNECTION */
20430
20431 {
20432 int i;
20433
20434#ifdef FREECIV_JSON_CONNECTION
20435 /* Create the array. */
20436 DIO_PUT(farray, &dout, &field_addr, O_LAST);
20437
20438 /* Enter the array. */
20439 field_addr.sub_location = plocation_elem_new(0);
20440#endif /* FREECIV_JSON_CONNECTION */
20441
20442 for (i = 0; i < O_LAST; i++) {
20443#ifdef FREECIV_JSON_CONNECTION
20444 /* Next array element. */
20445 field_addr.sub_location->number = i;
20446#endif /* FREECIV_JSON_CONNECTION */
20447 DIO_PUT(uint16, &dout, &field_addr, real_packet->waste[i]);
20448 }
20449
20450#ifdef FREECIV_JSON_CONNECTION
20451 /* Exit array. */
20452 free(field_addr.sub_location);
20453 field_addr.sub_location = NULL;
20454#endif /* FREECIV_JSON_CONNECTION */
20455 }
20456#ifdef FREECIV_JSON_CONNECTION
20457 field_addr.name = "unhappy_penalty";
20458#endif /* FREECIV_JSON_CONNECTION */
20459
20460 {
20461 int i;
20462
20463#ifdef FREECIV_JSON_CONNECTION
20464 /* Create the array. */
20465 DIO_PUT(farray, &dout, &field_addr, O_LAST);
20466
20467 /* Enter the array. */
20468 field_addr.sub_location = plocation_elem_new(0);
20469#endif /* FREECIV_JSON_CONNECTION */
20470
20471 for (i = 0; i < O_LAST; i++) {
20472#ifdef FREECIV_JSON_CONNECTION
20473 /* Next array element. */
20474 field_addr.sub_location->number = i;
20475#endif /* FREECIV_JSON_CONNECTION */
20476 DIO_PUT(sint16, &dout, &field_addr, real_packet->unhappy_penalty[i]);
20477 }
20478
20479#ifdef FREECIV_JSON_CONNECTION
20480 /* Exit array. */
20481 free(field_addr.sub_location);
20482 field_addr.sub_location = NULL;
20483#endif /* FREECIV_JSON_CONNECTION */
20484 }
20485#ifdef FREECIV_JSON_CONNECTION
20486 field_addr.name = "prod";
20487#endif /* FREECIV_JSON_CONNECTION */
20488
20489 {
20490 int i;
20491
20492#ifdef FREECIV_JSON_CONNECTION
20493 /* Create the array. */
20494 DIO_PUT(farray, &dout, &field_addr, O_LAST);
20495
20496 /* Enter the array. */
20497 field_addr.sub_location = plocation_elem_new(0);
20498#endif /* FREECIV_JSON_CONNECTION */
20499
20500 for (i = 0; i < O_LAST; i++) {
20501#ifdef FREECIV_JSON_CONNECTION
20502 /* Next array element. */
20503 field_addr.sub_location->number = i;
20504#endif /* FREECIV_JSON_CONNECTION */
20505 DIO_PUT(uint16, &dout, &field_addr, real_packet->prod[i]);
20506 }
20507
20508#ifdef FREECIV_JSON_CONNECTION
20509 /* Exit array. */
20510 free(field_addr.sub_location);
20511 field_addr.sub_location = NULL;
20512#endif /* FREECIV_JSON_CONNECTION */
20513 }
20514#ifdef FREECIV_JSON_CONNECTION
20515 field_addr.name = "citizen_base";
20516#endif /* FREECIV_JSON_CONNECTION */
20517
20518 {
20519 int i;
20520
20521#ifdef FREECIV_JSON_CONNECTION
20522 /* Create the array. */
20523 DIO_PUT(farray, &dout, &field_addr, O_LAST);
20524
20525 /* Enter the array. */
20526 field_addr.sub_location = plocation_elem_new(0);
20527#endif /* FREECIV_JSON_CONNECTION */
20528
20529 for (i = 0; i < O_LAST; i++) {
20530#ifdef FREECIV_JSON_CONNECTION
20531 /* Next array element. */
20532 field_addr.sub_location->number = i;
20533#endif /* FREECIV_JSON_CONNECTION */
20534 DIO_PUT(sint16, &dout, &field_addr, real_packet->citizen_base[i]);
20535 }
20536
20537#ifdef FREECIV_JSON_CONNECTION
20538 /* Exit array. */
20539 free(field_addr.sub_location);
20540 field_addr.sub_location = NULL;
20541#endif /* FREECIV_JSON_CONNECTION */
20542 }
20543#ifdef FREECIV_JSON_CONNECTION
20544 field_addr.name = "usage";
20545#endif /* FREECIV_JSON_CONNECTION */
20546
20547 {
20548 int i;
20549
20550#ifdef FREECIV_JSON_CONNECTION
20551 /* Create the array. */
20552 DIO_PUT(farray, &dout, &field_addr, O_LAST);
20553
20554 /* Enter the array. */
20555 field_addr.sub_location = plocation_elem_new(0);
20556#endif /* FREECIV_JSON_CONNECTION */
20557
20558 for (i = 0; i < O_LAST; i++) {
20559#ifdef FREECIV_JSON_CONNECTION
20560 /* Next array element. */
20561 field_addr.sub_location->number = i;
20562#endif /* FREECIV_JSON_CONNECTION */
20563 DIO_PUT(sint16, &dout, &field_addr, real_packet->usage[i]);
20564 }
20565
20566#ifdef FREECIV_JSON_CONNECTION
20567 /* Exit array. */
20568 free(field_addr.sub_location);
20569 field_addr.sub_location = NULL;
20570#endif /* FREECIV_JSON_CONNECTION */
20571 }
20572#ifdef FREECIV_JSON_CONNECTION
20573 field_addr.name = "food_stock";
20574#endif /* FREECIV_JSON_CONNECTION */
20575 DIO_PUT(sint16, &dout, &field_addr, real_packet->food_stock);
20576#ifdef FREECIV_JSON_CONNECTION
20577 field_addr.name = "shield_stock";
20578#endif /* FREECIV_JSON_CONNECTION */
20579 DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
20580#ifdef FREECIV_JSON_CONNECTION
20581 field_addr.name = "trade_route_count";
20582#endif /* FREECIV_JSON_CONNECTION */
20583 DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_route_count);
20584#ifdef FREECIV_JSON_CONNECTION
20585 field_addr.name = "pollution";
20586#endif /* FREECIV_JSON_CONNECTION */
20587 DIO_PUT(uint16, &dout, &field_addr, real_packet->pollution);
20588#ifdef FREECIV_JSON_CONNECTION
20589 field_addr.name = "illness_trade";
20590#endif /* FREECIV_JSON_CONNECTION */
20591 DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade);
20592#ifdef FREECIV_JSON_CONNECTION
20593 field_addr.name = "production_kind";
20594#endif /* FREECIV_JSON_CONNECTION */
20595 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
20596#ifdef FREECIV_JSON_CONNECTION
20597 field_addr.name = "production_value";
20598#endif /* FREECIV_JSON_CONNECTION */
20599 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
20600#ifdef FREECIV_JSON_CONNECTION
20601 field_addr.name = "turn_founded";
20602#endif /* FREECIV_JSON_CONNECTION */
20603 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
20604#ifdef FREECIV_JSON_CONNECTION
20605 field_addr.name = "turn_last_built";
20606#endif /* FREECIV_JSON_CONNECTION */
20607 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
20608#ifdef FREECIV_JSON_CONNECTION
20609 field_addr.name = "changed_from_kind";
20610#endif /* FREECIV_JSON_CONNECTION */
20611 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_kind);
20612#ifdef FREECIV_JSON_CONNECTION
20613 field_addr.name = "changed_from_value";
20614#endif /* FREECIV_JSON_CONNECTION */
20615 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_value);
20616#ifdef FREECIV_JSON_CONNECTION
20617 field_addr.name = "before_change_shields";
20618#endif /* FREECIV_JSON_CONNECTION */
20619 DIO_PUT(uint16, &dout, &field_addr, real_packet->before_change_shields);
20620#ifdef FREECIV_JSON_CONNECTION
20621 field_addr.name = "disbanded_shields";
20622#endif /* FREECIV_JSON_CONNECTION */
20623 DIO_PUT(uint16, &dout, &field_addr, real_packet->disbanded_shields);
20624#ifdef FREECIV_JSON_CONNECTION
20625 field_addr.name = "caravan_shields";
20626#endif /* FREECIV_JSON_CONNECTION */
20627 DIO_PUT(uint16, &dout, &field_addr, real_packet->caravan_shields);
20628#ifdef FREECIV_JSON_CONNECTION
20629 field_addr.name = "last_turns_shield_surplus";
20630#endif /* FREECIV_JSON_CONNECTION */
20631 DIO_PUT(uint16, &dout, &field_addr, real_packet->last_turns_shield_surplus);
20632#ifdef FREECIV_JSON_CONNECTION
20633 field_addr.name = "airlift";
20634#endif /* FREECIV_JSON_CONNECTION */
20635 DIO_PUT(uint8, &dout, &field_addr, real_packet->airlift);
20636#ifdef FREECIV_JSON_CONNECTION
20637 field_addr.name = "did_buy";
20638#endif /* FREECIV_JSON_CONNECTION */
20639 DIO_PUT(bool8, &dout, &field_addr, real_packet->did_buy);
20640#ifdef FREECIV_JSON_CONNECTION
20641 field_addr.name = "did_sell";
20642#endif /* FREECIV_JSON_CONNECTION */
20643 DIO_PUT(bool8, &dout, &field_addr, real_packet->did_sell);
20644#ifdef FREECIV_JSON_CONNECTION
20645 field_addr.name = "was_happy";
20646#endif /* FREECIV_JSON_CONNECTION */
20647 DIO_PUT(bool8, &dout, &field_addr, real_packet->was_happy);
20648#ifdef FREECIV_JSON_CONNECTION
20649 field_addr.name = "diplomat_investigate";
20650#endif /* FREECIV_JSON_CONNECTION */
20651 DIO_PUT(bool8, &dout, &field_addr, real_packet->diplomat_investigate);
20652#ifdef FREECIV_JSON_CONNECTION
20653 field_addr.name = "walls";
20654#endif /* FREECIV_JSON_CONNECTION */
20655 DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
20656#ifdef FREECIV_JSON_CONNECTION
20657 field_addr.name = "city_image";
20658#endif /* FREECIV_JSON_CONNECTION */
20659 DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
20660#ifdef FREECIV_JSON_CONNECTION
20661 field_addr.name = "steal";
20662#endif /* FREECIV_JSON_CONNECTION */
20663 DIO_PUT(uint16, &dout, &field_addr, real_packet->steal);
20664#ifdef FREECIV_JSON_CONNECTION
20665 field_addr.name = "worklist";
20666#endif /* FREECIV_JSON_CONNECTION */
20667 DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
20668#ifdef FREECIV_JSON_CONNECTION
20669 field_addr.name = "improvements";
20670#endif /* FREECIV_JSON_CONNECTION */
20671 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
20672#ifdef FREECIV_JSON_CONNECTION
20673 field_addr.name = "city_options";
20674#endif /* FREECIV_JSON_CONNECTION */
20675 DIO_BV_PUT(&dout, &field_addr, packet->city_options);
20676#ifdef FREECIV_JSON_CONNECTION
20677 field_addr.name = "name";
20678#endif /* FREECIV_JSON_CONNECTION */
20679 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
20680
20681#endif
20682 SEND_PACKET_END(PACKET_CITY_INFO);
20683}
20684
20685#ifdef FREECIV_DELTA_PROTOCOL
20686static genhash_val_t hash_packet_city_info_103(const void *vkey)
20687{
20688 const struct packet_city_info *key = (const struct packet_city_info *) vkey;
20689
20690 return key->id16;
20691}
20692
20693static bool cmp_packet_city_info_103(const void *vkey1, const void *vkey2)
20694{
20695 const struct packet_city_info *key1 = (const struct packet_city_info *) vkey1;
20696 const struct packet_city_info *key2 = (const struct packet_city_info *) vkey2;
20697
20698 return key1->id16 == key2->id16;
20699}
20700 BV_DEFINE(packet_city_info_103_fields, 48);
20701#endif /* FREECIV_DELTA_PROTOCOL */
20702
20703 static struct packet_city_info *receive_packet_city_info_103(struct connection *pc)
20704{
20705#ifdef FREECIV_DELTA_PROTOCOL
20706 packet_city_info_103_fields fields;
20707 struct packet_city_info *old;
20708 struct genhash **hash = pc->phs.received + PACKET_CITY_INFO;
20709#endif /* FREECIV_DELTA_PROTOCOL */
20710 RECEIVE_PACKET_START(packet_city_info, real_packet);
20711#ifdef FREECIV_JSON_CONNECTION
20712 struct plocation field_addr;
20713 {
20714 struct plocation *field_addr_tmp = plocation_field_new(NULL);
20715 field_addr = *field_addr_tmp;
20716 FC_FREE(field_addr_tmp);
20717 }
20718#endif /* FREECIV_JSON_CONNECTION */
20719
20720#ifdef FREECIV_DELTA_PROTOCOL
20721#ifdef FREECIV_JSON_CONNECTION
20722 field_addr.name = "fields";
20723#endif /* FREECIV_JSON_CONNECTION */
20724 DIO_BV_GET(&din, &field_addr, fields);
20725 #ifdef FREECIV_JSON_CONNECTION
20726 field_addr.name = "id16";
20727 #endif /* FREECIV_JSON_CONNECTION */
20728 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
20729 RECEIVE_PACKET_FIELD_ERROR(id16);
20730 }
20731
20732#else /* FREECIV_DELTA_PROTOCOL */
20733 #ifdef FREECIV_JSON_CONNECTION
20734 field_addr.name = "id16";
20735 #endif /* FREECIV_JSON_CONNECTION */
20736 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
20737 RECEIVE_PACKET_FIELD_ERROR(id16);
20738 }
20739 #ifdef FREECIV_JSON_CONNECTION
20740 field_addr.name = "tile";
20741 #endif /* FREECIV_JSON_CONNECTION */
20742 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
20743 RECEIVE_PACKET_FIELD_ERROR(tile);
20744 }
20745 #ifdef FREECIV_JSON_CONNECTION
20746 field_addr.name = "owner";
20747 #endif /* FREECIV_JSON_CONNECTION */
20748 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
20749 RECEIVE_PACKET_FIELD_ERROR(owner);
20750 }
20751 #ifdef FREECIV_JSON_CONNECTION
20752 field_addr.name = "size";
20753 #endif /* FREECIV_JSON_CONNECTION */
20754 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
20755 RECEIVE_PACKET_FIELD_ERROR(size);
20756 }
20757 #ifdef FREECIV_JSON_CONNECTION
20758 field_addr.name = "city_radius_sq";
20759 #endif /* FREECIV_JSON_CONNECTION */
20760 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_radius_sq)) {
20761 RECEIVE_PACKET_FIELD_ERROR(city_radius_sq);
20762 }
20763 #ifdef FREECIV_JSON_CONNECTION
20764 field_addr.name = "style";
20765 #endif /* FREECIV_JSON_CONNECTION */
20766 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
20767 RECEIVE_PACKET_FIELD_ERROR(style);
20768 }
20769 #ifdef FREECIV_JSON_CONNECTION
20770 field_addr.name = "capital";
20771 #endif /* FREECIV_JSON_CONNECTION */
20772 {
20773 int readin;
20774
20775 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
20776 RECEIVE_PACKET_FIELD_ERROR(capital);
20777 }
20778 real_packet->capital = readin;
20779 }
20780 #ifdef FREECIV_JSON_CONNECTION
20781 field_addr.name = "ppl_happy";
20782 #endif /* FREECIV_JSON_CONNECTION */
20783
20784 {
20785 int i;
20786
20787 #ifdef FREECIV_JSON_CONNECTION
20788 /* Enter array. */
20789 field_addr.sub_location = plocation_elem_new(0);
20790 #endif /* FREECIV_JSON_CONNECTION */
20791
20792 for (i = 0; i < FEELING_LAST; i++) {
20793 #ifdef FREECIV_JSON_CONNECTION
20794 field_addr.sub_location->number = i;
20795 #endif /* FREECIV_JSON_CONNECTION */
20796 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
20797 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
20798 }
20799 }
20800
20801 #ifdef FREECIV_JSON_CONNECTION
20802 /* Exit array. */
20803 free(field_addr.sub_location);
20804 field_addr.sub_location = NULL;
20805 #endif /* FREECIV_JSON_CONNECTION */
20806 }
20807 #ifdef FREECIV_JSON_CONNECTION
20808 field_addr.name = "ppl_content";
20809 #endif /* FREECIV_JSON_CONNECTION */
20810
20811 {
20812 int i;
20813
20814 #ifdef FREECIV_JSON_CONNECTION
20815 /* Enter array. */
20816 field_addr.sub_location = plocation_elem_new(0);
20817 #endif /* FREECIV_JSON_CONNECTION */
20818
20819 for (i = 0; i < FEELING_LAST; i++) {
20820 #ifdef FREECIV_JSON_CONNECTION
20821 field_addr.sub_location->number = i;
20822 #endif /* FREECIV_JSON_CONNECTION */
20823 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
20824 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
20825 }
20826 }
20827
20828 #ifdef FREECIV_JSON_CONNECTION
20829 /* Exit array. */
20830 free(field_addr.sub_location);
20831 field_addr.sub_location = NULL;
20832 #endif /* FREECIV_JSON_CONNECTION */
20833 }
20834 #ifdef FREECIV_JSON_CONNECTION
20835 field_addr.name = "ppl_unhappy";
20836 #endif /* FREECIV_JSON_CONNECTION */
20837
20838 {
20839 int i;
20840
20841 #ifdef FREECIV_JSON_CONNECTION
20842 /* Enter array. */
20843 field_addr.sub_location = plocation_elem_new(0);
20844 #endif /* FREECIV_JSON_CONNECTION */
20845
20846 for (i = 0; i < FEELING_LAST; i++) {
20847 #ifdef FREECIV_JSON_CONNECTION
20848 field_addr.sub_location->number = i;
20849 #endif /* FREECIV_JSON_CONNECTION */
20850 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
20851 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
20852 }
20853 }
20854
20855 #ifdef FREECIV_JSON_CONNECTION
20856 /* Exit array. */
20857 free(field_addr.sub_location);
20858 field_addr.sub_location = NULL;
20859 #endif /* FREECIV_JSON_CONNECTION */
20860 }
20861 #ifdef FREECIV_JSON_CONNECTION
20862 field_addr.name = "ppl_angry";
20863 #endif /* FREECIV_JSON_CONNECTION */
20864
20865 {
20866 int i;
20867
20868 #ifdef FREECIV_JSON_CONNECTION
20869 /* Enter array. */
20870 field_addr.sub_location = plocation_elem_new(0);
20871 #endif /* FREECIV_JSON_CONNECTION */
20872
20873 for (i = 0; i < FEELING_LAST; i++) {
20874 #ifdef FREECIV_JSON_CONNECTION
20875 field_addr.sub_location->number = i;
20876 #endif /* FREECIV_JSON_CONNECTION */
20877 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
20878 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
20879 }
20880 }
20881
20882 #ifdef FREECIV_JSON_CONNECTION
20883 /* Exit array. */
20884 free(field_addr.sub_location);
20885 field_addr.sub_location = NULL;
20886 #endif /* FREECIV_JSON_CONNECTION */
20887 }
20888 #ifdef FREECIV_JSON_CONNECTION
20889 field_addr.name = "specialists_size";
20890 #endif /* FREECIV_JSON_CONNECTION */
20891 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
20892 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
20893 }
20894 #ifdef FREECIV_JSON_CONNECTION
20895 field_addr.name = "specialists";
20896 #endif /* FREECIV_JSON_CONNECTION */
20897
20898 {
20899 int i;
20900
20901 #ifdef FREECIV_JSON_CONNECTION
20902 /* Enter array. */
20903 field_addr.sub_location = plocation_elem_new(0);
20904 #endif /* FREECIV_JSON_CONNECTION */
20905
20906 if (real_packet->specialists_size > SP_MAX) {
20907 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
20908 }
20909 for (i = 0; i < real_packet->specialists_size; i++) {
20910 #ifdef FREECIV_JSON_CONNECTION
20911 field_addr.sub_location->number = i;
20912 #endif /* FREECIV_JSON_CONNECTION */
20913 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
20914 RECEIVE_PACKET_FIELD_ERROR(specialists);
20915 }
20916 }
20917
20918 #ifdef FREECIV_JSON_CONNECTION
20919 /* Exit array. */
20920 free(field_addr.sub_location);
20921 field_addr.sub_location = NULL;
20922 #endif /* FREECIV_JSON_CONNECTION */
20923 }
20924 #ifdef FREECIV_JSON_CONNECTION
20925 field_addr.name = "history";
20926 #endif /* FREECIV_JSON_CONNECTION */
20927 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
20928 RECEIVE_PACKET_FIELD_ERROR(history);
20929 }
20930 #ifdef FREECIV_JSON_CONNECTION
20931 field_addr.name = "culture";
20932 #endif /* FREECIV_JSON_CONNECTION */
20933 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
20934 RECEIVE_PACKET_FIELD_ERROR(culture);
20935 }
20936 #ifdef FREECIV_JSON_CONNECTION
20937 field_addr.name = "buy_cost";
20938 #endif /* FREECIV_JSON_CONNECTION */
20939 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->buy_cost)) {
20940 RECEIVE_PACKET_FIELD_ERROR(buy_cost);
20941 }
20942 #ifdef FREECIV_JSON_CONNECTION
20943 field_addr.name = "surplus";
20944 #endif /* FREECIV_JSON_CONNECTION */
20945
20946 {
20947 int i;
20948
20949 #ifdef FREECIV_JSON_CONNECTION
20950 /* Enter array. */
20951 field_addr.sub_location = plocation_elem_new(0);
20952 #endif /* FREECIV_JSON_CONNECTION */
20953
20954 for (i = 0; i < O_LAST; i++) {
20955 #ifdef FREECIV_JSON_CONNECTION
20956 field_addr.sub_location->number = i;
20957 #endif /* FREECIV_JSON_CONNECTION */
20958 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->surplus[i])) {
20959 RECEIVE_PACKET_FIELD_ERROR(surplus);
20960 }
20961 }
20962
20963 #ifdef FREECIV_JSON_CONNECTION
20964 /* Exit array. */
20965 free(field_addr.sub_location);
20966 field_addr.sub_location = NULL;
20967 #endif /* FREECIV_JSON_CONNECTION */
20968 }
20969 #ifdef FREECIV_JSON_CONNECTION
20970 field_addr.name = "waste";
20971 #endif /* FREECIV_JSON_CONNECTION */
20972
20973 {
20974 int i;
20975
20976 #ifdef FREECIV_JSON_CONNECTION
20977 /* Enter array. */
20978 field_addr.sub_location = plocation_elem_new(0);
20979 #endif /* FREECIV_JSON_CONNECTION */
20980
20981 for (i = 0; i < O_LAST; i++) {
20982 #ifdef FREECIV_JSON_CONNECTION
20983 field_addr.sub_location->number = i;
20984 #endif /* FREECIV_JSON_CONNECTION */
20985 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->waste[i])) {
20986 RECEIVE_PACKET_FIELD_ERROR(waste);
20987 }
20988 }
20989
20990 #ifdef FREECIV_JSON_CONNECTION
20991 /* Exit array. */
20992 free(field_addr.sub_location);
20993 field_addr.sub_location = NULL;
20994 #endif /* FREECIV_JSON_CONNECTION */
20995 }
20996 #ifdef FREECIV_JSON_CONNECTION
20997 field_addr.name = "unhappy_penalty";
20998 #endif /* FREECIV_JSON_CONNECTION */
20999
21000 {
21001 int i;
21002
21003 #ifdef FREECIV_JSON_CONNECTION
21004 /* Enter array. */
21005 field_addr.sub_location = plocation_elem_new(0);
21006 #endif /* FREECIV_JSON_CONNECTION */
21007
21008 for (i = 0; i < O_LAST; i++) {
21009 #ifdef FREECIV_JSON_CONNECTION
21010 field_addr.sub_location->number = i;
21011 #endif /* FREECIV_JSON_CONNECTION */
21012 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->unhappy_penalty[i])) {
21013 RECEIVE_PACKET_FIELD_ERROR(unhappy_penalty);
21014 }
21015 }
21016
21017 #ifdef FREECIV_JSON_CONNECTION
21018 /* Exit array. */
21019 free(field_addr.sub_location);
21020 field_addr.sub_location = NULL;
21021 #endif /* FREECIV_JSON_CONNECTION */
21022 }
21023 #ifdef FREECIV_JSON_CONNECTION
21024 field_addr.name = "prod";
21025 #endif /* FREECIV_JSON_CONNECTION */
21026
21027 {
21028 int i;
21029
21030 #ifdef FREECIV_JSON_CONNECTION
21031 /* Enter array. */
21032 field_addr.sub_location = plocation_elem_new(0);
21033 #endif /* FREECIV_JSON_CONNECTION */
21034
21035 for (i = 0; i < O_LAST; i++) {
21036 #ifdef FREECIV_JSON_CONNECTION
21037 field_addr.sub_location->number = i;
21038 #endif /* FREECIV_JSON_CONNECTION */
21039 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->prod[i])) {
21040 RECEIVE_PACKET_FIELD_ERROR(prod);
21041 }
21042 }
21043
21044 #ifdef FREECIV_JSON_CONNECTION
21045 /* Exit array. */
21046 free(field_addr.sub_location);
21047 field_addr.sub_location = NULL;
21048 #endif /* FREECIV_JSON_CONNECTION */
21049 }
21050 #ifdef FREECIV_JSON_CONNECTION
21051 field_addr.name = "citizen_base";
21052 #endif /* FREECIV_JSON_CONNECTION */
21053
21054 {
21055 int i;
21056
21057 #ifdef FREECIV_JSON_CONNECTION
21058 /* Enter array. */
21059 field_addr.sub_location = plocation_elem_new(0);
21060 #endif /* FREECIV_JSON_CONNECTION */
21061
21062 for (i = 0; i < O_LAST; i++) {
21063 #ifdef FREECIV_JSON_CONNECTION
21064 field_addr.sub_location->number = i;
21065 #endif /* FREECIV_JSON_CONNECTION */
21066 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->citizen_base[i])) {
21067 RECEIVE_PACKET_FIELD_ERROR(citizen_base);
21068 }
21069 }
21070
21071 #ifdef FREECIV_JSON_CONNECTION
21072 /* Exit array. */
21073 free(field_addr.sub_location);
21074 field_addr.sub_location = NULL;
21075 #endif /* FREECIV_JSON_CONNECTION */
21076 }
21077 #ifdef FREECIV_JSON_CONNECTION
21078 field_addr.name = "usage";
21079 #endif /* FREECIV_JSON_CONNECTION */
21080
21081 {
21082 int i;
21083
21084 #ifdef FREECIV_JSON_CONNECTION
21085 /* Enter array. */
21086 field_addr.sub_location = plocation_elem_new(0);
21087 #endif /* FREECIV_JSON_CONNECTION */
21088
21089 for (i = 0; i < O_LAST; i++) {
21090 #ifdef FREECIV_JSON_CONNECTION
21091 field_addr.sub_location->number = i;
21092 #endif /* FREECIV_JSON_CONNECTION */
21093 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->usage[i])) {
21094 RECEIVE_PACKET_FIELD_ERROR(usage);
21095 }
21096 }
21097
21098 #ifdef FREECIV_JSON_CONNECTION
21099 /* Exit array. */
21100 free(field_addr.sub_location);
21101 field_addr.sub_location = NULL;
21102 #endif /* FREECIV_JSON_CONNECTION */
21103 }
21104 #ifdef FREECIV_JSON_CONNECTION
21105 field_addr.name = "food_stock";
21106 #endif /* FREECIV_JSON_CONNECTION */
21107 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->food_stock)) {
21108 RECEIVE_PACKET_FIELD_ERROR(food_stock);
21109 }
21110 #ifdef FREECIV_JSON_CONNECTION
21111 field_addr.name = "shield_stock";
21112 #endif /* FREECIV_JSON_CONNECTION */
21113 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
21114 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
21115 }
21116 #ifdef FREECIV_JSON_CONNECTION
21117 field_addr.name = "trade_route_count";
21118 #endif /* FREECIV_JSON_CONNECTION */
21119 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_route_count)) {
21120 RECEIVE_PACKET_FIELD_ERROR(trade_route_count);
21121 }
21122 #ifdef FREECIV_JSON_CONNECTION
21123 field_addr.name = "pollution";
21124 #endif /* FREECIV_JSON_CONNECTION */
21125 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->pollution)) {
21126 RECEIVE_PACKET_FIELD_ERROR(pollution);
21127 }
21128 #ifdef FREECIV_JSON_CONNECTION
21129 field_addr.name = "illness_trade";
21130 #endif /* FREECIV_JSON_CONNECTION */
21131 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade)) {
21132 RECEIVE_PACKET_FIELD_ERROR(illness_trade);
21133 }
21134 #ifdef FREECIV_JSON_CONNECTION
21135 field_addr.name = "production_kind";
21136 #endif /* FREECIV_JSON_CONNECTION */
21137 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
21138 RECEIVE_PACKET_FIELD_ERROR(production_kind);
21139 }
21140 #ifdef FREECIV_JSON_CONNECTION
21141 field_addr.name = "production_value";
21142 #endif /* FREECIV_JSON_CONNECTION */
21143 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
21144 RECEIVE_PACKET_FIELD_ERROR(production_value);
21145 }
21146 #ifdef FREECIV_JSON_CONNECTION
21147 field_addr.name = "turn_founded";
21148 #endif /* FREECIV_JSON_CONNECTION */
21149 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
21150 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
21151 }
21152 #ifdef FREECIV_JSON_CONNECTION
21153 field_addr.name = "turn_last_built";
21154 #endif /* FREECIV_JSON_CONNECTION */
21155 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
21156 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
21157 }
21158 #ifdef FREECIV_JSON_CONNECTION
21159 field_addr.name = "changed_from_kind";
21160 #endif /* FREECIV_JSON_CONNECTION */
21161 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_kind)) {
21162 RECEIVE_PACKET_FIELD_ERROR(changed_from_kind);
21163 }
21164 #ifdef FREECIV_JSON_CONNECTION
21165 field_addr.name = "changed_from_value";
21166 #endif /* FREECIV_JSON_CONNECTION */
21167 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_value)) {
21168 RECEIVE_PACKET_FIELD_ERROR(changed_from_value);
21169 }
21170 #ifdef FREECIV_JSON_CONNECTION
21171 field_addr.name = "before_change_shields";
21172 #endif /* FREECIV_JSON_CONNECTION */
21173 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->before_change_shields)) {
21174 RECEIVE_PACKET_FIELD_ERROR(before_change_shields);
21175 }
21176 #ifdef FREECIV_JSON_CONNECTION
21177 field_addr.name = "disbanded_shields";
21178 #endif /* FREECIV_JSON_CONNECTION */
21179 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disbanded_shields)) {
21180 RECEIVE_PACKET_FIELD_ERROR(disbanded_shields);
21181 }
21182 #ifdef FREECIV_JSON_CONNECTION
21183 field_addr.name = "caravan_shields";
21184 #endif /* FREECIV_JSON_CONNECTION */
21185 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->caravan_shields)) {
21186 RECEIVE_PACKET_FIELD_ERROR(caravan_shields);
21187 }
21188 #ifdef FREECIV_JSON_CONNECTION
21189 field_addr.name = "last_turns_shield_surplus";
21190 #endif /* FREECIV_JSON_CONNECTION */
21191 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->last_turns_shield_surplus)) {
21192 RECEIVE_PACKET_FIELD_ERROR(last_turns_shield_surplus);
21193 }
21194 #ifdef FREECIV_JSON_CONNECTION
21195 field_addr.name = "airlift";
21196 #endif /* FREECIV_JSON_CONNECTION */
21197 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->airlift)) {
21198 RECEIVE_PACKET_FIELD_ERROR(airlift);
21199 }
21200 #ifdef FREECIV_JSON_CONNECTION
21201 field_addr.name = "did_buy";
21202 #endif /* FREECIV_JSON_CONNECTION */
21203 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_buy)) {
21204 RECEIVE_PACKET_FIELD_ERROR(did_buy);
21205 }
21206 #ifdef FREECIV_JSON_CONNECTION
21207 field_addr.name = "did_sell";
21208 #endif /* FREECIV_JSON_CONNECTION */
21209 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_sell)) {
21210 RECEIVE_PACKET_FIELD_ERROR(did_sell);
21211 }
21212 #ifdef FREECIV_JSON_CONNECTION
21213 field_addr.name = "was_happy";
21214 #endif /* FREECIV_JSON_CONNECTION */
21215 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->was_happy)) {
21216 RECEIVE_PACKET_FIELD_ERROR(was_happy);
21217 }
21218 #ifdef FREECIV_JSON_CONNECTION
21219 field_addr.name = "diplomat_investigate";
21220 #endif /* FREECIV_JSON_CONNECTION */
21221 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->diplomat_investigate)) {
21222 RECEIVE_PACKET_FIELD_ERROR(diplomat_investigate);
21223 }
21224 #ifdef FREECIV_JSON_CONNECTION
21225 field_addr.name = "walls";
21226 #endif /* FREECIV_JSON_CONNECTION */
21227 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
21228 RECEIVE_PACKET_FIELD_ERROR(walls);
21229 }
21230 #ifdef FREECIV_JSON_CONNECTION
21231 field_addr.name = "city_image";
21232 #endif /* FREECIV_JSON_CONNECTION */
21233 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
21234 RECEIVE_PACKET_FIELD_ERROR(city_image);
21235 }
21236 #ifdef FREECIV_JSON_CONNECTION
21237 field_addr.name = "steal";
21238 #endif /* FREECIV_JSON_CONNECTION */
21239 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->steal)) {
21240 RECEIVE_PACKET_FIELD_ERROR(steal);
21241 }
21242 #ifdef FREECIV_JSON_CONNECTION
21243 field_addr.name = "worklist";
21244 #endif /* FREECIV_JSON_CONNECTION */
21245 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
21246 RECEIVE_PACKET_FIELD_ERROR(worklist);
21247 }
21248 #ifdef FREECIV_JSON_CONNECTION
21249 field_addr.name = "improvements";
21250 #endif /* FREECIV_JSON_CONNECTION */
21251 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
21252 RECEIVE_PACKET_FIELD_ERROR(improvements);
21253 }
21254 #ifdef FREECIV_JSON_CONNECTION
21255 field_addr.name = "city_options";
21256 #endif /* FREECIV_JSON_CONNECTION */
21257 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
21258 RECEIVE_PACKET_FIELD_ERROR(city_options);
21259 }
21260 #ifdef FREECIV_JSON_CONNECTION
21261 field_addr.name = "name";
21262 #endif /* FREECIV_JSON_CONNECTION */
21263 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
21264 RECEIVE_PACKET_FIELD_ERROR(name);
21265 }
21266
21267#endif
21268 log_packet_detailed("packet_city_info_103: got info about (%d)",
21269 real_packet->id16);
21270
21271#ifdef FREECIV_DELTA_PROTOCOL
21272 if (NULL == *hash) {
21273 *hash = genhash_new_full(hash_packet_city_info_103, cmp_packet_city_info_103,
21274 NULL, NULL, NULL, free);
21275 }
21276
21277 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
21278 *real_packet = *old;
21279 } else {
21280 int id16 = real_packet->id16;
21281
21282 log_packet_detailed(" no old info");
21283 memset(real_packet, 0, sizeof(*real_packet));
21284
21285 real_packet->id16 = id16;
21286 }
21287
21288 if (BV_ISSET(fields, 0)) {
21289 log_packet_detailed(" got field 'tile'");
21290 #ifdef FREECIV_JSON_CONNECTION
21291 field_addr.name = "tile";
21292 #endif /* FREECIV_JSON_CONNECTION */
21293 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
21294 RECEIVE_PACKET_FIELD_ERROR(tile);
21295 }
21296 }
21297 if (BV_ISSET(fields, 1)) {
21298 log_packet_detailed(" got field 'owner'");
21299 #ifdef FREECIV_JSON_CONNECTION
21300 field_addr.name = "owner";
21301 #endif /* FREECIV_JSON_CONNECTION */
21302 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
21303 RECEIVE_PACKET_FIELD_ERROR(owner);
21304 }
21305 }
21306 if (BV_ISSET(fields, 2)) {
21307 log_packet_detailed(" got field 'size'");
21308 #ifdef FREECIV_JSON_CONNECTION
21309 field_addr.name = "size";
21310 #endif /* FREECIV_JSON_CONNECTION */
21311 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
21312 RECEIVE_PACKET_FIELD_ERROR(size);
21313 }
21314 }
21315 if (BV_ISSET(fields, 3)) {
21316 log_packet_detailed(" got field 'city_radius_sq'");
21317 #ifdef FREECIV_JSON_CONNECTION
21318 field_addr.name = "city_radius_sq";
21319 #endif /* FREECIV_JSON_CONNECTION */
21320 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_radius_sq)) {
21321 RECEIVE_PACKET_FIELD_ERROR(city_radius_sq);
21322 }
21323 }
21324 if (BV_ISSET(fields, 4)) {
21325 log_packet_detailed(" got field 'style'");
21326 #ifdef FREECIV_JSON_CONNECTION
21327 field_addr.name = "style";
21328 #endif /* FREECIV_JSON_CONNECTION */
21329 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
21330 RECEIVE_PACKET_FIELD_ERROR(style);
21331 }
21332 }
21333 if (BV_ISSET(fields, 5)) {
21334 log_packet_detailed(" got field 'capital'");
21335 #ifdef FREECIV_JSON_CONNECTION
21336 field_addr.name = "capital";
21337 #endif /* FREECIV_JSON_CONNECTION */
21338 {
21339 int readin;
21340
21341 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
21342 RECEIVE_PACKET_FIELD_ERROR(capital);
21343 }
21344 real_packet->capital = readin;
21345 }
21346 }
21347 if (BV_ISSET(fields, 6)) {
21348 log_packet_detailed(" got field 'ppl_happy'");
21349 #ifdef FREECIV_JSON_CONNECTION
21350 field_addr.name = "ppl_happy";
21351 #endif /* FREECIV_JSON_CONNECTION */
21352
21353 {
21354 int i;
21355
21356 #ifdef FREECIV_JSON_CONNECTION
21357 /* Enter array. */
21358 field_addr.sub_location = plocation_elem_new(0);
21359 #endif /* FREECIV_JSON_CONNECTION */
21360
21361 for (i = 0; i < FEELING_LAST; i++) {
21362 #ifdef FREECIV_JSON_CONNECTION
21363 field_addr.sub_location->number = i;
21364 #endif /* FREECIV_JSON_CONNECTION */
21365 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
21366 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
21367 }
21368 }
21369
21370 #ifdef FREECIV_JSON_CONNECTION
21371 /* Exit array. */
21372 free(field_addr.sub_location);
21373 field_addr.sub_location = NULL;
21374 #endif /* FREECIV_JSON_CONNECTION */
21375 }
21376 }
21377 if (BV_ISSET(fields, 7)) {
21378 log_packet_detailed(" got field 'ppl_content'");
21379 #ifdef FREECIV_JSON_CONNECTION
21380 field_addr.name = "ppl_content";
21381 #endif /* FREECIV_JSON_CONNECTION */
21382
21383 {
21384 int i;
21385
21386 #ifdef FREECIV_JSON_CONNECTION
21387 /* Enter array. */
21388 field_addr.sub_location = plocation_elem_new(0);
21389 #endif /* FREECIV_JSON_CONNECTION */
21390
21391 for (i = 0; i < FEELING_LAST; i++) {
21392 #ifdef FREECIV_JSON_CONNECTION
21393 field_addr.sub_location->number = i;
21394 #endif /* FREECIV_JSON_CONNECTION */
21395 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
21396 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
21397 }
21398 }
21399
21400 #ifdef FREECIV_JSON_CONNECTION
21401 /* Exit array. */
21402 free(field_addr.sub_location);
21403 field_addr.sub_location = NULL;
21404 #endif /* FREECIV_JSON_CONNECTION */
21405 }
21406 }
21407 if (BV_ISSET(fields, 8)) {
21408 log_packet_detailed(" got field 'ppl_unhappy'");
21409 #ifdef FREECIV_JSON_CONNECTION
21410 field_addr.name = "ppl_unhappy";
21411 #endif /* FREECIV_JSON_CONNECTION */
21412
21413 {
21414 int i;
21415
21416 #ifdef FREECIV_JSON_CONNECTION
21417 /* Enter array. */
21418 field_addr.sub_location = plocation_elem_new(0);
21419 #endif /* FREECIV_JSON_CONNECTION */
21420
21421 for (i = 0; i < FEELING_LAST; i++) {
21422 #ifdef FREECIV_JSON_CONNECTION
21423 field_addr.sub_location->number = i;
21424 #endif /* FREECIV_JSON_CONNECTION */
21425 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
21426 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
21427 }
21428 }
21429
21430 #ifdef FREECIV_JSON_CONNECTION
21431 /* Exit array. */
21432 free(field_addr.sub_location);
21433 field_addr.sub_location = NULL;
21434 #endif /* FREECIV_JSON_CONNECTION */
21435 }
21436 }
21437 if (BV_ISSET(fields, 9)) {
21438 log_packet_detailed(" got field 'ppl_angry'");
21439 #ifdef FREECIV_JSON_CONNECTION
21440 field_addr.name = "ppl_angry";
21441 #endif /* FREECIV_JSON_CONNECTION */
21442
21443 {
21444 int i;
21445
21446 #ifdef FREECIV_JSON_CONNECTION
21447 /* Enter array. */
21448 field_addr.sub_location = plocation_elem_new(0);
21449 #endif /* FREECIV_JSON_CONNECTION */
21450
21451 for (i = 0; i < FEELING_LAST; i++) {
21452 #ifdef FREECIV_JSON_CONNECTION
21453 field_addr.sub_location->number = i;
21454 #endif /* FREECIV_JSON_CONNECTION */
21455 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
21456 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
21457 }
21458 }
21459
21460 #ifdef FREECIV_JSON_CONNECTION
21461 /* Exit array. */
21462 free(field_addr.sub_location);
21463 field_addr.sub_location = NULL;
21464 #endif /* FREECIV_JSON_CONNECTION */
21465 }
21466 }
21467 if (BV_ISSET(fields, 10)) {
21468 log_packet_detailed(" got field 'specialists_size'");
21469 #ifdef FREECIV_JSON_CONNECTION
21470 field_addr.name = "specialists_size";
21471 #endif /* FREECIV_JSON_CONNECTION */
21472 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
21473 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
21474 }
21475 }
21476 if (BV_ISSET(fields, 11)) {
21477 log_packet_detailed(" got field 'specialists'");
21478 #ifdef FREECIV_JSON_CONNECTION
21479 field_addr.name = "specialists";
21480 #endif /* FREECIV_JSON_CONNECTION */
21481
21482 {
21483 int i;
21484
21485 #ifdef FREECIV_JSON_CONNECTION
21486 /* Enter array. */
21487 field_addr.sub_location = plocation_elem_new(0);
21488 #endif /* FREECIV_JSON_CONNECTION */
21489
21490 if (real_packet->specialists_size > SP_MAX) {
21491 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
21492 }
21493 for (i = 0; i < real_packet->specialists_size; i++) {
21494 #ifdef FREECIV_JSON_CONNECTION
21495 field_addr.sub_location->number = i;
21496 #endif /* FREECIV_JSON_CONNECTION */
21497 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
21498 RECEIVE_PACKET_FIELD_ERROR(specialists);
21499 }
21500 }
21501
21502 #ifdef FREECIV_JSON_CONNECTION
21503 /* Exit array. */
21504 free(field_addr.sub_location);
21505 field_addr.sub_location = NULL;
21506 #endif /* FREECIV_JSON_CONNECTION */
21507 }
21508 }
21509 if (BV_ISSET(fields, 12)) {
21510 log_packet_detailed(" got field 'history'");
21511 #ifdef FREECIV_JSON_CONNECTION
21512 field_addr.name = "history";
21513 #endif /* FREECIV_JSON_CONNECTION */
21514 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
21515 RECEIVE_PACKET_FIELD_ERROR(history);
21516 }
21517 }
21518 if (BV_ISSET(fields, 13)) {
21519 log_packet_detailed(" got field 'culture'");
21520 #ifdef FREECIV_JSON_CONNECTION
21521 field_addr.name = "culture";
21522 #endif /* FREECIV_JSON_CONNECTION */
21523 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
21524 RECEIVE_PACKET_FIELD_ERROR(culture);
21525 }
21526 }
21527 if (BV_ISSET(fields, 14)) {
21528 log_packet_detailed(" got field 'buy_cost'");
21529 #ifdef FREECIV_JSON_CONNECTION
21530 field_addr.name = "buy_cost";
21531 #endif /* FREECIV_JSON_CONNECTION */
21532 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->buy_cost)) {
21533 RECEIVE_PACKET_FIELD_ERROR(buy_cost);
21534 }
21535 }
21536 if (BV_ISSET(fields, 15)) {
21537 log_packet_detailed(" got field 'surplus'");
21538 #ifdef FREECIV_JSON_CONNECTION
21539 field_addr.name = "surplus";
21540 #endif /* FREECIV_JSON_CONNECTION */
21541
21542 {
21543 int i;
21544
21545 #ifdef FREECIV_JSON_CONNECTION
21546 /* Enter array. */
21547 field_addr.sub_location = plocation_elem_new(0);
21548 #endif /* FREECIV_JSON_CONNECTION */
21549
21550 for (i = 0; i < O_LAST; i++) {
21551 #ifdef FREECIV_JSON_CONNECTION
21552 field_addr.sub_location->number = i;
21553 #endif /* FREECIV_JSON_CONNECTION */
21554 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->surplus[i])) {
21555 RECEIVE_PACKET_FIELD_ERROR(surplus);
21556 }
21557 }
21558
21559 #ifdef FREECIV_JSON_CONNECTION
21560 /* Exit array. */
21561 free(field_addr.sub_location);
21562 field_addr.sub_location = NULL;
21563 #endif /* FREECIV_JSON_CONNECTION */
21564 }
21565 }
21566 if (BV_ISSET(fields, 16)) {
21567 log_packet_detailed(" got field 'waste'");
21568 #ifdef FREECIV_JSON_CONNECTION
21569 field_addr.name = "waste";
21570 #endif /* FREECIV_JSON_CONNECTION */
21571
21572 {
21573 int i;
21574
21575 #ifdef FREECIV_JSON_CONNECTION
21576 /* Enter array. */
21577 field_addr.sub_location = plocation_elem_new(0);
21578 #endif /* FREECIV_JSON_CONNECTION */
21579
21580 for (i = 0; i < O_LAST; i++) {
21581 #ifdef FREECIV_JSON_CONNECTION
21582 field_addr.sub_location->number = i;
21583 #endif /* FREECIV_JSON_CONNECTION */
21584 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->waste[i])) {
21585 RECEIVE_PACKET_FIELD_ERROR(waste);
21586 }
21587 }
21588
21589 #ifdef FREECIV_JSON_CONNECTION
21590 /* Exit array. */
21591 free(field_addr.sub_location);
21592 field_addr.sub_location = NULL;
21593 #endif /* FREECIV_JSON_CONNECTION */
21594 }
21595 }
21596 if (BV_ISSET(fields, 17)) {
21597 log_packet_detailed(" got field 'unhappy_penalty'");
21598 #ifdef FREECIV_JSON_CONNECTION
21599 field_addr.name = "unhappy_penalty";
21600 #endif /* FREECIV_JSON_CONNECTION */
21601
21602 {
21603 int i;
21604
21605 #ifdef FREECIV_JSON_CONNECTION
21606 /* Enter array. */
21607 field_addr.sub_location = plocation_elem_new(0);
21608 #endif /* FREECIV_JSON_CONNECTION */
21609
21610 for (i = 0; i < O_LAST; i++) {
21611 #ifdef FREECIV_JSON_CONNECTION
21612 field_addr.sub_location->number = i;
21613 #endif /* FREECIV_JSON_CONNECTION */
21614 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->unhappy_penalty[i])) {
21615 RECEIVE_PACKET_FIELD_ERROR(unhappy_penalty);
21616 }
21617 }
21618
21619 #ifdef FREECIV_JSON_CONNECTION
21620 /* Exit array. */
21621 free(field_addr.sub_location);
21622 field_addr.sub_location = NULL;
21623 #endif /* FREECIV_JSON_CONNECTION */
21624 }
21625 }
21626 if (BV_ISSET(fields, 18)) {
21627 log_packet_detailed(" got field 'prod'");
21628 #ifdef FREECIV_JSON_CONNECTION
21629 field_addr.name = "prod";
21630 #endif /* FREECIV_JSON_CONNECTION */
21631
21632 {
21633 int i;
21634
21635 #ifdef FREECIV_JSON_CONNECTION
21636 /* Enter array. */
21637 field_addr.sub_location = plocation_elem_new(0);
21638 #endif /* FREECIV_JSON_CONNECTION */
21639
21640 for (i = 0; i < O_LAST; i++) {
21641 #ifdef FREECIV_JSON_CONNECTION
21642 field_addr.sub_location->number = i;
21643 #endif /* FREECIV_JSON_CONNECTION */
21644 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->prod[i])) {
21645 RECEIVE_PACKET_FIELD_ERROR(prod);
21646 }
21647 }
21648
21649 #ifdef FREECIV_JSON_CONNECTION
21650 /* Exit array. */
21651 free(field_addr.sub_location);
21652 field_addr.sub_location = NULL;
21653 #endif /* FREECIV_JSON_CONNECTION */
21654 }
21655 }
21656 if (BV_ISSET(fields, 19)) {
21657 log_packet_detailed(" got field 'citizen_base'");
21658 #ifdef FREECIV_JSON_CONNECTION
21659 field_addr.name = "citizen_base";
21660 #endif /* FREECIV_JSON_CONNECTION */
21661
21662 {
21663 int i;
21664
21665 #ifdef FREECIV_JSON_CONNECTION
21666 /* Enter array. */
21667 field_addr.sub_location = plocation_elem_new(0);
21668 #endif /* FREECIV_JSON_CONNECTION */
21669
21670 for (i = 0; i < O_LAST; i++) {
21671 #ifdef FREECIV_JSON_CONNECTION
21672 field_addr.sub_location->number = i;
21673 #endif /* FREECIV_JSON_CONNECTION */
21674 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->citizen_base[i])) {
21675 RECEIVE_PACKET_FIELD_ERROR(citizen_base);
21676 }
21677 }
21678
21679 #ifdef FREECIV_JSON_CONNECTION
21680 /* Exit array. */
21681 free(field_addr.sub_location);
21682 field_addr.sub_location = NULL;
21683 #endif /* FREECIV_JSON_CONNECTION */
21684 }
21685 }
21686 if (BV_ISSET(fields, 20)) {
21687 log_packet_detailed(" got field 'usage'");
21688 #ifdef FREECIV_JSON_CONNECTION
21689 field_addr.name = "usage";
21690 #endif /* FREECIV_JSON_CONNECTION */
21691
21692 {
21693 int i;
21694
21695 #ifdef FREECIV_JSON_CONNECTION
21696 /* Enter array. */
21697 field_addr.sub_location = plocation_elem_new(0);
21698 #endif /* FREECIV_JSON_CONNECTION */
21699
21700 for (i = 0; i < O_LAST; i++) {
21701 #ifdef FREECIV_JSON_CONNECTION
21702 field_addr.sub_location->number = i;
21703 #endif /* FREECIV_JSON_CONNECTION */
21704 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->usage[i])) {
21705 RECEIVE_PACKET_FIELD_ERROR(usage);
21706 }
21707 }
21708
21709 #ifdef FREECIV_JSON_CONNECTION
21710 /* Exit array. */
21711 free(field_addr.sub_location);
21712 field_addr.sub_location = NULL;
21713 #endif /* FREECIV_JSON_CONNECTION */
21714 }
21715 }
21716 if (BV_ISSET(fields, 21)) {
21717 log_packet_detailed(" got field 'food_stock'");
21718 #ifdef FREECIV_JSON_CONNECTION
21719 field_addr.name = "food_stock";
21720 #endif /* FREECIV_JSON_CONNECTION */
21721 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->food_stock)) {
21722 RECEIVE_PACKET_FIELD_ERROR(food_stock);
21723 }
21724 }
21725 if (BV_ISSET(fields, 22)) {
21726 log_packet_detailed(" got field 'shield_stock'");
21727 #ifdef FREECIV_JSON_CONNECTION
21728 field_addr.name = "shield_stock";
21729 #endif /* FREECIV_JSON_CONNECTION */
21730 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
21731 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
21732 }
21733 }
21734 if (BV_ISSET(fields, 23)) {
21735 log_packet_detailed(" got field 'trade_route_count'");
21736 #ifdef FREECIV_JSON_CONNECTION
21737 field_addr.name = "trade_route_count";
21738 #endif /* FREECIV_JSON_CONNECTION */
21739 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_route_count)) {
21740 RECEIVE_PACKET_FIELD_ERROR(trade_route_count);
21741 }
21742 }
21743 if (BV_ISSET(fields, 24)) {
21744 log_packet_detailed(" got field 'pollution'");
21745 #ifdef FREECIV_JSON_CONNECTION
21746 field_addr.name = "pollution";
21747 #endif /* FREECIV_JSON_CONNECTION */
21748 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->pollution)) {
21749 RECEIVE_PACKET_FIELD_ERROR(pollution);
21750 }
21751 }
21752 if (BV_ISSET(fields, 25)) {
21753 log_packet_detailed(" got field 'illness_trade'");
21754 #ifdef FREECIV_JSON_CONNECTION
21755 field_addr.name = "illness_trade";
21756 #endif /* FREECIV_JSON_CONNECTION */
21757 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade)) {
21758 RECEIVE_PACKET_FIELD_ERROR(illness_trade);
21759 }
21760 }
21761 if (BV_ISSET(fields, 26)) {
21762 log_packet_detailed(" got field 'production_kind'");
21763 #ifdef FREECIV_JSON_CONNECTION
21764 field_addr.name = "production_kind";
21765 #endif /* FREECIV_JSON_CONNECTION */
21766 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
21767 RECEIVE_PACKET_FIELD_ERROR(production_kind);
21768 }
21769 }
21770 if (BV_ISSET(fields, 27)) {
21771 log_packet_detailed(" got field 'production_value'");
21772 #ifdef FREECIV_JSON_CONNECTION
21773 field_addr.name = "production_value";
21774 #endif /* FREECIV_JSON_CONNECTION */
21775 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
21776 RECEIVE_PACKET_FIELD_ERROR(production_value);
21777 }
21778 }
21779 if (BV_ISSET(fields, 28)) {
21780 log_packet_detailed(" got field 'turn_founded'");
21781 #ifdef FREECIV_JSON_CONNECTION
21782 field_addr.name = "turn_founded";
21783 #endif /* FREECIV_JSON_CONNECTION */
21784 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
21785 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
21786 }
21787 }
21788 if (BV_ISSET(fields, 29)) {
21789 log_packet_detailed(" got field 'turn_last_built'");
21790 #ifdef FREECIV_JSON_CONNECTION
21791 field_addr.name = "turn_last_built";
21792 #endif /* FREECIV_JSON_CONNECTION */
21793 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
21794 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
21795 }
21796 }
21797 if (BV_ISSET(fields, 30)) {
21798 log_packet_detailed(" got field 'changed_from_kind'");
21799 #ifdef FREECIV_JSON_CONNECTION
21800 field_addr.name = "changed_from_kind";
21801 #endif /* FREECIV_JSON_CONNECTION */
21802 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_kind)) {
21803 RECEIVE_PACKET_FIELD_ERROR(changed_from_kind);
21804 }
21805 }
21806 if (BV_ISSET(fields, 31)) {
21807 log_packet_detailed(" got field 'changed_from_value'");
21808 #ifdef FREECIV_JSON_CONNECTION
21809 field_addr.name = "changed_from_value";
21810 #endif /* FREECIV_JSON_CONNECTION */
21811 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_value)) {
21812 RECEIVE_PACKET_FIELD_ERROR(changed_from_value);
21813 }
21814 }
21815 if (BV_ISSET(fields, 32)) {
21816 log_packet_detailed(" got field 'before_change_shields'");
21817 #ifdef FREECIV_JSON_CONNECTION
21818 field_addr.name = "before_change_shields";
21819 #endif /* FREECIV_JSON_CONNECTION */
21820 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->before_change_shields)) {
21821 RECEIVE_PACKET_FIELD_ERROR(before_change_shields);
21822 }
21823 }
21824 if (BV_ISSET(fields, 33)) {
21825 log_packet_detailed(" got field 'disbanded_shields'");
21826 #ifdef FREECIV_JSON_CONNECTION
21827 field_addr.name = "disbanded_shields";
21828 #endif /* FREECIV_JSON_CONNECTION */
21829 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disbanded_shields)) {
21830 RECEIVE_PACKET_FIELD_ERROR(disbanded_shields);
21831 }
21832 }
21833 if (BV_ISSET(fields, 34)) {
21834 log_packet_detailed(" got field 'caravan_shields'");
21835 #ifdef FREECIV_JSON_CONNECTION
21836 field_addr.name = "caravan_shields";
21837 #endif /* FREECIV_JSON_CONNECTION */
21838 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->caravan_shields)) {
21839 RECEIVE_PACKET_FIELD_ERROR(caravan_shields);
21840 }
21841 }
21842 if (BV_ISSET(fields, 35)) {
21843 log_packet_detailed(" got field 'last_turns_shield_surplus'");
21844 #ifdef FREECIV_JSON_CONNECTION
21845 field_addr.name = "last_turns_shield_surplus";
21846 #endif /* FREECIV_JSON_CONNECTION */
21847 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->last_turns_shield_surplus)) {
21848 RECEIVE_PACKET_FIELD_ERROR(last_turns_shield_surplus);
21849 }
21850 }
21851 if (BV_ISSET(fields, 36)) {
21852 log_packet_detailed(" got field 'airlift'");
21853 #ifdef FREECIV_JSON_CONNECTION
21854 field_addr.name = "airlift";
21855 #endif /* FREECIV_JSON_CONNECTION */
21856 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->airlift)) {
21857 RECEIVE_PACKET_FIELD_ERROR(airlift);
21858 }
21859 }
21860 real_packet->did_buy = BV_ISSET(fields, 37);
21861 real_packet->did_sell = BV_ISSET(fields, 38);
21862 real_packet->was_happy = BV_ISSET(fields, 39);
21863 real_packet->diplomat_investigate = BV_ISSET(fields, 40);
21864 if (BV_ISSET(fields, 41)) {
21865 log_packet_detailed(" got field 'walls'");
21866 #ifdef FREECIV_JSON_CONNECTION
21867 field_addr.name = "walls";
21868 #endif /* FREECIV_JSON_CONNECTION */
21869 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
21870 RECEIVE_PACKET_FIELD_ERROR(walls);
21871 }
21872 }
21873 if (BV_ISSET(fields, 42)) {
21874 log_packet_detailed(" got field 'city_image'");
21875 #ifdef FREECIV_JSON_CONNECTION
21876 field_addr.name = "city_image";
21877 #endif /* FREECIV_JSON_CONNECTION */
21878 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
21879 RECEIVE_PACKET_FIELD_ERROR(city_image);
21880 }
21881 }
21882 if (BV_ISSET(fields, 43)) {
21883 log_packet_detailed(" got field 'steal'");
21884 #ifdef FREECIV_JSON_CONNECTION
21885 field_addr.name = "steal";
21886 #endif /* FREECIV_JSON_CONNECTION */
21887 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->steal)) {
21888 RECEIVE_PACKET_FIELD_ERROR(steal);
21889 }
21890 }
21891 if (BV_ISSET(fields, 44)) {
21892 log_packet_detailed(" got field 'worklist'");
21893 #ifdef FREECIV_JSON_CONNECTION
21894 field_addr.name = "worklist";
21895 #endif /* FREECIV_JSON_CONNECTION */
21896 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
21897 RECEIVE_PACKET_FIELD_ERROR(worklist);
21898 }
21899 }
21900 if (BV_ISSET(fields, 45)) {
21901 log_packet_detailed(" got field 'improvements'");
21902 #ifdef FREECIV_JSON_CONNECTION
21903 field_addr.name = "improvements";
21904 #endif /* FREECIV_JSON_CONNECTION */
21905 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
21906 RECEIVE_PACKET_FIELD_ERROR(improvements);
21907 }
21908 }
21909 if (BV_ISSET(fields, 46)) {
21910 log_packet_detailed(" got field 'city_options'");
21911 #ifdef FREECIV_JSON_CONNECTION
21912 field_addr.name = "city_options";
21913 #endif /* FREECIV_JSON_CONNECTION */
21914 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
21915 RECEIVE_PACKET_FIELD_ERROR(city_options);
21916 }
21917 }
21918 if (BV_ISSET(fields, 47)) {
21919 log_packet_detailed(" got field 'name'");
21920 #ifdef FREECIV_JSON_CONNECTION
21921 field_addr.name = "name";
21922 #endif /* FREECIV_JSON_CONNECTION */
21923 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
21924 RECEIVE_PACKET_FIELD_ERROR(name);
21925 }
21926 }
21927
21928 if (NULL == old) {
21929 old = fc_malloc(sizeof(*old));
21930 *old = *real_packet;
21931 genhash_insert(*hash, old, old);
21932 } else {
21933 *old = *real_packet;
21934 }
21935
21936 hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
21937 if (NULL != *hash) {
21938 genhash_remove(*hash, real_packet);
21939 }
21940
21941#endif /* FREECIV_DELTA_PROTOCOL */
21942 RECEIVE_PACKET_END(real_packet);
21943}
21944
21945 static int send_packet_city_info_103(struct connection *pc, const struct packet_city_info *packet, bool force_to_send)
21946{
21947 const struct packet_city_info *real_packet = packet;
21948#ifdef FREECIV_DELTA_PROTOCOL
21949 packet_city_info_103_fields fields;
21950 struct packet_city_info *old;
21951 bool differ;
21952 struct genhash **hash = pc->phs.sent + PACKET_CITY_INFO;
21953 int different = force_to_send;
21954#endif /* FREECIV_DELTA_PROTOCOL */
21955 SEND_PACKET_START(PACKET_CITY_INFO);
21956#ifdef FREECIV_JSON_CONNECTION
21957 struct plocation field_addr;
21958 {
21959 struct plocation *field_addr_tmp = plocation_field_new(NULL);
21960 field_addr = *field_addr_tmp;
21961 FC_FREE(field_addr_tmp);
21962 }
21963#endif /* FREECIV_JSON_CONNECTION */
21964
21965 log_packet_detailed("packet_city_info_103: sending info about (%d)",
21966 real_packet->id16);
21967
21968#ifdef FREECIV_DELTA_PROTOCOL
21969 if (NULL == *hash) {
21970 *hash = genhash_new_full(hash_packet_city_info_103, cmp_packet_city_info_103,
21971 NULL, NULL, NULL, free);
21972 }
21973 BV_CLR_ALL(fields);
21974
21975 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
21976 old = fc_malloc(sizeof(*old));
21977 *old = *real_packet;
21978 genhash_insert(*hash, old, old);
21979 memset(old, 0, sizeof(*old));
21980 different = 1; /* Force to send. */
21981 }
21982 differ = (old->tile != real_packet->tile);
21983 if (differ) {
21984 different++;
21985 BV_SET(fields, 0);
21986 }
21987
21988 differ = (old->owner != real_packet->owner);
21989 if (differ) {
21990 different++;
21991 BV_SET(fields, 1);
21992 }
21993
21994 differ = (old->size != real_packet->size);
21995 if (differ) {
21996 different++;
21997 BV_SET(fields, 2);
21998 }
21999
22000 differ = (old->city_radius_sq != real_packet->city_radius_sq);
22001 if (differ) {
22002 different++;
22003 BV_SET(fields, 3);
22004 }
22005
22006 differ = (old->style != real_packet->style);
22007 if (differ) {
22008 different++;
22009 BV_SET(fields, 4);
22010 }
22011
22012 differ = (old->capital != real_packet->capital);
22013 if (differ) {
22014 different++;
22015 BV_SET(fields, 5);
22016 }
22017
22018
22019 {
22020 differ = FALSE;
22021 {
22022 int i;
22023
22024 for (i = 0; i < FEELING_LAST; i++) {
22025 if (old->ppl_happy[i] != real_packet->ppl_happy[i]) {
22026 differ = TRUE;
22027 break;
22028 }
22029 }
22030 }
22031 }
22032 if (differ) {
22033 different++;
22034 BV_SET(fields, 6);
22035 }
22036
22037
22038 {
22039 differ = FALSE;
22040 {
22041 int i;
22042
22043 for (i = 0; i < FEELING_LAST; i++) {
22044 if (old->ppl_content[i] != real_packet->ppl_content[i]) {
22045 differ = TRUE;
22046 break;
22047 }
22048 }
22049 }
22050 }
22051 if (differ) {
22052 different++;
22053 BV_SET(fields, 7);
22054 }
22055
22056
22057 {
22058 differ = FALSE;
22059 {
22060 int i;
22061
22062 for (i = 0; i < FEELING_LAST; i++) {
22063 if (old->ppl_unhappy[i] != real_packet->ppl_unhappy[i]) {
22064 differ = TRUE;
22065 break;
22066 }
22067 }
22068 }
22069 }
22070 if (differ) {
22071 different++;
22072 BV_SET(fields, 8);
22073 }
22074
22075
22076 {
22077 differ = FALSE;
22078 {
22079 int i;
22080
22081 for (i = 0; i < FEELING_LAST; i++) {
22082 if (old->ppl_angry[i] != real_packet->ppl_angry[i]) {
22083 differ = TRUE;
22084 break;
22085 }
22086 }
22087 }
22088 }
22089 if (differ) {
22090 different++;
22091 BV_SET(fields, 9);
22092 }
22093
22094 differ = (old->specialists_size != real_packet->specialists_size);
22095 if (differ) {
22096 different++;
22097 BV_SET(fields, 10);
22098 }
22099
22100
22101 {
22102 differ = (old->specialists_size != real_packet->specialists_size);
22103 if (!differ) {
22104 int i;
22105
22106 for (i = 0; i < real_packet->specialists_size; i++) {
22107 if (old->specialists[i] != real_packet->specialists[i]) {
22108 differ = TRUE;
22109 break;
22110 }
22111 }
22112 }
22113 }
22114 if (differ) {
22115 different++;
22116 BV_SET(fields, 11);
22117 }
22118
22119 differ = (old->history != real_packet->history);
22120 if (differ) {
22121 different++;
22122 BV_SET(fields, 12);
22123 }
22124
22125 differ = (old->culture != real_packet->culture);
22126 if (differ) {
22127 different++;
22128 BV_SET(fields, 13);
22129 }
22130
22131 differ = (old->buy_cost != real_packet->buy_cost);
22132 if (differ) {
22133 different++;
22134 BV_SET(fields, 14);
22135 }
22136
22137
22138 {
22139 differ = FALSE;
22140 {
22141 int i;
22142
22143 for (i = 0; i < O_LAST; i++) {
22144 if (old->surplus[i] != real_packet->surplus[i]) {
22145 differ = TRUE;
22146 break;
22147 }
22148 }
22149 }
22150 }
22151 if (differ) {
22152 different++;
22153 BV_SET(fields, 15);
22154 }
22155
22156
22157 {
22158 differ = FALSE;
22159 {
22160 int i;
22161
22162 for (i = 0; i < O_LAST; i++) {
22163 if (old->waste[i] != real_packet->waste[i]) {
22164 differ = TRUE;
22165 break;
22166 }
22167 }
22168 }
22169 }
22170 if (differ) {
22171 different++;
22172 BV_SET(fields, 16);
22173 }
22174
22175
22176 {
22177 differ = FALSE;
22178 {
22179 int i;
22180
22181 for (i = 0; i < O_LAST; i++) {
22182 if (old->unhappy_penalty[i] != real_packet->unhappy_penalty[i]) {
22183 differ = TRUE;
22184 break;
22185 }
22186 }
22187 }
22188 }
22189 if (differ) {
22190 different++;
22191 BV_SET(fields, 17);
22192 }
22193
22194
22195 {
22196 differ = FALSE;
22197 {
22198 int i;
22199
22200 for (i = 0; i < O_LAST; i++) {
22201 if (old->prod[i] != real_packet->prod[i]) {
22202 differ = TRUE;
22203 break;
22204 }
22205 }
22206 }
22207 }
22208 if (differ) {
22209 different++;
22210 BV_SET(fields, 18);
22211 }
22212
22213
22214 {
22215 differ = FALSE;
22216 {
22217 int i;
22218
22219 for (i = 0; i < O_LAST; i++) {
22220 if (old->citizen_base[i] != real_packet->citizen_base[i]) {
22221 differ = TRUE;
22222 break;
22223 }
22224 }
22225 }
22226 }
22227 if (differ) {
22228 different++;
22229 BV_SET(fields, 19);
22230 }
22231
22232
22233 {
22234 differ = FALSE;
22235 {
22236 int i;
22237
22238 for (i = 0; i < O_LAST; i++) {
22239 if (old->usage[i] != real_packet->usage[i]) {
22240 differ = TRUE;
22241 break;
22242 }
22243 }
22244 }
22245 }
22246 if (differ) {
22247 different++;
22248 BV_SET(fields, 20);
22249 }
22250
22251 differ = (old->food_stock != real_packet->food_stock);
22252 if (differ) {
22253 different++;
22254 BV_SET(fields, 21);
22255 }
22256
22257 differ = (old->shield_stock != real_packet->shield_stock);
22258 if (differ) {
22259 different++;
22260 BV_SET(fields, 22);
22261 }
22262
22263 differ = (old->trade_route_count != real_packet->trade_route_count);
22264 if (differ) {
22265 different++;
22266 BV_SET(fields, 23);
22267 }
22268
22269 differ = (old->pollution != real_packet->pollution);
22270 if (differ) {
22271 different++;
22272 BV_SET(fields, 24);
22273 }
22274
22275 differ = (old->illness_trade != real_packet->illness_trade);
22276 if (differ) {
22277 different++;
22278 BV_SET(fields, 25);
22279 }
22280
22281 differ = (old->production_kind != real_packet->production_kind);
22282 if (differ) {
22283 different++;
22284 BV_SET(fields, 26);
22285 }
22286
22287 differ = (old->production_value != real_packet->production_value);
22288 if (differ) {
22289 different++;
22290 BV_SET(fields, 27);
22291 }
22292
22293 differ = (old->turn_founded != real_packet->turn_founded);
22294 if (differ) {
22295 different++;
22296 BV_SET(fields, 28);
22297 }
22298
22299 differ = (old->turn_last_built != real_packet->turn_last_built);
22300 if (differ) {
22301 different++;
22302 BV_SET(fields, 29);
22303 }
22304
22305 differ = (old->changed_from_kind != real_packet->changed_from_kind);
22306 if (differ) {
22307 different++;
22308 BV_SET(fields, 30);
22309 }
22310
22311 differ = (old->changed_from_value != real_packet->changed_from_value);
22312 if (differ) {
22313 different++;
22314 BV_SET(fields, 31);
22315 }
22316
22317 differ = (old->before_change_shields != real_packet->before_change_shields);
22318 if (differ) {
22319 different++;
22320 BV_SET(fields, 32);
22321 }
22322
22323 differ = (old->disbanded_shields != real_packet->disbanded_shields);
22324 if (differ) {
22325 different++;
22326 BV_SET(fields, 33);
22327 }
22328
22329 differ = (old->caravan_shields != real_packet->caravan_shields);
22330 if (differ) {
22331 different++;
22332 BV_SET(fields, 34);
22333 }
22334
22335 differ = (old->last_turns_shield_surplus != real_packet->last_turns_shield_surplus);
22336 if (differ) {
22337 different++;
22338 BV_SET(fields, 35);
22339 }
22340
22341 differ = (old->airlift != real_packet->airlift);
22342 if (differ) {
22343 different++;
22344 BV_SET(fields, 36);
22345 }
22346
22347 differ = (old->did_buy != real_packet->did_buy);
22348 if (differ) {
22349 different++;
22350 }
22351 if (packet->did_buy) {
22352 BV_SET(fields, 37);
22353 }
22354
22355 differ = (old->did_sell != real_packet->did_sell);
22356 if (differ) {
22357 different++;
22358 }
22359 if (packet->did_sell) {
22360 BV_SET(fields, 38);
22361 }
22362
22363 differ = (old->was_happy != real_packet->was_happy);
22364 if (differ) {
22365 different++;
22366 }
22367 if (packet->was_happy) {
22368 BV_SET(fields, 39);
22369 }
22370
22371 differ = (old->diplomat_investigate != real_packet->diplomat_investigate);
22372 if (differ) {
22373 different++;
22374 }
22375 if (packet->diplomat_investigate) {
22376 BV_SET(fields, 40);
22377 }
22378
22379 differ = (old->walls != real_packet->walls);
22380 if (differ) {
22381 different++;
22382 BV_SET(fields, 41);
22383 }
22384
22385 differ = (old->city_image != real_packet->city_image);
22386 if (differ) {
22387 different++;
22388 BV_SET(fields, 42);
22389 }
22390
22391 differ = (old->steal != real_packet->steal);
22392 if (differ) {
22393 different++;
22394 BV_SET(fields, 43);
22395 }
22396
22397 differ = !are_worklists_equal(&old->worklist, &real_packet->worklist);
22398 if (differ) {
22399 different++;
22400 BV_SET(fields, 44);
22401 }
22402
22403 differ = !BV_ARE_EQUAL(old->improvements, real_packet->improvements);
22404 if (differ) {
22405 different++;
22406 BV_SET(fields, 45);
22407 }
22408
22409 differ = !BV_ARE_EQUAL(old->city_options, real_packet->city_options);
22410 if (differ) {
22411 different++;
22412 BV_SET(fields, 46);
22413 }
22414
22415 differ = (strcmp(old->name, real_packet->name) != 0);
22416 if (differ) {
22417 different++;
22418 BV_SET(fields, 47);
22419 }
22420
22421
22422 if (different == 0) {
22423 log_packet_detailed(" no change -> discard");
22424 return 0;
22425 }
22426
22427#ifdef FREECIV_JSON_CONNECTION
22428 field_addr.name = "fields";
22429#endif /* FREECIV_JSON_CONNECTION */
22430 DIO_BV_PUT(&dout, &field_addr, fields);
22431#ifdef FREECIV_JSON_CONNECTION
22432 field_addr.name = "id16";
22433#endif /* FREECIV_JSON_CONNECTION */
22434 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
22435
22436 if (BV_ISSET(fields, 0)) {
22437 log_packet_detailed(" field 'tile' has changed");
22438 #ifdef FREECIV_JSON_CONNECTION
22439 field_addr.name = "tile";
22440#endif /* FREECIV_JSON_CONNECTION */
22441 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
22442 }
22443 if (BV_ISSET(fields, 1)) {
22444 log_packet_detailed(" field 'owner' has changed");
22445 #ifdef FREECIV_JSON_CONNECTION
22446 field_addr.name = "owner";
22447#endif /* FREECIV_JSON_CONNECTION */
22448 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
22449 }
22450 if (BV_ISSET(fields, 2)) {
22451 log_packet_detailed(" field 'size' has changed");
22452 #ifdef FREECIV_JSON_CONNECTION
22453 field_addr.name = "size";
22454#endif /* FREECIV_JSON_CONNECTION */
22455 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
22456 }
22457 if (BV_ISSET(fields, 3)) {
22458 log_packet_detailed(" field 'city_radius_sq' has changed");
22459 #ifdef FREECIV_JSON_CONNECTION
22460 field_addr.name = "city_radius_sq";
22461#endif /* FREECIV_JSON_CONNECTION */
22462 DIO_PUT(uint8, &dout, &field_addr, real_packet->city_radius_sq);
22463 }
22464 if (BV_ISSET(fields, 4)) {
22465 log_packet_detailed(" field 'style' has changed");
22466 #ifdef FREECIV_JSON_CONNECTION
22467 field_addr.name = "style";
22468#endif /* FREECIV_JSON_CONNECTION */
22469 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
22470 }
22471 if (BV_ISSET(fields, 5)) {
22472 log_packet_detailed(" field 'capital' has changed");
22473 #ifdef FREECIV_JSON_CONNECTION
22474 field_addr.name = "capital";
22475#endif /* FREECIV_JSON_CONNECTION */
22476 DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
22477 }
22478 if (BV_ISSET(fields, 6)) {
22479 log_packet_detailed(" field 'ppl_happy' has changed");
22480 #ifdef FREECIV_JSON_CONNECTION
22481 field_addr.name = "ppl_happy";
22482#endif /* FREECIV_JSON_CONNECTION */
22483
22484 {
22485 int i;
22486
22487#ifdef FREECIV_JSON_CONNECTION
22488 /* Create the array. */
22489 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
22490
22491 /* Enter the array. */
22492 field_addr.sub_location = plocation_elem_new(0);
22493#endif /* FREECIV_JSON_CONNECTION */
22494
22495 for (i = 0; i < FEELING_LAST; i++) {
22496#ifdef FREECIV_JSON_CONNECTION
22497 /* Next array element. */
22498 field_addr.sub_location->number = i;
22499#endif /* FREECIV_JSON_CONNECTION */
22500 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
22501 }
22502
22503#ifdef FREECIV_JSON_CONNECTION
22504 /* Exit array. */
22505 free(field_addr.sub_location);
22506 field_addr.sub_location = NULL;
22507#endif /* FREECIV_JSON_CONNECTION */
22508 }
22509 }
22510 if (BV_ISSET(fields, 7)) {
22511 log_packet_detailed(" field 'ppl_content' has changed");
22512 #ifdef FREECIV_JSON_CONNECTION
22513 field_addr.name = "ppl_content";
22514#endif /* FREECIV_JSON_CONNECTION */
22515
22516 {
22517 int i;
22518
22519#ifdef FREECIV_JSON_CONNECTION
22520 /* Create the array. */
22521 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
22522
22523 /* Enter the array. */
22524 field_addr.sub_location = plocation_elem_new(0);
22525#endif /* FREECIV_JSON_CONNECTION */
22526
22527 for (i = 0; i < FEELING_LAST; i++) {
22528#ifdef FREECIV_JSON_CONNECTION
22529 /* Next array element. */
22530 field_addr.sub_location->number = i;
22531#endif /* FREECIV_JSON_CONNECTION */
22532 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
22533 }
22534
22535#ifdef FREECIV_JSON_CONNECTION
22536 /* Exit array. */
22537 free(field_addr.sub_location);
22538 field_addr.sub_location = NULL;
22539#endif /* FREECIV_JSON_CONNECTION */
22540 }
22541 }
22542 if (BV_ISSET(fields, 8)) {
22543 log_packet_detailed(" field 'ppl_unhappy' has changed");
22544 #ifdef FREECIV_JSON_CONNECTION
22545 field_addr.name = "ppl_unhappy";
22546#endif /* FREECIV_JSON_CONNECTION */
22547
22548 {
22549 int i;
22550
22551#ifdef FREECIV_JSON_CONNECTION
22552 /* Create the array. */
22553 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
22554
22555 /* Enter the array. */
22556 field_addr.sub_location = plocation_elem_new(0);
22557#endif /* FREECIV_JSON_CONNECTION */
22558
22559 for (i = 0; i < FEELING_LAST; i++) {
22560#ifdef FREECIV_JSON_CONNECTION
22561 /* Next array element. */
22562 field_addr.sub_location->number = i;
22563#endif /* FREECIV_JSON_CONNECTION */
22564 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
22565 }
22566
22567#ifdef FREECIV_JSON_CONNECTION
22568 /* Exit array. */
22569 free(field_addr.sub_location);
22570 field_addr.sub_location = NULL;
22571#endif /* FREECIV_JSON_CONNECTION */
22572 }
22573 }
22574 if (BV_ISSET(fields, 9)) {
22575 log_packet_detailed(" field 'ppl_angry' has changed");
22576 #ifdef FREECIV_JSON_CONNECTION
22577 field_addr.name = "ppl_angry";
22578#endif /* FREECIV_JSON_CONNECTION */
22579
22580 {
22581 int i;
22582
22583#ifdef FREECIV_JSON_CONNECTION
22584 /* Create the array. */
22585 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
22586
22587 /* Enter the array. */
22588 field_addr.sub_location = plocation_elem_new(0);
22589#endif /* FREECIV_JSON_CONNECTION */
22590
22591 for (i = 0; i < FEELING_LAST; i++) {
22592#ifdef FREECIV_JSON_CONNECTION
22593 /* Next array element. */
22594 field_addr.sub_location->number = i;
22595#endif /* FREECIV_JSON_CONNECTION */
22596 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
22597 }
22598
22599#ifdef FREECIV_JSON_CONNECTION
22600 /* Exit array. */
22601 free(field_addr.sub_location);
22602 field_addr.sub_location = NULL;
22603#endif /* FREECIV_JSON_CONNECTION */
22604 }
22605 }
22606 if (BV_ISSET(fields, 10)) {
22607 log_packet_detailed(" field 'specialists_size' has changed");
22608 #ifdef FREECIV_JSON_CONNECTION
22609 field_addr.name = "specialists_size";
22610#endif /* FREECIV_JSON_CONNECTION */
22611 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
22612 }
22613 if (BV_ISSET(fields, 11)) {
22614 log_packet_detailed(" field 'specialists' has changed");
22615 #ifdef FREECIV_JSON_CONNECTION
22616 field_addr.name = "specialists";
22617#endif /* FREECIV_JSON_CONNECTION */
22618
22619 {
22620 int i;
22621
22622#ifdef FREECIV_JSON_CONNECTION
22623 /* Create the array. */
22624 DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
22625
22626 /* Enter the array. */
22627 field_addr.sub_location = plocation_elem_new(0);
22628#endif /* FREECIV_JSON_CONNECTION */
22629
22630 for (i = 0; i < real_packet->specialists_size; i++) {
22631#ifdef FREECIV_JSON_CONNECTION
22632 /* Next array element. */
22633 field_addr.sub_location->number = i;
22634#endif /* FREECIV_JSON_CONNECTION */
22635 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
22636 }
22637
22638#ifdef FREECIV_JSON_CONNECTION
22639 /* Exit array. */
22640 free(field_addr.sub_location);
22641 field_addr.sub_location = NULL;
22642#endif /* FREECIV_JSON_CONNECTION */
22643 }
22644 }
22645 if (BV_ISSET(fields, 12)) {
22646 log_packet_detailed(" field 'history' has changed");
22647 #ifdef FREECIV_JSON_CONNECTION
22648 field_addr.name = "history";
22649#endif /* FREECIV_JSON_CONNECTION */
22650 DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
22651 }
22652 if (BV_ISSET(fields, 13)) {
22653 log_packet_detailed(" field 'culture' has changed");
22654 #ifdef FREECIV_JSON_CONNECTION
22655 field_addr.name = "culture";
22656#endif /* FREECIV_JSON_CONNECTION */
22657 DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
22658 }
22659 if (BV_ISSET(fields, 14)) {
22660 log_packet_detailed(" field 'buy_cost' has changed");
22661 #ifdef FREECIV_JSON_CONNECTION
22662 field_addr.name = "buy_cost";
22663#endif /* FREECIV_JSON_CONNECTION */
22664 DIO_PUT(uint32, &dout, &field_addr, real_packet->buy_cost);
22665 }
22666 if (BV_ISSET(fields, 15)) {
22667 log_packet_detailed(" field 'surplus' has changed");
22668 #ifdef FREECIV_JSON_CONNECTION
22669 field_addr.name = "surplus";
22670#endif /* FREECIV_JSON_CONNECTION */
22671
22672 {
22673 int i;
22674
22675#ifdef FREECIV_JSON_CONNECTION
22676 /* Create the array. */
22677 DIO_PUT(farray, &dout, &field_addr, O_LAST);
22678
22679 /* Enter the array. */
22680 field_addr.sub_location = plocation_elem_new(0);
22681#endif /* FREECIV_JSON_CONNECTION */
22682
22683 for (i = 0; i < O_LAST; i++) {
22684#ifdef FREECIV_JSON_CONNECTION
22685 /* Next array element. */
22686 field_addr.sub_location->number = i;
22687#endif /* FREECIV_JSON_CONNECTION */
22688 DIO_PUT(sint16, &dout, &field_addr, real_packet->surplus[i]);
22689 }
22690
22691#ifdef FREECIV_JSON_CONNECTION
22692 /* Exit array. */
22693 free(field_addr.sub_location);
22694 field_addr.sub_location = NULL;
22695#endif /* FREECIV_JSON_CONNECTION */
22696 }
22697 }
22698 if (BV_ISSET(fields, 16)) {
22699 log_packet_detailed(" field 'waste' has changed");
22700 #ifdef FREECIV_JSON_CONNECTION
22701 field_addr.name = "waste";
22702#endif /* FREECIV_JSON_CONNECTION */
22703
22704 {
22705 int i;
22706
22707#ifdef FREECIV_JSON_CONNECTION
22708 /* Create the array. */
22709 DIO_PUT(farray, &dout, &field_addr, O_LAST);
22710
22711 /* Enter the array. */
22712 field_addr.sub_location = plocation_elem_new(0);
22713#endif /* FREECIV_JSON_CONNECTION */
22714
22715 for (i = 0; i < O_LAST; i++) {
22716#ifdef FREECIV_JSON_CONNECTION
22717 /* Next array element. */
22718 field_addr.sub_location->number = i;
22719#endif /* FREECIV_JSON_CONNECTION */
22720 DIO_PUT(uint16, &dout, &field_addr, real_packet->waste[i]);
22721 }
22722
22723#ifdef FREECIV_JSON_CONNECTION
22724 /* Exit array. */
22725 free(field_addr.sub_location);
22726 field_addr.sub_location = NULL;
22727#endif /* FREECIV_JSON_CONNECTION */
22728 }
22729 }
22730 if (BV_ISSET(fields, 17)) {
22731 log_packet_detailed(" field 'unhappy_penalty' has changed");
22732 #ifdef FREECIV_JSON_CONNECTION
22733 field_addr.name = "unhappy_penalty";
22734#endif /* FREECIV_JSON_CONNECTION */
22735
22736 {
22737 int i;
22738
22739#ifdef FREECIV_JSON_CONNECTION
22740 /* Create the array. */
22741 DIO_PUT(farray, &dout, &field_addr, O_LAST);
22742
22743 /* Enter the array. */
22744 field_addr.sub_location = plocation_elem_new(0);
22745#endif /* FREECIV_JSON_CONNECTION */
22746
22747 for (i = 0; i < O_LAST; i++) {
22748#ifdef FREECIV_JSON_CONNECTION
22749 /* Next array element. */
22750 field_addr.sub_location->number = i;
22751#endif /* FREECIV_JSON_CONNECTION */
22752 DIO_PUT(sint16, &dout, &field_addr, real_packet->unhappy_penalty[i]);
22753 }
22754
22755#ifdef FREECIV_JSON_CONNECTION
22756 /* Exit array. */
22757 free(field_addr.sub_location);
22758 field_addr.sub_location = NULL;
22759#endif /* FREECIV_JSON_CONNECTION */
22760 }
22761 }
22762 if (BV_ISSET(fields, 18)) {
22763 log_packet_detailed(" field 'prod' has changed");
22764 #ifdef FREECIV_JSON_CONNECTION
22765 field_addr.name = "prod";
22766#endif /* FREECIV_JSON_CONNECTION */
22767
22768 {
22769 int i;
22770
22771#ifdef FREECIV_JSON_CONNECTION
22772 /* Create the array. */
22773 DIO_PUT(farray, &dout, &field_addr, O_LAST);
22774
22775 /* Enter the array. */
22776 field_addr.sub_location = plocation_elem_new(0);
22777#endif /* FREECIV_JSON_CONNECTION */
22778
22779 for (i = 0; i < O_LAST; i++) {
22780#ifdef FREECIV_JSON_CONNECTION
22781 /* Next array element. */
22782 field_addr.sub_location->number = i;
22783#endif /* FREECIV_JSON_CONNECTION */
22784 DIO_PUT(uint16, &dout, &field_addr, real_packet->prod[i]);
22785 }
22786
22787#ifdef FREECIV_JSON_CONNECTION
22788 /* Exit array. */
22789 free(field_addr.sub_location);
22790 field_addr.sub_location = NULL;
22791#endif /* FREECIV_JSON_CONNECTION */
22792 }
22793 }
22794 if (BV_ISSET(fields, 19)) {
22795 log_packet_detailed(" field 'citizen_base' has changed");
22796 #ifdef FREECIV_JSON_CONNECTION
22797 field_addr.name = "citizen_base";
22798#endif /* FREECIV_JSON_CONNECTION */
22799
22800 {
22801 int i;
22802
22803#ifdef FREECIV_JSON_CONNECTION
22804 /* Create the array. */
22805 DIO_PUT(farray, &dout, &field_addr, O_LAST);
22806
22807 /* Enter the array. */
22808 field_addr.sub_location = plocation_elem_new(0);
22809#endif /* FREECIV_JSON_CONNECTION */
22810
22811 for (i = 0; i < O_LAST; i++) {
22812#ifdef FREECIV_JSON_CONNECTION
22813 /* Next array element. */
22814 field_addr.sub_location->number = i;
22815#endif /* FREECIV_JSON_CONNECTION */
22816 DIO_PUT(sint16, &dout, &field_addr, real_packet->citizen_base[i]);
22817 }
22818
22819#ifdef FREECIV_JSON_CONNECTION
22820 /* Exit array. */
22821 free(field_addr.sub_location);
22822 field_addr.sub_location = NULL;
22823#endif /* FREECIV_JSON_CONNECTION */
22824 }
22825 }
22826 if (BV_ISSET(fields, 20)) {
22827 log_packet_detailed(" field 'usage' has changed");
22828 #ifdef FREECIV_JSON_CONNECTION
22829 field_addr.name = "usage";
22830#endif /* FREECIV_JSON_CONNECTION */
22831
22832 {
22833 int i;
22834
22835#ifdef FREECIV_JSON_CONNECTION
22836 /* Create the array. */
22837 DIO_PUT(farray, &dout, &field_addr, O_LAST);
22838
22839 /* Enter the array. */
22840 field_addr.sub_location = plocation_elem_new(0);
22841#endif /* FREECIV_JSON_CONNECTION */
22842
22843 for (i = 0; i < O_LAST; i++) {
22844#ifdef FREECIV_JSON_CONNECTION
22845 /* Next array element. */
22846 field_addr.sub_location->number = i;
22847#endif /* FREECIV_JSON_CONNECTION */
22848 DIO_PUT(sint16, &dout, &field_addr, real_packet->usage[i]);
22849 }
22850
22851#ifdef FREECIV_JSON_CONNECTION
22852 /* Exit array. */
22853 free(field_addr.sub_location);
22854 field_addr.sub_location = NULL;
22855#endif /* FREECIV_JSON_CONNECTION */
22856 }
22857 }
22858 if (BV_ISSET(fields, 21)) {
22859 log_packet_detailed(" field 'food_stock' has changed");
22860 #ifdef FREECIV_JSON_CONNECTION
22861 field_addr.name = "food_stock";
22862#endif /* FREECIV_JSON_CONNECTION */
22863 DIO_PUT(sint16, &dout, &field_addr, real_packet->food_stock);
22864 }
22865 if (BV_ISSET(fields, 22)) {
22866 log_packet_detailed(" field 'shield_stock' has changed");
22867 #ifdef FREECIV_JSON_CONNECTION
22868 field_addr.name = "shield_stock";
22869#endif /* FREECIV_JSON_CONNECTION */
22870 DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
22871 }
22872 if (BV_ISSET(fields, 23)) {
22873 log_packet_detailed(" field 'trade_route_count' has changed");
22874 #ifdef FREECIV_JSON_CONNECTION
22875 field_addr.name = "trade_route_count";
22876#endif /* FREECIV_JSON_CONNECTION */
22877 DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_route_count);
22878 }
22879 if (BV_ISSET(fields, 24)) {
22880 log_packet_detailed(" field 'pollution' has changed");
22881 #ifdef FREECIV_JSON_CONNECTION
22882 field_addr.name = "pollution";
22883#endif /* FREECIV_JSON_CONNECTION */
22884 DIO_PUT(uint16, &dout, &field_addr, real_packet->pollution);
22885 }
22886 if (BV_ISSET(fields, 25)) {
22887 log_packet_detailed(" field 'illness_trade' has changed");
22888 #ifdef FREECIV_JSON_CONNECTION
22889 field_addr.name = "illness_trade";
22890#endif /* FREECIV_JSON_CONNECTION */
22891 DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade);
22892 }
22893 if (BV_ISSET(fields, 26)) {
22894 log_packet_detailed(" field 'production_kind' has changed");
22895 #ifdef FREECIV_JSON_CONNECTION
22896 field_addr.name = "production_kind";
22897#endif /* FREECIV_JSON_CONNECTION */
22898 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
22899 }
22900 if (BV_ISSET(fields, 27)) {
22901 log_packet_detailed(" field 'production_value' has changed");
22902 #ifdef FREECIV_JSON_CONNECTION
22903 field_addr.name = "production_value";
22904#endif /* FREECIV_JSON_CONNECTION */
22905 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
22906 }
22907 if (BV_ISSET(fields, 28)) {
22908 log_packet_detailed(" field 'turn_founded' has changed");
22909 #ifdef FREECIV_JSON_CONNECTION
22910 field_addr.name = "turn_founded";
22911#endif /* FREECIV_JSON_CONNECTION */
22912 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
22913 }
22914 if (BV_ISSET(fields, 29)) {
22915 log_packet_detailed(" field 'turn_last_built' has changed");
22916 #ifdef FREECIV_JSON_CONNECTION
22917 field_addr.name = "turn_last_built";
22918#endif /* FREECIV_JSON_CONNECTION */
22919 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
22920 }
22921 if (BV_ISSET(fields, 30)) {
22922 log_packet_detailed(" field 'changed_from_kind' has changed");
22923 #ifdef FREECIV_JSON_CONNECTION
22924 field_addr.name = "changed_from_kind";
22925#endif /* FREECIV_JSON_CONNECTION */
22926 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_kind);
22927 }
22928 if (BV_ISSET(fields, 31)) {
22929 log_packet_detailed(" field 'changed_from_value' has changed");
22930 #ifdef FREECIV_JSON_CONNECTION
22931 field_addr.name = "changed_from_value";
22932#endif /* FREECIV_JSON_CONNECTION */
22933 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_value);
22934 }
22935 if (BV_ISSET(fields, 32)) {
22936 log_packet_detailed(" field 'before_change_shields' has changed");
22937 #ifdef FREECIV_JSON_CONNECTION
22938 field_addr.name = "before_change_shields";
22939#endif /* FREECIV_JSON_CONNECTION */
22940 DIO_PUT(uint16, &dout, &field_addr, real_packet->before_change_shields);
22941 }
22942 if (BV_ISSET(fields, 33)) {
22943 log_packet_detailed(" field 'disbanded_shields' has changed");
22944 #ifdef FREECIV_JSON_CONNECTION
22945 field_addr.name = "disbanded_shields";
22946#endif /* FREECIV_JSON_CONNECTION */
22947 DIO_PUT(uint16, &dout, &field_addr, real_packet->disbanded_shields);
22948 }
22949 if (BV_ISSET(fields, 34)) {
22950 log_packet_detailed(" field 'caravan_shields' has changed");
22951 #ifdef FREECIV_JSON_CONNECTION
22952 field_addr.name = "caravan_shields";
22953#endif /* FREECIV_JSON_CONNECTION */
22954 DIO_PUT(uint16, &dout, &field_addr, real_packet->caravan_shields);
22955 }
22956 if (BV_ISSET(fields, 35)) {
22957 log_packet_detailed(" field 'last_turns_shield_surplus' has changed");
22958 #ifdef FREECIV_JSON_CONNECTION
22959 field_addr.name = "last_turns_shield_surplus";
22960#endif /* FREECIV_JSON_CONNECTION */
22961 DIO_PUT(uint16, &dout, &field_addr, real_packet->last_turns_shield_surplus);
22962 }
22963 if (BV_ISSET(fields, 36)) {
22964 log_packet_detailed(" field 'airlift' has changed");
22965 #ifdef FREECIV_JSON_CONNECTION
22966 field_addr.name = "airlift";
22967#endif /* FREECIV_JSON_CONNECTION */
22968 DIO_PUT(uint8, &dout, &field_addr, real_packet->airlift);
22969 }
22970 /* field 37 is folded into the header */
22971 /* field 38 is folded into the header */
22972 /* field 39 is folded into the header */
22973 /* field 40 is folded into the header */
22974 if (BV_ISSET(fields, 41)) {
22975 log_packet_detailed(" field 'walls' has changed");
22976 #ifdef FREECIV_JSON_CONNECTION
22977 field_addr.name = "walls";
22978#endif /* FREECIV_JSON_CONNECTION */
22979 DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
22980 }
22981 if (BV_ISSET(fields, 42)) {
22982 log_packet_detailed(" field 'city_image' has changed");
22983 #ifdef FREECIV_JSON_CONNECTION
22984 field_addr.name = "city_image";
22985#endif /* FREECIV_JSON_CONNECTION */
22986 DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
22987 }
22988 if (BV_ISSET(fields, 43)) {
22989 log_packet_detailed(" field 'steal' has changed");
22990 #ifdef FREECIV_JSON_CONNECTION
22991 field_addr.name = "steal";
22992#endif /* FREECIV_JSON_CONNECTION */
22993 DIO_PUT(uint16, &dout, &field_addr, real_packet->steal);
22994 }
22995 if (BV_ISSET(fields, 44)) {
22996 log_packet_detailed(" field 'worklist' has changed");
22997 #ifdef FREECIV_JSON_CONNECTION
22998 field_addr.name = "worklist";
22999#endif /* FREECIV_JSON_CONNECTION */
23000 DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
23001 }
23002 if (BV_ISSET(fields, 45)) {
23003 log_packet_detailed(" field 'improvements' has changed");
23004 #ifdef FREECIV_JSON_CONNECTION
23005 field_addr.name = "improvements";
23006#endif /* FREECIV_JSON_CONNECTION */
23007 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
23008 }
23009 if (BV_ISSET(fields, 46)) {
23010 log_packet_detailed(" field 'city_options' has changed");
23011 #ifdef FREECIV_JSON_CONNECTION
23012 field_addr.name = "city_options";
23013#endif /* FREECIV_JSON_CONNECTION */
23014 DIO_BV_PUT(&dout, &field_addr, packet->city_options);
23015 }
23016 if (BV_ISSET(fields, 47)) {
23017 log_packet_detailed(" field 'name' has changed");
23018 #ifdef FREECIV_JSON_CONNECTION
23019 field_addr.name = "name";
23020#endif /* FREECIV_JSON_CONNECTION */
23021 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
23022 }
23023
23024 *old = *real_packet;
23025
23026 hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
23027 if (NULL != *hash) {
23028 genhash_remove(*hash, real_packet);
23029 }
23030#endif /* FREECIV_DELTA_PROTOCOL */
23031#ifndef FREECIV_DELTA_PROTOCOL
23032#ifdef FREECIV_JSON_CONNECTION
23033 field_addr.name = "id16";
23034#endif /* FREECIV_JSON_CONNECTION */
23035 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
23036#ifdef FREECIV_JSON_CONNECTION
23037 field_addr.name = "tile";
23038#endif /* FREECIV_JSON_CONNECTION */
23039 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
23040#ifdef FREECIV_JSON_CONNECTION
23041 field_addr.name = "owner";
23042#endif /* FREECIV_JSON_CONNECTION */
23043 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
23044#ifdef FREECIV_JSON_CONNECTION
23045 field_addr.name = "size";
23046#endif /* FREECIV_JSON_CONNECTION */
23047 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
23048#ifdef FREECIV_JSON_CONNECTION
23049 field_addr.name = "city_radius_sq";
23050#endif /* FREECIV_JSON_CONNECTION */
23051 DIO_PUT(uint8, &dout, &field_addr, real_packet->city_radius_sq);
23052#ifdef FREECIV_JSON_CONNECTION
23053 field_addr.name = "style";
23054#endif /* FREECIV_JSON_CONNECTION */
23055 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
23056#ifdef FREECIV_JSON_CONNECTION
23057 field_addr.name = "capital";
23058#endif /* FREECIV_JSON_CONNECTION */
23059 DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
23060#ifdef FREECIV_JSON_CONNECTION
23061 field_addr.name = "ppl_happy";
23062#endif /* FREECIV_JSON_CONNECTION */
23063
23064 {
23065 int i;
23066
23067#ifdef FREECIV_JSON_CONNECTION
23068 /* Create the array. */
23069 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
23070
23071 /* Enter the array. */
23072 field_addr.sub_location = plocation_elem_new(0);
23073#endif /* FREECIV_JSON_CONNECTION */
23074
23075 for (i = 0; i < FEELING_LAST; i++) {
23076#ifdef FREECIV_JSON_CONNECTION
23077 /* Next array element. */
23078 field_addr.sub_location->number = i;
23079#endif /* FREECIV_JSON_CONNECTION */
23080 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
23081 }
23082
23083#ifdef FREECIV_JSON_CONNECTION
23084 /* Exit array. */
23085 free(field_addr.sub_location);
23086 field_addr.sub_location = NULL;
23087#endif /* FREECIV_JSON_CONNECTION */
23088 }
23089#ifdef FREECIV_JSON_CONNECTION
23090 field_addr.name = "ppl_content";
23091#endif /* FREECIV_JSON_CONNECTION */
23092
23093 {
23094 int i;
23095
23096#ifdef FREECIV_JSON_CONNECTION
23097 /* Create the array. */
23098 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
23099
23100 /* Enter the array. */
23101 field_addr.sub_location = plocation_elem_new(0);
23102#endif /* FREECIV_JSON_CONNECTION */
23103
23104 for (i = 0; i < FEELING_LAST; i++) {
23105#ifdef FREECIV_JSON_CONNECTION
23106 /* Next array element. */
23107 field_addr.sub_location->number = i;
23108#endif /* FREECIV_JSON_CONNECTION */
23109 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
23110 }
23111
23112#ifdef FREECIV_JSON_CONNECTION
23113 /* Exit array. */
23114 free(field_addr.sub_location);
23115 field_addr.sub_location = NULL;
23116#endif /* FREECIV_JSON_CONNECTION */
23117 }
23118#ifdef FREECIV_JSON_CONNECTION
23119 field_addr.name = "ppl_unhappy";
23120#endif /* FREECIV_JSON_CONNECTION */
23121
23122 {
23123 int i;
23124
23125#ifdef FREECIV_JSON_CONNECTION
23126 /* Create the array. */
23127 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
23128
23129 /* Enter the array. */
23130 field_addr.sub_location = plocation_elem_new(0);
23131#endif /* FREECIV_JSON_CONNECTION */
23132
23133 for (i = 0; i < FEELING_LAST; i++) {
23134#ifdef FREECIV_JSON_CONNECTION
23135 /* Next array element. */
23136 field_addr.sub_location->number = i;
23137#endif /* FREECIV_JSON_CONNECTION */
23138 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
23139 }
23140
23141#ifdef FREECIV_JSON_CONNECTION
23142 /* Exit array. */
23143 free(field_addr.sub_location);
23144 field_addr.sub_location = NULL;
23145#endif /* FREECIV_JSON_CONNECTION */
23146 }
23147#ifdef FREECIV_JSON_CONNECTION
23148 field_addr.name = "ppl_angry";
23149#endif /* FREECIV_JSON_CONNECTION */
23150
23151 {
23152 int i;
23153
23154#ifdef FREECIV_JSON_CONNECTION
23155 /* Create the array. */
23156 DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
23157
23158 /* Enter the array. */
23159 field_addr.sub_location = plocation_elem_new(0);
23160#endif /* FREECIV_JSON_CONNECTION */
23161
23162 for (i = 0; i < FEELING_LAST; i++) {
23163#ifdef FREECIV_JSON_CONNECTION
23164 /* Next array element. */
23165 field_addr.sub_location->number = i;
23166#endif /* FREECIV_JSON_CONNECTION */
23167 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
23168 }
23169
23170#ifdef FREECIV_JSON_CONNECTION
23171 /* Exit array. */
23172 free(field_addr.sub_location);
23173 field_addr.sub_location = NULL;
23174#endif /* FREECIV_JSON_CONNECTION */
23175 }
23176#ifdef FREECIV_JSON_CONNECTION
23177 field_addr.name = "specialists_size";
23178#endif /* FREECIV_JSON_CONNECTION */
23179 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
23180#ifdef FREECIV_JSON_CONNECTION
23181 field_addr.name = "specialists";
23182#endif /* FREECIV_JSON_CONNECTION */
23183
23184 {
23185 int i;
23186
23187#ifdef FREECIV_JSON_CONNECTION
23188 /* Create the array. */
23189 DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
23190
23191 /* Enter the array. */
23192 field_addr.sub_location = plocation_elem_new(0);
23193#endif /* FREECIV_JSON_CONNECTION */
23194
23195 for (i = 0; i < real_packet->specialists_size; i++) {
23196#ifdef FREECIV_JSON_CONNECTION
23197 /* Next array element. */
23198 field_addr.sub_location->number = i;
23199#endif /* FREECIV_JSON_CONNECTION */
23200 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
23201 }
23202
23203#ifdef FREECIV_JSON_CONNECTION
23204 /* Exit array. */
23205 free(field_addr.sub_location);
23206 field_addr.sub_location = NULL;
23207#endif /* FREECIV_JSON_CONNECTION */
23208 }
23209#ifdef FREECIV_JSON_CONNECTION
23210 field_addr.name = "history";
23211#endif /* FREECIV_JSON_CONNECTION */
23212 DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
23213#ifdef FREECIV_JSON_CONNECTION
23214 field_addr.name = "culture";
23215#endif /* FREECIV_JSON_CONNECTION */
23216 DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
23217#ifdef FREECIV_JSON_CONNECTION
23218 field_addr.name = "buy_cost";
23219#endif /* FREECIV_JSON_CONNECTION */
23220 DIO_PUT(uint32, &dout, &field_addr, real_packet->buy_cost);
23221#ifdef FREECIV_JSON_CONNECTION
23222 field_addr.name = "surplus";
23223#endif /* FREECIV_JSON_CONNECTION */
23224
23225 {
23226 int i;
23227
23228#ifdef FREECIV_JSON_CONNECTION
23229 /* Create the array. */
23230 DIO_PUT(farray, &dout, &field_addr, O_LAST);
23231
23232 /* Enter the array. */
23233 field_addr.sub_location = plocation_elem_new(0);
23234#endif /* FREECIV_JSON_CONNECTION */
23235
23236 for (i = 0; i < O_LAST; i++) {
23237#ifdef FREECIV_JSON_CONNECTION
23238 /* Next array element. */
23239 field_addr.sub_location->number = i;
23240#endif /* FREECIV_JSON_CONNECTION */
23241 DIO_PUT(sint16, &dout, &field_addr, real_packet->surplus[i]);
23242 }
23243
23244#ifdef FREECIV_JSON_CONNECTION
23245 /* Exit array. */
23246 free(field_addr.sub_location);
23247 field_addr.sub_location = NULL;
23248#endif /* FREECIV_JSON_CONNECTION */
23249 }
23250#ifdef FREECIV_JSON_CONNECTION
23251 field_addr.name = "waste";
23252#endif /* FREECIV_JSON_CONNECTION */
23253
23254 {
23255 int i;
23256
23257#ifdef FREECIV_JSON_CONNECTION
23258 /* Create the array. */
23259 DIO_PUT(farray, &dout, &field_addr, O_LAST);
23260
23261 /* Enter the array. */
23262 field_addr.sub_location = plocation_elem_new(0);
23263#endif /* FREECIV_JSON_CONNECTION */
23264
23265 for (i = 0; i < O_LAST; i++) {
23266#ifdef FREECIV_JSON_CONNECTION
23267 /* Next array element. */
23268 field_addr.sub_location->number = i;
23269#endif /* FREECIV_JSON_CONNECTION */
23270 DIO_PUT(uint16, &dout, &field_addr, real_packet->waste[i]);
23271 }
23272
23273#ifdef FREECIV_JSON_CONNECTION
23274 /* Exit array. */
23275 free(field_addr.sub_location);
23276 field_addr.sub_location = NULL;
23277#endif /* FREECIV_JSON_CONNECTION */
23278 }
23279#ifdef FREECIV_JSON_CONNECTION
23280 field_addr.name = "unhappy_penalty";
23281#endif /* FREECIV_JSON_CONNECTION */
23282
23283 {
23284 int i;
23285
23286#ifdef FREECIV_JSON_CONNECTION
23287 /* Create the array. */
23288 DIO_PUT(farray, &dout, &field_addr, O_LAST);
23289
23290 /* Enter the array. */
23291 field_addr.sub_location = plocation_elem_new(0);
23292#endif /* FREECIV_JSON_CONNECTION */
23293
23294 for (i = 0; i < O_LAST; i++) {
23295#ifdef FREECIV_JSON_CONNECTION
23296 /* Next array element. */
23297 field_addr.sub_location->number = i;
23298#endif /* FREECIV_JSON_CONNECTION */
23299 DIO_PUT(sint16, &dout, &field_addr, real_packet->unhappy_penalty[i]);
23300 }
23301
23302#ifdef FREECIV_JSON_CONNECTION
23303 /* Exit array. */
23304 free(field_addr.sub_location);
23305 field_addr.sub_location = NULL;
23306#endif /* FREECIV_JSON_CONNECTION */
23307 }
23308#ifdef FREECIV_JSON_CONNECTION
23309 field_addr.name = "prod";
23310#endif /* FREECIV_JSON_CONNECTION */
23311
23312 {
23313 int i;
23314
23315#ifdef FREECIV_JSON_CONNECTION
23316 /* Create the array. */
23317 DIO_PUT(farray, &dout, &field_addr, O_LAST);
23318
23319 /* Enter the array. */
23320 field_addr.sub_location = plocation_elem_new(0);
23321#endif /* FREECIV_JSON_CONNECTION */
23322
23323 for (i = 0; i < O_LAST; i++) {
23324#ifdef FREECIV_JSON_CONNECTION
23325 /* Next array element. */
23326 field_addr.sub_location->number = i;
23327#endif /* FREECIV_JSON_CONNECTION */
23328 DIO_PUT(uint16, &dout, &field_addr, real_packet->prod[i]);
23329 }
23330
23331#ifdef FREECIV_JSON_CONNECTION
23332 /* Exit array. */
23333 free(field_addr.sub_location);
23334 field_addr.sub_location = NULL;
23335#endif /* FREECIV_JSON_CONNECTION */
23336 }
23337#ifdef FREECIV_JSON_CONNECTION
23338 field_addr.name = "citizen_base";
23339#endif /* FREECIV_JSON_CONNECTION */
23340
23341 {
23342 int i;
23343
23344#ifdef FREECIV_JSON_CONNECTION
23345 /* Create the array. */
23346 DIO_PUT(farray, &dout, &field_addr, O_LAST);
23347
23348 /* Enter the array. */
23349 field_addr.sub_location = plocation_elem_new(0);
23350#endif /* FREECIV_JSON_CONNECTION */
23351
23352 for (i = 0; i < O_LAST; i++) {
23353#ifdef FREECIV_JSON_CONNECTION
23354 /* Next array element. */
23355 field_addr.sub_location->number = i;
23356#endif /* FREECIV_JSON_CONNECTION */
23357 DIO_PUT(sint16, &dout, &field_addr, real_packet->citizen_base[i]);
23358 }
23359
23360#ifdef FREECIV_JSON_CONNECTION
23361 /* Exit array. */
23362 free(field_addr.sub_location);
23363 field_addr.sub_location = NULL;
23364#endif /* FREECIV_JSON_CONNECTION */
23365 }
23366#ifdef FREECIV_JSON_CONNECTION
23367 field_addr.name = "usage";
23368#endif /* FREECIV_JSON_CONNECTION */
23369
23370 {
23371 int i;
23372
23373#ifdef FREECIV_JSON_CONNECTION
23374 /* Create the array. */
23375 DIO_PUT(farray, &dout, &field_addr, O_LAST);
23376
23377 /* Enter the array. */
23378 field_addr.sub_location = plocation_elem_new(0);
23379#endif /* FREECIV_JSON_CONNECTION */
23380
23381 for (i = 0; i < O_LAST; i++) {
23382#ifdef FREECIV_JSON_CONNECTION
23383 /* Next array element. */
23384 field_addr.sub_location->number = i;
23385#endif /* FREECIV_JSON_CONNECTION */
23386 DIO_PUT(sint16, &dout, &field_addr, real_packet->usage[i]);
23387 }
23388
23389#ifdef FREECIV_JSON_CONNECTION
23390 /* Exit array. */
23391 free(field_addr.sub_location);
23392 field_addr.sub_location = NULL;
23393#endif /* FREECIV_JSON_CONNECTION */
23394 }
23395#ifdef FREECIV_JSON_CONNECTION
23396 field_addr.name = "food_stock";
23397#endif /* FREECIV_JSON_CONNECTION */
23398 DIO_PUT(sint16, &dout, &field_addr, real_packet->food_stock);
23399#ifdef FREECIV_JSON_CONNECTION
23400 field_addr.name = "shield_stock";
23401#endif /* FREECIV_JSON_CONNECTION */
23402 DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
23403#ifdef FREECIV_JSON_CONNECTION
23404 field_addr.name = "trade_route_count";
23405#endif /* FREECIV_JSON_CONNECTION */
23406 DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_route_count);
23407#ifdef FREECIV_JSON_CONNECTION
23408 field_addr.name = "pollution";
23409#endif /* FREECIV_JSON_CONNECTION */
23410 DIO_PUT(uint16, &dout, &field_addr, real_packet->pollution);
23411#ifdef FREECIV_JSON_CONNECTION
23412 field_addr.name = "illness_trade";
23413#endif /* FREECIV_JSON_CONNECTION */
23414 DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade);
23415#ifdef FREECIV_JSON_CONNECTION
23416 field_addr.name = "production_kind";
23417#endif /* FREECIV_JSON_CONNECTION */
23418 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
23419#ifdef FREECIV_JSON_CONNECTION
23420 field_addr.name = "production_value";
23421#endif /* FREECIV_JSON_CONNECTION */
23422 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
23423#ifdef FREECIV_JSON_CONNECTION
23424 field_addr.name = "turn_founded";
23425#endif /* FREECIV_JSON_CONNECTION */
23426 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
23427#ifdef FREECIV_JSON_CONNECTION
23428 field_addr.name = "turn_last_built";
23429#endif /* FREECIV_JSON_CONNECTION */
23430 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
23431#ifdef FREECIV_JSON_CONNECTION
23432 field_addr.name = "changed_from_kind";
23433#endif /* FREECIV_JSON_CONNECTION */
23434 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_kind);
23435#ifdef FREECIV_JSON_CONNECTION
23436 field_addr.name = "changed_from_value";
23437#endif /* FREECIV_JSON_CONNECTION */
23438 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_value);
23439#ifdef FREECIV_JSON_CONNECTION
23440 field_addr.name = "before_change_shields";
23441#endif /* FREECIV_JSON_CONNECTION */
23442 DIO_PUT(uint16, &dout, &field_addr, real_packet->before_change_shields);
23443#ifdef FREECIV_JSON_CONNECTION
23444 field_addr.name = "disbanded_shields";
23445#endif /* FREECIV_JSON_CONNECTION */
23446 DIO_PUT(uint16, &dout, &field_addr, real_packet->disbanded_shields);
23447#ifdef FREECIV_JSON_CONNECTION
23448 field_addr.name = "caravan_shields";
23449#endif /* FREECIV_JSON_CONNECTION */
23450 DIO_PUT(uint16, &dout, &field_addr, real_packet->caravan_shields);
23451#ifdef FREECIV_JSON_CONNECTION
23452 field_addr.name = "last_turns_shield_surplus";
23453#endif /* FREECIV_JSON_CONNECTION */
23454 DIO_PUT(uint16, &dout, &field_addr, real_packet->last_turns_shield_surplus);
23455#ifdef FREECIV_JSON_CONNECTION
23456 field_addr.name = "airlift";
23457#endif /* FREECIV_JSON_CONNECTION */
23458 DIO_PUT(uint8, &dout, &field_addr, real_packet->airlift);
23459#ifdef FREECIV_JSON_CONNECTION
23460 field_addr.name = "did_buy";
23461#endif /* FREECIV_JSON_CONNECTION */
23462 DIO_PUT(bool8, &dout, &field_addr, real_packet->did_buy);
23463#ifdef FREECIV_JSON_CONNECTION
23464 field_addr.name = "did_sell";
23465#endif /* FREECIV_JSON_CONNECTION */
23466 DIO_PUT(bool8, &dout, &field_addr, real_packet->did_sell);
23467#ifdef FREECIV_JSON_CONNECTION
23468 field_addr.name = "was_happy";
23469#endif /* FREECIV_JSON_CONNECTION */
23470 DIO_PUT(bool8, &dout, &field_addr, real_packet->was_happy);
23471#ifdef FREECIV_JSON_CONNECTION
23472 field_addr.name = "diplomat_investigate";
23473#endif /* FREECIV_JSON_CONNECTION */
23474 DIO_PUT(bool8, &dout, &field_addr, real_packet->diplomat_investigate);
23475#ifdef FREECIV_JSON_CONNECTION
23476 field_addr.name = "walls";
23477#endif /* FREECIV_JSON_CONNECTION */
23478 DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
23479#ifdef FREECIV_JSON_CONNECTION
23480 field_addr.name = "city_image";
23481#endif /* FREECIV_JSON_CONNECTION */
23482 DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
23483#ifdef FREECIV_JSON_CONNECTION
23484 field_addr.name = "steal";
23485#endif /* FREECIV_JSON_CONNECTION */
23486 DIO_PUT(uint16, &dout, &field_addr, real_packet->steal);
23487#ifdef FREECIV_JSON_CONNECTION
23488 field_addr.name = "worklist";
23489#endif /* FREECIV_JSON_CONNECTION */
23490 DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
23491#ifdef FREECIV_JSON_CONNECTION
23492 field_addr.name = "improvements";
23493#endif /* FREECIV_JSON_CONNECTION */
23494 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
23495#ifdef FREECIV_JSON_CONNECTION
23496 field_addr.name = "city_options";
23497#endif /* FREECIV_JSON_CONNECTION */
23498 DIO_BV_PUT(&dout, &field_addr, packet->city_options);
23499#ifdef FREECIV_JSON_CONNECTION
23500 field_addr.name = "name";
23501#endif /* FREECIV_JSON_CONNECTION */
23502 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
23503
23504#endif
23505 SEND_PACKET_END(PACKET_CITY_INFO);
23506}
23507
23508 int send_packet_city_info(struct connection *pc, const struct packet_city_info *packet, bool force_to_send)
23509{
23510 if (!pc->used) {
23511 log_error("WARNING: trying to send data to the closed connection %s",
23512 conn_description(pc));
23513 return -1;
23514 }
23515 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_INFO].force_to_send != NULL, -1,
23516 "Handler for PACKET_CITY_INFO not installed");
23517 return pc->phs.handlers->send[PACKET_CITY_INFO].force_to_send(pc, packet, force_to_send);
23518}
23519
23520 void lsend_packet_city_info(struct conn_list *dest, const struct packet_city_info *packet, bool force_to_send)
23521{
23522 conn_list_iterate(dest, pconn) {
23523 send_packet_city_info(pconn, packet, force_to_send);
23524 } conn_list_iterate_end;
23525}
23526
23527#ifdef FREECIV_DELTA_PROTOCOL
23528#define hash_packet_city_nationalities_100 hash_const
23529
23530#define cmp_packet_city_nationalities_100 cmp_const
23531
23532 BV_DEFINE(packet_city_nationalities_100_fields, 4);
23533#endif /* FREECIV_DELTA_PROTOCOL */
23534
23535 static struct packet_city_nationalities *receive_packet_city_nationalities_100(struct connection *pc)
23536{
23537#ifdef FREECIV_DELTA_PROTOCOL
23538 packet_city_nationalities_100_fields fields;
23539 struct packet_city_nationalities *old;
23540 struct genhash **hash = pc->phs.received + PACKET_CITY_NATIONALITIES;
23541#endif /* FREECIV_DELTA_PROTOCOL */
23542 RECEIVE_PACKET_START(packet_city_nationalities, real_packet);
23543#ifdef FREECIV_JSON_CONNECTION
23544 struct plocation field_addr;
23545 {
23546 struct plocation *field_addr_tmp = plocation_field_new(NULL);
23547 field_addr = *field_addr_tmp;
23548 FC_FREE(field_addr_tmp);
23549 }
23550#endif /* FREECIV_JSON_CONNECTION */
23551
23552#ifdef FREECIV_DELTA_PROTOCOL
23553#ifdef FREECIV_JSON_CONNECTION
23554 field_addr.name = "fields";
23555#endif /* FREECIV_JSON_CONNECTION */
23556 DIO_BV_GET(&din, &field_addr, fields);
23557
23558#else /* FREECIV_DELTA_PROTOCOL */
23559 #ifdef FREECIV_JSON_CONNECTION
23560 field_addr.name = "id32";
23561 #endif /* FREECIV_JSON_CONNECTION */
23562 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
23563 RECEIVE_PACKET_FIELD_ERROR(id32);
23564 }
23565 #ifdef FREECIV_JSON_CONNECTION
23566 field_addr.name = "nationalities_count";
23567 #endif /* FREECIV_JSON_CONNECTION */
23568 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nationalities_count)) {
23569 RECEIVE_PACKET_FIELD_ERROR(nationalities_count);
23570 }
23571 #ifdef FREECIV_JSON_CONNECTION
23572 field_addr.name = "nation_id";
23573 #endif /* FREECIV_JSON_CONNECTION */
23574
23575 {
23576 int i;
23577
23578 #ifdef FREECIV_JSON_CONNECTION
23579 /* Enter array. */
23580 field_addr.sub_location = plocation_elem_new(0);
23581 #endif /* FREECIV_JSON_CONNECTION */
23582
23583 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
23584 RECEIVE_PACKET_FIELD_ERROR(nation_id, ": truncation array");
23585 }
23586 for (i = 0; i < real_packet->nationalities_count; i++) {
23587 #ifdef FREECIV_JSON_CONNECTION
23588 field_addr.sub_location->number = i;
23589 #endif /* FREECIV_JSON_CONNECTION */
23590 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nation_id[i])) {
23591 RECEIVE_PACKET_FIELD_ERROR(nation_id);
23592 }
23593 }
23594
23595 #ifdef FREECIV_JSON_CONNECTION
23596 /* Exit array. */
23597 free(field_addr.sub_location);
23598 field_addr.sub_location = NULL;
23599 #endif /* FREECIV_JSON_CONNECTION */
23600 }
23601 #ifdef FREECIV_JSON_CONNECTION
23602 field_addr.name = "nation_citizens";
23603 #endif /* FREECIV_JSON_CONNECTION */
23604
23605 {
23606 int i;
23607
23608 #ifdef FREECIV_JSON_CONNECTION
23609 /* Enter array. */
23610 field_addr.sub_location = plocation_elem_new(0);
23611 #endif /* FREECIV_JSON_CONNECTION */
23612
23613 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
23614 RECEIVE_PACKET_FIELD_ERROR(nation_citizens, ": truncation array");
23615 }
23616 for (i = 0; i < real_packet->nationalities_count; i++) {
23617 #ifdef FREECIV_JSON_CONNECTION
23618 field_addr.sub_location->number = i;
23619 #endif /* FREECIV_JSON_CONNECTION */
23620 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nation_citizens[i])) {
23621 RECEIVE_PACKET_FIELD_ERROR(nation_citizens);
23622 }
23623 }
23624
23625 #ifdef FREECIV_JSON_CONNECTION
23626 /* Exit array. */
23627 free(field_addr.sub_location);
23628 field_addr.sub_location = NULL;
23629 #endif /* FREECIV_JSON_CONNECTION */
23630 }
23631
23632#endif
23633 log_packet_detailed("packet_city_nationalities_100: got info about ()");
23634
23635#ifdef FREECIV_DELTA_PROTOCOL
23636 if (NULL == *hash) {
23637 *hash = genhash_new_full(hash_packet_city_nationalities_100, cmp_packet_city_nationalities_100,
23638 NULL, NULL, NULL, free);
23639 }
23640
23641 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
23642 *real_packet = *old;
23643 } else {
23644 log_packet_detailed(" no old info");
23645 memset(real_packet, 0, sizeof(*real_packet));
23646 }
23647
23648 if (BV_ISSET(fields, 0)) {
23649 log_packet_detailed(" got field 'id32'");
23650 #ifdef FREECIV_JSON_CONNECTION
23651 field_addr.name = "id32";
23652 #endif /* FREECIV_JSON_CONNECTION */
23653 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
23654 RECEIVE_PACKET_FIELD_ERROR(id32);
23655 }
23656 }
23657 if (BV_ISSET(fields, 1)) {
23658 log_packet_detailed(" got field 'nationalities_count'");
23659 #ifdef FREECIV_JSON_CONNECTION
23660 field_addr.name = "nationalities_count";
23661 #endif /* FREECIV_JSON_CONNECTION */
23662 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nationalities_count)) {
23663 RECEIVE_PACKET_FIELD_ERROR(nationalities_count);
23664 }
23665 }
23666 if (BV_ISSET(fields, 2)) {
23667 log_packet_detailed(" got field 'nation_id'");
23668 #ifdef FREECIV_JSON_CONNECTION
23669 field_addr.name = "nation_id";
23670 #endif /* FREECIV_JSON_CONNECTION */
23671
23672 {
23673 int i;
23674
23675 #ifdef FREECIV_JSON_CONNECTION
23676 /* Enter array. */
23677 field_addr.sub_location = plocation_elem_new(0);
23678 #endif /* FREECIV_JSON_CONNECTION */
23679
23680 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
23681 RECEIVE_PACKET_FIELD_ERROR(nation_id, ": truncation array");
23682 }
23683 for (i = 0; i < real_packet->nationalities_count; i++) {
23684 #ifdef FREECIV_JSON_CONNECTION
23685 field_addr.sub_location->number = i;
23686 #endif /* FREECIV_JSON_CONNECTION */
23687 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nation_id[i])) {
23688 RECEIVE_PACKET_FIELD_ERROR(nation_id);
23689 }
23690 }
23691
23692 #ifdef FREECIV_JSON_CONNECTION
23693 /* Exit array. */
23694 free(field_addr.sub_location);
23695 field_addr.sub_location = NULL;
23696 #endif /* FREECIV_JSON_CONNECTION */
23697 }
23698 }
23699 if (BV_ISSET(fields, 3)) {
23700 log_packet_detailed(" got field 'nation_citizens'");
23701 #ifdef FREECIV_JSON_CONNECTION
23702 field_addr.name = "nation_citizens";
23703 #endif /* FREECIV_JSON_CONNECTION */
23704
23705 {
23706 int i;
23707
23708 #ifdef FREECIV_JSON_CONNECTION
23709 /* Enter array. */
23710 field_addr.sub_location = plocation_elem_new(0);
23711 #endif /* FREECIV_JSON_CONNECTION */
23712
23713 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
23714 RECEIVE_PACKET_FIELD_ERROR(nation_citizens, ": truncation array");
23715 }
23716 for (i = 0; i < real_packet->nationalities_count; i++) {
23717 #ifdef FREECIV_JSON_CONNECTION
23718 field_addr.sub_location->number = i;
23719 #endif /* FREECIV_JSON_CONNECTION */
23720 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nation_citizens[i])) {
23721 RECEIVE_PACKET_FIELD_ERROR(nation_citizens);
23722 }
23723 }
23724
23725 #ifdef FREECIV_JSON_CONNECTION
23726 /* Exit array. */
23727 free(field_addr.sub_location);
23728 field_addr.sub_location = NULL;
23729 #endif /* FREECIV_JSON_CONNECTION */
23730 }
23731 }
23732
23733 if (NULL == old) {
23734 old = fc_malloc(sizeof(*old));
23735 *old = *real_packet;
23736 genhash_insert(*hash, old, old);
23737 } else {
23738 *old = *real_packet;
23739 }
23740
23741#endif /* FREECIV_DELTA_PROTOCOL */
23742 RECEIVE_PACKET_END(real_packet);
23743}
23744
23745 static int send_packet_city_nationalities_100(struct connection *pc, const struct packet_city_nationalities *packet, bool force_to_send)
23746{
23747 const struct packet_city_nationalities *real_packet = packet;
23748#ifdef FREECIV_DELTA_PROTOCOL
23749 packet_city_nationalities_100_fields fields;
23750 struct packet_city_nationalities *old;
23751 bool differ;
23752 struct genhash **hash = pc->phs.sent + PACKET_CITY_NATIONALITIES;
23753 int different = force_to_send;
23754#endif /* FREECIV_DELTA_PROTOCOL */
23755 SEND_PACKET_START(PACKET_CITY_NATIONALITIES);
23756#ifdef FREECIV_JSON_CONNECTION
23757 struct plocation field_addr;
23758 {
23759 struct plocation *field_addr_tmp = plocation_field_new(NULL);
23760 field_addr = *field_addr_tmp;
23761 FC_FREE(field_addr_tmp);
23762 }
23763#endif /* FREECIV_JSON_CONNECTION */
23764
23765 log_packet_detailed("packet_city_nationalities_100: sending info about ()");
23766
23767#ifdef FREECIV_DELTA_PROTOCOL
23768 if (NULL == *hash) {
23769 *hash = genhash_new_full(hash_packet_city_nationalities_100, cmp_packet_city_nationalities_100,
23770 NULL, NULL, NULL, free);
23771 }
23772 BV_CLR_ALL(fields);
23773
23774 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
23775 old = fc_malloc(sizeof(*old));
23776 *old = *real_packet;
23777 genhash_insert(*hash, old, old);
23778 memset(old, 0, sizeof(*old));
23779 different = 1; /* Force to send. */
23780 }
23781 differ = (old->id32 != real_packet->id32);
23782 if (differ) {
23783 different++;
23784 BV_SET(fields, 0);
23785 }
23786
23787 differ = (old->nationalities_count != real_packet->nationalities_count);
23788 if (differ) {
23789 different++;
23790 BV_SET(fields, 1);
23791 }
23792
23793
23794 {
23795 differ = (old->nationalities_count != real_packet->nationalities_count);
23796 if (!differ) {
23797 int i;
23798
23799 for (i = 0; i < real_packet->nationalities_count; i++) {
23800 if (old->nation_id[i] != real_packet->nation_id[i]) {
23801 differ = TRUE;
23802 break;
23803 }
23804 }
23805 }
23806 }
23807 if (differ) {
23808 different++;
23809 BV_SET(fields, 2);
23810 }
23811
23812
23813 {
23814 differ = (old->nationalities_count != real_packet->nationalities_count);
23815 if (!differ) {
23816 int i;
23817
23818 for (i = 0; i < real_packet->nationalities_count; i++) {
23819 if (old->nation_citizens[i] != real_packet->nation_citizens[i]) {
23820 differ = TRUE;
23821 break;
23822 }
23823 }
23824 }
23825 }
23826 if (differ) {
23827 different++;
23828 BV_SET(fields, 3);
23829 }
23830
23831
23832 if (different == 0) {
23833 log_packet_detailed(" no change -> discard");
23834 return 0;
23835 }
23836
23837#ifdef FREECIV_JSON_CONNECTION
23838 field_addr.name = "fields";
23839#endif /* FREECIV_JSON_CONNECTION */
23840 DIO_BV_PUT(&dout, &field_addr, fields);
23841
23842 if (BV_ISSET(fields, 0)) {
23843 log_packet_detailed(" field 'id32' has changed");
23844 #ifdef FREECIV_JSON_CONNECTION
23845 field_addr.name = "id32";
23846#endif /* FREECIV_JSON_CONNECTION */
23847 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
23848 }
23849 if (BV_ISSET(fields, 1)) {
23850 log_packet_detailed(" field 'nationalities_count' has changed");
23851 #ifdef FREECIV_JSON_CONNECTION
23852 field_addr.name = "nationalities_count";
23853#endif /* FREECIV_JSON_CONNECTION */
23854 DIO_PUT(uint8, &dout, &field_addr, real_packet->nationalities_count);
23855 }
23856 if (BV_ISSET(fields, 2)) {
23857 log_packet_detailed(" field 'nation_id' has changed");
23858 #ifdef FREECIV_JSON_CONNECTION
23859 field_addr.name = "nation_id";
23860#endif /* FREECIV_JSON_CONNECTION */
23861
23862 {
23863 int i;
23864
23865#ifdef FREECIV_JSON_CONNECTION
23866 /* Create the array. */
23867 DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
23868
23869 /* Enter the array. */
23870 field_addr.sub_location = plocation_elem_new(0);
23871#endif /* FREECIV_JSON_CONNECTION */
23872
23873 for (i = 0; i < real_packet->nationalities_count; i++) {
23874#ifdef FREECIV_JSON_CONNECTION
23875 /* Next array element. */
23876 field_addr.sub_location->number = i;
23877#endif /* FREECIV_JSON_CONNECTION */
23878 DIO_PUT(uint16, &dout, &field_addr, real_packet->nation_id[i]);
23879 }
23880
23881#ifdef FREECIV_JSON_CONNECTION
23882 /* Exit array. */
23883 free(field_addr.sub_location);
23884 field_addr.sub_location = NULL;
23885#endif /* FREECIV_JSON_CONNECTION */
23886 }
23887 }
23888 if (BV_ISSET(fields, 3)) {
23889 log_packet_detailed(" field 'nation_citizens' has changed");
23890 #ifdef FREECIV_JSON_CONNECTION
23891 field_addr.name = "nation_citizens";
23892#endif /* FREECIV_JSON_CONNECTION */
23893
23894 {
23895 int i;
23896
23897#ifdef FREECIV_JSON_CONNECTION
23898 /* Create the array. */
23899 DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
23900
23901 /* Enter the array. */
23902 field_addr.sub_location = plocation_elem_new(0);
23903#endif /* FREECIV_JSON_CONNECTION */
23904
23905 for (i = 0; i < real_packet->nationalities_count; i++) {
23906#ifdef FREECIV_JSON_CONNECTION
23907 /* Next array element. */
23908 field_addr.sub_location->number = i;
23909#endif /* FREECIV_JSON_CONNECTION */
23910 DIO_PUT(uint8, &dout, &field_addr, real_packet->nation_citizens[i]);
23911 }
23912
23913#ifdef FREECIV_JSON_CONNECTION
23914 /* Exit array. */
23915 free(field_addr.sub_location);
23916 field_addr.sub_location = NULL;
23917#endif /* FREECIV_JSON_CONNECTION */
23918 }
23919 }
23920
23921 *old = *real_packet;
23922#endif /* FREECIV_DELTA_PROTOCOL */
23923#ifndef FREECIV_DELTA_PROTOCOL
23924#ifdef FREECIV_JSON_CONNECTION
23925 field_addr.name = "id32";
23926#endif /* FREECIV_JSON_CONNECTION */
23927 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
23928#ifdef FREECIV_JSON_CONNECTION
23929 field_addr.name = "nationalities_count";
23930#endif /* FREECIV_JSON_CONNECTION */
23931 DIO_PUT(uint8, &dout, &field_addr, real_packet->nationalities_count);
23932#ifdef FREECIV_JSON_CONNECTION
23933 field_addr.name = "nation_id";
23934#endif /* FREECIV_JSON_CONNECTION */
23935
23936 {
23937 int i;
23938
23939#ifdef FREECIV_JSON_CONNECTION
23940 /* Create the array. */
23941 DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
23942
23943 /* Enter the array. */
23944 field_addr.sub_location = plocation_elem_new(0);
23945#endif /* FREECIV_JSON_CONNECTION */
23946
23947 for (i = 0; i < real_packet->nationalities_count; i++) {
23948#ifdef FREECIV_JSON_CONNECTION
23949 /* Next array element. */
23950 field_addr.sub_location->number = i;
23951#endif /* FREECIV_JSON_CONNECTION */
23952 DIO_PUT(uint16, &dout, &field_addr, real_packet->nation_id[i]);
23953 }
23954
23955#ifdef FREECIV_JSON_CONNECTION
23956 /* Exit array. */
23957 free(field_addr.sub_location);
23958 field_addr.sub_location = NULL;
23959#endif /* FREECIV_JSON_CONNECTION */
23960 }
23961#ifdef FREECIV_JSON_CONNECTION
23962 field_addr.name = "nation_citizens";
23963#endif /* FREECIV_JSON_CONNECTION */
23964
23965 {
23966 int i;
23967
23968#ifdef FREECIV_JSON_CONNECTION
23969 /* Create the array. */
23970 DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
23971
23972 /* Enter the array. */
23973 field_addr.sub_location = plocation_elem_new(0);
23974#endif /* FREECIV_JSON_CONNECTION */
23975
23976 for (i = 0; i < real_packet->nationalities_count; i++) {
23977#ifdef FREECIV_JSON_CONNECTION
23978 /* Next array element. */
23979 field_addr.sub_location->number = i;
23980#endif /* FREECIV_JSON_CONNECTION */
23981 DIO_PUT(uint8, &dout, &field_addr, real_packet->nation_citizens[i]);
23982 }
23983
23984#ifdef FREECIV_JSON_CONNECTION
23985 /* Exit array. */
23986 free(field_addr.sub_location);
23987 field_addr.sub_location = NULL;
23988#endif /* FREECIV_JSON_CONNECTION */
23989 }
23990
23991#endif
23992 SEND_PACKET_END(PACKET_CITY_NATIONALITIES);
23993}
23994
23995#ifdef FREECIV_DELTA_PROTOCOL
23996static genhash_val_t hash_packet_city_nationalities_101(const void *vkey)
23997{
23998 const struct packet_city_nationalities *key = (const struct packet_city_nationalities *) vkey;
23999
24000 return key->id16;
24001}
24002
24003static bool cmp_packet_city_nationalities_101(const void *vkey1, const void *vkey2)
24004{
24005 const struct packet_city_nationalities *key1 = (const struct packet_city_nationalities *) vkey1;
24006 const struct packet_city_nationalities *key2 = (const struct packet_city_nationalities *) vkey2;
24007
24008 return key1->id16 == key2->id16;
24009}
24010 BV_DEFINE(packet_city_nationalities_101_fields, 3);
24011#endif /* FREECIV_DELTA_PROTOCOL */
24012
24013 static struct packet_city_nationalities *receive_packet_city_nationalities_101(struct connection *pc)
24014{
24015#ifdef FREECIV_DELTA_PROTOCOL
24016 packet_city_nationalities_101_fields fields;
24017 struct packet_city_nationalities *old;
24018 struct genhash **hash = pc->phs.received + PACKET_CITY_NATIONALITIES;
24019#endif /* FREECIV_DELTA_PROTOCOL */
24020 RECEIVE_PACKET_START(packet_city_nationalities, real_packet);
24021#ifdef FREECIV_JSON_CONNECTION
24022 struct plocation field_addr;
24023 {
24024 struct plocation *field_addr_tmp = plocation_field_new(NULL);
24025 field_addr = *field_addr_tmp;
24026 FC_FREE(field_addr_tmp);
24027 }
24028#endif /* FREECIV_JSON_CONNECTION */
24029
24030#ifdef FREECIV_DELTA_PROTOCOL
24031#ifdef FREECIV_JSON_CONNECTION
24032 field_addr.name = "fields";
24033#endif /* FREECIV_JSON_CONNECTION */
24034 DIO_BV_GET(&din, &field_addr, fields);
24035 #ifdef FREECIV_JSON_CONNECTION
24036 field_addr.name = "id16";
24037 #endif /* FREECIV_JSON_CONNECTION */
24038 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
24039 RECEIVE_PACKET_FIELD_ERROR(id16);
24040 }
24041
24042#else /* FREECIV_DELTA_PROTOCOL */
24043 #ifdef FREECIV_JSON_CONNECTION
24044 field_addr.name = "id16";
24045 #endif /* FREECIV_JSON_CONNECTION */
24046 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
24047 RECEIVE_PACKET_FIELD_ERROR(id16);
24048 }
24049 #ifdef FREECIV_JSON_CONNECTION
24050 field_addr.name = "nationalities_count";
24051 #endif /* FREECIV_JSON_CONNECTION */
24052 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nationalities_count)) {
24053 RECEIVE_PACKET_FIELD_ERROR(nationalities_count);
24054 }
24055 #ifdef FREECIV_JSON_CONNECTION
24056 field_addr.name = "nation_id";
24057 #endif /* FREECIV_JSON_CONNECTION */
24058
24059 {
24060 int i;
24061
24062 #ifdef FREECIV_JSON_CONNECTION
24063 /* Enter array. */
24064 field_addr.sub_location = plocation_elem_new(0);
24065 #endif /* FREECIV_JSON_CONNECTION */
24066
24067 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
24068 RECEIVE_PACKET_FIELD_ERROR(nation_id, ": truncation array");
24069 }
24070 for (i = 0; i < real_packet->nationalities_count; i++) {
24071 #ifdef FREECIV_JSON_CONNECTION
24072 field_addr.sub_location->number = i;
24073 #endif /* FREECIV_JSON_CONNECTION */
24074 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nation_id[i])) {
24075 RECEIVE_PACKET_FIELD_ERROR(nation_id);
24076 }
24077 }
24078
24079 #ifdef FREECIV_JSON_CONNECTION
24080 /* Exit array. */
24081 free(field_addr.sub_location);
24082 field_addr.sub_location = NULL;
24083 #endif /* FREECIV_JSON_CONNECTION */
24084 }
24085 #ifdef FREECIV_JSON_CONNECTION
24086 field_addr.name = "nation_citizens";
24087 #endif /* FREECIV_JSON_CONNECTION */
24088
24089 {
24090 int i;
24091
24092 #ifdef FREECIV_JSON_CONNECTION
24093 /* Enter array. */
24094 field_addr.sub_location = plocation_elem_new(0);
24095 #endif /* FREECIV_JSON_CONNECTION */
24096
24097 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
24098 RECEIVE_PACKET_FIELD_ERROR(nation_citizens, ": truncation array");
24099 }
24100 for (i = 0; i < real_packet->nationalities_count; i++) {
24101 #ifdef FREECIV_JSON_CONNECTION
24102 field_addr.sub_location->number = i;
24103 #endif /* FREECIV_JSON_CONNECTION */
24104 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nation_citizens[i])) {
24105 RECEIVE_PACKET_FIELD_ERROR(nation_citizens);
24106 }
24107 }
24108
24109 #ifdef FREECIV_JSON_CONNECTION
24110 /* Exit array. */
24111 free(field_addr.sub_location);
24112 field_addr.sub_location = NULL;
24113 #endif /* FREECIV_JSON_CONNECTION */
24114 }
24115
24116#endif
24117 log_packet_detailed("packet_city_nationalities_101: got info about (%d)",
24118 real_packet->id16);
24119
24120#ifdef FREECIV_DELTA_PROTOCOL
24121 if (NULL == *hash) {
24122 *hash = genhash_new_full(hash_packet_city_nationalities_101, cmp_packet_city_nationalities_101,
24123 NULL, NULL, NULL, free);
24124 }
24125
24126 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
24127 *real_packet = *old;
24128 } else {
24129 int id16 = real_packet->id16;
24130
24131 log_packet_detailed(" no old info");
24132 memset(real_packet, 0, sizeof(*real_packet));
24133
24134 real_packet->id16 = id16;
24135 }
24136
24137 if (BV_ISSET(fields, 0)) {
24138 log_packet_detailed(" got field 'nationalities_count'");
24139 #ifdef FREECIV_JSON_CONNECTION
24140 field_addr.name = "nationalities_count";
24141 #endif /* FREECIV_JSON_CONNECTION */
24142 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nationalities_count)) {
24143 RECEIVE_PACKET_FIELD_ERROR(nationalities_count);
24144 }
24145 }
24146 if (BV_ISSET(fields, 1)) {
24147 log_packet_detailed(" got field 'nation_id'");
24148 #ifdef FREECIV_JSON_CONNECTION
24149 field_addr.name = "nation_id";
24150 #endif /* FREECIV_JSON_CONNECTION */
24151
24152 {
24153 int i;
24154
24155 #ifdef FREECIV_JSON_CONNECTION
24156 /* Enter array. */
24157 field_addr.sub_location = plocation_elem_new(0);
24158 #endif /* FREECIV_JSON_CONNECTION */
24159
24160 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
24161 RECEIVE_PACKET_FIELD_ERROR(nation_id, ": truncation array");
24162 }
24163 for (i = 0; i < real_packet->nationalities_count; i++) {
24164 #ifdef FREECIV_JSON_CONNECTION
24165 field_addr.sub_location->number = i;
24166 #endif /* FREECIV_JSON_CONNECTION */
24167 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nation_id[i])) {
24168 RECEIVE_PACKET_FIELD_ERROR(nation_id);
24169 }
24170 }
24171
24172 #ifdef FREECIV_JSON_CONNECTION
24173 /* Exit array. */
24174 free(field_addr.sub_location);
24175 field_addr.sub_location = NULL;
24176 #endif /* FREECIV_JSON_CONNECTION */
24177 }
24178 }
24179 if (BV_ISSET(fields, 2)) {
24180 log_packet_detailed(" got field 'nation_citizens'");
24181 #ifdef FREECIV_JSON_CONNECTION
24182 field_addr.name = "nation_citizens";
24183 #endif /* FREECIV_JSON_CONNECTION */
24184
24185 {
24186 int i;
24187
24188 #ifdef FREECIV_JSON_CONNECTION
24189 /* Enter array. */
24190 field_addr.sub_location = plocation_elem_new(0);
24191 #endif /* FREECIV_JSON_CONNECTION */
24192
24193 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
24194 RECEIVE_PACKET_FIELD_ERROR(nation_citizens, ": truncation array");
24195 }
24196 for (i = 0; i < real_packet->nationalities_count; i++) {
24197 #ifdef FREECIV_JSON_CONNECTION
24198 field_addr.sub_location->number = i;
24199 #endif /* FREECIV_JSON_CONNECTION */
24200 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nation_citizens[i])) {
24201 RECEIVE_PACKET_FIELD_ERROR(nation_citizens);
24202 }
24203 }
24204
24205 #ifdef FREECIV_JSON_CONNECTION
24206 /* Exit array. */
24207 free(field_addr.sub_location);
24208 field_addr.sub_location = NULL;
24209 #endif /* FREECIV_JSON_CONNECTION */
24210 }
24211 }
24212
24213 if (NULL == old) {
24214 old = fc_malloc(sizeof(*old));
24215 *old = *real_packet;
24216 genhash_insert(*hash, old, old);
24217 } else {
24218 *old = *real_packet;
24219 }
24220
24221#endif /* FREECIV_DELTA_PROTOCOL */
24222 RECEIVE_PACKET_END(real_packet);
24223}
24224
24225 static int send_packet_city_nationalities_101(struct connection *pc, const struct packet_city_nationalities *packet, bool force_to_send)
24226{
24227 const struct packet_city_nationalities *real_packet = packet;
24228#ifdef FREECIV_DELTA_PROTOCOL
24229 packet_city_nationalities_101_fields fields;
24230 struct packet_city_nationalities *old;
24231 bool differ;
24232 struct genhash **hash = pc->phs.sent + PACKET_CITY_NATIONALITIES;
24233 int different = force_to_send;
24234#endif /* FREECIV_DELTA_PROTOCOL */
24235 SEND_PACKET_START(PACKET_CITY_NATIONALITIES);
24236#ifdef FREECIV_JSON_CONNECTION
24237 struct plocation field_addr;
24238 {
24239 struct plocation *field_addr_tmp = plocation_field_new(NULL);
24240 field_addr = *field_addr_tmp;
24241 FC_FREE(field_addr_tmp);
24242 }
24243#endif /* FREECIV_JSON_CONNECTION */
24244
24245 log_packet_detailed("packet_city_nationalities_101: sending info about (%d)",
24246 real_packet->id16);
24247
24248#ifdef FREECIV_DELTA_PROTOCOL
24249 if (NULL == *hash) {
24250 *hash = genhash_new_full(hash_packet_city_nationalities_101, cmp_packet_city_nationalities_101,
24251 NULL, NULL, NULL, free);
24252 }
24253 BV_CLR_ALL(fields);
24254
24255 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
24256 old = fc_malloc(sizeof(*old));
24257 *old = *real_packet;
24258 genhash_insert(*hash, old, old);
24259 memset(old, 0, sizeof(*old));
24260 different = 1; /* Force to send. */
24261 }
24262 differ = (old->nationalities_count != real_packet->nationalities_count);
24263 if (differ) {
24264 different++;
24265 BV_SET(fields, 0);
24266 }
24267
24268
24269 {
24270 differ = (old->nationalities_count != real_packet->nationalities_count);
24271 if (!differ) {
24272 int i;
24273
24274 for (i = 0; i < real_packet->nationalities_count; i++) {
24275 if (old->nation_id[i] != real_packet->nation_id[i]) {
24276 differ = TRUE;
24277 break;
24278 }
24279 }
24280 }
24281 }
24282 if (differ) {
24283 different++;
24284 BV_SET(fields, 1);
24285 }
24286
24287
24288 {
24289 differ = (old->nationalities_count != real_packet->nationalities_count);
24290 if (!differ) {
24291 int i;
24292
24293 for (i = 0; i < real_packet->nationalities_count; i++) {
24294 if (old->nation_citizens[i] != real_packet->nation_citizens[i]) {
24295 differ = TRUE;
24296 break;
24297 }
24298 }
24299 }
24300 }
24301 if (differ) {
24302 different++;
24303 BV_SET(fields, 2);
24304 }
24305
24306
24307 if (different == 0) {
24308 log_packet_detailed(" no change -> discard");
24309 return 0;
24310 }
24311
24312#ifdef FREECIV_JSON_CONNECTION
24313 field_addr.name = "fields";
24314#endif /* FREECIV_JSON_CONNECTION */
24315 DIO_BV_PUT(&dout, &field_addr, fields);
24316#ifdef FREECIV_JSON_CONNECTION
24317 field_addr.name = "id16";
24318#endif /* FREECIV_JSON_CONNECTION */
24319 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
24320
24321 if (BV_ISSET(fields, 0)) {
24322 log_packet_detailed(" field 'nationalities_count' has changed");
24323 #ifdef FREECIV_JSON_CONNECTION
24324 field_addr.name = "nationalities_count";
24325#endif /* FREECIV_JSON_CONNECTION */
24326 DIO_PUT(uint8, &dout, &field_addr, real_packet->nationalities_count);
24327 }
24328 if (BV_ISSET(fields, 1)) {
24329 log_packet_detailed(" field 'nation_id' has changed");
24330 #ifdef FREECIV_JSON_CONNECTION
24331 field_addr.name = "nation_id";
24332#endif /* FREECIV_JSON_CONNECTION */
24333
24334 {
24335 int i;
24336
24337#ifdef FREECIV_JSON_CONNECTION
24338 /* Create the array. */
24339 DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
24340
24341 /* Enter the array. */
24342 field_addr.sub_location = plocation_elem_new(0);
24343#endif /* FREECIV_JSON_CONNECTION */
24344
24345 for (i = 0; i < real_packet->nationalities_count; i++) {
24346#ifdef FREECIV_JSON_CONNECTION
24347 /* Next array element. */
24348 field_addr.sub_location->number = i;
24349#endif /* FREECIV_JSON_CONNECTION */
24350 DIO_PUT(uint16, &dout, &field_addr, real_packet->nation_id[i]);
24351 }
24352
24353#ifdef FREECIV_JSON_CONNECTION
24354 /* Exit array. */
24355 free(field_addr.sub_location);
24356 field_addr.sub_location = NULL;
24357#endif /* FREECIV_JSON_CONNECTION */
24358 }
24359 }
24360 if (BV_ISSET(fields, 2)) {
24361 log_packet_detailed(" field 'nation_citizens' has changed");
24362 #ifdef FREECIV_JSON_CONNECTION
24363 field_addr.name = "nation_citizens";
24364#endif /* FREECIV_JSON_CONNECTION */
24365
24366 {
24367 int i;
24368
24369#ifdef FREECIV_JSON_CONNECTION
24370 /* Create the array. */
24371 DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
24372
24373 /* Enter the array. */
24374 field_addr.sub_location = plocation_elem_new(0);
24375#endif /* FREECIV_JSON_CONNECTION */
24376
24377 for (i = 0; i < real_packet->nationalities_count; i++) {
24378#ifdef FREECIV_JSON_CONNECTION
24379 /* Next array element. */
24380 field_addr.sub_location->number = i;
24381#endif /* FREECIV_JSON_CONNECTION */
24382 DIO_PUT(uint8, &dout, &field_addr, real_packet->nation_citizens[i]);
24383 }
24384
24385#ifdef FREECIV_JSON_CONNECTION
24386 /* Exit array. */
24387 free(field_addr.sub_location);
24388 field_addr.sub_location = NULL;
24389#endif /* FREECIV_JSON_CONNECTION */
24390 }
24391 }
24392
24393 *old = *real_packet;
24394#endif /* FREECIV_DELTA_PROTOCOL */
24395#ifndef FREECIV_DELTA_PROTOCOL
24396#ifdef FREECIV_JSON_CONNECTION
24397 field_addr.name = "id16";
24398#endif /* FREECIV_JSON_CONNECTION */
24399 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
24400#ifdef FREECIV_JSON_CONNECTION
24401 field_addr.name = "nationalities_count";
24402#endif /* FREECIV_JSON_CONNECTION */
24403 DIO_PUT(uint8, &dout, &field_addr, real_packet->nationalities_count);
24404#ifdef FREECIV_JSON_CONNECTION
24405 field_addr.name = "nation_id";
24406#endif /* FREECIV_JSON_CONNECTION */
24407
24408 {
24409 int i;
24410
24411#ifdef FREECIV_JSON_CONNECTION
24412 /* Create the array. */
24413 DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
24414
24415 /* Enter the array. */
24416 field_addr.sub_location = plocation_elem_new(0);
24417#endif /* FREECIV_JSON_CONNECTION */
24418
24419 for (i = 0; i < real_packet->nationalities_count; i++) {
24420#ifdef FREECIV_JSON_CONNECTION
24421 /* Next array element. */
24422 field_addr.sub_location->number = i;
24423#endif /* FREECIV_JSON_CONNECTION */
24424 DIO_PUT(uint16, &dout, &field_addr, real_packet->nation_id[i]);
24425 }
24426
24427#ifdef FREECIV_JSON_CONNECTION
24428 /* Exit array. */
24429 free(field_addr.sub_location);
24430 field_addr.sub_location = NULL;
24431#endif /* FREECIV_JSON_CONNECTION */
24432 }
24433#ifdef FREECIV_JSON_CONNECTION
24434 field_addr.name = "nation_citizens";
24435#endif /* FREECIV_JSON_CONNECTION */
24436
24437 {
24438 int i;
24439
24440#ifdef FREECIV_JSON_CONNECTION
24441 /* Create the array. */
24442 DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
24443
24444 /* Enter the array. */
24445 field_addr.sub_location = plocation_elem_new(0);
24446#endif /* FREECIV_JSON_CONNECTION */
24447
24448 for (i = 0; i < real_packet->nationalities_count; i++) {
24449#ifdef FREECIV_JSON_CONNECTION
24450 /* Next array element. */
24451 field_addr.sub_location->number = i;
24452#endif /* FREECIV_JSON_CONNECTION */
24453 DIO_PUT(uint8, &dout, &field_addr, real_packet->nation_citizens[i]);
24454 }
24455
24456#ifdef FREECIV_JSON_CONNECTION
24457 /* Exit array. */
24458 free(field_addr.sub_location);
24459 field_addr.sub_location = NULL;
24460#endif /* FREECIV_JSON_CONNECTION */
24461 }
24462
24463#endif
24464 SEND_PACKET_END(PACKET_CITY_NATIONALITIES);
24465}
24466
24467 int send_packet_city_nationalities(struct connection *pc, const struct packet_city_nationalities *packet, bool force_to_send)
24468{
24469 if (!pc->used) {
24470 log_error("WARNING: trying to send data to the closed connection %s",
24471 conn_description(pc));
24472 return -1;
24473 }
24474 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_NATIONALITIES].force_to_send != NULL, -1,
24475 "Handler for PACKET_CITY_NATIONALITIES not installed");
24476 return pc->phs.handlers->send[PACKET_CITY_NATIONALITIES].force_to_send(pc, packet, force_to_send);
24477}
24478
24479 void lsend_packet_city_nationalities(struct conn_list *dest, const struct packet_city_nationalities *packet, bool force_to_send)
24480{
24481 conn_list_iterate(dest, pconn) {
24482 send_packet_city_nationalities(pconn, packet, force_to_send);
24483 } conn_list_iterate_end;
24484}
24485
24486#ifdef FREECIV_DELTA_PROTOCOL
24487#define hash_packet_city_short_info_100 hash_const
24488
24489#define cmp_packet_city_short_info_100 cmp_const
24490
24491 BV_DEFINE(packet_city_short_info_100_fields, 13);
24492#endif /* FREECIV_DELTA_PROTOCOL */
24493
24494 static struct packet_city_short_info *receive_packet_city_short_info_100(struct connection *pc)
24495{
24496#ifdef FREECIV_DELTA_PROTOCOL
24497 packet_city_short_info_100_fields fields;
24498 struct packet_city_short_info *old;
24499 struct genhash **hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
24500#endif /* FREECIV_DELTA_PROTOCOL */
24501 RECEIVE_PACKET_START(packet_city_short_info, real_packet);
24502#ifdef FREECIV_JSON_CONNECTION
24503 struct plocation field_addr;
24504 {
24505 struct plocation *field_addr_tmp = plocation_field_new(NULL);
24506 field_addr = *field_addr_tmp;
24507 FC_FREE(field_addr_tmp);
24508 }
24509#endif /* FREECIV_JSON_CONNECTION */
24510
24511#ifdef FREECIV_DELTA_PROTOCOL
24512#ifdef FREECIV_JSON_CONNECTION
24513 field_addr.name = "fields";
24514#endif /* FREECIV_JSON_CONNECTION */
24515 DIO_BV_GET(&din, &field_addr, fields);
24516
24517#else /* FREECIV_DELTA_PROTOCOL */
24518 #ifdef FREECIV_JSON_CONNECTION
24519 field_addr.name = "id32";
24520 #endif /* FREECIV_JSON_CONNECTION */
24521 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
24522 RECEIVE_PACKET_FIELD_ERROR(id32);
24523 }
24524 #ifdef FREECIV_JSON_CONNECTION
24525 field_addr.name = "tile";
24526 #endif /* FREECIV_JSON_CONNECTION */
24527 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
24528 RECEIVE_PACKET_FIELD_ERROR(tile);
24529 }
24530 #ifdef FREECIV_JSON_CONNECTION
24531 field_addr.name = "owner";
24532 #endif /* FREECIV_JSON_CONNECTION */
24533 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
24534 RECEIVE_PACKET_FIELD_ERROR(owner);
24535 }
24536 #ifdef FREECIV_JSON_CONNECTION
24537 field_addr.name = "size";
24538 #endif /* FREECIV_JSON_CONNECTION */
24539 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
24540 RECEIVE_PACKET_FIELD_ERROR(size);
24541 }
24542 #ifdef FREECIV_JSON_CONNECTION
24543 field_addr.name = "style";
24544 #endif /* FREECIV_JSON_CONNECTION */
24545 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
24546 RECEIVE_PACKET_FIELD_ERROR(style);
24547 }
24548 #ifdef FREECIV_JSON_CONNECTION
24549 field_addr.name = "capital";
24550 #endif /* FREECIV_JSON_CONNECTION */
24551 {
24552 int readin;
24553
24554 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
24555 RECEIVE_PACKET_FIELD_ERROR(capital);
24556 }
24557 real_packet->capital = readin;
24558 }
24559 #ifdef FREECIV_JSON_CONNECTION
24560 field_addr.name = "occupied";
24561 #endif /* FREECIV_JSON_CONNECTION */
24562 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->occupied)) {
24563 RECEIVE_PACKET_FIELD_ERROR(occupied);
24564 }
24565 #ifdef FREECIV_JSON_CONNECTION
24566 field_addr.name = "walls";
24567 #endif /* FREECIV_JSON_CONNECTION */
24568 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
24569 RECEIVE_PACKET_FIELD_ERROR(walls);
24570 }
24571 #ifdef FREECIV_JSON_CONNECTION
24572 field_addr.name = "happy";
24573 #endif /* FREECIV_JSON_CONNECTION */
24574 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->happy)) {
24575 RECEIVE_PACKET_FIELD_ERROR(happy);
24576 }
24577 #ifdef FREECIV_JSON_CONNECTION
24578 field_addr.name = "unhappy";
24579 #endif /* FREECIV_JSON_CONNECTION */
24580 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unhappy)) {
24581 RECEIVE_PACKET_FIELD_ERROR(unhappy);
24582 }
24583 #ifdef FREECIV_JSON_CONNECTION
24584 field_addr.name = "city_image";
24585 #endif /* FREECIV_JSON_CONNECTION */
24586 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
24587 RECEIVE_PACKET_FIELD_ERROR(city_image);
24588 }
24589 #ifdef FREECIV_JSON_CONNECTION
24590 field_addr.name = "improvements";
24591 #endif /* FREECIV_JSON_CONNECTION */
24592 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
24593 RECEIVE_PACKET_FIELD_ERROR(improvements);
24594 }
24595 #ifdef FREECIV_JSON_CONNECTION
24596 field_addr.name = "name";
24597 #endif /* FREECIV_JSON_CONNECTION */
24598 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
24599 RECEIVE_PACKET_FIELD_ERROR(name);
24600 }
24601
24602#endif
24603 log_packet_detailed("packet_city_short_info_100: got info about ()");
24604
24605#ifdef FREECIV_DELTA_PROTOCOL
24606 if (NULL == *hash) {
24607 *hash = genhash_new_full(hash_packet_city_short_info_100, cmp_packet_city_short_info_100,
24608 NULL, NULL, NULL, free);
24609 }
24610
24611 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
24612 *real_packet = *old;
24613 } else {
24614 log_packet_detailed(" no old info");
24615 memset(real_packet, 0, sizeof(*real_packet));
24616 }
24617
24618 if (BV_ISSET(fields, 0)) {
24619 log_packet_detailed(" got field 'id32'");
24620 #ifdef FREECIV_JSON_CONNECTION
24621 field_addr.name = "id32";
24622 #endif /* FREECIV_JSON_CONNECTION */
24623 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
24624 RECEIVE_PACKET_FIELD_ERROR(id32);
24625 }
24626 }
24627 if (BV_ISSET(fields, 1)) {
24628 log_packet_detailed(" got field 'tile'");
24629 #ifdef FREECIV_JSON_CONNECTION
24630 field_addr.name = "tile";
24631 #endif /* FREECIV_JSON_CONNECTION */
24632 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
24633 RECEIVE_PACKET_FIELD_ERROR(tile);
24634 }
24635 }
24636 if (BV_ISSET(fields, 2)) {
24637 log_packet_detailed(" got field 'owner'");
24638 #ifdef FREECIV_JSON_CONNECTION
24639 field_addr.name = "owner";
24640 #endif /* FREECIV_JSON_CONNECTION */
24641 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
24642 RECEIVE_PACKET_FIELD_ERROR(owner);
24643 }
24644 }
24645 if (BV_ISSET(fields, 3)) {
24646 log_packet_detailed(" got field 'size'");
24647 #ifdef FREECIV_JSON_CONNECTION
24648 field_addr.name = "size";
24649 #endif /* FREECIV_JSON_CONNECTION */
24650 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
24651 RECEIVE_PACKET_FIELD_ERROR(size);
24652 }
24653 }
24654 if (BV_ISSET(fields, 4)) {
24655 log_packet_detailed(" got field 'style'");
24656 #ifdef FREECIV_JSON_CONNECTION
24657 field_addr.name = "style";
24658 #endif /* FREECIV_JSON_CONNECTION */
24659 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
24660 RECEIVE_PACKET_FIELD_ERROR(style);
24661 }
24662 }
24663 if (BV_ISSET(fields, 5)) {
24664 log_packet_detailed(" got field 'capital'");
24665 #ifdef FREECIV_JSON_CONNECTION
24666 field_addr.name = "capital";
24667 #endif /* FREECIV_JSON_CONNECTION */
24668 {
24669 int readin;
24670
24671 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
24672 RECEIVE_PACKET_FIELD_ERROR(capital);
24673 }
24674 real_packet->capital = readin;
24675 }
24676 }
24677 real_packet->occupied = BV_ISSET(fields, 6);
24678 if (BV_ISSET(fields, 7)) {
24679 log_packet_detailed(" got field 'walls'");
24680 #ifdef FREECIV_JSON_CONNECTION
24681 field_addr.name = "walls";
24682 #endif /* FREECIV_JSON_CONNECTION */
24683 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
24684 RECEIVE_PACKET_FIELD_ERROR(walls);
24685 }
24686 }
24687 real_packet->happy = BV_ISSET(fields, 8);
24688 real_packet->unhappy = BV_ISSET(fields, 9);
24689 if (BV_ISSET(fields, 10)) {
24690 log_packet_detailed(" got field 'city_image'");
24691 #ifdef FREECIV_JSON_CONNECTION
24692 field_addr.name = "city_image";
24693 #endif /* FREECIV_JSON_CONNECTION */
24694 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
24695 RECEIVE_PACKET_FIELD_ERROR(city_image);
24696 }
24697 }
24698 if (BV_ISSET(fields, 11)) {
24699 log_packet_detailed(" got field 'improvements'");
24700 #ifdef FREECIV_JSON_CONNECTION
24701 field_addr.name = "improvements";
24702 #endif /* FREECIV_JSON_CONNECTION */
24703 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
24704 RECEIVE_PACKET_FIELD_ERROR(improvements);
24705 }
24706 }
24707 if (BV_ISSET(fields, 12)) {
24708 log_packet_detailed(" got field 'name'");
24709 #ifdef FREECIV_JSON_CONNECTION
24710 field_addr.name = "name";
24711 #endif /* FREECIV_JSON_CONNECTION */
24712 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
24713 RECEIVE_PACKET_FIELD_ERROR(name);
24714 }
24715 }
24716
24717 if (NULL == old) {
24718 old = fc_malloc(sizeof(*old));
24719 *old = *real_packet;
24720 genhash_insert(*hash, old, old);
24721 } else {
24722 *old = *real_packet;
24723 }
24724
24725 hash = pc->phs.received + PACKET_CITY_INFO;
24726 if (NULL != *hash) {
24727 genhash_remove(*hash, real_packet);
24728 }
24729
24730 hash = pc->phs.received + PACKET_WEB_CITY_INFO_ADDITION;
24731 if (NULL != *hash) {
24732 genhash_remove(*hash, real_packet);
24733 }
24734
24735 hash = pc->phs.received + PACKET_CITY_NATIONALITIES;
24736 if (NULL != *hash) {
24737 genhash_remove(*hash, real_packet);
24738 }
24739
24740 hash = pc->phs.received + PACKET_CITY_RALLY_POINT;
24741 if (NULL != *hash) {
24742 genhash_remove(*hash, real_packet);
24743 }
24744
24745#endif /* FREECIV_DELTA_PROTOCOL */
24746 RECEIVE_PACKET_END(real_packet);
24747}
24748
24749 static int send_packet_city_short_info_100(struct connection *pc, const struct packet_city_short_info *packet)
24750{
24751 const struct packet_city_short_info *real_packet = packet;
24752#ifdef FREECIV_DELTA_PROTOCOL
24753 packet_city_short_info_100_fields fields;
24754 struct packet_city_short_info *old;
24755 bool differ;
24756 struct genhash **hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
24757 int different = 0;
24758#endif /* FREECIV_DELTA_PROTOCOL */
24759 SEND_PACKET_START(PACKET_CITY_SHORT_INFO);
24760#ifdef FREECIV_JSON_CONNECTION
24761 struct plocation field_addr;
24762 {
24763 struct plocation *field_addr_tmp = plocation_field_new(NULL);
24764 field_addr = *field_addr_tmp;
24765 FC_FREE(field_addr_tmp);
24766 }
24767#endif /* FREECIV_JSON_CONNECTION */
24768
24769 log_packet_detailed("packet_city_short_info_100: sending info about ()");
24770
24771#ifdef FREECIV_DELTA_PROTOCOL
24772 if (NULL == *hash) {
24773 *hash = genhash_new_full(hash_packet_city_short_info_100, cmp_packet_city_short_info_100,
24774 NULL, NULL, NULL, free);
24775 }
24776 BV_CLR_ALL(fields);
24777
24778 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
24779 old = fc_malloc(sizeof(*old));
24780 *old = *real_packet;
24781 genhash_insert(*hash, old, old);
24782 memset(old, 0, sizeof(*old));
24783 different = 1; /* Force to send. */
24784 }
24785 differ = (old->id32 != real_packet->id32);
24786 if (differ) {
24787 different++;
24788 BV_SET(fields, 0);
24789 }
24790
24791 differ = (old->tile != real_packet->tile);
24792 if (differ) {
24793 different++;
24794 BV_SET(fields, 1);
24795 }
24796
24797 differ = (old->owner != real_packet->owner);
24798 if (differ) {
24799 different++;
24800 BV_SET(fields, 2);
24801 }
24802
24803 differ = (old->size != real_packet->size);
24804 if (differ) {
24805 different++;
24806 BV_SET(fields, 3);
24807 }
24808
24809 differ = (old->style != real_packet->style);
24810 if (differ) {
24811 different++;
24812 BV_SET(fields, 4);
24813 }
24814
24815 differ = (old->capital != real_packet->capital);
24816 if (differ) {
24817 different++;
24818 BV_SET(fields, 5);
24819 }
24820
24821 differ = (old->occupied != real_packet->occupied);
24822 if (differ) {
24823 different++;
24824 }
24825 if (packet->occupied) {
24826 BV_SET(fields, 6);
24827 }
24828
24829 differ = (old->walls != real_packet->walls);
24830 if (differ) {
24831 different++;
24832 BV_SET(fields, 7);
24833 }
24834
24835 differ = (old->happy != real_packet->happy);
24836 if (differ) {
24837 different++;
24838 }
24839 if (packet->happy) {
24840 BV_SET(fields, 8);
24841 }
24842
24843 differ = (old->unhappy != real_packet->unhappy);
24844 if (differ) {
24845 different++;
24846 }
24847 if (packet->unhappy) {
24848 BV_SET(fields, 9);
24849 }
24850
24851 differ = (old->city_image != real_packet->city_image);
24852 if (differ) {
24853 different++;
24854 BV_SET(fields, 10);
24855 }
24856
24857 differ = !BV_ARE_EQUAL(old->improvements, real_packet->improvements);
24858 if (differ) {
24859 different++;
24860 BV_SET(fields, 11);
24861 }
24862
24863 differ = (strcmp(old->name, real_packet->name) != 0);
24864 if (differ) {
24865 different++;
24866 BV_SET(fields, 12);
24867 }
24868
24869
24870 if (different == 0) {
24871 log_packet_detailed(" no change -> discard");
24872 return 0;
24873 }
24874
24875#ifdef FREECIV_JSON_CONNECTION
24876 field_addr.name = "fields";
24877#endif /* FREECIV_JSON_CONNECTION */
24878 DIO_BV_PUT(&dout, &field_addr, fields);
24879
24880 if (BV_ISSET(fields, 0)) {
24881 log_packet_detailed(" field 'id32' has changed");
24882 #ifdef FREECIV_JSON_CONNECTION
24883 field_addr.name = "id32";
24884#endif /* FREECIV_JSON_CONNECTION */
24885 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
24886 }
24887 if (BV_ISSET(fields, 1)) {
24888 log_packet_detailed(" field 'tile' has changed");
24889 #ifdef FREECIV_JSON_CONNECTION
24890 field_addr.name = "tile";
24891#endif /* FREECIV_JSON_CONNECTION */
24892 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
24893 }
24894 if (BV_ISSET(fields, 2)) {
24895 log_packet_detailed(" field 'owner' has changed");
24896 #ifdef FREECIV_JSON_CONNECTION
24897 field_addr.name = "owner";
24898#endif /* FREECIV_JSON_CONNECTION */
24899 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
24900 }
24901 if (BV_ISSET(fields, 3)) {
24902 log_packet_detailed(" field 'size' has changed");
24903 #ifdef FREECIV_JSON_CONNECTION
24904 field_addr.name = "size";
24905#endif /* FREECIV_JSON_CONNECTION */
24906 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
24907 }
24908 if (BV_ISSET(fields, 4)) {
24909 log_packet_detailed(" field 'style' has changed");
24910 #ifdef FREECIV_JSON_CONNECTION
24911 field_addr.name = "style";
24912#endif /* FREECIV_JSON_CONNECTION */
24913 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
24914 }
24915 if (BV_ISSET(fields, 5)) {
24916 log_packet_detailed(" field 'capital' has changed");
24917 #ifdef FREECIV_JSON_CONNECTION
24918 field_addr.name = "capital";
24919#endif /* FREECIV_JSON_CONNECTION */
24920 DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
24921 }
24922 /* field 6 is folded into the header */
24923 if (BV_ISSET(fields, 7)) {
24924 log_packet_detailed(" field 'walls' has changed");
24925 #ifdef FREECIV_JSON_CONNECTION
24926 field_addr.name = "walls";
24927#endif /* FREECIV_JSON_CONNECTION */
24928 DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
24929 }
24930 /* field 8 is folded into the header */
24931 /* field 9 is folded into the header */
24932 if (BV_ISSET(fields, 10)) {
24933 log_packet_detailed(" field 'city_image' has changed");
24934 #ifdef FREECIV_JSON_CONNECTION
24935 field_addr.name = "city_image";
24936#endif /* FREECIV_JSON_CONNECTION */
24937 DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
24938 }
24939 if (BV_ISSET(fields, 11)) {
24940 log_packet_detailed(" field 'improvements' has changed");
24941 #ifdef FREECIV_JSON_CONNECTION
24942 field_addr.name = "improvements";
24943#endif /* FREECIV_JSON_CONNECTION */
24944 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
24945 }
24946 if (BV_ISSET(fields, 12)) {
24947 log_packet_detailed(" field 'name' has changed");
24948 #ifdef FREECIV_JSON_CONNECTION
24949 field_addr.name = "name";
24950#endif /* FREECIV_JSON_CONNECTION */
24951 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
24952 }
24953
24954 *old = *real_packet;
24955
24956 hash = pc->phs.sent + PACKET_CITY_INFO;
24957 if (NULL != *hash) {
24958 genhash_remove(*hash, real_packet);
24959 }
24960
24961 hash = pc->phs.sent + PACKET_WEB_CITY_INFO_ADDITION;
24962 if (NULL != *hash) {
24963 genhash_remove(*hash, real_packet);
24964 }
24965
24966 hash = pc->phs.sent + PACKET_CITY_NATIONALITIES;
24967 if (NULL != *hash) {
24968 genhash_remove(*hash, real_packet);
24969 }
24970
24971 hash = pc->phs.sent + PACKET_CITY_RALLY_POINT;
24972 if (NULL != *hash) {
24973 genhash_remove(*hash, real_packet);
24974 }
24975#endif /* FREECIV_DELTA_PROTOCOL */
24976#ifndef FREECIV_DELTA_PROTOCOL
24977#ifdef FREECIV_JSON_CONNECTION
24978 field_addr.name = "id32";
24979#endif /* FREECIV_JSON_CONNECTION */
24980 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
24981#ifdef FREECIV_JSON_CONNECTION
24982 field_addr.name = "tile";
24983#endif /* FREECIV_JSON_CONNECTION */
24984 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
24985#ifdef FREECIV_JSON_CONNECTION
24986 field_addr.name = "owner";
24987#endif /* FREECIV_JSON_CONNECTION */
24988 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
24989#ifdef FREECIV_JSON_CONNECTION
24990 field_addr.name = "size";
24991#endif /* FREECIV_JSON_CONNECTION */
24992 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
24993#ifdef FREECIV_JSON_CONNECTION
24994 field_addr.name = "style";
24995#endif /* FREECIV_JSON_CONNECTION */
24996 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
24997#ifdef FREECIV_JSON_CONNECTION
24998 field_addr.name = "capital";
24999#endif /* FREECIV_JSON_CONNECTION */
25000 DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
25001#ifdef FREECIV_JSON_CONNECTION
25002 field_addr.name = "occupied";
25003#endif /* FREECIV_JSON_CONNECTION */
25004 DIO_PUT(bool8, &dout, &field_addr, real_packet->occupied);
25005#ifdef FREECIV_JSON_CONNECTION
25006 field_addr.name = "walls";
25007#endif /* FREECIV_JSON_CONNECTION */
25008 DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
25009#ifdef FREECIV_JSON_CONNECTION
25010 field_addr.name = "happy";
25011#endif /* FREECIV_JSON_CONNECTION */
25012 DIO_PUT(bool8, &dout, &field_addr, real_packet->happy);
25013#ifdef FREECIV_JSON_CONNECTION
25014 field_addr.name = "unhappy";
25015#endif /* FREECIV_JSON_CONNECTION */
25016 DIO_PUT(bool8, &dout, &field_addr, real_packet->unhappy);
25017#ifdef FREECIV_JSON_CONNECTION
25018 field_addr.name = "city_image";
25019#endif /* FREECIV_JSON_CONNECTION */
25020 DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
25021#ifdef FREECIV_JSON_CONNECTION
25022 field_addr.name = "improvements";
25023#endif /* FREECIV_JSON_CONNECTION */
25024 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
25025#ifdef FREECIV_JSON_CONNECTION
25026 field_addr.name = "name";
25027#endif /* FREECIV_JSON_CONNECTION */
25028 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
25029
25030#endif
25031 SEND_PACKET_END(PACKET_CITY_SHORT_INFO);
25032}
25033
25034#ifdef FREECIV_DELTA_PROTOCOL
25035static genhash_val_t hash_packet_city_short_info_101(const void *vkey)
25036{
25037 const struct packet_city_short_info *key = (const struct packet_city_short_info *) vkey;
25038
25039 return key->id16;
25040}
25041
25042static bool cmp_packet_city_short_info_101(const void *vkey1, const void *vkey2)
25043{
25044 const struct packet_city_short_info *key1 = (const struct packet_city_short_info *) vkey1;
25045 const struct packet_city_short_info *key2 = (const struct packet_city_short_info *) vkey2;
25046
25047 return key1->id16 == key2->id16;
25048}
25049 BV_DEFINE(packet_city_short_info_101_fields, 12);
25050#endif /* FREECIV_DELTA_PROTOCOL */
25051
25052 static struct packet_city_short_info *receive_packet_city_short_info_101(struct connection *pc)
25053{
25054#ifdef FREECIV_DELTA_PROTOCOL
25055 packet_city_short_info_101_fields fields;
25056 struct packet_city_short_info *old;
25057 struct genhash **hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
25058#endif /* FREECIV_DELTA_PROTOCOL */
25059 RECEIVE_PACKET_START(packet_city_short_info, real_packet);
25060#ifdef FREECIV_JSON_CONNECTION
25061 struct plocation field_addr;
25062 {
25063 struct plocation *field_addr_tmp = plocation_field_new(NULL);
25064 field_addr = *field_addr_tmp;
25065 FC_FREE(field_addr_tmp);
25066 }
25067#endif /* FREECIV_JSON_CONNECTION */
25068
25069#ifdef FREECIV_DELTA_PROTOCOL
25070#ifdef FREECIV_JSON_CONNECTION
25071 field_addr.name = "fields";
25072#endif /* FREECIV_JSON_CONNECTION */
25073 DIO_BV_GET(&din, &field_addr, fields);
25074 #ifdef FREECIV_JSON_CONNECTION
25075 field_addr.name = "id16";
25076 #endif /* FREECIV_JSON_CONNECTION */
25077 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
25078 RECEIVE_PACKET_FIELD_ERROR(id16);
25079 }
25080
25081#else /* FREECIV_DELTA_PROTOCOL */
25082 #ifdef FREECIV_JSON_CONNECTION
25083 field_addr.name = "id16";
25084 #endif /* FREECIV_JSON_CONNECTION */
25085 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
25086 RECEIVE_PACKET_FIELD_ERROR(id16);
25087 }
25088 #ifdef FREECIV_JSON_CONNECTION
25089 field_addr.name = "tile";
25090 #endif /* FREECIV_JSON_CONNECTION */
25091 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
25092 RECEIVE_PACKET_FIELD_ERROR(tile);
25093 }
25094 #ifdef FREECIV_JSON_CONNECTION
25095 field_addr.name = "owner";
25096 #endif /* FREECIV_JSON_CONNECTION */
25097 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
25098 RECEIVE_PACKET_FIELD_ERROR(owner);
25099 }
25100 #ifdef FREECIV_JSON_CONNECTION
25101 field_addr.name = "size";
25102 #endif /* FREECIV_JSON_CONNECTION */
25103 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
25104 RECEIVE_PACKET_FIELD_ERROR(size);
25105 }
25106 #ifdef FREECIV_JSON_CONNECTION
25107 field_addr.name = "style";
25108 #endif /* FREECIV_JSON_CONNECTION */
25109 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
25110 RECEIVE_PACKET_FIELD_ERROR(style);
25111 }
25112 #ifdef FREECIV_JSON_CONNECTION
25113 field_addr.name = "capital";
25114 #endif /* FREECIV_JSON_CONNECTION */
25115 {
25116 int readin;
25117
25118 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
25119 RECEIVE_PACKET_FIELD_ERROR(capital);
25120 }
25121 real_packet->capital = readin;
25122 }
25123 #ifdef FREECIV_JSON_CONNECTION
25124 field_addr.name = "occupied";
25125 #endif /* FREECIV_JSON_CONNECTION */
25126 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->occupied)) {
25127 RECEIVE_PACKET_FIELD_ERROR(occupied);
25128 }
25129 #ifdef FREECIV_JSON_CONNECTION
25130 field_addr.name = "walls";
25131 #endif /* FREECIV_JSON_CONNECTION */
25132 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
25133 RECEIVE_PACKET_FIELD_ERROR(walls);
25134 }
25135 #ifdef FREECIV_JSON_CONNECTION
25136 field_addr.name = "happy";
25137 #endif /* FREECIV_JSON_CONNECTION */
25138 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->happy)) {
25139 RECEIVE_PACKET_FIELD_ERROR(happy);
25140 }
25141 #ifdef FREECIV_JSON_CONNECTION
25142 field_addr.name = "unhappy";
25143 #endif /* FREECIV_JSON_CONNECTION */
25144 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unhappy)) {
25145 RECEIVE_PACKET_FIELD_ERROR(unhappy);
25146 }
25147 #ifdef FREECIV_JSON_CONNECTION
25148 field_addr.name = "city_image";
25149 #endif /* FREECIV_JSON_CONNECTION */
25150 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
25151 RECEIVE_PACKET_FIELD_ERROR(city_image);
25152 }
25153 #ifdef FREECIV_JSON_CONNECTION
25154 field_addr.name = "improvements";
25155 #endif /* FREECIV_JSON_CONNECTION */
25156 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
25157 RECEIVE_PACKET_FIELD_ERROR(improvements);
25158 }
25159 #ifdef FREECIV_JSON_CONNECTION
25160 field_addr.name = "name";
25161 #endif /* FREECIV_JSON_CONNECTION */
25162 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
25163 RECEIVE_PACKET_FIELD_ERROR(name);
25164 }
25165
25166#endif
25167 log_packet_detailed("packet_city_short_info_101: got info about (%d)",
25168 real_packet->id16);
25169
25170#ifdef FREECIV_DELTA_PROTOCOL
25171 if (NULL == *hash) {
25172 *hash = genhash_new_full(hash_packet_city_short_info_101, cmp_packet_city_short_info_101,
25173 NULL, NULL, NULL, free);
25174 }
25175
25176 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
25177 *real_packet = *old;
25178 } else {
25179 int id16 = real_packet->id16;
25180
25181 log_packet_detailed(" no old info");
25182 memset(real_packet, 0, sizeof(*real_packet));
25183
25184 real_packet->id16 = id16;
25185 }
25186
25187 if (BV_ISSET(fields, 0)) {
25188 log_packet_detailed(" got field 'tile'");
25189 #ifdef FREECIV_JSON_CONNECTION
25190 field_addr.name = "tile";
25191 #endif /* FREECIV_JSON_CONNECTION */
25192 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
25193 RECEIVE_PACKET_FIELD_ERROR(tile);
25194 }
25195 }
25196 if (BV_ISSET(fields, 1)) {
25197 log_packet_detailed(" got field 'owner'");
25198 #ifdef FREECIV_JSON_CONNECTION
25199 field_addr.name = "owner";
25200 #endif /* FREECIV_JSON_CONNECTION */
25201 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
25202 RECEIVE_PACKET_FIELD_ERROR(owner);
25203 }
25204 }
25205 if (BV_ISSET(fields, 2)) {
25206 log_packet_detailed(" got field 'size'");
25207 #ifdef FREECIV_JSON_CONNECTION
25208 field_addr.name = "size";
25209 #endif /* FREECIV_JSON_CONNECTION */
25210 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
25211 RECEIVE_PACKET_FIELD_ERROR(size);
25212 }
25213 }
25214 if (BV_ISSET(fields, 3)) {
25215 log_packet_detailed(" got field 'style'");
25216 #ifdef FREECIV_JSON_CONNECTION
25217 field_addr.name = "style";
25218 #endif /* FREECIV_JSON_CONNECTION */
25219 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
25220 RECEIVE_PACKET_FIELD_ERROR(style);
25221 }
25222 }
25223 if (BV_ISSET(fields, 4)) {
25224 log_packet_detailed(" got field 'capital'");
25225 #ifdef FREECIV_JSON_CONNECTION
25226 field_addr.name = "capital";
25227 #endif /* FREECIV_JSON_CONNECTION */
25228 {
25229 int readin;
25230
25231 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
25232 RECEIVE_PACKET_FIELD_ERROR(capital);
25233 }
25234 real_packet->capital = readin;
25235 }
25236 }
25237 real_packet->occupied = BV_ISSET(fields, 5);
25238 if (BV_ISSET(fields, 6)) {
25239 log_packet_detailed(" got field 'walls'");
25240 #ifdef FREECIV_JSON_CONNECTION
25241 field_addr.name = "walls";
25242 #endif /* FREECIV_JSON_CONNECTION */
25243 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
25244 RECEIVE_PACKET_FIELD_ERROR(walls);
25245 }
25246 }
25247 real_packet->happy = BV_ISSET(fields, 7);
25248 real_packet->unhappy = BV_ISSET(fields, 8);
25249 if (BV_ISSET(fields, 9)) {
25250 log_packet_detailed(" got field 'city_image'");
25251 #ifdef FREECIV_JSON_CONNECTION
25252 field_addr.name = "city_image";
25253 #endif /* FREECIV_JSON_CONNECTION */
25254 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
25255 RECEIVE_PACKET_FIELD_ERROR(city_image);
25256 }
25257 }
25258 if (BV_ISSET(fields, 10)) {
25259 log_packet_detailed(" got field 'improvements'");
25260 #ifdef FREECIV_JSON_CONNECTION
25261 field_addr.name = "improvements";
25262 #endif /* FREECIV_JSON_CONNECTION */
25263 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
25264 RECEIVE_PACKET_FIELD_ERROR(improvements);
25265 }
25266 }
25267 if (BV_ISSET(fields, 11)) {
25268 log_packet_detailed(" got field 'name'");
25269 #ifdef FREECIV_JSON_CONNECTION
25270 field_addr.name = "name";
25271 #endif /* FREECIV_JSON_CONNECTION */
25272 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
25273 RECEIVE_PACKET_FIELD_ERROR(name);
25274 }
25275 }
25276
25277 if (NULL == old) {
25278 old = fc_malloc(sizeof(*old));
25279 *old = *real_packet;
25280 genhash_insert(*hash, old, old);
25281 } else {
25282 *old = *real_packet;
25283 }
25284
25285 hash = pc->phs.received + PACKET_CITY_INFO;
25286 if (NULL != *hash) {
25287 genhash_remove(*hash, real_packet);
25288 }
25289
25290 hash = pc->phs.received + PACKET_WEB_CITY_INFO_ADDITION;
25291 if (NULL != *hash) {
25292 genhash_remove(*hash, real_packet);
25293 }
25294
25295 hash = pc->phs.received + PACKET_CITY_NATIONALITIES;
25296 if (NULL != *hash) {
25297 genhash_remove(*hash, real_packet);
25298 }
25299
25300 hash = pc->phs.received + PACKET_CITY_RALLY_POINT;
25301 if (NULL != *hash) {
25302 genhash_remove(*hash, real_packet);
25303 }
25304
25305#endif /* FREECIV_DELTA_PROTOCOL */
25306 RECEIVE_PACKET_END(real_packet);
25307}
25308
25309 static int send_packet_city_short_info_101(struct connection *pc, const struct packet_city_short_info *packet)
25310{
25311 const struct packet_city_short_info *real_packet = packet;
25312#ifdef FREECIV_DELTA_PROTOCOL
25313 packet_city_short_info_101_fields fields;
25314 struct packet_city_short_info *old;
25315 bool differ;
25316 struct genhash **hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
25317 int different = 0;
25318#endif /* FREECIV_DELTA_PROTOCOL */
25319 SEND_PACKET_START(PACKET_CITY_SHORT_INFO);
25320#ifdef FREECIV_JSON_CONNECTION
25321 struct plocation field_addr;
25322 {
25323 struct plocation *field_addr_tmp = plocation_field_new(NULL);
25324 field_addr = *field_addr_tmp;
25325 FC_FREE(field_addr_tmp);
25326 }
25327#endif /* FREECIV_JSON_CONNECTION */
25328
25329 log_packet_detailed("packet_city_short_info_101: sending info about (%d)",
25330 real_packet->id16);
25331
25332#ifdef FREECIV_DELTA_PROTOCOL
25333 if (NULL == *hash) {
25334 *hash = genhash_new_full(hash_packet_city_short_info_101, cmp_packet_city_short_info_101,
25335 NULL, NULL, NULL, free);
25336 }
25337 BV_CLR_ALL(fields);
25338
25339 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
25340 old = fc_malloc(sizeof(*old));
25341 *old = *real_packet;
25342 genhash_insert(*hash, old, old);
25343 memset(old, 0, sizeof(*old));
25344 different = 1; /* Force to send. */
25345 }
25346 differ = (old->tile != real_packet->tile);
25347 if (differ) {
25348 different++;
25349 BV_SET(fields, 0);
25350 }
25351
25352 differ = (old->owner != real_packet->owner);
25353 if (differ) {
25354 different++;
25355 BV_SET(fields, 1);
25356 }
25357
25358 differ = (old->size != real_packet->size);
25359 if (differ) {
25360 different++;
25361 BV_SET(fields, 2);
25362 }
25363
25364 differ = (old->style != real_packet->style);
25365 if (differ) {
25366 different++;
25367 BV_SET(fields, 3);
25368 }
25369
25370 differ = (old->capital != real_packet->capital);
25371 if (differ) {
25372 different++;
25373 BV_SET(fields, 4);
25374 }
25375
25376 differ = (old->occupied != real_packet->occupied);
25377 if (differ) {
25378 different++;
25379 }
25380 if (packet->occupied) {
25381 BV_SET(fields, 5);
25382 }
25383
25384 differ = (old->walls != real_packet->walls);
25385 if (differ) {
25386 different++;
25387 BV_SET(fields, 6);
25388 }
25389
25390 differ = (old->happy != real_packet->happy);
25391 if (differ) {
25392 different++;
25393 }
25394 if (packet->happy) {
25395 BV_SET(fields, 7);
25396 }
25397
25398 differ = (old->unhappy != real_packet->unhappy);
25399 if (differ) {
25400 different++;
25401 }
25402 if (packet->unhappy) {
25403 BV_SET(fields, 8);
25404 }
25405
25406 differ = (old->city_image != real_packet->city_image);
25407 if (differ) {
25408 different++;
25409 BV_SET(fields, 9);
25410 }
25411
25412 differ = !BV_ARE_EQUAL(old->improvements, real_packet->improvements);
25413 if (differ) {
25414 different++;
25415 BV_SET(fields, 10);
25416 }
25417
25418 differ = (strcmp(old->name, real_packet->name) != 0);
25419 if (differ) {
25420 different++;
25421 BV_SET(fields, 11);
25422 }
25423
25424
25425 if (different == 0) {
25426 log_packet_detailed(" no change -> discard");
25427 return 0;
25428 }
25429
25430#ifdef FREECIV_JSON_CONNECTION
25431 field_addr.name = "fields";
25432#endif /* FREECIV_JSON_CONNECTION */
25433 DIO_BV_PUT(&dout, &field_addr, fields);
25434#ifdef FREECIV_JSON_CONNECTION
25435 field_addr.name = "id16";
25436#endif /* FREECIV_JSON_CONNECTION */
25437 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
25438
25439 if (BV_ISSET(fields, 0)) {
25440 log_packet_detailed(" field 'tile' has changed");
25441 #ifdef FREECIV_JSON_CONNECTION
25442 field_addr.name = "tile";
25443#endif /* FREECIV_JSON_CONNECTION */
25444 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
25445 }
25446 if (BV_ISSET(fields, 1)) {
25447 log_packet_detailed(" field 'owner' has changed");
25448 #ifdef FREECIV_JSON_CONNECTION
25449 field_addr.name = "owner";
25450#endif /* FREECIV_JSON_CONNECTION */
25451 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
25452 }
25453 if (BV_ISSET(fields, 2)) {
25454 log_packet_detailed(" field 'size' has changed");
25455 #ifdef FREECIV_JSON_CONNECTION
25456 field_addr.name = "size";
25457#endif /* FREECIV_JSON_CONNECTION */
25458 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
25459 }
25460 if (BV_ISSET(fields, 3)) {
25461 log_packet_detailed(" field 'style' has changed");
25462 #ifdef FREECIV_JSON_CONNECTION
25463 field_addr.name = "style";
25464#endif /* FREECIV_JSON_CONNECTION */
25465 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
25466 }
25467 if (BV_ISSET(fields, 4)) {
25468 log_packet_detailed(" field 'capital' has changed");
25469 #ifdef FREECIV_JSON_CONNECTION
25470 field_addr.name = "capital";
25471#endif /* FREECIV_JSON_CONNECTION */
25472 DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
25473 }
25474 /* field 5 is folded into the header */
25475 if (BV_ISSET(fields, 6)) {
25476 log_packet_detailed(" field 'walls' has changed");
25477 #ifdef FREECIV_JSON_CONNECTION
25478 field_addr.name = "walls";
25479#endif /* FREECIV_JSON_CONNECTION */
25480 DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
25481 }
25482 /* field 7 is folded into the header */
25483 /* field 8 is folded into the header */
25484 if (BV_ISSET(fields, 9)) {
25485 log_packet_detailed(" field 'city_image' has changed");
25486 #ifdef FREECIV_JSON_CONNECTION
25487 field_addr.name = "city_image";
25488#endif /* FREECIV_JSON_CONNECTION */
25489 DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
25490 }
25491 if (BV_ISSET(fields, 10)) {
25492 log_packet_detailed(" field 'improvements' has changed");
25493 #ifdef FREECIV_JSON_CONNECTION
25494 field_addr.name = "improvements";
25495#endif /* FREECIV_JSON_CONNECTION */
25496 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
25497 }
25498 if (BV_ISSET(fields, 11)) {
25499 log_packet_detailed(" field 'name' has changed");
25500 #ifdef FREECIV_JSON_CONNECTION
25501 field_addr.name = "name";
25502#endif /* FREECIV_JSON_CONNECTION */
25503 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
25504 }
25505
25506 *old = *real_packet;
25507
25508 hash = pc->phs.sent + PACKET_CITY_INFO;
25509 if (NULL != *hash) {
25510 genhash_remove(*hash, real_packet);
25511 }
25512
25513 hash = pc->phs.sent + PACKET_WEB_CITY_INFO_ADDITION;
25514 if (NULL != *hash) {
25515 genhash_remove(*hash, real_packet);
25516 }
25517
25518 hash = pc->phs.sent + PACKET_CITY_NATIONALITIES;
25519 if (NULL != *hash) {
25520 genhash_remove(*hash, real_packet);
25521 }
25522
25523 hash = pc->phs.sent + PACKET_CITY_RALLY_POINT;
25524 if (NULL != *hash) {
25525 genhash_remove(*hash, real_packet);
25526 }
25527#endif /* FREECIV_DELTA_PROTOCOL */
25528#ifndef FREECIV_DELTA_PROTOCOL
25529#ifdef FREECIV_JSON_CONNECTION
25530 field_addr.name = "id16";
25531#endif /* FREECIV_JSON_CONNECTION */
25532 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
25533#ifdef FREECIV_JSON_CONNECTION
25534 field_addr.name = "tile";
25535#endif /* FREECIV_JSON_CONNECTION */
25536 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
25537#ifdef FREECIV_JSON_CONNECTION
25538 field_addr.name = "owner";
25539#endif /* FREECIV_JSON_CONNECTION */
25540 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
25541#ifdef FREECIV_JSON_CONNECTION
25542 field_addr.name = "size";
25543#endif /* FREECIV_JSON_CONNECTION */
25544 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
25545#ifdef FREECIV_JSON_CONNECTION
25546 field_addr.name = "style";
25547#endif /* FREECIV_JSON_CONNECTION */
25548 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
25549#ifdef FREECIV_JSON_CONNECTION
25550 field_addr.name = "capital";
25551#endif /* FREECIV_JSON_CONNECTION */
25552 DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
25553#ifdef FREECIV_JSON_CONNECTION
25554 field_addr.name = "occupied";
25555#endif /* FREECIV_JSON_CONNECTION */
25556 DIO_PUT(bool8, &dout, &field_addr, real_packet->occupied);
25557#ifdef FREECIV_JSON_CONNECTION
25558 field_addr.name = "walls";
25559#endif /* FREECIV_JSON_CONNECTION */
25560 DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
25561#ifdef FREECIV_JSON_CONNECTION
25562 field_addr.name = "happy";
25563#endif /* FREECIV_JSON_CONNECTION */
25564 DIO_PUT(bool8, &dout, &field_addr, real_packet->happy);
25565#ifdef FREECIV_JSON_CONNECTION
25566 field_addr.name = "unhappy";
25567#endif /* FREECIV_JSON_CONNECTION */
25568 DIO_PUT(bool8, &dout, &field_addr, real_packet->unhappy);
25569#ifdef FREECIV_JSON_CONNECTION
25570 field_addr.name = "city_image";
25571#endif /* FREECIV_JSON_CONNECTION */
25572 DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
25573#ifdef FREECIV_JSON_CONNECTION
25574 field_addr.name = "improvements";
25575#endif /* FREECIV_JSON_CONNECTION */
25576 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
25577#ifdef FREECIV_JSON_CONNECTION
25578 field_addr.name = "name";
25579#endif /* FREECIV_JSON_CONNECTION */
25580 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
25581
25582#endif
25583 SEND_PACKET_END(PACKET_CITY_SHORT_INFO);
25584}
25585
25586 int send_packet_city_short_info(struct connection *pc, const struct packet_city_short_info *packet)
25587{
25588 if (!pc->used) {
25589 log_error("WARNING: trying to send data to the closed connection %s",
25590 conn_description(pc));
25591 return -1;
25592 }
25593 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_SHORT_INFO].packet != NULL, -1,
25594 "Handler for PACKET_CITY_SHORT_INFO not installed");
25595 return pc->phs.handlers->send[PACKET_CITY_SHORT_INFO].packet(pc, packet);
25596}
25597
25598 void lsend_packet_city_short_info(struct conn_list *dest, const struct packet_city_short_info *packet)
25599{
25600 conn_list_iterate(dest, pconn) {
25601 send_packet_city_short_info(pconn, packet);
25602 } conn_list_iterate_end;
25603}
25604
25605#ifdef FREECIV_DELTA_PROTOCOL
25606#define hash_packet_trade_route_info_100 hash_const
25607
25608#define cmp_packet_trade_route_info_100 cmp_const
25609
25610 BV_DEFINE(packet_trade_route_info_100_fields, 6);
25611#endif /* FREECIV_DELTA_PROTOCOL */
25612
25613 static struct packet_trade_route_info *receive_packet_trade_route_info_100(struct connection *pc)
25614{
25615#ifdef FREECIV_DELTA_PROTOCOL
25616 packet_trade_route_info_100_fields fields;
25617 struct packet_trade_route_info *old;
25618 struct genhash **hash = pc->phs.received + PACKET_TRADE_ROUTE_INFO;
25619#endif /* FREECIV_DELTA_PROTOCOL */
25620 RECEIVE_PACKET_START(packet_trade_route_info, real_packet);
25621#ifdef FREECIV_JSON_CONNECTION
25622 struct plocation field_addr;
25623 {
25624 struct plocation *field_addr_tmp = plocation_field_new(NULL);
25625 field_addr = *field_addr_tmp;
25626 FC_FREE(field_addr_tmp);
25627 }
25628#endif /* FREECIV_JSON_CONNECTION */
25629
25630#ifdef FREECIV_DELTA_PROTOCOL
25631#ifdef FREECIV_JSON_CONNECTION
25632 field_addr.name = "fields";
25633#endif /* FREECIV_JSON_CONNECTION */
25634 DIO_BV_GET(&din, &field_addr, fields);
25635
25636#else /* FREECIV_DELTA_PROTOCOL */
25637 #ifdef FREECIV_JSON_CONNECTION
25638 field_addr.name = "city32";
25639 #endif /* FREECIV_JSON_CONNECTION */
25640 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city32)) {
25641 RECEIVE_PACKET_FIELD_ERROR(city32);
25642 }
25643 #ifdef FREECIV_JSON_CONNECTION
25644 field_addr.name = "index";
25645 #endif /* FREECIV_JSON_CONNECTION */
25646 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->index)) {
25647 RECEIVE_PACKET_FIELD_ERROR(index);
25648 }
25649 #ifdef FREECIV_JSON_CONNECTION
25650 field_addr.name = "partner32";
25651 #endif /* FREECIV_JSON_CONNECTION */
25652 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->partner32)) {
25653 RECEIVE_PACKET_FIELD_ERROR(partner32);
25654 }
25655 #ifdef FREECIV_JSON_CONNECTION
25656 field_addr.name = "value";
25657 #endif /* FREECIV_JSON_CONNECTION */
25658 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->value)) {
25659 RECEIVE_PACKET_FIELD_ERROR(value);
25660 }
25661 #ifdef FREECIV_JSON_CONNECTION
25662 field_addr.name = "direction";
25663 #endif /* FREECIV_JSON_CONNECTION */
25664 {
25665 int readin;
25666
25667 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
25668 RECEIVE_PACKET_FIELD_ERROR(direction);
25669 }
25670 real_packet->direction = readin;
25671 }
25672 #ifdef FREECIV_JSON_CONNECTION
25673 field_addr.name = "goods";
25674 #endif /* FREECIV_JSON_CONNECTION */
25675 {
25676 int readin;
25677
25678 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
25679 RECEIVE_PACKET_FIELD_ERROR(goods);
25680 }
25681 real_packet->goods = readin;
25682 }
25683
25684#endif
25685 log_packet_detailed("packet_trade_route_info_100: got info about ()");
25686
25687#ifdef FREECIV_DELTA_PROTOCOL
25688 if (NULL == *hash) {
25689 *hash = genhash_new_full(hash_packet_trade_route_info_100, cmp_packet_trade_route_info_100,
25690 NULL, NULL, NULL, free);
25691 }
25692
25693 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
25694 *real_packet = *old;
25695 } else {
25696 log_packet_detailed(" no old info");
25697 memset(real_packet, 0, sizeof(*real_packet));
25698 }
25699
25700 if (BV_ISSET(fields, 0)) {
25701 log_packet_detailed(" got field 'city32'");
25702 #ifdef FREECIV_JSON_CONNECTION
25703 field_addr.name = "city32";
25704 #endif /* FREECIV_JSON_CONNECTION */
25705 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city32)) {
25706 RECEIVE_PACKET_FIELD_ERROR(city32);
25707 }
25708 }
25709 if (BV_ISSET(fields, 1)) {
25710 log_packet_detailed(" got field 'index'");
25711 #ifdef FREECIV_JSON_CONNECTION
25712 field_addr.name = "index";
25713 #endif /* FREECIV_JSON_CONNECTION */
25714 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->index)) {
25715 RECEIVE_PACKET_FIELD_ERROR(index);
25716 }
25717 }
25718 if (BV_ISSET(fields, 2)) {
25719 log_packet_detailed(" got field 'partner32'");
25720 #ifdef FREECIV_JSON_CONNECTION
25721 field_addr.name = "partner32";
25722 #endif /* FREECIV_JSON_CONNECTION */
25723 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->partner32)) {
25724 RECEIVE_PACKET_FIELD_ERROR(partner32);
25725 }
25726 }
25727 if (BV_ISSET(fields, 3)) {
25728 log_packet_detailed(" got field 'value'");
25729 #ifdef FREECIV_JSON_CONNECTION
25730 field_addr.name = "value";
25731 #endif /* FREECIV_JSON_CONNECTION */
25732 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->value)) {
25733 RECEIVE_PACKET_FIELD_ERROR(value);
25734 }
25735 }
25736 if (BV_ISSET(fields, 4)) {
25737 log_packet_detailed(" got field 'direction'");
25738 #ifdef FREECIV_JSON_CONNECTION
25739 field_addr.name = "direction";
25740 #endif /* FREECIV_JSON_CONNECTION */
25741 {
25742 int readin;
25743
25744 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
25745 RECEIVE_PACKET_FIELD_ERROR(direction);
25746 }
25747 real_packet->direction = readin;
25748 }
25749 }
25750 if (BV_ISSET(fields, 5)) {
25751 log_packet_detailed(" got field 'goods'");
25752 #ifdef FREECIV_JSON_CONNECTION
25753 field_addr.name = "goods";
25754 #endif /* FREECIV_JSON_CONNECTION */
25755 {
25756 int readin;
25757
25758 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
25759 RECEIVE_PACKET_FIELD_ERROR(goods);
25760 }
25761 real_packet->goods = readin;
25762 }
25763 }
25764
25765 if (NULL == old) {
25766 old = fc_malloc(sizeof(*old));
25767 *old = *real_packet;
25768 genhash_insert(*hash, old, old);
25769 } else {
25770 *old = *real_packet;
25771 }
25772
25773#endif /* FREECIV_DELTA_PROTOCOL */
25774 RECEIVE_PACKET_END(real_packet);
25775}
25776
25777 static int send_packet_trade_route_info_100(struct connection *pc, const struct packet_trade_route_info *packet)
25778{
25779 const struct packet_trade_route_info *real_packet = packet;
25780#ifdef FREECIV_DELTA_PROTOCOL
25781 packet_trade_route_info_100_fields fields;
25782 struct packet_trade_route_info *old;
25783 bool differ;
25784 struct genhash **hash = pc->phs.sent + PACKET_TRADE_ROUTE_INFO;
25785#endif /* FREECIV_DELTA_PROTOCOL */
25786 SEND_PACKET_START(PACKET_TRADE_ROUTE_INFO);
25787#ifdef FREECIV_JSON_CONNECTION
25788 struct plocation field_addr;
25789 {
25790 struct plocation *field_addr_tmp = plocation_field_new(NULL);
25791 field_addr = *field_addr_tmp;
25792 FC_FREE(field_addr_tmp);
25793 }
25794#endif /* FREECIV_JSON_CONNECTION */
25795
25796 log_packet_detailed("packet_trade_route_info_100: sending info about ()");
25797
25798#ifdef FREECIV_DELTA_PROTOCOL
25799 if (NULL == *hash) {
25800 *hash = genhash_new_full(hash_packet_trade_route_info_100, cmp_packet_trade_route_info_100,
25801 NULL, NULL, NULL, free);
25802 }
25803 BV_CLR_ALL(fields);
25804
25805 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
25806 old = fc_malloc(sizeof(*old));
25807 *old = *real_packet;
25808 genhash_insert(*hash, old, old);
25809 memset(old, 0, sizeof(*old));
25810 }
25811 differ = (old->city32 != real_packet->city32);
25812 if (differ) {
25813 BV_SET(fields, 0);
25814 }
25815
25816 differ = (old->index != real_packet->index);
25817 if (differ) {
25818 BV_SET(fields, 1);
25819 }
25820
25821 differ = (old->partner32 != real_packet->partner32);
25822 if (differ) {
25823 BV_SET(fields, 2);
25824 }
25825
25826 differ = (old->value != real_packet->value);
25827 if (differ) {
25828 BV_SET(fields, 3);
25829 }
25830
25831 differ = (old->direction != real_packet->direction);
25832 if (differ) {
25833 BV_SET(fields, 4);
25834 }
25835
25836 differ = (old->goods != real_packet->goods);
25837 if (differ) {
25838 BV_SET(fields, 5);
25839 }
25840
25841
25842#ifdef FREECIV_JSON_CONNECTION
25843 field_addr.name = "fields";
25844#endif /* FREECIV_JSON_CONNECTION */
25845 DIO_BV_PUT(&dout, &field_addr, fields);
25846
25847 if (BV_ISSET(fields, 0)) {
25848 log_packet_detailed(" field 'city32' has changed");
25849 #ifdef FREECIV_JSON_CONNECTION
25850 field_addr.name = "city32";
25851#endif /* FREECIV_JSON_CONNECTION */
25852 DIO_PUT(uint32, &dout, &field_addr, real_packet->city32);
25853 }
25854 if (BV_ISSET(fields, 1)) {
25855 log_packet_detailed(" field 'index' has changed");
25856 #ifdef FREECIV_JSON_CONNECTION
25857 field_addr.name = "index";
25858#endif /* FREECIV_JSON_CONNECTION */
25859 DIO_PUT(uint8, &dout, &field_addr, real_packet->index);
25860 }
25861 if (BV_ISSET(fields, 2)) {
25862 log_packet_detailed(" field 'partner32' has changed");
25863 #ifdef FREECIV_JSON_CONNECTION
25864 field_addr.name = "partner32";
25865#endif /* FREECIV_JSON_CONNECTION */
25866 DIO_PUT(uint32, &dout, &field_addr, real_packet->partner32);
25867 }
25868 if (BV_ISSET(fields, 3)) {
25869 log_packet_detailed(" field 'value' has changed");
25870 #ifdef FREECIV_JSON_CONNECTION
25871 field_addr.name = "value";
25872#endif /* FREECIV_JSON_CONNECTION */
25873 DIO_PUT(uint16, &dout, &field_addr, real_packet->value);
25874 }
25875 if (BV_ISSET(fields, 4)) {
25876 log_packet_detailed(" field 'direction' has changed");
25877 #ifdef FREECIV_JSON_CONNECTION
25878 field_addr.name = "direction";
25879#endif /* FREECIV_JSON_CONNECTION */
25880 DIO_PUT(uint8, &dout, &field_addr, real_packet->direction);
25881 }
25882 if (BV_ISSET(fields, 5)) {
25883 log_packet_detailed(" field 'goods' has changed");
25884 #ifdef FREECIV_JSON_CONNECTION
25885 field_addr.name = "goods";
25886#endif /* FREECIV_JSON_CONNECTION */
25887 DIO_PUT(uint8, &dout, &field_addr, real_packet->goods);
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 = "city32";
25895#endif /* FREECIV_JSON_CONNECTION */
25896 DIO_PUT(uint32, &dout, &field_addr, real_packet->city32);
25897#ifdef FREECIV_JSON_CONNECTION
25898 field_addr.name = "index";
25899#endif /* FREECIV_JSON_CONNECTION */
25900 DIO_PUT(uint8, &dout, &field_addr, real_packet->index);
25901#ifdef FREECIV_JSON_CONNECTION
25902 field_addr.name = "partner32";
25903#endif /* FREECIV_JSON_CONNECTION */
25904 DIO_PUT(uint32, &dout, &field_addr, real_packet->partner32);
25905#ifdef FREECIV_JSON_CONNECTION
25906 field_addr.name = "value";
25907#endif /* FREECIV_JSON_CONNECTION */
25908 DIO_PUT(uint16, &dout, &field_addr, real_packet->value);
25909#ifdef FREECIV_JSON_CONNECTION
25910 field_addr.name = "direction";
25911#endif /* FREECIV_JSON_CONNECTION */
25912 DIO_PUT(uint8, &dout, &field_addr, real_packet->direction);
25913#ifdef FREECIV_JSON_CONNECTION
25914 field_addr.name = "goods";
25915#endif /* FREECIV_JSON_CONNECTION */
25916 DIO_PUT(uint8, &dout, &field_addr, real_packet->goods);
25917
25918#endif
25919 SEND_PACKET_END(PACKET_TRADE_ROUTE_INFO);
25920}
25921
25922#ifdef FREECIV_DELTA_PROTOCOL
25923#define hash_packet_trade_route_info_101 hash_const
25924
25925#define cmp_packet_trade_route_info_101 cmp_const
25926
25927 BV_DEFINE(packet_trade_route_info_101_fields, 6);
25928#endif /* FREECIV_DELTA_PROTOCOL */
25929
25930 static struct packet_trade_route_info *receive_packet_trade_route_info_101(struct connection *pc)
25931{
25932#ifdef FREECIV_DELTA_PROTOCOL
25933 packet_trade_route_info_101_fields fields;
25934 struct packet_trade_route_info *old;
25935 struct genhash **hash = pc->phs.received + PACKET_TRADE_ROUTE_INFO;
25936#endif /* FREECIV_DELTA_PROTOCOL */
25937 RECEIVE_PACKET_START(packet_trade_route_info, real_packet);
25938#ifdef FREECIV_JSON_CONNECTION
25939 struct plocation field_addr;
25940 {
25941 struct plocation *field_addr_tmp = plocation_field_new(NULL);
25942 field_addr = *field_addr_tmp;
25943 FC_FREE(field_addr_tmp);
25944 }
25945#endif /* FREECIV_JSON_CONNECTION */
25946
25947#ifdef FREECIV_DELTA_PROTOCOL
25948#ifdef FREECIV_JSON_CONNECTION
25949 field_addr.name = "fields";
25950#endif /* FREECIV_JSON_CONNECTION */
25951 DIO_BV_GET(&din, &field_addr, fields);
25952
25953#else /* FREECIV_DELTA_PROTOCOL */
25954 #ifdef FREECIV_JSON_CONNECTION
25955 field_addr.name = "city16";
25956 #endif /* FREECIV_JSON_CONNECTION */
25957 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city16)) {
25958 RECEIVE_PACKET_FIELD_ERROR(city16);
25959 }
25960 #ifdef FREECIV_JSON_CONNECTION
25961 field_addr.name = "index";
25962 #endif /* FREECIV_JSON_CONNECTION */
25963 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->index)) {
25964 RECEIVE_PACKET_FIELD_ERROR(index);
25965 }
25966 #ifdef FREECIV_JSON_CONNECTION
25967 field_addr.name = "partner16";
25968 #endif /* FREECIV_JSON_CONNECTION */
25969 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->partner16)) {
25970 RECEIVE_PACKET_FIELD_ERROR(partner16);
25971 }
25972 #ifdef FREECIV_JSON_CONNECTION
25973 field_addr.name = "value";
25974 #endif /* FREECIV_JSON_CONNECTION */
25975 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->value)) {
25976 RECEIVE_PACKET_FIELD_ERROR(value);
25977 }
25978 #ifdef FREECIV_JSON_CONNECTION
25979 field_addr.name = "direction";
25980 #endif /* FREECIV_JSON_CONNECTION */
25981 {
25982 int readin;
25983
25984 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
25985 RECEIVE_PACKET_FIELD_ERROR(direction);
25986 }
25987 real_packet->direction = readin;
25988 }
25989 #ifdef FREECIV_JSON_CONNECTION
25990 field_addr.name = "goods";
25991 #endif /* FREECIV_JSON_CONNECTION */
25992 {
25993 int readin;
25994
25995 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
25996 RECEIVE_PACKET_FIELD_ERROR(goods);
25997 }
25998 real_packet->goods = readin;
25999 }
26000
26001#endif
26002 log_packet_detailed("packet_trade_route_info_101: got info about ()");
26003
26004#ifdef FREECIV_DELTA_PROTOCOL
26005 if (NULL == *hash) {
26006 *hash = genhash_new_full(hash_packet_trade_route_info_101, cmp_packet_trade_route_info_101,
26007 NULL, NULL, NULL, free);
26008 }
26009
26010 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
26011 *real_packet = *old;
26012 } else {
26013 log_packet_detailed(" no old info");
26014 memset(real_packet, 0, sizeof(*real_packet));
26015 }
26016
26017 if (BV_ISSET(fields, 0)) {
26018 log_packet_detailed(" got field 'city16'");
26019 #ifdef FREECIV_JSON_CONNECTION
26020 field_addr.name = "city16";
26021 #endif /* FREECIV_JSON_CONNECTION */
26022 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city16)) {
26023 RECEIVE_PACKET_FIELD_ERROR(city16);
26024 }
26025 }
26026 if (BV_ISSET(fields, 1)) {
26027 log_packet_detailed(" got field 'index'");
26028 #ifdef FREECIV_JSON_CONNECTION
26029 field_addr.name = "index";
26030 #endif /* FREECIV_JSON_CONNECTION */
26031 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->index)) {
26032 RECEIVE_PACKET_FIELD_ERROR(index);
26033 }
26034 }
26035 if (BV_ISSET(fields, 2)) {
26036 log_packet_detailed(" got field 'partner16'");
26037 #ifdef FREECIV_JSON_CONNECTION
26038 field_addr.name = "partner16";
26039 #endif /* FREECIV_JSON_CONNECTION */
26040 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->partner16)) {
26041 RECEIVE_PACKET_FIELD_ERROR(partner16);
26042 }
26043 }
26044 if (BV_ISSET(fields, 3)) {
26045 log_packet_detailed(" got field 'value'");
26046 #ifdef FREECIV_JSON_CONNECTION
26047 field_addr.name = "value";
26048 #endif /* FREECIV_JSON_CONNECTION */
26049 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->value)) {
26050 RECEIVE_PACKET_FIELD_ERROR(value);
26051 }
26052 }
26053 if (BV_ISSET(fields, 4)) {
26054 log_packet_detailed(" got field 'direction'");
26055 #ifdef FREECIV_JSON_CONNECTION
26056 field_addr.name = "direction";
26057 #endif /* FREECIV_JSON_CONNECTION */
26058 {
26059 int readin;
26060
26061 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
26062 RECEIVE_PACKET_FIELD_ERROR(direction);
26063 }
26064 real_packet->direction = readin;
26065 }
26066 }
26067 if (BV_ISSET(fields, 5)) {
26068 log_packet_detailed(" got field 'goods'");
26069 #ifdef FREECIV_JSON_CONNECTION
26070 field_addr.name = "goods";
26071 #endif /* FREECIV_JSON_CONNECTION */
26072 {
26073 int readin;
26074
26075 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
26076 RECEIVE_PACKET_FIELD_ERROR(goods);
26077 }
26078 real_packet->goods = readin;
26079 }
26080 }
26081
26082 if (NULL == old) {
26083 old = fc_malloc(sizeof(*old));
26084 *old = *real_packet;
26085 genhash_insert(*hash, old, old);
26086 } else {
26087 *old = *real_packet;
26088 }
26089
26090#endif /* FREECIV_DELTA_PROTOCOL */
26091 RECEIVE_PACKET_END(real_packet);
26092}
26093
26094 static int send_packet_trade_route_info_101(struct connection *pc, const struct packet_trade_route_info *packet)
26095{
26096 const struct packet_trade_route_info *real_packet = packet;
26097#ifdef FREECIV_DELTA_PROTOCOL
26098 packet_trade_route_info_101_fields fields;
26099 struct packet_trade_route_info *old;
26100 bool differ;
26101 struct genhash **hash = pc->phs.sent + PACKET_TRADE_ROUTE_INFO;
26102#endif /* FREECIV_DELTA_PROTOCOL */
26103 SEND_PACKET_START(PACKET_TRADE_ROUTE_INFO);
26104#ifdef FREECIV_JSON_CONNECTION
26105 struct plocation field_addr;
26106 {
26107 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26108 field_addr = *field_addr_tmp;
26109 FC_FREE(field_addr_tmp);
26110 }
26111#endif /* FREECIV_JSON_CONNECTION */
26112
26113 log_packet_detailed("packet_trade_route_info_101: sending info about ()");
26114
26115#ifdef FREECIV_DELTA_PROTOCOL
26116 if (NULL == *hash) {
26117 *hash = genhash_new_full(hash_packet_trade_route_info_101, cmp_packet_trade_route_info_101,
26118 NULL, NULL, NULL, free);
26119 }
26120 BV_CLR_ALL(fields);
26121
26122 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
26123 old = fc_malloc(sizeof(*old));
26124 *old = *real_packet;
26125 genhash_insert(*hash, old, old);
26126 memset(old, 0, sizeof(*old));
26127 }
26128 differ = (old->city16 != real_packet->city16);
26129 if (differ) {
26130 BV_SET(fields, 0);
26131 }
26132
26133 differ = (old->index != real_packet->index);
26134 if (differ) {
26135 BV_SET(fields, 1);
26136 }
26137
26138 differ = (old->partner16 != real_packet->partner16);
26139 if (differ) {
26140 BV_SET(fields, 2);
26141 }
26142
26143 differ = (old->value != real_packet->value);
26144 if (differ) {
26145 BV_SET(fields, 3);
26146 }
26147
26148 differ = (old->direction != real_packet->direction);
26149 if (differ) {
26150 BV_SET(fields, 4);
26151 }
26152
26153 differ = (old->goods != real_packet->goods);
26154 if (differ) {
26155 BV_SET(fields, 5);
26156 }
26157
26158
26159#ifdef FREECIV_JSON_CONNECTION
26160 field_addr.name = "fields";
26161#endif /* FREECIV_JSON_CONNECTION */
26162 DIO_BV_PUT(&dout, &field_addr, fields);
26163
26164 if (BV_ISSET(fields, 0)) {
26165 log_packet_detailed(" field 'city16' has changed");
26166 #ifdef FREECIV_JSON_CONNECTION
26167 field_addr.name = "city16";
26168#endif /* FREECIV_JSON_CONNECTION */
26169 DIO_PUT(uint16, &dout, &field_addr, real_packet->city16);
26170 }
26171 if (BV_ISSET(fields, 1)) {
26172 log_packet_detailed(" field 'index' has changed");
26173 #ifdef FREECIV_JSON_CONNECTION
26174 field_addr.name = "index";
26175#endif /* FREECIV_JSON_CONNECTION */
26176 DIO_PUT(uint8, &dout, &field_addr, real_packet->index);
26177 }
26178 if (BV_ISSET(fields, 2)) {
26179 log_packet_detailed(" field 'partner16' has changed");
26180 #ifdef FREECIV_JSON_CONNECTION
26181 field_addr.name = "partner16";
26182#endif /* FREECIV_JSON_CONNECTION */
26183 DIO_PUT(uint16, &dout, &field_addr, real_packet->partner16);
26184 }
26185 if (BV_ISSET(fields, 3)) {
26186 log_packet_detailed(" field 'value' has changed");
26187 #ifdef FREECIV_JSON_CONNECTION
26188 field_addr.name = "value";
26189#endif /* FREECIV_JSON_CONNECTION */
26190 DIO_PUT(uint16, &dout, &field_addr, real_packet->value);
26191 }
26192 if (BV_ISSET(fields, 4)) {
26193 log_packet_detailed(" field 'direction' has changed");
26194 #ifdef FREECIV_JSON_CONNECTION
26195 field_addr.name = "direction";
26196#endif /* FREECIV_JSON_CONNECTION */
26197 DIO_PUT(uint8, &dout, &field_addr, real_packet->direction);
26198 }
26199 if (BV_ISSET(fields, 5)) {
26200 log_packet_detailed(" field 'goods' has changed");
26201 #ifdef FREECIV_JSON_CONNECTION
26202 field_addr.name = "goods";
26203#endif /* FREECIV_JSON_CONNECTION */
26204 DIO_PUT(uint8, &dout, &field_addr, real_packet->goods);
26205 }
26206
26207 *old = *real_packet;
26208#endif /* FREECIV_DELTA_PROTOCOL */
26209#ifndef FREECIV_DELTA_PROTOCOL
26210#ifdef FREECIV_JSON_CONNECTION
26211 field_addr.name = "city16";
26212#endif /* FREECIV_JSON_CONNECTION */
26213 DIO_PUT(uint16, &dout, &field_addr, real_packet->city16);
26214#ifdef FREECIV_JSON_CONNECTION
26215 field_addr.name = "index";
26216#endif /* FREECIV_JSON_CONNECTION */
26217 DIO_PUT(uint8, &dout, &field_addr, real_packet->index);
26218#ifdef FREECIV_JSON_CONNECTION
26219 field_addr.name = "partner16";
26220#endif /* FREECIV_JSON_CONNECTION */
26221 DIO_PUT(uint16, &dout, &field_addr, real_packet->partner16);
26222#ifdef FREECIV_JSON_CONNECTION
26223 field_addr.name = "value";
26224#endif /* FREECIV_JSON_CONNECTION */
26225 DIO_PUT(uint16, &dout, &field_addr, real_packet->value);
26226#ifdef FREECIV_JSON_CONNECTION
26227 field_addr.name = "direction";
26228#endif /* FREECIV_JSON_CONNECTION */
26229 DIO_PUT(uint8, &dout, &field_addr, real_packet->direction);
26230#ifdef FREECIV_JSON_CONNECTION
26231 field_addr.name = "goods";
26232#endif /* FREECIV_JSON_CONNECTION */
26233 DIO_PUT(uint8, &dout, &field_addr, real_packet->goods);
26234
26235#endif
26236 SEND_PACKET_END(PACKET_TRADE_ROUTE_INFO);
26237}
26238
26239 int send_packet_trade_route_info(struct connection *pc, const struct packet_trade_route_info *packet)
26240{
26241 if (!pc->used) {
26242 log_error("WARNING: trying to send data to the closed connection %s",
26243 conn_description(pc));
26244 return -1;
26245 }
26246 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_TRADE_ROUTE_INFO].packet != NULL, -1,
26247 "Handler for PACKET_TRADE_ROUTE_INFO not installed");
26248 return pc->phs.handlers->send[PACKET_TRADE_ROUTE_INFO].packet(pc, packet);
26249}
26250
26251 void lsend_packet_trade_route_info(struct conn_list *dest, const struct packet_trade_route_info *packet)
26252{
26253 conn_list_iterate(dest, pconn) {
26254 send_packet_trade_route_info(pconn, packet);
26255 } conn_list_iterate_end;
26256}
26257
26258#ifdef FREECIV_DELTA_PROTOCOL
26259#define hash_packet_city_sell_100 hash_const
26260
26261#define cmp_packet_city_sell_100 cmp_const
26262
26263 BV_DEFINE(packet_city_sell_100_fields, 2);
26264#endif /* FREECIV_DELTA_PROTOCOL */
26265
26266 static struct packet_city_sell *receive_packet_city_sell_100(struct connection *pc)
26267{
26268#ifdef FREECIV_DELTA_PROTOCOL
26269 packet_city_sell_100_fields fields;
26270 struct packet_city_sell *old;
26271 struct genhash **hash = pc->phs.received + PACKET_CITY_SELL;
26272#endif /* FREECIV_DELTA_PROTOCOL */
26273 RECEIVE_PACKET_START(packet_city_sell, real_packet);
26274#ifdef FREECIV_JSON_CONNECTION
26275 struct plocation field_addr;
26276 {
26277 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26278 field_addr = *field_addr_tmp;
26279 FC_FREE(field_addr_tmp);
26280 }
26281#endif /* FREECIV_JSON_CONNECTION */
26282
26283#ifdef FREECIV_DELTA_PROTOCOL
26284#ifdef FREECIV_JSON_CONNECTION
26285 field_addr.name = "fields";
26286#endif /* FREECIV_JSON_CONNECTION */
26287 DIO_BV_GET(&din, &field_addr, fields);
26288
26289#else /* FREECIV_DELTA_PROTOCOL */
26290 #ifdef FREECIV_JSON_CONNECTION
26291 field_addr.name = "city_id32";
26292 #endif /* FREECIV_JSON_CONNECTION */
26293 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
26294 RECEIVE_PACKET_FIELD_ERROR(city_id32);
26295 }
26296 #ifdef FREECIV_JSON_CONNECTION
26297 field_addr.name = "build_id";
26298 #endif /* FREECIV_JSON_CONNECTION */
26299 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_id)) {
26300 RECEIVE_PACKET_FIELD_ERROR(build_id);
26301 }
26302
26303#endif
26304 log_packet_detailed("packet_city_sell_100: got info about ()");
26305
26306#ifdef FREECIV_DELTA_PROTOCOL
26307 if (NULL == *hash) {
26308 *hash = genhash_new_full(hash_packet_city_sell_100, cmp_packet_city_sell_100,
26309 NULL, NULL, NULL, free);
26310 }
26311
26312 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
26313 *real_packet = *old;
26314 } else {
26315 log_packet_detailed(" no old info");
26316 memset(real_packet, 0, sizeof(*real_packet));
26317 }
26318
26319 if (BV_ISSET(fields, 0)) {
26320 log_packet_detailed(" got field 'city_id32'");
26321 #ifdef FREECIV_JSON_CONNECTION
26322 field_addr.name = "city_id32";
26323 #endif /* FREECIV_JSON_CONNECTION */
26324 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
26325 RECEIVE_PACKET_FIELD_ERROR(city_id32);
26326 }
26327 }
26328 if (BV_ISSET(fields, 1)) {
26329 log_packet_detailed(" got field 'build_id'");
26330 #ifdef FREECIV_JSON_CONNECTION
26331 field_addr.name = "build_id";
26332 #endif /* FREECIV_JSON_CONNECTION */
26333 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_id)) {
26334 RECEIVE_PACKET_FIELD_ERROR(build_id);
26335 }
26336 }
26337
26338 if (NULL == old) {
26339 old = fc_malloc(sizeof(*old));
26340 *old = *real_packet;
26341 genhash_insert(*hash, old, old);
26342 } else {
26343 *old = *real_packet;
26344 }
26345
26346#endif /* FREECIV_DELTA_PROTOCOL */
26347 RECEIVE_PACKET_END(real_packet);
26348}
26349
26350 static int send_packet_city_sell_100(struct connection *pc, const struct packet_city_sell *packet)
26351{
26352 const struct packet_city_sell *real_packet = packet;
26353#ifdef FREECIV_DELTA_PROTOCOL
26354 packet_city_sell_100_fields fields;
26355 struct packet_city_sell *old;
26356 bool differ;
26357 struct genhash **hash = pc->phs.sent + PACKET_CITY_SELL;
26358#endif /* FREECIV_DELTA_PROTOCOL */
26359 SEND_PACKET_START(PACKET_CITY_SELL);
26360#ifdef FREECIV_JSON_CONNECTION
26361 struct plocation field_addr;
26362 {
26363 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26364 field_addr = *field_addr_tmp;
26365 FC_FREE(field_addr_tmp);
26366 }
26367#endif /* FREECIV_JSON_CONNECTION */
26368
26369 log_packet_detailed("packet_city_sell_100: sending info about ()");
26370
26371#ifdef FREECIV_DELTA_PROTOCOL
26372 if (NULL == *hash) {
26373 *hash = genhash_new_full(hash_packet_city_sell_100, cmp_packet_city_sell_100,
26374 NULL, NULL, NULL, free);
26375 }
26376 BV_CLR_ALL(fields);
26377
26378 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
26379 old = fc_malloc(sizeof(*old));
26380 *old = *real_packet;
26381 genhash_insert(*hash, old, old);
26382 memset(old, 0, sizeof(*old));
26383 }
26384 differ = (old->city_id32 != real_packet->city_id32);
26385 if (differ) {
26386 BV_SET(fields, 0);
26387 }
26388
26389 differ = (old->build_id != real_packet->build_id);
26390 if (differ) {
26391 BV_SET(fields, 1);
26392 }
26393
26394
26395#ifdef FREECIV_JSON_CONNECTION
26396 field_addr.name = "fields";
26397#endif /* FREECIV_JSON_CONNECTION */
26398 DIO_BV_PUT(&dout, &field_addr, fields);
26399
26400 if (BV_ISSET(fields, 0)) {
26401 log_packet_detailed(" field 'city_id32' has changed");
26402 #ifdef FREECIV_JSON_CONNECTION
26403 field_addr.name = "city_id32";
26404#endif /* FREECIV_JSON_CONNECTION */
26405 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
26406 }
26407 if (BV_ISSET(fields, 1)) {
26408 log_packet_detailed(" field 'build_id' has changed");
26409 #ifdef FREECIV_JSON_CONNECTION
26410 field_addr.name = "build_id";
26411#endif /* FREECIV_JSON_CONNECTION */
26412 DIO_PUT(uint8, &dout, &field_addr, real_packet->build_id);
26413 }
26414
26415 *old = *real_packet;
26416#endif /* FREECIV_DELTA_PROTOCOL */
26417#ifndef FREECIV_DELTA_PROTOCOL
26418#ifdef FREECIV_JSON_CONNECTION
26419 field_addr.name = "city_id32";
26420#endif /* FREECIV_JSON_CONNECTION */
26421 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
26422#ifdef FREECIV_JSON_CONNECTION
26423 field_addr.name = "build_id";
26424#endif /* FREECIV_JSON_CONNECTION */
26425 DIO_PUT(uint8, &dout, &field_addr, real_packet->build_id);
26426
26427#endif
26428 SEND_PACKET_END(PACKET_CITY_SELL);
26429}
26430
26431#ifdef FREECIV_DELTA_PROTOCOL
26432#define hash_packet_city_sell_101 hash_const
26433
26434#define cmp_packet_city_sell_101 cmp_const
26435
26436 BV_DEFINE(packet_city_sell_101_fields, 2);
26437#endif /* FREECIV_DELTA_PROTOCOL */
26438
26439 static struct packet_city_sell *receive_packet_city_sell_101(struct connection *pc)
26440{
26441#ifdef FREECIV_DELTA_PROTOCOL
26442 packet_city_sell_101_fields fields;
26443 struct packet_city_sell *old;
26444 struct genhash **hash = pc->phs.received + PACKET_CITY_SELL;
26445#endif /* FREECIV_DELTA_PROTOCOL */
26446 RECEIVE_PACKET_START(packet_city_sell, real_packet);
26447#ifdef FREECIV_JSON_CONNECTION
26448 struct plocation field_addr;
26449 {
26450 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26451 field_addr = *field_addr_tmp;
26452 FC_FREE(field_addr_tmp);
26453 }
26454#endif /* FREECIV_JSON_CONNECTION */
26455
26456#ifdef FREECIV_DELTA_PROTOCOL
26457#ifdef FREECIV_JSON_CONNECTION
26458 field_addr.name = "fields";
26459#endif /* FREECIV_JSON_CONNECTION */
26460 DIO_BV_GET(&din, &field_addr, fields);
26461
26462#else /* FREECIV_DELTA_PROTOCOL */
26463 #ifdef FREECIV_JSON_CONNECTION
26464 field_addr.name = "city_id16";
26465 #endif /* FREECIV_JSON_CONNECTION */
26466 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
26467 RECEIVE_PACKET_FIELD_ERROR(city_id16);
26468 }
26469 #ifdef FREECIV_JSON_CONNECTION
26470 field_addr.name = "build_id";
26471 #endif /* FREECIV_JSON_CONNECTION */
26472 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_id)) {
26473 RECEIVE_PACKET_FIELD_ERROR(build_id);
26474 }
26475
26476#endif
26477 log_packet_detailed("packet_city_sell_101: got info about ()");
26478
26479#ifdef FREECIV_DELTA_PROTOCOL
26480 if (NULL == *hash) {
26481 *hash = genhash_new_full(hash_packet_city_sell_101, cmp_packet_city_sell_101,
26482 NULL, NULL, NULL, free);
26483 }
26484
26485 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
26486 *real_packet = *old;
26487 } else {
26488 log_packet_detailed(" no old info");
26489 memset(real_packet, 0, sizeof(*real_packet));
26490 }
26491
26492 if (BV_ISSET(fields, 0)) {
26493 log_packet_detailed(" got field 'city_id16'");
26494 #ifdef FREECIV_JSON_CONNECTION
26495 field_addr.name = "city_id16";
26496 #endif /* FREECIV_JSON_CONNECTION */
26497 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
26498 RECEIVE_PACKET_FIELD_ERROR(city_id16);
26499 }
26500 }
26501 if (BV_ISSET(fields, 1)) {
26502 log_packet_detailed(" got field 'build_id'");
26503 #ifdef FREECIV_JSON_CONNECTION
26504 field_addr.name = "build_id";
26505 #endif /* FREECIV_JSON_CONNECTION */
26506 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_id)) {
26507 RECEIVE_PACKET_FIELD_ERROR(build_id);
26508 }
26509 }
26510
26511 if (NULL == old) {
26512 old = fc_malloc(sizeof(*old));
26513 *old = *real_packet;
26514 genhash_insert(*hash, old, old);
26515 } else {
26516 *old = *real_packet;
26517 }
26518
26519#endif /* FREECIV_DELTA_PROTOCOL */
26520 RECEIVE_PACKET_END(real_packet);
26521}
26522
26523 static int send_packet_city_sell_101(struct connection *pc, const struct packet_city_sell *packet)
26524{
26525 const struct packet_city_sell *real_packet = packet;
26526#ifdef FREECIV_DELTA_PROTOCOL
26527 packet_city_sell_101_fields fields;
26528 struct packet_city_sell *old;
26529 bool differ;
26530 struct genhash **hash = pc->phs.sent + PACKET_CITY_SELL;
26531#endif /* FREECIV_DELTA_PROTOCOL */
26532 SEND_PACKET_START(PACKET_CITY_SELL);
26533#ifdef FREECIV_JSON_CONNECTION
26534 struct plocation field_addr;
26535 {
26536 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26537 field_addr = *field_addr_tmp;
26538 FC_FREE(field_addr_tmp);
26539 }
26540#endif /* FREECIV_JSON_CONNECTION */
26541
26542 log_packet_detailed("packet_city_sell_101: sending info about ()");
26543
26544#ifdef FREECIV_DELTA_PROTOCOL
26545 if (NULL == *hash) {
26546 *hash = genhash_new_full(hash_packet_city_sell_101, cmp_packet_city_sell_101,
26547 NULL, NULL, NULL, free);
26548 }
26549 BV_CLR_ALL(fields);
26550
26551 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
26552 old = fc_malloc(sizeof(*old));
26553 *old = *real_packet;
26554 genhash_insert(*hash, old, old);
26555 memset(old, 0, sizeof(*old));
26556 }
26557 differ = (old->city_id16 != real_packet->city_id16);
26558 if (differ) {
26559 BV_SET(fields, 0);
26560 }
26561
26562 differ = (old->build_id != real_packet->build_id);
26563 if (differ) {
26564 BV_SET(fields, 1);
26565 }
26566
26567
26568#ifdef FREECIV_JSON_CONNECTION
26569 field_addr.name = "fields";
26570#endif /* FREECIV_JSON_CONNECTION */
26571 DIO_BV_PUT(&dout, &field_addr, fields);
26572
26573 if (BV_ISSET(fields, 0)) {
26574 log_packet_detailed(" field 'city_id16' has changed");
26575 #ifdef FREECIV_JSON_CONNECTION
26576 field_addr.name = "city_id16";
26577#endif /* FREECIV_JSON_CONNECTION */
26578 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
26579 }
26580 if (BV_ISSET(fields, 1)) {
26581 log_packet_detailed(" field 'build_id' has changed");
26582 #ifdef FREECIV_JSON_CONNECTION
26583 field_addr.name = "build_id";
26584#endif /* FREECIV_JSON_CONNECTION */
26585 DIO_PUT(uint8, &dout, &field_addr, real_packet->build_id);
26586 }
26587
26588 *old = *real_packet;
26589#endif /* FREECIV_DELTA_PROTOCOL */
26590#ifndef FREECIV_DELTA_PROTOCOL
26591#ifdef FREECIV_JSON_CONNECTION
26592 field_addr.name = "city_id16";
26593#endif /* FREECIV_JSON_CONNECTION */
26594 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
26595#ifdef FREECIV_JSON_CONNECTION
26596 field_addr.name = "build_id";
26597#endif /* FREECIV_JSON_CONNECTION */
26598 DIO_PUT(uint8, &dout, &field_addr, real_packet->build_id);
26599
26600#endif
26601 SEND_PACKET_END(PACKET_CITY_SELL);
26602}
26603
26604 int send_packet_city_sell(struct connection *pc, const struct packet_city_sell *packet)
26605{
26606 if (!pc->used) {
26607 log_error("WARNING: trying to send data to the closed connection %s",
26608 conn_description(pc));
26609 return -1;
26610 }
26611 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_SELL].packet != NULL, -1,
26612 "Handler for PACKET_CITY_SELL not installed");
26613 return pc->phs.handlers->send[PACKET_CITY_SELL].packet(pc, packet);
26614}
26615
26616 int dsend_packet_city_sell(struct connection *pc, int city_id16, int city_id32, int build_id)
26617{
26618 struct packet_city_sell packet, *real_packet = &packet;
26619
26620 real_packet->city_id16 = city_id16;
26621 real_packet->city_id32 = city_id32;
26622 real_packet->build_id = build_id;
26623
26624 return send_packet_city_sell(pc, real_packet);
26625}
26626
26627#ifdef FREECIV_DELTA_PROTOCOL
26628#define hash_packet_city_buy_100 hash_const
26629
26630#define cmp_packet_city_buy_100 cmp_const
26631
26632 BV_DEFINE(packet_city_buy_100_fields, 1);
26633#endif /* FREECIV_DELTA_PROTOCOL */
26634
26635 static struct packet_city_buy *receive_packet_city_buy_100(struct connection *pc)
26636{
26637#ifdef FREECIV_DELTA_PROTOCOL
26638 packet_city_buy_100_fields fields;
26639 struct packet_city_buy *old;
26640 struct genhash **hash = pc->phs.received + PACKET_CITY_BUY;
26641#endif /* FREECIV_DELTA_PROTOCOL */
26642 RECEIVE_PACKET_START(packet_city_buy, real_packet);
26643#ifdef FREECIV_JSON_CONNECTION
26644 struct plocation field_addr;
26645 {
26646 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26647 field_addr = *field_addr_tmp;
26648 FC_FREE(field_addr_tmp);
26649 }
26650#endif /* FREECIV_JSON_CONNECTION */
26651
26652#ifdef FREECIV_DELTA_PROTOCOL
26653#ifdef FREECIV_JSON_CONNECTION
26654 field_addr.name = "fields";
26655#endif /* FREECIV_JSON_CONNECTION */
26656 DIO_BV_GET(&din, &field_addr, fields);
26657
26658#else /* FREECIV_DELTA_PROTOCOL */
26659 #ifdef FREECIV_JSON_CONNECTION
26660 field_addr.name = "city_id32";
26661 #endif /* FREECIV_JSON_CONNECTION */
26662 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
26663 RECEIVE_PACKET_FIELD_ERROR(city_id32);
26664 }
26665
26666#endif
26667 log_packet_detailed("packet_city_buy_100: got info about ()");
26668
26669#ifdef FREECIV_DELTA_PROTOCOL
26670 if (NULL == *hash) {
26671 *hash = genhash_new_full(hash_packet_city_buy_100, cmp_packet_city_buy_100,
26672 NULL, NULL, NULL, free);
26673 }
26674
26675 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
26676 *real_packet = *old;
26677 } else {
26678 log_packet_detailed(" no old info");
26679 memset(real_packet, 0, sizeof(*real_packet));
26680 }
26681
26682 if (BV_ISSET(fields, 0)) {
26683 log_packet_detailed(" got field 'city_id32'");
26684 #ifdef FREECIV_JSON_CONNECTION
26685 field_addr.name = "city_id32";
26686 #endif /* FREECIV_JSON_CONNECTION */
26687 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
26688 RECEIVE_PACKET_FIELD_ERROR(city_id32);
26689 }
26690 }
26691
26692 if (NULL == old) {
26693 old = fc_malloc(sizeof(*old));
26694 *old = *real_packet;
26695 genhash_insert(*hash, old, old);
26696 } else {
26697 *old = *real_packet;
26698 }
26699
26700#endif /* FREECIV_DELTA_PROTOCOL */
26701 RECEIVE_PACKET_END(real_packet);
26702}
26703
26704 static int send_packet_city_buy_100(struct connection *pc, const struct packet_city_buy *packet)
26705{
26706 const struct packet_city_buy *real_packet = packet;
26707#ifdef FREECIV_DELTA_PROTOCOL
26708 packet_city_buy_100_fields fields;
26709 struct packet_city_buy *old;
26710 bool differ;
26711 struct genhash **hash = pc->phs.sent + PACKET_CITY_BUY;
26712#endif /* FREECIV_DELTA_PROTOCOL */
26713 SEND_PACKET_START(PACKET_CITY_BUY);
26714#ifdef FREECIV_JSON_CONNECTION
26715 struct plocation field_addr;
26716 {
26717 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26718 field_addr = *field_addr_tmp;
26719 FC_FREE(field_addr_tmp);
26720 }
26721#endif /* FREECIV_JSON_CONNECTION */
26722
26723 log_packet_detailed("packet_city_buy_100: sending info about ()");
26724
26725#ifdef FREECIV_DELTA_PROTOCOL
26726 if (NULL == *hash) {
26727 *hash = genhash_new_full(hash_packet_city_buy_100, cmp_packet_city_buy_100,
26728 NULL, NULL, NULL, free);
26729 }
26730 BV_CLR_ALL(fields);
26731
26732 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
26733 old = fc_malloc(sizeof(*old));
26734 *old = *real_packet;
26735 genhash_insert(*hash, old, old);
26736 memset(old, 0, sizeof(*old));
26737 }
26738 differ = (old->city_id32 != real_packet->city_id32);
26739 if (differ) {
26740 BV_SET(fields, 0);
26741 }
26742
26743
26744#ifdef FREECIV_JSON_CONNECTION
26745 field_addr.name = "fields";
26746#endif /* FREECIV_JSON_CONNECTION */
26747 DIO_BV_PUT(&dout, &field_addr, fields);
26748
26749 if (BV_ISSET(fields, 0)) {
26750 log_packet_detailed(" field 'city_id32' has changed");
26751 #ifdef FREECIV_JSON_CONNECTION
26752 field_addr.name = "city_id32";
26753#endif /* FREECIV_JSON_CONNECTION */
26754 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
26755 }
26756
26757 *old = *real_packet;
26758#endif /* FREECIV_DELTA_PROTOCOL */
26759#ifndef FREECIV_DELTA_PROTOCOL
26760#ifdef FREECIV_JSON_CONNECTION
26761 field_addr.name = "city_id32";
26762#endif /* FREECIV_JSON_CONNECTION */
26763 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
26764
26765#endif
26766 SEND_PACKET_END(PACKET_CITY_BUY);
26767}
26768
26769#ifdef FREECIV_DELTA_PROTOCOL
26770#define hash_packet_city_buy_101 hash_const
26771
26772#define cmp_packet_city_buy_101 cmp_const
26773
26774 BV_DEFINE(packet_city_buy_101_fields, 1);
26775#endif /* FREECIV_DELTA_PROTOCOL */
26776
26777 static struct packet_city_buy *receive_packet_city_buy_101(struct connection *pc)
26778{
26779#ifdef FREECIV_DELTA_PROTOCOL
26780 packet_city_buy_101_fields fields;
26781 struct packet_city_buy *old;
26782 struct genhash **hash = pc->phs.received + PACKET_CITY_BUY;
26783#endif /* FREECIV_DELTA_PROTOCOL */
26784 RECEIVE_PACKET_START(packet_city_buy, real_packet);
26785#ifdef FREECIV_JSON_CONNECTION
26786 struct plocation field_addr;
26787 {
26788 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26789 field_addr = *field_addr_tmp;
26790 FC_FREE(field_addr_tmp);
26791 }
26792#endif /* FREECIV_JSON_CONNECTION */
26793
26794#ifdef FREECIV_DELTA_PROTOCOL
26795#ifdef FREECIV_JSON_CONNECTION
26796 field_addr.name = "fields";
26797#endif /* FREECIV_JSON_CONNECTION */
26798 DIO_BV_GET(&din, &field_addr, fields);
26799
26800#else /* FREECIV_DELTA_PROTOCOL */
26801 #ifdef FREECIV_JSON_CONNECTION
26802 field_addr.name = "city_id16";
26803 #endif /* FREECIV_JSON_CONNECTION */
26804 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
26805 RECEIVE_PACKET_FIELD_ERROR(city_id16);
26806 }
26807
26808#endif
26809 log_packet_detailed("packet_city_buy_101: got info about ()");
26810
26811#ifdef FREECIV_DELTA_PROTOCOL
26812 if (NULL == *hash) {
26813 *hash = genhash_new_full(hash_packet_city_buy_101, cmp_packet_city_buy_101,
26814 NULL, NULL, NULL, free);
26815 }
26816
26817 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
26818 *real_packet = *old;
26819 } else {
26820 log_packet_detailed(" no old info");
26821 memset(real_packet, 0, sizeof(*real_packet));
26822 }
26823
26824 if (BV_ISSET(fields, 0)) {
26825 log_packet_detailed(" got field 'city_id16'");
26826 #ifdef FREECIV_JSON_CONNECTION
26827 field_addr.name = "city_id16";
26828 #endif /* FREECIV_JSON_CONNECTION */
26829 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
26830 RECEIVE_PACKET_FIELD_ERROR(city_id16);
26831 }
26832 }
26833
26834 if (NULL == old) {
26835 old = fc_malloc(sizeof(*old));
26836 *old = *real_packet;
26837 genhash_insert(*hash, old, old);
26838 } else {
26839 *old = *real_packet;
26840 }
26841
26842#endif /* FREECIV_DELTA_PROTOCOL */
26843 RECEIVE_PACKET_END(real_packet);
26844}
26845
26846 static int send_packet_city_buy_101(struct connection *pc, const struct packet_city_buy *packet)
26847{
26848 const struct packet_city_buy *real_packet = packet;
26849#ifdef FREECIV_DELTA_PROTOCOL
26850 packet_city_buy_101_fields fields;
26851 struct packet_city_buy *old;
26852 bool differ;
26853 struct genhash **hash = pc->phs.sent + PACKET_CITY_BUY;
26854#endif /* FREECIV_DELTA_PROTOCOL */
26855 SEND_PACKET_START(PACKET_CITY_BUY);
26856#ifdef FREECIV_JSON_CONNECTION
26857 struct plocation field_addr;
26858 {
26859 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26860 field_addr = *field_addr_tmp;
26861 FC_FREE(field_addr_tmp);
26862 }
26863#endif /* FREECIV_JSON_CONNECTION */
26864
26865 log_packet_detailed("packet_city_buy_101: sending info about ()");
26866
26867#ifdef FREECIV_DELTA_PROTOCOL
26868 if (NULL == *hash) {
26869 *hash = genhash_new_full(hash_packet_city_buy_101, cmp_packet_city_buy_101,
26870 NULL, NULL, NULL, free);
26871 }
26872 BV_CLR_ALL(fields);
26873
26874 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
26875 old = fc_malloc(sizeof(*old));
26876 *old = *real_packet;
26877 genhash_insert(*hash, old, old);
26878 memset(old, 0, sizeof(*old));
26879 }
26880 differ = (old->city_id16 != real_packet->city_id16);
26881 if (differ) {
26882 BV_SET(fields, 0);
26883 }
26884
26885
26886#ifdef FREECIV_JSON_CONNECTION
26887 field_addr.name = "fields";
26888#endif /* FREECIV_JSON_CONNECTION */
26889 DIO_BV_PUT(&dout, &field_addr, fields);
26890
26891 if (BV_ISSET(fields, 0)) {
26892 log_packet_detailed(" field 'city_id16' has changed");
26893 #ifdef FREECIV_JSON_CONNECTION
26894 field_addr.name = "city_id16";
26895#endif /* FREECIV_JSON_CONNECTION */
26896 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
26897 }
26898
26899 *old = *real_packet;
26900#endif /* FREECIV_DELTA_PROTOCOL */
26901#ifndef FREECIV_DELTA_PROTOCOL
26902#ifdef FREECIV_JSON_CONNECTION
26903 field_addr.name = "city_id16";
26904#endif /* FREECIV_JSON_CONNECTION */
26905 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
26906
26907#endif
26908 SEND_PACKET_END(PACKET_CITY_BUY);
26909}
26910
26911 int send_packet_city_buy(struct connection *pc, const struct packet_city_buy *packet)
26912{
26913 if (!pc->used) {
26914 log_error("WARNING: trying to send data to the closed connection %s",
26915 conn_description(pc));
26916 return -1;
26917 }
26918 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_BUY].packet != NULL, -1,
26919 "Handler for PACKET_CITY_BUY not installed");
26920 return pc->phs.handlers->send[PACKET_CITY_BUY].packet(pc, packet);
26921}
26922
26923 int dsend_packet_city_buy(struct connection *pc, int city_id16, int city_id32)
26924{
26925 struct packet_city_buy packet, *real_packet = &packet;
26926
26927 real_packet->city_id16 = city_id16;
26928 real_packet->city_id32 = city_id32;
26929
26930 return send_packet_city_buy(pc, real_packet);
26931}
26932
26933#ifdef FREECIV_DELTA_PROTOCOL
26934#define hash_packet_city_change_100 hash_const
26935
26936#define cmp_packet_city_change_100 cmp_const
26937
26938 BV_DEFINE(packet_city_change_100_fields, 3);
26939#endif /* FREECIV_DELTA_PROTOCOL */
26940
26941 static struct packet_city_change *receive_packet_city_change_100(struct connection *pc)
26942{
26943#ifdef FREECIV_DELTA_PROTOCOL
26944 packet_city_change_100_fields fields;
26945 struct packet_city_change *old;
26946 struct genhash **hash = pc->phs.received + PACKET_CITY_CHANGE;
26947#endif /* FREECIV_DELTA_PROTOCOL */
26948 RECEIVE_PACKET_START(packet_city_change, real_packet);
26949#ifdef FREECIV_JSON_CONNECTION
26950 struct plocation field_addr;
26951 {
26952 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26953 field_addr = *field_addr_tmp;
26954 FC_FREE(field_addr_tmp);
26955 }
26956#endif /* FREECIV_JSON_CONNECTION */
26957
26958#ifdef FREECIV_DELTA_PROTOCOL
26959#ifdef FREECIV_JSON_CONNECTION
26960 field_addr.name = "fields";
26961#endif /* FREECIV_JSON_CONNECTION */
26962 DIO_BV_GET(&din, &field_addr, fields);
26963
26964#else /* FREECIV_DELTA_PROTOCOL */
26965 #ifdef FREECIV_JSON_CONNECTION
26966 field_addr.name = "city_id32";
26967 #endif /* FREECIV_JSON_CONNECTION */
26968 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
26969 RECEIVE_PACKET_FIELD_ERROR(city_id32);
26970 }
26971 #ifdef FREECIV_JSON_CONNECTION
26972 field_addr.name = "production_kind";
26973 #endif /* FREECIV_JSON_CONNECTION */
26974 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
26975 RECEIVE_PACKET_FIELD_ERROR(production_kind);
26976 }
26977 #ifdef FREECIV_JSON_CONNECTION
26978 field_addr.name = "production_value";
26979 #endif /* FREECIV_JSON_CONNECTION */
26980 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
26981 RECEIVE_PACKET_FIELD_ERROR(production_value);
26982 }
26983
26984#endif
26985 log_packet_detailed("packet_city_change_100: got info about ()");
26986
26987#ifdef FREECIV_DELTA_PROTOCOL
26988 if (NULL == *hash) {
26989 *hash = genhash_new_full(hash_packet_city_change_100, cmp_packet_city_change_100,
26990 NULL, NULL, NULL, free);
26991 }
26992
26993 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
26994 *real_packet = *old;
26995 } else {
26996 log_packet_detailed(" no old info");
26997 memset(real_packet, 0, sizeof(*real_packet));
26998 }
26999
27000 if (BV_ISSET(fields, 0)) {
27001 log_packet_detailed(" got field 'city_id32'");
27002 #ifdef FREECIV_JSON_CONNECTION
27003 field_addr.name = "city_id32";
27004 #endif /* FREECIV_JSON_CONNECTION */
27005 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
27006 RECEIVE_PACKET_FIELD_ERROR(city_id32);
27007 }
27008 }
27009 if (BV_ISSET(fields, 1)) {
27010 log_packet_detailed(" got field 'production_kind'");
27011 #ifdef FREECIV_JSON_CONNECTION
27012 field_addr.name = "production_kind";
27013 #endif /* FREECIV_JSON_CONNECTION */
27014 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
27015 RECEIVE_PACKET_FIELD_ERROR(production_kind);
27016 }
27017 }
27018 if (BV_ISSET(fields, 2)) {
27019 log_packet_detailed(" got field 'production_value'");
27020 #ifdef FREECIV_JSON_CONNECTION
27021 field_addr.name = "production_value";
27022 #endif /* FREECIV_JSON_CONNECTION */
27023 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
27024 RECEIVE_PACKET_FIELD_ERROR(production_value);
27025 }
27026 }
27027
27028 if (NULL == old) {
27029 old = fc_malloc(sizeof(*old));
27030 *old = *real_packet;
27031 genhash_insert(*hash, old, old);
27032 } else {
27033 *old = *real_packet;
27034 }
27035
27036#endif /* FREECIV_DELTA_PROTOCOL */
27037 RECEIVE_PACKET_END(real_packet);
27038}
27039
27040 static int send_packet_city_change_100(struct connection *pc, const struct packet_city_change *packet)
27041{
27042 const struct packet_city_change *real_packet = packet;
27043#ifdef FREECIV_DELTA_PROTOCOL
27044 packet_city_change_100_fields fields;
27045 struct packet_city_change *old;
27046 bool differ;
27047 struct genhash **hash = pc->phs.sent + PACKET_CITY_CHANGE;
27048#endif /* FREECIV_DELTA_PROTOCOL */
27049 SEND_PACKET_START(PACKET_CITY_CHANGE);
27050#ifdef FREECIV_JSON_CONNECTION
27051 struct plocation field_addr;
27052 {
27053 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27054 field_addr = *field_addr_tmp;
27055 FC_FREE(field_addr_tmp);
27056 }
27057#endif /* FREECIV_JSON_CONNECTION */
27058
27059 log_packet_detailed("packet_city_change_100: sending info about ()");
27060
27061#ifdef FREECIV_DELTA_PROTOCOL
27062 if (NULL == *hash) {
27063 *hash = genhash_new_full(hash_packet_city_change_100, cmp_packet_city_change_100,
27064 NULL, NULL, NULL, free);
27065 }
27066 BV_CLR_ALL(fields);
27067
27068 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
27069 old = fc_malloc(sizeof(*old));
27070 *old = *real_packet;
27071 genhash_insert(*hash, old, old);
27072 memset(old, 0, sizeof(*old));
27073 }
27074 differ = (old->city_id32 != real_packet->city_id32);
27075 if (differ) {
27076 BV_SET(fields, 0);
27077 }
27078
27079 differ = (old->production_kind != real_packet->production_kind);
27080 if (differ) {
27081 BV_SET(fields, 1);
27082 }
27083
27084 differ = (old->production_value != real_packet->production_value);
27085 if (differ) {
27086 BV_SET(fields, 2);
27087 }
27088
27089
27090#ifdef FREECIV_JSON_CONNECTION
27091 field_addr.name = "fields";
27092#endif /* FREECIV_JSON_CONNECTION */
27093 DIO_BV_PUT(&dout, &field_addr, fields);
27094
27095 if (BV_ISSET(fields, 0)) {
27096 log_packet_detailed(" field 'city_id32' has changed");
27097 #ifdef FREECIV_JSON_CONNECTION
27098 field_addr.name = "city_id32";
27099#endif /* FREECIV_JSON_CONNECTION */
27100 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
27101 }
27102 if (BV_ISSET(fields, 1)) {
27103 log_packet_detailed(" field 'production_kind' has changed");
27104 #ifdef FREECIV_JSON_CONNECTION
27105 field_addr.name = "production_kind";
27106#endif /* FREECIV_JSON_CONNECTION */
27107 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
27108 }
27109 if (BV_ISSET(fields, 2)) {
27110 log_packet_detailed(" field 'production_value' has changed");
27111 #ifdef FREECIV_JSON_CONNECTION
27112 field_addr.name = "production_value";
27113#endif /* FREECIV_JSON_CONNECTION */
27114 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
27115 }
27116
27117 *old = *real_packet;
27118#endif /* FREECIV_DELTA_PROTOCOL */
27119#ifndef FREECIV_DELTA_PROTOCOL
27120#ifdef FREECIV_JSON_CONNECTION
27121 field_addr.name = "city_id32";
27122#endif /* FREECIV_JSON_CONNECTION */
27123 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
27124#ifdef FREECIV_JSON_CONNECTION
27125 field_addr.name = "production_kind";
27126#endif /* FREECIV_JSON_CONNECTION */
27127 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
27128#ifdef FREECIV_JSON_CONNECTION
27129 field_addr.name = "production_value";
27130#endif /* FREECIV_JSON_CONNECTION */
27131 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
27132
27133#endif
27134 SEND_PACKET_END(PACKET_CITY_CHANGE);
27135}
27136
27137#ifdef FREECIV_DELTA_PROTOCOL
27138#define hash_packet_city_change_101 hash_const
27139
27140#define cmp_packet_city_change_101 cmp_const
27141
27142 BV_DEFINE(packet_city_change_101_fields, 3);
27143#endif /* FREECIV_DELTA_PROTOCOL */
27144
27145 static struct packet_city_change *receive_packet_city_change_101(struct connection *pc)
27146{
27147#ifdef FREECIV_DELTA_PROTOCOL
27148 packet_city_change_101_fields fields;
27149 struct packet_city_change *old;
27150 struct genhash **hash = pc->phs.received + PACKET_CITY_CHANGE;
27151#endif /* FREECIV_DELTA_PROTOCOL */
27152 RECEIVE_PACKET_START(packet_city_change, real_packet);
27153#ifdef FREECIV_JSON_CONNECTION
27154 struct plocation field_addr;
27155 {
27156 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27157 field_addr = *field_addr_tmp;
27158 FC_FREE(field_addr_tmp);
27159 }
27160#endif /* FREECIV_JSON_CONNECTION */
27161
27162#ifdef FREECIV_DELTA_PROTOCOL
27163#ifdef FREECIV_JSON_CONNECTION
27164 field_addr.name = "fields";
27165#endif /* FREECIV_JSON_CONNECTION */
27166 DIO_BV_GET(&din, &field_addr, fields);
27167
27168#else /* FREECIV_DELTA_PROTOCOL */
27169 #ifdef FREECIV_JSON_CONNECTION
27170 field_addr.name = "city_id16";
27171 #endif /* FREECIV_JSON_CONNECTION */
27172 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
27173 RECEIVE_PACKET_FIELD_ERROR(city_id16);
27174 }
27175 #ifdef FREECIV_JSON_CONNECTION
27176 field_addr.name = "production_kind";
27177 #endif /* FREECIV_JSON_CONNECTION */
27178 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
27179 RECEIVE_PACKET_FIELD_ERROR(production_kind);
27180 }
27181 #ifdef FREECIV_JSON_CONNECTION
27182 field_addr.name = "production_value";
27183 #endif /* FREECIV_JSON_CONNECTION */
27184 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
27185 RECEIVE_PACKET_FIELD_ERROR(production_value);
27186 }
27187
27188#endif
27189 log_packet_detailed("packet_city_change_101: got info about ()");
27190
27191#ifdef FREECIV_DELTA_PROTOCOL
27192 if (NULL == *hash) {
27193 *hash = genhash_new_full(hash_packet_city_change_101, cmp_packet_city_change_101,
27194 NULL, NULL, NULL, free);
27195 }
27196
27197 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
27198 *real_packet = *old;
27199 } else {
27200 log_packet_detailed(" no old info");
27201 memset(real_packet, 0, sizeof(*real_packet));
27202 }
27203
27204 if (BV_ISSET(fields, 0)) {
27205 log_packet_detailed(" got field 'city_id16'");
27206 #ifdef FREECIV_JSON_CONNECTION
27207 field_addr.name = "city_id16";
27208 #endif /* FREECIV_JSON_CONNECTION */
27209 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
27210 RECEIVE_PACKET_FIELD_ERROR(city_id16);
27211 }
27212 }
27213 if (BV_ISSET(fields, 1)) {
27214 log_packet_detailed(" got field 'production_kind'");
27215 #ifdef FREECIV_JSON_CONNECTION
27216 field_addr.name = "production_kind";
27217 #endif /* FREECIV_JSON_CONNECTION */
27218 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
27219 RECEIVE_PACKET_FIELD_ERROR(production_kind);
27220 }
27221 }
27222 if (BV_ISSET(fields, 2)) {
27223 log_packet_detailed(" got field 'production_value'");
27224 #ifdef FREECIV_JSON_CONNECTION
27225 field_addr.name = "production_value";
27226 #endif /* FREECIV_JSON_CONNECTION */
27227 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
27228 RECEIVE_PACKET_FIELD_ERROR(production_value);
27229 }
27230 }
27231
27232 if (NULL == old) {
27233 old = fc_malloc(sizeof(*old));
27234 *old = *real_packet;
27235 genhash_insert(*hash, old, old);
27236 } else {
27237 *old = *real_packet;
27238 }
27239
27240#endif /* FREECIV_DELTA_PROTOCOL */
27241 RECEIVE_PACKET_END(real_packet);
27242}
27243
27244 static int send_packet_city_change_101(struct connection *pc, const struct packet_city_change *packet)
27245{
27246 const struct packet_city_change *real_packet = packet;
27247#ifdef FREECIV_DELTA_PROTOCOL
27248 packet_city_change_101_fields fields;
27249 struct packet_city_change *old;
27250 bool differ;
27251 struct genhash **hash = pc->phs.sent + PACKET_CITY_CHANGE;
27252#endif /* FREECIV_DELTA_PROTOCOL */
27253 SEND_PACKET_START(PACKET_CITY_CHANGE);
27254#ifdef FREECIV_JSON_CONNECTION
27255 struct plocation field_addr;
27256 {
27257 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27258 field_addr = *field_addr_tmp;
27259 FC_FREE(field_addr_tmp);
27260 }
27261#endif /* FREECIV_JSON_CONNECTION */
27262
27263 log_packet_detailed("packet_city_change_101: sending info about ()");
27264
27265#ifdef FREECIV_DELTA_PROTOCOL
27266 if (NULL == *hash) {
27267 *hash = genhash_new_full(hash_packet_city_change_101, cmp_packet_city_change_101,
27268 NULL, NULL, NULL, free);
27269 }
27270 BV_CLR_ALL(fields);
27271
27272 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
27273 old = fc_malloc(sizeof(*old));
27274 *old = *real_packet;
27275 genhash_insert(*hash, old, old);
27276 memset(old, 0, sizeof(*old));
27277 }
27278 differ = (old->city_id16 != real_packet->city_id16);
27279 if (differ) {
27280 BV_SET(fields, 0);
27281 }
27282
27283 differ = (old->production_kind != real_packet->production_kind);
27284 if (differ) {
27285 BV_SET(fields, 1);
27286 }
27287
27288 differ = (old->production_value != real_packet->production_value);
27289 if (differ) {
27290 BV_SET(fields, 2);
27291 }
27292
27293
27294#ifdef FREECIV_JSON_CONNECTION
27295 field_addr.name = "fields";
27296#endif /* FREECIV_JSON_CONNECTION */
27297 DIO_BV_PUT(&dout, &field_addr, fields);
27298
27299 if (BV_ISSET(fields, 0)) {
27300 log_packet_detailed(" field 'city_id16' has changed");
27301 #ifdef FREECIV_JSON_CONNECTION
27302 field_addr.name = "city_id16";
27303#endif /* FREECIV_JSON_CONNECTION */
27304 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
27305 }
27306 if (BV_ISSET(fields, 1)) {
27307 log_packet_detailed(" field 'production_kind' has changed");
27308 #ifdef FREECIV_JSON_CONNECTION
27309 field_addr.name = "production_kind";
27310#endif /* FREECIV_JSON_CONNECTION */
27311 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
27312 }
27313 if (BV_ISSET(fields, 2)) {
27314 log_packet_detailed(" field 'production_value' has changed");
27315 #ifdef FREECIV_JSON_CONNECTION
27316 field_addr.name = "production_value";
27317#endif /* FREECIV_JSON_CONNECTION */
27318 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
27319 }
27320
27321 *old = *real_packet;
27322#endif /* FREECIV_DELTA_PROTOCOL */
27323#ifndef FREECIV_DELTA_PROTOCOL
27324#ifdef FREECIV_JSON_CONNECTION
27325 field_addr.name = "city_id16";
27326#endif /* FREECIV_JSON_CONNECTION */
27327 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
27328#ifdef FREECIV_JSON_CONNECTION
27329 field_addr.name = "production_kind";
27330#endif /* FREECIV_JSON_CONNECTION */
27331 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
27332#ifdef FREECIV_JSON_CONNECTION
27333 field_addr.name = "production_value";
27334#endif /* FREECIV_JSON_CONNECTION */
27335 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
27336
27337#endif
27338 SEND_PACKET_END(PACKET_CITY_CHANGE);
27339}
27340
27341 int send_packet_city_change(struct connection *pc, const struct packet_city_change *packet)
27342{
27343 if (!pc->used) {
27344 log_error("WARNING: trying to send data to the closed connection %s",
27345 conn_description(pc));
27346 return -1;
27347 }
27348 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_CHANGE].packet != NULL, -1,
27349 "Handler for PACKET_CITY_CHANGE not installed");
27350 return pc->phs.handlers->send[PACKET_CITY_CHANGE].packet(pc, packet);
27351}
27352
27353 int dsend_packet_city_change(struct connection *pc, int city_id16, int city_id32, int production_kind, int production_value)
27354{
27355 struct packet_city_change packet, *real_packet = &packet;
27356
27357 real_packet->city_id16 = city_id16;
27358 real_packet->city_id32 = city_id32;
27359 real_packet->production_kind = production_kind;
27360 real_packet->production_value = production_value;
27361
27362 return send_packet_city_change(pc, real_packet);
27363}
27364
27365#ifdef FREECIV_DELTA_PROTOCOL
27366#define hash_packet_city_worklist_100 hash_const
27367
27368#define cmp_packet_city_worklist_100 cmp_const
27369
27370 BV_DEFINE(packet_city_worklist_100_fields, 2);
27371#endif /* FREECIV_DELTA_PROTOCOL */
27372
27373 static struct packet_city_worklist *receive_packet_city_worklist_100(struct connection *pc)
27374{
27375#ifdef FREECIV_DELTA_PROTOCOL
27376 packet_city_worklist_100_fields fields;
27377 struct packet_city_worklist *old;
27378 struct genhash **hash = pc->phs.received + PACKET_CITY_WORKLIST;
27379#endif /* FREECIV_DELTA_PROTOCOL */
27380 RECEIVE_PACKET_START(packet_city_worklist, real_packet);
27381#ifdef FREECIV_JSON_CONNECTION
27382 struct plocation field_addr;
27383 {
27384 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27385 field_addr = *field_addr_tmp;
27386 FC_FREE(field_addr_tmp);
27387 }
27388#endif /* FREECIV_JSON_CONNECTION */
27389
27390#ifdef FREECIV_DELTA_PROTOCOL
27391#ifdef FREECIV_JSON_CONNECTION
27392 field_addr.name = "fields";
27393#endif /* FREECIV_JSON_CONNECTION */
27394 DIO_BV_GET(&din, &field_addr, fields);
27395
27396#else /* FREECIV_DELTA_PROTOCOL */
27397 #ifdef FREECIV_JSON_CONNECTION
27398 field_addr.name = "city_id32";
27399 #endif /* FREECIV_JSON_CONNECTION */
27400 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
27401 RECEIVE_PACKET_FIELD_ERROR(city_id32);
27402 }
27403 #ifdef FREECIV_JSON_CONNECTION
27404 field_addr.name = "worklist";
27405 #endif /* FREECIV_JSON_CONNECTION */
27406 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
27407 RECEIVE_PACKET_FIELD_ERROR(worklist);
27408 }
27409
27410#endif
27411 log_packet_detailed("packet_city_worklist_100: got info about ()");
27412
27413#ifdef FREECIV_DELTA_PROTOCOL
27414 if (NULL == *hash) {
27415 *hash = genhash_new_full(hash_packet_city_worklist_100, cmp_packet_city_worklist_100,
27416 NULL, NULL, NULL, free);
27417 }
27418
27419 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
27420 *real_packet = *old;
27421 } else {
27422 log_packet_detailed(" no old info");
27423 memset(real_packet, 0, sizeof(*real_packet));
27424 }
27425
27426 if (BV_ISSET(fields, 0)) {
27427 log_packet_detailed(" got field 'city_id32'");
27428 #ifdef FREECIV_JSON_CONNECTION
27429 field_addr.name = "city_id32";
27430 #endif /* FREECIV_JSON_CONNECTION */
27431 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
27432 RECEIVE_PACKET_FIELD_ERROR(city_id32);
27433 }
27434 }
27435 if (BV_ISSET(fields, 1)) {
27436 log_packet_detailed(" got field 'worklist'");
27437 #ifdef FREECIV_JSON_CONNECTION
27438 field_addr.name = "worklist";
27439 #endif /* FREECIV_JSON_CONNECTION */
27440 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
27441 RECEIVE_PACKET_FIELD_ERROR(worklist);
27442 }
27443 }
27444
27445 if (NULL == old) {
27446 old = fc_malloc(sizeof(*old));
27447 *old = *real_packet;
27448 genhash_insert(*hash, old, old);
27449 } else {
27450 *old = *real_packet;
27451 }
27452
27453#endif /* FREECIV_DELTA_PROTOCOL */
27454 RECEIVE_PACKET_END(real_packet);
27455}
27456
27457 static int send_packet_city_worklist_100(struct connection *pc, const struct packet_city_worklist *packet)
27458{
27459 const struct packet_city_worklist *real_packet = packet;
27460#ifdef FREECIV_DELTA_PROTOCOL
27461 packet_city_worklist_100_fields fields;
27462 struct packet_city_worklist *old;
27463 bool differ;
27464 struct genhash **hash = pc->phs.sent + PACKET_CITY_WORKLIST;
27465#endif /* FREECIV_DELTA_PROTOCOL */
27466 SEND_PACKET_START(PACKET_CITY_WORKLIST);
27467#ifdef FREECIV_JSON_CONNECTION
27468 struct plocation field_addr;
27469 {
27470 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27471 field_addr = *field_addr_tmp;
27472 FC_FREE(field_addr_tmp);
27473 }
27474#endif /* FREECIV_JSON_CONNECTION */
27475
27476 log_packet_detailed("packet_city_worklist_100: sending info about ()");
27477
27478#ifdef FREECIV_DELTA_PROTOCOL
27479 if (NULL == *hash) {
27480 *hash = genhash_new_full(hash_packet_city_worklist_100, cmp_packet_city_worklist_100,
27481 NULL, NULL, NULL, free);
27482 }
27483 BV_CLR_ALL(fields);
27484
27485 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
27486 old = fc_malloc(sizeof(*old));
27487 *old = *real_packet;
27488 genhash_insert(*hash, old, old);
27489 memset(old, 0, sizeof(*old));
27490 }
27491 differ = (old->city_id32 != real_packet->city_id32);
27492 if (differ) {
27493 BV_SET(fields, 0);
27494 }
27495
27496 differ = !are_worklists_equal(&old->worklist, &real_packet->worklist);
27497 if (differ) {
27498 BV_SET(fields, 1);
27499 }
27500
27501
27502#ifdef FREECIV_JSON_CONNECTION
27503 field_addr.name = "fields";
27504#endif /* FREECIV_JSON_CONNECTION */
27505 DIO_BV_PUT(&dout, &field_addr, fields);
27506
27507 if (BV_ISSET(fields, 0)) {
27508 log_packet_detailed(" field 'city_id32' has changed");
27509 #ifdef FREECIV_JSON_CONNECTION
27510 field_addr.name = "city_id32";
27511#endif /* FREECIV_JSON_CONNECTION */
27512 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
27513 }
27514 if (BV_ISSET(fields, 1)) {
27515 log_packet_detailed(" field 'worklist' has changed");
27516 #ifdef FREECIV_JSON_CONNECTION
27517 field_addr.name = "worklist";
27518#endif /* FREECIV_JSON_CONNECTION */
27519 DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
27520 }
27521
27522 *old = *real_packet;
27523#endif /* FREECIV_DELTA_PROTOCOL */
27524#ifndef FREECIV_DELTA_PROTOCOL
27525#ifdef FREECIV_JSON_CONNECTION
27526 field_addr.name = "city_id32";
27527#endif /* FREECIV_JSON_CONNECTION */
27528 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
27529#ifdef FREECIV_JSON_CONNECTION
27530 field_addr.name = "worklist";
27531#endif /* FREECIV_JSON_CONNECTION */
27532 DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
27533
27534#endif
27535 SEND_PACKET_END(PACKET_CITY_WORKLIST);
27536}
27537
27538#ifdef FREECIV_DELTA_PROTOCOL
27539#define hash_packet_city_worklist_101 hash_const
27540
27541#define cmp_packet_city_worklist_101 cmp_const
27542
27543 BV_DEFINE(packet_city_worklist_101_fields, 2);
27544#endif /* FREECIV_DELTA_PROTOCOL */
27545
27546 static struct packet_city_worklist *receive_packet_city_worklist_101(struct connection *pc)
27547{
27548#ifdef FREECIV_DELTA_PROTOCOL
27549 packet_city_worklist_101_fields fields;
27550 struct packet_city_worklist *old;
27551 struct genhash **hash = pc->phs.received + PACKET_CITY_WORKLIST;
27552#endif /* FREECIV_DELTA_PROTOCOL */
27553 RECEIVE_PACKET_START(packet_city_worklist, real_packet);
27554#ifdef FREECIV_JSON_CONNECTION
27555 struct plocation field_addr;
27556 {
27557 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27558 field_addr = *field_addr_tmp;
27559 FC_FREE(field_addr_tmp);
27560 }
27561#endif /* FREECIV_JSON_CONNECTION */
27562
27563#ifdef FREECIV_DELTA_PROTOCOL
27564#ifdef FREECIV_JSON_CONNECTION
27565 field_addr.name = "fields";
27566#endif /* FREECIV_JSON_CONNECTION */
27567 DIO_BV_GET(&din, &field_addr, fields);
27568
27569#else /* FREECIV_DELTA_PROTOCOL */
27570 #ifdef FREECIV_JSON_CONNECTION
27571 field_addr.name = "city_id16";
27572 #endif /* FREECIV_JSON_CONNECTION */
27573 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
27574 RECEIVE_PACKET_FIELD_ERROR(city_id16);
27575 }
27576 #ifdef FREECIV_JSON_CONNECTION
27577 field_addr.name = "worklist";
27578 #endif /* FREECIV_JSON_CONNECTION */
27579 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
27580 RECEIVE_PACKET_FIELD_ERROR(worklist);
27581 }
27582
27583#endif
27584 log_packet_detailed("packet_city_worklist_101: got info about ()");
27585
27586#ifdef FREECIV_DELTA_PROTOCOL
27587 if (NULL == *hash) {
27588 *hash = genhash_new_full(hash_packet_city_worklist_101, cmp_packet_city_worklist_101,
27589 NULL, NULL, NULL, free);
27590 }
27591
27592 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
27593 *real_packet = *old;
27594 } else {
27595 log_packet_detailed(" no old info");
27596 memset(real_packet, 0, sizeof(*real_packet));
27597 }
27598
27599 if (BV_ISSET(fields, 0)) {
27600 log_packet_detailed(" got field 'city_id16'");
27601 #ifdef FREECIV_JSON_CONNECTION
27602 field_addr.name = "city_id16";
27603 #endif /* FREECIV_JSON_CONNECTION */
27604 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
27605 RECEIVE_PACKET_FIELD_ERROR(city_id16);
27606 }
27607 }
27608 if (BV_ISSET(fields, 1)) {
27609 log_packet_detailed(" got field 'worklist'");
27610 #ifdef FREECIV_JSON_CONNECTION
27611 field_addr.name = "worklist";
27612 #endif /* FREECIV_JSON_CONNECTION */
27613 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
27614 RECEIVE_PACKET_FIELD_ERROR(worklist);
27615 }
27616 }
27617
27618 if (NULL == old) {
27619 old = fc_malloc(sizeof(*old));
27620 *old = *real_packet;
27621 genhash_insert(*hash, old, old);
27622 } else {
27623 *old = *real_packet;
27624 }
27625
27626#endif /* FREECIV_DELTA_PROTOCOL */
27627 RECEIVE_PACKET_END(real_packet);
27628}
27629
27630 static int send_packet_city_worklist_101(struct connection *pc, const struct packet_city_worklist *packet)
27631{
27632 const struct packet_city_worklist *real_packet = packet;
27633#ifdef FREECIV_DELTA_PROTOCOL
27634 packet_city_worklist_101_fields fields;
27635 struct packet_city_worklist *old;
27636 bool differ;
27637 struct genhash **hash = pc->phs.sent + PACKET_CITY_WORKLIST;
27638#endif /* FREECIV_DELTA_PROTOCOL */
27639 SEND_PACKET_START(PACKET_CITY_WORKLIST);
27640#ifdef FREECIV_JSON_CONNECTION
27641 struct plocation field_addr;
27642 {
27643 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27644 field_addr = *field_addr_tmp;
27645 FC_FREE(field_addr_tmp);
27646 }
27647#endif /* FREECIV_JSON_CONNECTION */
27648
27649 log_packet_detailed("packet_city_worklist_101: sending info about ()");
27650
27651#ifdef FREECIV_DELTA_PROTOCOL
27652 if (NULL == *hash) {
27653 *hash = genhash_new_full(hash_packet_city_worklist_101, cmp_packet_city_worklist_101,
27654 NULL, NULL, NULL, free);
27655 }
27656 BV_CLR_ALL(fields);
27657
27658 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
27659 old = fc_malloc(sizeof(*old));
27660 *old = *real_packet;
27661 genhash_insert(*hash, old, old);
27662 memset(old, 0, sizeof(*old));
27663 }
27664 differ = (old->city_id16 != real_packet->city_id16);
27665 if (differ) {
27666 BV_SET(fields, 0);
27667 }
27668
27669 differ = !are_worklists_equal(&old->worklist, &real_packet->worklist);
27670 if (differ) {
27671 BV_SET(fields, 1);
27672 }
27673
27674
27675#ifdef FREECIV_JSON_CONNECTION
27676 field_addr.name = "fields";
27677#endif /* FREECIV_JSON_CONNECTION */
27678 DIO_BV_PUT(&dout, &field_addr, fields);
27679
27680 if (BV_ISSET(fields, 0)) {
27681 log_packet_detailed(" field 'city_id16' has changed");
27682 #ifdef FREECIV_JSON_CONNECTION
27683 field_addr.name = "city_id16";
27684#endif /* FREECIV_JSON_CONNECTION */
27685 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
27686 }
27687 if (BV_ISSET(fields, 1)) {
27688 log_packet_detailed(" field 'worklist' has changed");
27689 #ifdef FREECIV_JSON_CONNECTION
27690 field_addr.name = "worklist";
27691#endif /* FREECIV_JSON_CONNECTION */
27692 DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
27693 }
27694
27695 *old = *real_packet;
27696#endif /* FREECIV_DELTA_PROTOCOL */
27697#ifndef FREECIV_DELTA_PROTOCOL
27698#ifdef FREECIV_JSON_CONNECTION
27699 field_addr.name = "city_id16";
27700#endif /* FREECIV_JSON_CONNECTION */
27701 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
27702#ifdef FREECIV_JSON_CONNECTION
27703 field_addr.name = "worklist";
27704#endif /* FREECIV_JSON_CONNECTION */
27705 DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
27706
27707#endif
27708 SEND_PACKET_END(PACKET_CITY_WORKLIST);
27709}
27710
27711 int send_packet_city_worklist(struct connection *pc, const struct packet_city_worklist *packet)
27712{
27713 if (!pc->used) {
27714 log_error("WARNING: trying to send data to the closed connection %s",
27715 conn_description(pc));
27716 return -1;
27717 }
27718 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_WORKLIST].packet != NULL, -1,
27719 "Handler for PACKET_CITY_WORKLIST not installed");
27720 return pc->phs.handlers->send[PACKET_CITY_WORKLIST].packet(pc, packet);
27721}
27722
27723 int dsend_packet_city_worklist(struct connection *pc, int city_id16, int city_id32, const struct worklist *worklist)
27724{
27725 struct packet_city_worklist packet, *real_packet = &packet;
27726
27727 real_packet->city_id16 = city_id16;
27728 real_packet->city_id32 = city_id32;
27729 worklist_copy(&real_packet->worklist, worklist);
27730
27731 return send_packet_city_worklist(pc, real_packet);
27732}
27733
27734#ifdef FREECIV_DELTA_PROTOCOL
27735#define hash_packet_city_make_specialist_100 hash_const
27736
27737#define cmp_packet_city_make_specialist_100 cmp_const
27738
27739 BV_DEFINE(packet_city_make_specialist_100_fields, 2);
27740#endif /* FREECIV_DELTA_PROTOCOL */
27741
27742 static struct packet_city_make_specialist *receive_packet_city_make_specialist_100(struct connection *pc)
27743{
27744#ifdef FREECIV_DELTA_PROTOCOL
27745 packet_city_make_specialist_100_fields fields;
27746 struct packet_city_make_specialist *old;
27747 struct genhash **hash = pc->phs.received + PACKET_CITY_MAKE_SPECIALIST;
27748#endif /* FREECIV_DELTA_PROTOCOL */
27749 RECEIVE_PACKET_START(packet_city_make_specialist, real_packet);
27750#ifdef FREECIV_JSON_CONNECTION
27751 struct plocation field_addr;
27752 {
27753 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27754 field_addr = *field_addr_tmp;
27755 FC_FREE(field_addr_tmp);
27756 }
27757#endif /* FREECIV_JSON_CONNECTION */
27758
27759#ifdef FREECIV_DELTA_PROTOCOL
27760#ifdef FREECIV_JSON_CONNECTION
27761 field_addr.name = "fields";
27762#endif /* FREECIV_JSON_CONNECTION */
27763 DIO_BV_GET(&din, &field_addr, fields);
27764
27765#else /* FREECIV_DELTA_PROTOCOL */
27766 #ifdef FREECIV_JSON_CONNECTION
27767 field_addr.name = "city_id32";
27768 #endif /* FREECIV_JSON_CONNECTION */
27769 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
27770 RECEIVE_PACKET_FIELD_ERROR(city_id32);
27771 }
27772 #ifdef FREECIV_JSON_CONNECTION
27773 field_addr.name = "tile_id";
27774 #endif /* FREECIV_JSON_CONNECTION */
27775 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
27776 RECEIVE_PACKET_FIELD_ERROR(tile_id);
27777 }
27778
27779#endif
27780 log_packet_detailed("packet_city_make_specialist_100: got info about ()");
27781
27782#ifdef FREECIV_DELTA_PROTOCOL
27783 if (NULL == *hash) {
27784 *hash = genhash_new_full(hash_packet_city_make_specialist_100, cmp_packet_city_make_specialist_100,
27785 NULL, NULL, NULL, free);
27786 }
27787
27788 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
27789 *real_packet = *old;
27790 } else {
27791 log_packet_detailed(" no old info");
27792 memset(real_packet, 0, sizeof(*real_packet));
27793 }
27794
27795 if (BV_ISSET(fields, 0)) {
27796 log_packet_detailed(" got field 'city_id32'");
27797 #ifdef FREECIV_JSON_CONNECTION
27798 field_addr.name = "city_id32";
27799 #endif /* FREECIV_JSON_CONNECTION */
27800 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
27801 RECEIVE_PACKET_FIELD_ERROR(city_id32);
27802 }
27803 }
27804 if (BV_ISSET(fields, 1)) {
27805 log_packet_detailed(" got field 'tile_id'");
27806 #ifdef FREECIV_JSON_CONNECTION
27807 field_addr.name = "tile_id";
27808 #endif /* FREECIV_JSON_CONNECTION */
27809 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
27810 RECEIVE_PACKET_FIELD_ERROR(tile_id);
27811 }
27812 }
27813
27814 if (NULL == old) {
27815 old = fc_malloc(sizeof(*old));
27816 *old = *real_packet;
27817 genhash_insert(*hash, old, old);
27818 } else {
27819 *old = *real_packet;
27820 }
27821
27822#endif /* FREECIV_DELTA_PROTOCOL */
27823 RECEIVE_PACKET_END(real_packet);
27824}
27825
27826 static int send_packet_city_make_specialist_100(struct connection *pc, const struct packet_city_make_specialist *packet)
27827{
27828 const struct packet_city_make_specialist *real_packet = packet;
27829#ifdef FREECIV_DELTA_PROTOCOL
27830 packet_city_make_specialist_100_fields fields;
27831 struct packet_city_make_specialist *old;
27832 bool differ;
27833 struct genhash **hash = pc->phs.sent + PACKET_CITY_MAKE_SPECIALIST;
27834#endif /* FREECIV_DELTA_PROTOCOL */
27835 SEND_PACKET_START(PACKET_CITY_MAKE_SPECIALIST);
27836#ifdef FREECIV_JSON_CONNECTION
27837 struct plocation field_addr;
27838 {
27839 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27840 field_addr = *field_addr_tmp;
27841 FC_FREE(field_addr_tmp);
27842 }
27843#endif /* FREECIV_JSON_CONNECTION */
27844
27845 log_packet_detailed("packet_city_make_specialist_100: sending info about ()");
27846
27847#ifdef FREECIV_DELTA_PROTOCOL
27848 if (NULL == *hash) {
27849 *hash = genhash_new_full(hash_packet_city_make_specialist_100, cmp_packet_city_make_specialist_100,
27850 NULL, NULL, NULL, free);
27851 }
27852 BV_CLR_ALL(fields);
27853
27854 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
27855 old = fc_malloc(sizeof(*old));
27856 *old = *real_packet;
27857 genhash_insert(*hash, old, old);
27858 memset(old, 0, sizeof(*old));
27859 }
27860 differ = (old->city_id32 != real_packet->city_id32);
27861 if (differ) {
27862 BV_SET(fields, 0);
27863 }
27864
27865 differ = (old->tile_id != real_packet->tile_id);
27866 if (differ) {
27867 BV_SET(fields, 1);
27868 }
27869
27870
27871#ifdef FREECIV_JSON_CONNECTION
27872 field_addr.name = "fields";
27873#endif /* FREECIV_JSON_CONNECTION */
27874 DIO_BV_PUT(&dout, &field_addr, fields);
27875
27876 if (BV_ISSET(fields, 0)) {
27877 log_packet_detailed(" field 'city_id32' has changed");
27878 #ifdef FREECIV_JSON_CONNECTION
27879 field_addr.name = "city_id32";
27880#endif /* FREECIV_JSON_CONNECTION */
27881 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
27882 }
27883 if (BV_ISSET(fields, 1)) {
27884 log_packet_detailed(" field 'tile_id' has changed");
27885 #ifdef FREECIV_JSON_CONNECTION
27886 field_addr.name = "tile_id";
27887#endif /* FREECIV_JSON_CONNECTION */
27888 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
27889 }
27890
27891 *old = *real_packet;
27892#endif /* FREECIV_DELTA_PROTOCOL */
27893#ifndef FREECIV_DELTA_PROTOCOL
27894#ifdef FREECIV_JSON_CONNECTION
27895 field_addr.name = "city_id32";
27896#endif /* FREECIV_JSON_CONNECTION */
27897 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
27898#ifdef FREECIV_JSON_CONNECTION
27899 field_addr.name = "tile_id";
27900#endif /* FREECIV_JSON_CONNECTION */
27901 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
27902
27903#endif
27904 SEND_PACKET_END(PACKET_CITY_MAKE_SPECIALIST);
27905}
27906
27907#ifdef FREECIV_DELTA_PROTOCOL
27908#define hash_packet_city_make_specialist_101 hash_const
27909
27910#define cmp_packet_city_make_specialist_101 cmp_const
27911
27912 BV_DEFINE(packet_city_make_specialist_101_fields, 2);
27913#endif /* FREECIV_DELTA_PROTOCOL */
27914
27915 static struct packet_city_make_specialist *receive_packet_city_make_specialist_101(struct connection *pc)
27916{
27917#ifdef FREECIV_DELTA_PROTOCOL
27918 packet_city_make_specialist_101_fields fields;
27919 struct packet_city_make_specialist *old;
27920 struct genhash **hash = pc->phs.received + PACKET_CITY_MAKE_SPECIALIST;
27921#endif /* FREECIV_DELTA_PROTOCOL */
27922 RECEIVE_PACKET_START(packet_city_make_specialist, real_packet);
27923#ifdef FREECIV_JSON_CONNECTION
27924 struct plocation field_addr;
27925 {
27926 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27927 field_addr = *field_addr_tmp;
27928 FC_FREE(field_addr_tmp);
27929 }
27930#endif /* FREECIV_JSON_CONNECTION */
27931
27932#ifdef FREECIV_DELTA_PROTOCOL
27933#ifdef FREECIV_JSON_CONNECTION
27934 field_addr.name = "fields";
27935#endif /* FREECIV_JSON_CONNECTION */
27936 DIO_BV_GET(&din, &field_addr, fields);
27937
27938#else /* FREECIV_DELTA_PROTOCOL */
27939 #ifdef FREECIV_JSON_CONNECTION
27940 field_addr.name = "city_id16";
27941 #endif /* FREECIV_JSON_CONNECTION */
27942 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
27943 RECEIVE_PACKET_FIELD_ERROR(city_id16);
27944 }
27945 #ifdef FREECIV_JSON_CONNECTION
27946 field_addr.name = "tile_id";
27947 #endif /* FREECIV_JSON_CONNECTION */
27948 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
27949 RECEIVE_PACKET_FIELD_ERROR(tile_id);
27950 }
27951
27952#endif
27953 log_packet_detailed("packet_city_make_specialist_101: got info about ()");
27954
27955#ifdef FREECIV_DELTA_PROTOCOL
27956 if (NULL == *hash) {
27957 *hash = genhash_new_full(hash_packet_city_make_specialist_101, cmp_packet_city_make_specialist_101,
27958 NULL, NULL, NULL, free);
27959 }
27960
27961 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
27962 *real_packet = *old;
27963 } else {
27964 log_packet_detailed(" no old info");
27965 memset(real_packet, 0, sizeof(*real_packet));
27966 }
27967
27968 if (BV_ISSET(fields, 0)) {
27969 log_packet_detailed(" got field 'city_id16'");
27970 #ifdef FREECIV_JSON_CONNECTION
27971 field_addr.name = "city_id16";
27972 #endif /* FREECIV_JSON_CONNECTION */
27973 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
27974 RECEIVE_PACKET_FIELD_ERROR(city_id16);
27975 }
27976 }
27977 if (BV_ISSET(fields, 1)) {
27978 log_packet_detailed(" got field 'tile_id'");
27979 #ifdef FREECIV_JSON_CONNECTION
27980 field_addr.name = "tile_id";
27981 #endif /* FREECIV_JSON_CONNECTION */
27982 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
27983 RECEIVE_PACKET_FIELD_ERROR(tile_id);
27984 }
27985 }
27986
27987 if (NULL == old) {
27988 old = fc_malloc(sizeof(*old));
27989 *old = *real_packet;
27990 genhash_insert(*hash, old, old);
27991 } else {
27992 *old = *real_packet;
27993 }
27994
27995#endif /* FREECIV_DELTA_PROTOCOL */
27996 RECEIVE_PACKET_END(real_packet);
27997}
27998
27999 static int send_packet_city_make_specialist_101(struct connection *pc, const struct packet_city_make_specialist *packet)
28000{
28001 const struct packet_city_make_specialist *real_packet = packet;
28002#ifdef FREECIV_DELTA_PROTOCOL
28003 packet_city_make_specialist_101_fields fields;
28004 struct packet_city_make_specialist *old;
28005 bool differ;
28006 struct genhash **hash = pc->phs.sent + PACKET_CITY_MAKE_SPECIALIST;
28007#endif /* FREECIV_DELTA_PROTOCOL */
28008 SEND_PACKET_START(PACKET_CITY_MAKE_SPECIALIST);
28009#ifdef FREECIV_JSON_CONNECTION
28010 struct plocation field_addr;
28011 {
28012 struct plocation *field_addr_tmp = plocation_field_new(NULL);
28013 field_addr = *field_addr_tmp;
28014 FC_FREE(field_addr_tmp);
28015 }
28016#endif /* FREECIV_JSON_CONNECTION */
28017
28018 log_packet_detailed("packet_city_make_specialist_101: sending info about ()");
28019
28020#ifdef FREECIV_DELTA_PROTOCOL
28021 if (NULL == *hash) {
28022 *hash = genhash_new_full(hash_packet_city_make_specialist_101, cmp_packet_city_make_specialist_101,
28023 NULL, NULL, NULL, free);
28024 }
28025 BV_CLR_ALL(fields);
28026
28027 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
28028 old = fc_malloc(sizeof(*old));
28029 *old = *real_packet;
28030 genhash_insert(*hash, old, old);
28031 memset(old, 0, sizeof(*old));
28032 }
28033 differ = (old->city_id16 != real_packet->city_id16);
28034 if (differ) {
28035 BV_SET(fields, 0);
28036 }
28037
28038 differ = (old->tile_id != real_packet->tile_id);
28039 if (differ) {
28040 BV_SET(fields, 1);
28041 }
28042
28043
28044#ifdef FREECIV_JSON_CONNECTION
28045 field_addr.name = "fields";
28046#endif /* FREECIV_JSON_CONNECTION */
28047 DIO_BV_PUT(&dout, &field_addr, fields);
28048
28049 if (BV_ISSET(fields, 0)) {
28050 log_packet_detailed(" field 'city_id16' has changed");
28051 #ifdef FREECIV_JSON_CONNECTION
28052 field_addr.name = "city_id16";
28053#endif /* FREECIV_JSON_CONNECTION */
28054 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
28055 }
28056 if (BV_ISSET(fields, 1)) {
28057 log_packet_detailed(" field 'tile_id' has changed");
28058 #ifdef FREECIV_JSON_CONNECTION
28059 field_addr.name = "tile_id";
28060#endif /* FREECIV_JSON_CONNECTION */
28061 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
28062 }
28063
28064 *old = *real_packet;
28065#endif /* FREECIV_DELTA_PROTOCOL */
28066#ifndef FREECIV_DELTA_PROTOCOL
28067#ifdef FREECIV_JSON_CONNECTION
28068 field_addr.name = "city_id16";
28069#endif /* FREECIV_JSON_CONNECTION */
28070 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
28071#ifdef FREECIV_JSON_CONNECTION
28072 field_addr.name = "tile_id";
28073#endif /* FREECIV_JSON_CONNECTION */
28074 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
28075
28076#endif
28077 SEND_PACKET_END(PACKET_CITY_MAKE_SPECIALIST);
28078}
28079
28080 int send_packet_city_make_specialist(struct connection *pc, const struct packet_city_make_specialist *packet)
28081{
28082 if (!pc->used) {
28083 log_error("WARNING: trying to send data to the closed connection %s",
28084 conn_description(pc));
28085 return -1;
28086 }
28087 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_MAKE_SPECIALIST].packet != NULL, -1,
28088 "Handler for PACKET_CITY_MAKE_SPECIALIST not installed");
28089 return pc->phs.handlers->send[PACKET_CITY_MAKE_SPECIALIST].packet(pc, packet);
28090}
28091
28092 int dsend_packet_city_make_specialist(struct connection *pc, int city_id16, int city_id32, int tile_id)
28093{
28094 struct packet_city_make_specialist packet, *real_packet = &packet;
28095
28096 real_packet->city_id16 = city_id16;
28097 real_packet->city_id32 = city_id32;
28098 real_packet->tile_id = tile_id;
28099
28100 return send_packet_city_make_specialist(pc, real_packet);
28101}
28102
28103#ifdef FREECIV_DELTA_PROTOCOL
28104#define hash_packet_city_make_worker_100 hash_const
28105
28106#define cmp_packet_city_make_worker_100 cmp_const
28107
28108 BV_DEFINE(packet_city_make_worker_100_fields, 2);
28109#endif /* FREECIV_DELTA_PROTOCOL */
28110
28111 static struct packet_city_make_worker *receive_packet_city_make_worker_100(struct connection *pc)
28112{
28113#ifdef FREECIV_DELTA_PROTOCOL
28114 packet_city_make_worker_100_fields fields;
28115 struct packet_city_make_worker *old;
28116 struct genhash **hash = pc->phs.received + PACKET_CITY_MAKE_WORKER;
28117#endif /* FREECIV_DELTA_PROTOCOL */
28118 RECEIVE_PACKET_START(packet_city_make_worker, real_packet);
28119#ifdef FREECIV_JSON_CONNECTION
28120 struct plocation field_addr;
28121 {
28122 struct plocation *field_addr_tmp = plocation_field_new(NULL);
28123 field_addr = *field_addr_tmp;
28124 FC_FREE(field_addr_tmp);
28125 }
28126#endif /* FREECIV_JSON_CONNECTION */
28127
28128#ifdef FREECIV_DELTA_PROTOCOL
28129#ifdef FREECIV_JSON_CONNECTION
28130 field_addr.name = "fields";
28131#endif /* FREECIV_JSON_CONNECTION */
28132 DIO_BV_GET(&din, &field_addr, fields);
28133
28134#else /* FREECIV_DELTA_PROTOCOL */
28135 #ifdef FREECIV_JSON_CONNECTION
28136 field_addr.name = "city_id32";
28137 #endif /* FREECIV_JSON_CONNECTION */
28138 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
28139 RECEIVE_PACKET_FIELD_ERROR(city_id32);
28140 }
28141 #ifdef FREECIV_JSON_CONNECTION
28142 field_addr.name = "tile_id";
28143 #endif /* FREECIV_JSON_CONNECTION */
28144 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
28145 RECEIVE_PACKET_FIELD_ERROR(tile_id);
28146 }
28147
28148#endif
28149 log_packet_detailed("packet_city_make_worker_100: got info about ()");
28150
28151#ifdef FREECIV_DELTA_PROTOCOL
28152 if (NULL == *hash) {
28153 *hash = genhash_new_full(hash_packet_city_make_worker_100, cmp_packet_city_make_worker_100,
28154 NULL, NULL, NULL, free);
28155 }
28156
28157 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
28158 *real_packet = *old;
28159 } else {
28160 log_packet_detailed(" no old info");
28161 memset(real_packet, 0, sizeof(*real_packet));
28162 }
28163
28164 if (BV_ISSET(fields, 0)) {
28165 log_packet_detailed(" got field 'city_id32'");
28166 #ifdef FREECIV_JSON_CONNECTION
28167 field_addr.name = "city_id32";
28168 #endif /* FREECIV_JSON_CONNECTION */
28169 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
28170 RECEIVE_PACKET_FIELD_ERROR(city_id32);
28171 }
28172 }
28173 if (BV_ISSET(fields, 1)) {
28174 log_packet_detailed(" got field 'tile_id'");
28175 #ifdef FREECIV_JSON_CONNECTION
28176 field_addr.name = "tile_id";
28177 #endif /* FREECIV_JSON_CONNECTION */
28178 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
28179 RECEIVE_PACKET_FIELD_ERROR(tile_id);
28180 }
28181 }
28182
28183 if (NULL == old) {
28184 old = fc_malloc(sizeof(*old));
28185 *old = *real_packet;
28186 genhash_insert(*hash, old, old);
28187 } else {
28188 *old = *real_packet;
28189 }
28190
28191#endif /* FREECIV_DELTA_PROTOCOL */
28192 RECEIVE_PACKET_END(real_packet);
28193}
28194
28195 static int send_packet_city_make_worker_100(struct connection *pc, const struct packet_city_make_worker *packet)
28196{
28197 const struct packet_city_make_worker *real_packet = packet;
28198#ifdef FREECIV_DELTA_PROTOCOL
28199 packet_city_make_worker_100_fields fields;
28200 struct packet_city_make_worker *old;
28201 bool differ;
28202 struct genhash **hash = pc->phs.sent + PACKET_CITY_MAKE_WORKER;
28203#endif /* FREECIV_DELTA_PROTOCOL */
28204 SEND_PACKET_START(PACKET_CITY_MAKE_WORKER);
28205#ifdef FREECIV_JSON_CONNECTION
28206 struct plocation field_addr;
28207 {
28208 struct plocation *field_addr_tmp = plocation_field_new(NULL);
28209 field_addr = *field_addr_tmp;
28210 FC_FREE(field_addr_tmp);
28211 }
28212#endif /* FREECIV_JSON_CONNECTION */
28213
28214 log_packet_detailed("packet_city_make_worker_100: sending info about ()");
28215
28216#ifdef FREECIV_DELTA_PROTOCOL
28217 if (NULL == *hash) {
28218 *hash = genhash_new_full(hash_packet_city_make_worker_100, cmp_packet_city_make_worker_100,
28219 NULL, NULL, NULL, free);
28220 }
28221 BV_CLR_ALL(fields);
28222
28223 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
28224 old = fc_malloc(sizeof(*old));
28225 *old = *real_packet;
28226 genhash_insert(*hash, old, old);
28227 memset(old, 0, sizeof(*old));
28228 }
28229 differ = (old->city_id32 != real_packet->city_id32);
28230 if (differ) {
28231 BV_SET(fields, 0);
28232 }
28233
28234 differ = (old->tile_id != real_packet->tile_id);
28235 if (differ) {
28236 BV_SET(fields, 1);
28237 }
28238
28239
28240#ifdef FREECIV_JSON_CONNECTION
28241 field_addr.name = "fields";
28242#endif /* FREECIV_JSON_CONNECTION */
28243 DIO_BV_PUT(&dout, &field_addr, fields);
28244
28245 if (BV_ISSET(fields, 0)) {
28246 log_packet_detailed(" field 'city_id32' has changed");
28247 #ifdef FREECIV_JSON_CONNECTION
28248 field_addr.name = "city_id32";
28249#endif /* FREECIV_JSON_CONNECTION */
28250 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
28251 }
28252 if (BV_ISSET(fields, 1)) {
28253 log_packet_detailed(" field 'tile_id' has changed");
28254 #ifdef FREECIV_JSON_CONNECTION
28255 field_addr.name = "tile_id";
28256#endif /* FREECIV_JSON_CONNECTION */
28257 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
28258 }
28259
28260 *old = *real_packet;
28261#endif /* FREECIV_DELTA_PROTOCOL */
28262#ifndef FREECIV_DELTA_PROTOCOL
28263#ifdef FREECIV_JSON_CONNECTION
28264 field_addr.name = "city_id32";
28265#endif /* FREECIV_JSON_CONNECTION */
28266 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
28267#ifdef FREECIV_JSON_CONNECTION
28268 field_addr.name = "tile_id";
28269#endif /* FREECIV_JSON_CONNECTION */
28270 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
28271
28272#endif
28273 SEND_PACKET_END(PACKET_CITY_MAKE_WORKER);
28274}
28275
28276#ifdef FREECIV_DELTA_PROTOCOL
28277#define hash_packet_city_make_worker_101 hash_const
28278
28279#define cmp_packet_city_make_worker_101 cmp_const
28280
28281 BV_DEFINE(packet_city_make_worker_101_fields, 2);
28282#endif /* FREECIV_DELTA_PROTOCOL */
28283
28284 static struct packet_city_make_worker *receive_packet_city_make_worker_101(struct connection *pc)
28285{
28286#ifdef FREECIV_DELTA_PROTOCOL
28287 packet_city_make_worker_101_fields fields;
28288 struct packet_city_make_worker *old;
28289 struct genhash **hash = pc->phs.received + PACKET_CITY_MAKE_WORKER;
28290#endif /* FREECIV_DELTA_PROTOCOL */
28291 RECEIVE_PACKET_START(packet_city_make_worker, real_packet);
28292#ifdef FREECIV_JSON_CONNECTION
28293 struct plocation field_addr;
28294 {
28295 struct plocation *field_addr_tmp = plocation_field_new(NULL);
28296 field_addr = *field_addr_tmp;
28297 FC_FREE(field_addr_tmp);
28298 }
28299#endif /* FREECIV_JSON_CONNECTION */
28300
28301#ifdef FREECIV_DELTA_PROTOCOL
28302#ifdef FREECIV_JSON_CONNECTION
28303 field_addr.name = "fields";
28304#endif /* FREECIV_JSON_CONNECTION */
28305 DIO_BV_GET(&din, &field_addr, fields);
28306
28307#else /* FREECIV_DELTA_PROTOCOL */
28308 #ifdef FREECIV_JSON_CONNECTION
28309 field_addr.name = "city_id16";
28310 #endif /* FREECIV_JSON_CONNECTION */
28311 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
28312 RECEIVE_PACKET_FIELD_ERROR(city_id16);
28313 }
28314 #ifdef FREECIV_JSON_CONNECTION
28315 field_addr.name = "tile_id";
28316 #endif /* FREECIV_JSON_CONNECTION */
28317 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
28318 RECEIVE_PACKET_FIELD_ERROR(tile_id);
28319 }
28320
28321#endif
28322 log_packet_detailed("packet_city_make_worker_101: got info about ()");
28323
28324#ifdef FREECIV_DELTA_PROTOCOL
28325 if (NULL == *hash) {
28326 *hash = genhash_new_full(hash_packet_city_make_worker_101, cmp_packet_city_make_worker_101,
28327 NULL, NULL, NULL, free);
28328 }
28329
28330 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
28331 *real_packet = *old;
28332 } else {
28333 log_packet_detailed(" no old info");
28334 memset(real_packet, 0, sizeof(*real_packet));
28335 }
28336
28337 if (BV_ISSET(fields, 0)) {
28338 log_packet_detailed(" got field 'city_id16'");
28339 #ifdef FREECIV_JSON_CONNECTION
28340 field_addr.name = "city_id16";
28341 #endif /* FREECIV_JSON_CONNECTION */
28342 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
28343 RECEIVE_PACKET_FIELD_ERROR(city_id16);
28344 }
28345 }
28346 if (BV_ISSET(fields, 1)) {
28347 log_packet_detailed(" got field 'tile_id'");
28348 #ifdef FREECIV_JSON_CONNECTION
28349 field_addr.name = "tile_id";
28350 #endif /* FREECIV_JSON_CONNECTION */
28351 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
28352 RECEIVE_PACKET_FIELD_ERROR(tile_id);
28353 }
28354 }
28355
28356 if (NULL == old) {
28357 old = fc_malloc(sizeof(*old));
28358 *old = *real_packet;
28359 genhash_insert(*hash, old, old);
28360 } else {
28361 *old = *real_packet;
28362 }
28363
28364#endif /* FREECIV_DELTA_PROTOCOL */
28365 RECEIVE_PACKET_END(real_packet);
28366}
28367
28368 static int send_packet_city_make_worker_101(struct connection *pc, const struct packet_city_make_worker *packet)
28369{
28370 const struct packet_city_make_worker *real_packet = packet;
28371#ifdef FREECIV_DELTA_PROTOCOL
28372 packet_city_make_worker_101_fields fields;
28373 struct packet_city_make_worker *old;
28374 bool differ;
28375 struct genhash **hash = pc->phs.sent + PACKET_CITY_MAKE_WORKER;
28376#endif /* FREECIV_DELTA_PROTOCOL */
28377 SEND_PACKET_START(PACKET_CITY_MAKE_WORKER);
28378#ifdef FREECIV_JSON_CONNECTION
28379 struct plocation field_addr;
28380 {
28381 struct plocation *field_addr_tmp = plocation_field_new(NULL);
28382 field_addr = *field_addr_tmp;
28383 FC_FREE(field_addr_tmp);
28384 }
28385#endif /* FREECIV_JSON_CONNECTION */
28386
28387 log_packet_detailed("packet_city_make_worker_101: sending info about ()");
28388
28389#ifdef FREECIV_DELTA_PROTOCOL
28390 if (NULL == *hash) {
28391 *hash = genhash_new_full(hash_packet_city_make_worker_101, cmp_packet_city_make_worker_101,
28392 NULL, NULL, NULL, free);
28393 }
28394 BV_CLR_ALL(fields);
28395
28396 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
28397 old = fc_malloc(sizeof(*old));
28398 *old = *real_packet;
28399 genhash_insert(*hash, old, old);
28400 memset(old, 0, sizeof(*old));
28401 }
28402 differ = (old->city_id16 != real_packet->city_id16);
28403 if (differ) {
28404 BV_SET(fields, 0);
28405 }
28406
28407 differ = (old->tile_id != real_packet->tile_id);
28408 if (differ) {
28409 BV_SET(fields, 1);
28410 }
28411
28412
28413#ifdef FREECIV_JSON_CONNECTION
28414 field_addr.name = "fields";
28415#endif /* FREECIV_JSON_CONNECTION */
28416 DIO_BV_PUT(&dout, &field_addr, fields);
28417
28418 if (BV_ISSET(fields, 0)) {
28419 log_packet_detailed(" field 'city_id16' has changed");
28420 #ifdef FREECIV_JSON_CONNECTION
28421 field_addr.name = "city_id16";
28422#endif /* FREECIV_JSON_CONNECTION */
28423 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
28424 }
28425 if (BV_ISSET(fields, 1)) {
28426 log_packet_detailed(" field 'tile_id' has changed");
28427 #ifdef FREECIV_JSON_CONNECTION
28428 field_addr.name = "tile_id";
28429#endif /* FREECIV_JSON_CONNECTION */
28430 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
28431 }
28432
28433 *old = *real_packet;
28434#endif /* FREECIV_DELTA_PROTOCOL */
28435#ifndef FREECIV_DELTA_PROTOCOL
28436#ifdef FREECIV_JSON_CONNECTION
28437 field_addr.name = "city_id16";
28438#endif /* FREECIV_JSON_CONNECTION */
28439 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
28440#ifdef FREECIV_JSON_CONNECTION
28441 field_addr.name = "tile_id";
28442#endif /* FREECIV_JSON_CONNECTION */
28443 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
28444
28445#endif
28446 SEND_PACKET_END(PACKET_CITY_MAKE_WORKER);
28447}
28448
28449 int send_packet_city_make_worker(struct connection *pc, const struct packet_city_make_worker *packet)
28450{
28451 if (!pc->used) {
28452 log_error("WARNING: trying to send data to the closed connection %s",
28453 conn_description(pc));
28454 return -1;
28455 }
28456 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_MAKE_WORKER].packet != NULL, -1,
28457 "Handler for PACKET_CITY_MAKE_WORKER not installed");
28458 return pc->phs.handlers->send[PACKET_CITY_MAKE_WORKER].packet(pc, packet);
28459}
28460
28461 int dsend_packet_city_make_worker(struct connection *pc, int city_id16, int city_id32, int tile_id)
28462{
28463 struct packet_city_make_worker packet, *real_packet = &packet;
28464
28465 real_packet->city_id16 = city_id16;
28466 real_packet->city_id32 = city_id32;
28467 real_packet->tile_id = tile_id;
28468
28469 return send_packet_city_make_worker(pc, real_packet);
28470}
28471
28472#ifdef FREECIV_DELTA_PROTOCOL
28473#define hash_packet_city_change_specialist_100 hash_const
28474
28475#define cmp_packet_city_change_specialist_100 cmp_const
28476
28477 BV_DEFINE(packet_city_change_specialist_100_fields, 3);
28478#endif /* FREECIV_DELTA_PROTOCOL */
28479
28480 static struct packet_city_change_specialist *receive_packet_city_change_specialist_100(struct connection *pc)
28481{
28482#ifdef FREECIV_DELTA_PROTOCOL
28483 packet_city_change_specialist_100_fields fields;
28484 struct packet_city_change_specialist *old;
28485 struct genhash **hash = pc->phs.received + PACKET_CITY_CHANGE_SPECIALIST;
28486#endif /* FREECIV_DELTA_PROTOCOL */
28487 RECEIVE_PACKET_START(packet_city_change_specialist, real_packet);
28488#ifdef FREECIV_JSON_CONNECTION
28489 struct plocation field_addr;
28490 {
28491 struct plocation *field_addr_tmp = plocation_field_new(NULL);
28492 field_addr = *field_addr_tmp;
28493 FC_FREE(field_addr_tmp);
28494 }
28495#endif /* FREECIV_JSON_CONNECTION */
28496
28497#ifdef FREECIV_DELTA_PROTOCOL
28498#ifdef FREECIV_JSON_CONNECTION
28499 field_addr.name = "fields";
28500#endif /* FREECIV_JSON_CONNECTION */
28501 DIO_BV_GET(&din, &field_addr, fields);
28502
28503#else /* FREECIV_DELTA_PROTOCOL */
28504 #ifdef FREECIV_JSON_CONNECTION
28505 field_addr.name = "city_id32";
28506 #endif /* FREECIV_JSON_CONNECTION */
28507 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
28508 RECEIVE_PACKET_FIELD_ERROR(city_id32);
28509 }
28510 #ifdef FREECIV_JSON_CONNECTION
28511 field_addr.name = "from";
28512 #endif /* FREECIV_JSON_CONNECTION */
28513 {
28514 int readin;
28515
28516 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28517 RECEIVE_PACKET_FIELD_ERROR(from);
28518 }
28519 real_packet->from = readin;
28520 }
28521 #ifdef FREECIV_JSON_CONNECTION
28522 field_addr.name = "to";
28523 #endif /* FREECIV_JSON_CONNECTION */
28524 {
28525 int readin;
28526
28527 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28528 RECEIVE_PACKET_FIELD_ERROR(to);
28529 }
28530 real_packet->to = readin;
28531 }
28532
28533#endif
28534 log_packet_detailed("packet_city_change_specialist_100: got info about ()");
28535
28536#ifdef FREECIV_DELTA_PROTOCOL
28537 if (NULL == *hash) {
28538 *hash = genhash_new_full(hash_packet_city_change_specialist_100, cmp_packet_city_change_specialist_100,
28539 NULL, NULL, NULL, free);
28540 }
28541
28542 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
28543 *real_packet = *old;
28544 } else {
28545 log_packet_detailed(" no old info");
28546 memset(real_packet, 0, sizeof(*real_packet));
28547 }
28548
28549 if (BV_ISSET(fields, 0)) {
28550 log_packet_detailed(" got field 'city_id32'");
28551 #ifdef FREECIV_JSON_CONNECTION
28552 field_addr.name = "city_id32";
28553 #endif /* FREECIV_JSON_CONNECTION */
28554 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
28555 RECEIVE_PACKET_FIELD_ERROR(city_id32);
28556 }
28557 }
28558 if (BV_ISSET(fields, 1)) {
28559 log_packet_detailed(" got field 'from'");
28560 #ifdef FREECIV_JSON_CONNECTION
28561 field_addr.name = "from";
28562 #endif /* FREECIV_JSON_CONNECTION */
28563 {
28564 int readin;
28565
28566 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28567 RECEIVE_PACKET_FIELD_ERROR(from);
28568 }
28569 real_packet->from = readin;
28570 }
28571 }
28572 if (BV_ISSET(fields, 2)) {
28573 log_packet_detailed(" got field 'to'");
28574 #ifdef FREECIV_JSON_CONNECTION
28575 field_addr.name = "to";
28576 #endif /* FREECIV_JSON_CONNECTION */
28577 {
28578 int readin;
28579
28580 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28581 RECEIVE_PACKET_FIELD_ERROR(to);
28582 }
28583 real_packet->to = readin;
28584 }
28585 }
28586
28587 if (NULL == old) {
28588 old = fc_malloc(sizeof(*old));
28589 *old = *real_packet;
28590 genhash_insert(*hash, old, old);
28591 } else {
28592 *old = *real_packet;
28593 }
28594
28595#endif /* FREECIV_DELTA_PROTOCOL */
28596 RECEIVE_PACKET_END(real_packet);
28597}
28598
28599 static int send_packet_city_change_specialist_100(struct connection *pc, const struct packet_city_change_specialist *packet)
28600{
28601 const struct packet_city_change_specialist *real_packet = packet;
28602#ifdef FREECIV_DELTA_PROTOCOL
28603 packet_city_change_specialist_100_fields fields;
28604 struct packet_city_change_specialist *old;
28605 bool differ;
28606 struct genhash **hash = pc->phs.sent + PACKET_CITY_CHANGE_SPECIALIST;
28607#endif /* FREECIV_DELTA_PROTOCOL */
28608 SEND_PACKET_START(PACKET_CITY_CHANGE_SPECIALIST);
28609#ifdef FREECIV_JSON_CONNECTION
28610 struct plocation field_addr;
28611 {
28612 struct plocation *field_addr_tmp = plocation_field_new(NULL);
28613 field_addr = *field_addr_tmp;
28614 FC_FREE(field_addr_tmp);
28615 }
28616#endif /* FREECIV_JSON_CONNECTION */
28617
28618 log_packet_detailed("packet_city_change_specialist_100: sending info about ()");
28619
28620#ifdef FREECIV_DELTA_PROTOCOL
28621 if (NULL == *hash) {
28622 *hash = genhash_new_full(hash_packet_city_change_specialist_100, cmp_packet_city_change_specialist_100,
28623 NULL, NULL, NULL, free);
28624 }
28625 BV_CLR_ALL(fields);
28626
28627 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
28628 old = fc_malloc(sizeof(*old));
28629 *old = *real_packet;
28630 genhash_insert(*hash, old, old);
28631 memset(old, 0, sizeof(*old));
28632 }
28633 differ = (old->city_id32 != real_packet->city_id32);
28634 if (differ) {
28635 BV_SET(fields, 0);
28636 }
28637
28638 differ = (old->from != real_packet->from);
28639 if (differ) {
28640 BV_SET(fields, 1);
28641 }
28642
28643 differ = (old->to != real_packet->to);
28644 if (differ) {
28645 BV_SET(fields, 2);
28646 }
28647
28648
28649#ifdef FREECIV_JSON_CONNECTION
28650 field_addr.name = "fields";
28651#endif /* FREECIV_JSON_CONNECTION */
28652 DIO_BV_PUT(&dout, &field_addr, fields);
28653
28654 if (BV_ISSET(fields, 0)) {
28655 log_packet_detailed(" field 'city_id32' has changed");
28656 #ifdef FREECIV_JSON_CONNECTION
28657 field_addr.name = "city_id32";
28658#endif /* FREECIV_JSON_CONNECTION */
28659 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
28660 }
28661 if (BV_ISSET(fields, 1)) {
28662 log_packet_detailed(" field 'from' has changed");
28663 #ifdef FREECIV_JSON_CONNECTION
28664 field_addr.name = "from";
28665#endif /* FREECIV_JSON_CONNECTION */
28666 DIO_PUT(uint8, &dout, &field_addr, real_packet->from);
28667 }
28668 if (BV_ISSET(fields, 2)) {
28669 log_packet_detailed(" field 'to' has changed");
28670 #ifdef FREECIV_JSON_CONNECTION
28671 field_addr.name = "to";
28672#endif /* FREECIV_JSON_CONNECTION */
28673 DIO_PUT(uint8, &dout, &field_addr, real_packet->to);
28674 }
28675
28676 *old = *real_packet;
28677#endif /* FREECIV_DELTA_PROTOCOL */
28678#ifndef FREECIV_DELTA_PROTOCOL
28679#ifdef FREECIV_JSON_CONNECTION
28680 field_addr.name = "city_id32";
28681#endif /* FREECIV_JSON_CONNECTION */
28682 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
28683#ifdef FREECIV_JSON_CONNECTION
28684 field_addr.name = "from";
28685#endif /* FREECIV_JSON_CONNECTION */
28686 DIO_PUT(uint8, &dout, &field_addr, real_packet->from);
28687#ifdef FREECIV_JSON_CONNECTION
28688 field_addr.name = "to";
28689#endif /* FREECIV_JSON_CONNECTION */
28690 DIO_PUT(uint8, &dout, &field_addr, real_packet->to);
28691
28692#endif
28693 SEND_PACKET_END(PACKET_CITY_CHANGE_SPECIALIST);
28694}
28695
28696#ifdef FREECIV_DELTA_PROTOCOL
28697#define hash_packet_city_change_specialist_101 hash_const
28698
28699#define cmp_packet_city_change_specialist_101 cmp_const
28700
28701 BV_DEFINE(packet_city_change_specialist_101_fields, 3);
28702#endif /* FREECIV_DELTA_PROTOCOL */
28703
28704 static struct packet_city_change_specialist *receive_packet_city_change_specialist_101(struct connection *pc)
28705{
28706#ifdef FREECIV_DELTA_PROTOCOL
28707 packet_city_change_specialist_101_fields fields;
28708 struct packet_city_change_specialist *old;
28709 struct genhash **hash = pc->phs.received + PACKET_CITY_CHANGE_SPECIALIST;
28710#endif /* FREECIV_DELTA_PROTOCOL */
28711 RECEIVE_PACKET_START(packet_city_change_specialist, real_packet);
28712#ifdef FREECIV_JSON_CONNECTION
28713 struct plocation field_addr;
28714 {
28715 struct plocation *field_addr_tmp = plocation_field_new(NULL);
28716 field_addr = *field_addr_tmp;
28717 FC_FREE(field_addr_tmp);
28718 }
28719#endif /* FREECIV_JSON_CONNECTION */
28720
28721#ifdef FREECIV_DELTA_PROTOCOL
28722#ifdef FREECIV_JSON_CONNECTION
28723 field_addr.name = "fields";
28724#endif /* FREECIV_JSON_CONNECTION */
28725 DIO_BV_GET(&din, &field_addr, fields);
28726
28727#else /* FREECIV_DELTA_PROTOCOL */
28728 #ifdef FREECIV_JSON_CONNECTION
28729 field_addr.name = "city_id16";
28730 #endif /* FREECIV_JSON_CONNECTION */
28731 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
28732 RECEIVE_PACKET_FIELD_ERROR(city_id16);
28733 }
28734 #ifdef FREECIV_JSON_CONNECTION
28735 field_addr.name = "from";
28736 #endif /* FREECIV_JSON_CONNECTION */
28737 {
28738 int readin;
28739
28740 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28741 RECEIVE_PACKET_FIELD_ERROR(from);
28742 }
28743 real_packet->from = readin;
28744 }
28745 #ifdef FREECIV_JSON_CONNECTION
28746 field_addr.name = "to";
28747 #endif /* FREECIV_JSON_CONNECTION */
28748 {
28749 int readin;
28750
28751 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28752 RECEIVE_PACKET_FIELD_ERROR(to);
28753 }
28754 real_packet->to = readin;
28755 }
28756
28757#endif
28758 log_packet_detailed("packet_city_change_specialist_101: got info about ()");
28759
28760#ifdef FREECIV_DELTA_PROTOCOL
28761 if (NULL == *hash) {
28762 *hash = genhash_new_full(hash_packet_city_change_specialist_101, cmp_packet_city_change_specialist_101,
28763 NULL, NULL, NULL, free);
28764 }
28765
28766 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
28767 *real_packet = *old;
28768 } else {
28769 log_packet_detailed(" no old info");
28770 memset(real_packet, 0, sizeof(*real_packet));
28771 }
28772
28773 if (BV_ISSET(fields, 0)) {
28774 log_packet_detailed(" got field 'city_id16'");
28775 #ifdef FREECIV_JSON_CONNECTION
28776 field_addr.name = "city_id16";
28777 #endif /* FREECIV_JSON_CONNECTION */
28778 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
28779 RECEIVE_PACKET_FIELD_ERROR(city_id16);
28780 }
28781 }
28782 if (BV_ISSET(fields, 1)) {
28783 log_packet_detailed(" got field 'from'");
28784 #ifdef FREECIV_JSON_CONNECTION
28785 field_addr.name = "from";
28786 #endif /* FREECIV_JSON_CONNECTION */
28787 {
28788 int readin;
28789
28790 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28791 RECEIVE_PACKET_FIELD_ERROR(from);
28792 }
28793 real_packet->from = readin;
28794 }
28795 }
28796 if (BV_ISSET(fields, 2)) {
28797 log_packet_detailed(" got field 'to'");
28798 #ifdef FREECIV_JSON_CONNECTION
28799 field_addr.name = "to";
28800 #endif /* FREECIV_JSON_CONNECTION */
28801 {
28802 int readin;
28803
28804 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28805 RECEIVE_PACKET_FIELD_ERROR(to);
28806 }
28807 real_packet->to = readin;
28808 }
28809 }
28810
28811 if (NULL == old) {
28812 old = fc_malloc(sizeof(*old));
28813 *old = *real_packet;
28814 genhash_insert(*hash, old, old);
28815 } else {
28816 *old = *real_packet;
28817 }
28818
28819#endif /* FREECIV_DELTA_PROTOCOL */
28820 RECEIVE_PACKET_END(real_packet);
28821}
28822
28823 static int send_packet_city_change_specialist_101(struct connection *pc, const struct packet_city_change_specialist *packet)
28824{
28825 const struct packet_city_change_specialist *real_packet = packet;
28826#ifdef FREECIV_DELTA_PROTOCOL
28827 packet_city_change_specialist_101_fields fields;
28828 struct packet_city_change_specialist *old;
28829 bool differ;
28830 struct genhash **hash = pc->phs.sent + PACKET_CITY_CHANGE_SPECIALIST;
28831#endif /* FREECIV_DELTA_PROTOCOL */
28832 SEND_PACKET_START(PACKET_CITY_CHANGE_SPECIALIST);
28833#ifdef FREECIV_JSON_CONNECTION
28834 struct plocation field_addr;
28835 {
28836 struct plocation *field_addr_tmp = plocation_field_new(NULL);
28837 field_addr = *field_addr_tmp;
28838 FC_FREE(field_addr_tmp);
28839 }
28840#endif /* FREECIV_JSON_CONNECTION */
28841
28842 log_packet_detailed("packet_city_change_specialist_101: sending info about ()");
28843
28844#ifdef FREECIV_DELTA_PROTOCOL
28845 if (NULL == *hash) {
28846 *hash = genhash_new_full(hash_packet_city_change_specialist_101, cmp_packet_city_change_specialist_101,
28847 NULL, NULL, NULL, free);
28848 }
28849 BV_CLR_ALL(fields);
28850
28851 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
28852 old = fc_malloc(sizeof(*old));
28853 *old = *real_packet;
28854 genhash_insert(*hash, old, old);
28855 memset(old, 0, sizeof(*old));
28856 }
28857 differ = (old->city_id16 != real_packet->city_id16);
28858 if (differ) {
28859 BV_SET(fields, 0);
28860 }
28861
28862 differ = (old->from != real_packet->from);
28863 if (differ) {
28864 BV_SET(fields, 1);
28865 }
28866
28867 differ = (old->to != real_packet->to);
28868 if (differ) {
28869 BV_SET(fields, 2);
28870 }
28871
28872
28873#ifdef FREECIV_JSON_CONNECTION
28874 field_addr.name = "fields";
28875#endif /* FREECIV_JSON_CONNECTION */
28876 DIO_BV_PUT(&dout, &field_addr, fields);
28877
28878 if (BV_ISSET(fields, 0)) {
28879 log_packet_detailed(" field 'city_id16' has changed");
28880 #ifdef FREECIV_JSON_CONNECTION
28881 field_addr.name = "city_id16";
28882#endif /* FREECIV_JSON_CONNECTION */
28883 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
28884 }
28885 if (BV_ISSET(fields, 1)) {
28886 log_packet_detailed(" field 'from' has changed");
28887 #ifdef FREECIV_JSON_CONNECTION
28888 field_addr.name = "from";
28889#endif /* FREECIV_JSON_CONNECTION */
28890 DIO_PUT(uint8, &dout, &field_addr, real_packet->from);
28891 }
28892 if (BV_ISSET(fields, 2)) {
28893 log_packet_detailed(" field 'to' has changed");
28894 #ifdef FREECIV_JSON_CONNECTION
28895 field_addr.name = "to";
28896#endif /* FREECIV_JSON_CONNECTION */
28897 DIO_PUT(uint8, &dout, &field_addr, real_packet->to);
28898 }
28899
28900 *old = *real_packet;
28901#endif /* FREECIV_DELTA_PROTOCOL */
28902#ifndef FREECIV_DELTA_PROTOCOL
28903#ifdef FREECIV_JSON_CONNECTION
28904 field_addr.name = "city_id16";
28905#endif /* FREECIV_JSON_CONNECTION */
28906 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
28907#ifdef FREECIV_JSON_CONNECTION
28908 field_addr.name = "from";
28909#endif /* FREECIV_JSON_CONNECTION */
28910 DIO_PUT(uint8, &dout, &field_addr, real_packet->from);
28911#ifdef FREECIV_JSON_CONNECTION
28912 field_addr.name = "to";
28913#endif /* FREECIV_JSON_CONNECTION */
28914 DIO_PUT(uint8, &dout, &field_addr, real_packet->to);
28915
28916#endif
28917 SEND_PACKET_END(PACKET_CITY_CHANGE_SPECIALIST);
28918}
28919
28920 int send_packet_city_change_specialist(struct connection *pc, const struct packet_city_change_specialist *packet)
28921{
28922 if (!pc->used) {
28923 log_error("WARNING: trying to send data to the closed connection %s",
28924 conn_description(pc));
28925 return -1;
28926 }
28927 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_CHANGE_SPECIALIST].packet != NULL, -1,
28928 "Handler for PACKET_CITY_CHANGE_SPECIALIST not installed");
28929 return pc->phs.handlers->send[PACKET_CITY_CHANGE_SPECIALIST].packet(pc, packet);
28930}
28931
28932 int dsend_packet_city_change_specialist(struct connection *pc, int city_id16, int city_id32, Specialist_type_id from, Specialist_type_id to)
28933{
28934 struct packet_city_change_specialist packet, *real_packet = &packet;
28935
28936 real_packet->city_id16 = city_id16;
28937 real_packet->city_id32 = city_id32;
28938 real_packet->from = from;
28939 real_packet->to = to;
28940
28941 return send_packet_city_change_specialist(pc, real_packet);
28942}
28943
28944#ifdef FREECIV_DELTA_PROTOCOL
28945#define hash_packet_city_rename_100 hash_const
28946
28947#define cmp_packet_city_rename_100 cmp_const
28948
28949 BV_DEFINE(packet_city_rename_100_fields, 2);
28950#endif /* FREECIV_DELTA_PROTOCOL */
28951
28952 static struct packet_city_rename *receive_packet_city_rename_100(struct connection *pc)
28953{
28954#ifdef FREECIV_DELTA_PROTOCOL
28955 packet_city_rename_100_fields fields;
28956 struct packet_city_rename *old;
28957 struct genhash **hash = pc->phs.received + PACKET_CITY_RENAME;
28958#endif /* FREECIV_DELTA_PROTOCOL */
28959 RECEIVE_PACKET_START(packet_city_rename, real_packet);
28960#ifdef FREECIV_JSON_CONNECTION
28961 struct plocation field_addr;
28962 {
28963 struct plocation *field_addr_tmp = plocation_field_new(NULL);
28964 field_addr = *field_addr_tmp;
28965 FC_FREE(field_addr_tmp);
28966 }
28967#endif /* FREECIV_JSON_CONNECTION */
28968
28969#ifdef FREECIV_DELTA_PROTOCOL
28970#ifdef FREECIV_JSON_CONNECTION
28971 field_addr.name = "fields";
28972#endif /* FREECIV_JSON_CONNECTION */
28973 DIO_BV_GET(&din, &field_addr, fields);
28974
28975#else /* FREECIV_DELTA_PROTOCOL */
28976 #ifdef FREECIV_JSON_CONNECTION
28977 field_addr.name = "city_id32";
28978 #endif /* FREECIV_JSON_CONNECTION */
28979 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
28980 RECEIVE_PACKET_FIELD_ERROR(city_id32);
28981 }
28982 #ifdef FREECIV_JSON_CONNECTION
28983 field_addr.name = "name";
28984 #endif /* FREECIV_JSON_CONNECTION */
28985 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
28986 RECEIVE_PACKET_FIELD_ERROR(name);
28987 }
28988
28989#endif
28990 log_packet_detailed("packet_city_rename_100: got info about ()");
28991
28992#ifdef FREECIV_DELTA_PROTOCOL
28993 if (NULL == *hash) {
28994 *hash = genhash_new_full(hash_packet_city_rename_100, cmp_packet_city_rename_100,
28995 NULL, NULL, NULL, free);
28996 }
28997
28998 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
28999 *real_packet = *old;
29000 } else {
29001 log_packet_detailed(" no old info");
29002 memset(real_packet, 0, sizeof(*real_packet));
29003 }
29004
29005 if (BV_ISSET(fields, 0)) {
29006 log_packet_detailed(" got field 'city_id32'");
29007 #ifdef FREECIV_JSON_CONNECTION
29008 field_addr.name = "city_id32";
29009 #endif /* FREECIV_JSON_CONNECTION */
29010 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
29011 RECEIVE_PACKET_FIELD_ERROR(city_id32);
29012 }
29013 }
29014 if (BV_ISSET(fields, 1)) {
29015 log_packet_detailed(" got field 'name'");
29016 #ifdef FREECIV_JSON_CONNECTION
29017 field_addr.name = "name";
29018 #endif /* FREECIV_JSON_CONNECTION */
29019 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
29020 RECEIVE_PACKET_FIELD_ERROR(name);
29021 }
29022 }
29023
29024 if (NULL == old) {
29025 old = fc_malloc(sizeof(*old));
29026 *old = *real_packet;
29027 genhash_insert(*hash, old, old);
29028 } else {
29029 *old = *real_packet;
29030 }
29031
29032#endif /* FREECIV_DELTA_PROTOCOL */
29033 RECEIVE_PACKET_END(real_packet);
29034}
29035
29036 static int send_packet_city_rename_100(struct connection *pc, const struct packet_city_rename *packet)
29037{
29038 const struct packet_city_rename *real_packet = packet;
29039#ifdef FREECIV_DELTA_PROTOCOL
29040 packet_city_rename_100_fields fields;
29041 struct packet_city_rename *old;
29042 bool differ;
29043 struct genhash **hash = pc->phs.sent + PACKET_CITY_RENAME;
29044#endif /* FREECIV_DELTA_PROTOCOL */
29045 SEND_PACKET_START(PACKET_CITY_RENAME);
29046#ifdef FREECIV_JSON_CONNECTION
29047 struct plocation field_addr;
29048 {
29049 struct plocation *field_addr_tmp = plocation_field_new(NULL);
29050 field_addr = *field_addr_tmp;
29051 FC_FREE(field_addr_tmp);
29052 }
29053#endif /* FREECIV_JSON_CONNECTION */
29054
29055 log_packet_detailed("packet_city_rename_100: sending info about ()");
29056
29057#ifdef FREECIV_DELTA_PROTOCOL
29058 if (NULL == *hash) {
29059 *hash = genhash_new_full(hash_packet_city_rename_100, cmp_packet_city_rename_100,
29060 NULL, NULL, NULL, free);
29061 }
29062 BV_CLR_ALL(fields);
29063
29064 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
29065 old = fc_malloc(sizeof(*old));
29066 *old = *real_packet;
29067 genhash_insert(*hash, old, old);
29068 memset(old, 0, sizeof(*old));
29069 }
29070 differ = (old->city_id32 != real_packet->city_id32);
29071 if (differ) {
29072 BV_SET(fields, 0);
29073 }
29074
29075 differ = (strcmp(old->name, real_packet->name) != 0);
29076 if (differ) {
29077 BV_SET(fields, 1);
29078 }
29079
29080
29081#ifdef FREECIV_JSON_CONNECTION
29082 field_addr.name = "fields";
29083#endif /* FREECIV_JSON_CONNECTION */
29084 DIO_BV_PUT(&dout, &field_addr, fields);
29085
29086 if (BV_ISSET(fields, 0)) {
29087 log_packet_detailed(" field 'city_id32' has changed");
29088 #ifdef FREECIV_JSON_CONNECTION
29089 field_addr.name = "city_id32";
29090#endif /* FREECIV_JSON_CONNECTION */
29091 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
29092 }
29093 if (BV_ISSET(fields, 1)) {
29094 log_packet_detailed(" field 'name' has changed");
29095 #ifdef FREECIV_JSON_CONNECTION
29096 field_addr.name = "name";
29097#endif /* FREECIV_JSON_CONNECTION */
29098 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
29099 }
29100
29101 *old = *real_packet;
29102#endif /* FREECIV_DELTA_PROTOCOL */
29103#ifndef FREECIV_DELTA_PROTOCOL
29104#ifdef FREECIV_JSON_CONNECTION
29105 field_addr.name = "city_id32";
29106#endif /* FREECIV_JSON_CONNECTION */
29107 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
29108#ifdef FREECIV_JSON_CONNECTION
29109 field_addr.name = "name";
29110#endif /* FREECIV_JSON_CONNECTION */
29111 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
29112
29113#endif
29114 SEND_PACKET_END(PACKET_CITY_RENAME);
29115}
29116
29117#ifdef FREECIV_DELTA_PROTOCOL
29118#define hash_packet_city_rename_101 hash_const
29119
29120#define cmp_packet_city_rename_101 cmp_const
29121
29122 BV_DEFINE(packet_city_rename_101_fields, 2);
29123#endif /* FREECIV_DELTA_PROTOCOL */
29124
29125 static struct packet_city_rename *receive_packet_city_rename_101(struct connection *pc)
29126{
29127#ifdef FREECIV_DELTA_PROTOCOL
29128 packet_city_rename_101_fields fields;
29129 struct packet_city_rename *old;
29130 struct genhash **hash = pc->phs.received + PACKET_CITY_RENAME;
29131#endif /* FREECIV_DELTA_PROTOCOL */
29132 RECEIVE_PACKET_START(packet_city_rename, real_packet);
29133#ifdef FREECIV_JSON_CONNECTION
29134 struct plocation field_addr;
29135 {
29136 struct plocation *field_addr_tmp = plocation_field_new(NULL);
29137 field_addr = *field_addr_tmp;
29138 FC_FREE(field_addr_tmp);
29139 }
29140#endif /* FREECIV_JSON_CONNECTION */
29141
29142#ifdef FREECIV_DELTA_PROTOCOL
29143#ifdef FREECIV_JSON_CONNECTION
29144 field_addr.name = "fields";
29145#endif /* FREECIV_JSON_CONNECTION */
29146 DIO_BV_GET(&din, &field_addr, fields);
29147
29148#else /* FREECIV_DELTA_PROTOCOL */
29149 #ifdef FREECIV_JSON_CONNECTION
29150 field_addr.name = "city_id16";
29151 #endif /* FREECIV_JSON_CONNECTION */
29152 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
29153 RECEIVE_PACKET_FIELD_ERROR(city_id16);
29154 }
29155 #ifdef FREECIV_JSON_CONNECTION
29156 field_addr.name = "name";
29157 #endif /* FREECIV_JSON_CONNECTION */
29158 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
29159 RECEIVE_PACKET_FIELD_ERROR(name);
29160 }
29161
29162#endif
29163 log_packet_detailed("packet_city_rename_101: got info about ()");
29164
29165#ifdef FREECIV_DELTA_PROTOCOL
29166 if (NULL == *hash) {
29167 *hash = genhash_new_full(hash_packet_city_rename_101, cmp_packet_city_rename_101,
29168 NULL, NULL, NULL, free);
29169 }
29170
29171 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
29172 *real_packet = *old;
29173 } else {
29174 log_packet_detailed(" no old info");
29175 memset(real_packet, 0, sizeof(*real_packet));
29176 }
29177
29178 if (BV_ISSET(fields, 0)) {
29179 log_packet_detailed(" got field 'city_id16'");
29180 #ifdef FREECIV_JSON_CONNECTION
29181 field_addr.name = "city_id16";
29182 #endif /* FREECIV_JSON_CONNECTION */
29183 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
29184 RECEIVE_PACKET_FIELD_ERROR(city_id16);
29185 }
29186 }
29187 if (BV_ISSET(fields, 1)) {
29188 log_packet_detailed(" got field 'name'");
29189 #ifdef FREECIV_JSON_CONNECTION
29190 field_addr.name = "name";
29191 #endif /* FREECIV_JSON_CONNECTION */
29192 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
29193 RECEIVE_PACKET_FIELD_ERROR(name);
29194 }
29195 }
29196
29197 if (NULL == old) {
29198 old = fc_malloc(sizeof(*old));
29199 *old = *real_packet;
29200 genhash_insert(*hash, old, old);
29201 } else {
29202 *old = *real_packet;
29203 }
29204
29205#endif /* FREECIV_DELTA_PROTOCOL */
29206 RECEIVE_PACKET_END(real_packet);
29207}
29208
29209 static int send_packet_city_rename_101(struct connection *pc, const struct packet_city_rename *packet)
29210{
29211 const struct packet_city_rename *real_packet = packet;
29212#ifdef FREECIV_DELTA_PROTOCOL
29213 packet_city_rename_101_fields fields;
29214 struct packet_city_rename *old;
29215 bool differ;
29216 struct genhash **hash = pc->phs.sent + PACKET_CITY_RENAME;
29217#endif /* FREECIV_DELTA_PROTOCOL */
29218 SEND_PACKET_START(PACKET_CITY_RENAME);
29219#ifdef FREECIV_JSON_CONNECTION
29220 struct plocation field_addr;
29221 {
29222 struct plocation *field_addr_tmp = plocation_field_new(NULL);
29223 field_addr = *field_addr_tmp;
29224 FC_FREE(field_addr_tmp);
29225 }
29226#endif /* FREECIV_JSON_CONNECTION */
29227
29228 log_packet_detailed("packet_city_rename_101: sending info about ()");
29229
29230#ifdef FREECIV_DELTA_PROTOCOL
29231 if (NULL == *hash) {
29232 *hash = genhash_new_full(hash_packet_city_rename_101, cmp_packet_city_rename_101,
29233 NULL, NULL, NULL, free);
29234 }
29235 BV_CLR_ALL(fields);
29236
29237 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
29238 old = fc_malloc(sizeof(*old));
29239 *old = *real_packet;
29240 genhash_insert(*hash, old, old);
29241 memset(old, 0, sizeof(*old));
29242 }
29243 differ = (old->city_id16 != real_packet->city_id16);
29244 if (differ) {
29245 BV_SET(fields, 0);
29246 }
29247
29248 differ = (strcmp(old->name, real_packet->name) != 0);
29249 if (differ) {
29250 BV_SET(fields, 1);
29251 }
29252
29253
29254#ifdef FREECIV_JSON_CONNECTION
29255 field_addr.name = "fields";
29256#endif /* FREECIV_JSON_CONNECTION */
29257 DIO_BV_PUT(&dout, &field_addr, fields);
29258
29259 if (BV_ISSET(fields, 0)) {
29260 log_packet_detailed(" field 'city_id16' has changed");
29261 #ifdef FREECIV_JSON_CONNECTION
29262 field_addr.name = "city_id16";
29263#endif /* FREECIV_JSON_CONNECTION */
29264 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
29265 }
29266 if (BV_ISSET(fields, 1)) {
29267 log_packet_detailed(" field 'name' has changed");
29268 #ifdef FREECIV_JSON_CONNECTION
29269 field_addr.name = "name";
29270#endif /* FREECIV_JSON_CONNECTION */
29271 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
29272 }
29273
29274 *old = *real_packet;
29275#endif /* FREECIV_DELTA_PROTOCOL */
29276#ifndef FREECIV_DELTA_PROTOCOL
29277#ifdef FREECIV_JSON_CONNECTION
29278 field_addr.name = "city_id16";
29279#endif /* FREECIV_JSON_CONNECTION */
29280 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
29281#ifdef FREECIV_JSON_CONNECTION
29282 field_addr.name = "name";
29283#endif /* FREECIV_JSON_CONNECTION */
29284 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
29285
29286#endif
29287 SEND_PACKET_END(PACKET_CITY_RENAME);
29288}
29289
29290 int send_packet_city_rename(struct connection *pc, const struct packet_city_rename *packet)
29291{
29292 if (!pc->used) {
29293 log_error("WARNING: trying to send data to the closed connection %s",
29294 conn_description(pc));
29295 return -1;
29296 }
29297 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_RENAME].packet != NULL, -1,
29298 "Handler for PACKET_CITY_RENAME not installed");
29299 return pc->phs.handlers->send[PACKET_CITY_RENAME].packet(pc, packet);
29300}
29301
29302 int dsend_packet_city_rename(struct connection *pc, int city_id16, int city_id32, const char *name)
29303{
29304 struct packet_city_rename packet, *real_packet = &packet;
29305
29306 real_packet->city_id16 = city_id16;
29307 real_packet->city_id32 = city_id32;
29308 sz_strlcpy(real_packet->name, name);
29309
29310 return send_packet_city_rename(pc, real_packet);
29311}
29312
29313#ifdef FREECIV_DELTA_PROTOCOL
29314#define hash_packet_city_options_req_100 hash_const
29315
29316#define cmp_packet_city_options_req_100 cmp_const
29317
29318 BV_DEFINE(packet_city_options_req_100_fields, 2);
29319#endif /* FREECIV_DELTA_PROTOCOL */
29320
29321 static struct packet_city_options_req *receive_packet_city_options_req_100(struct connection *pc)
29322{
29323#ifdef FREECIV_DELTA_PROTOCOL
29324 packet_city_options_req_100_fields fields;
29325 struct packet_city_options_req *old;
29326 struct genhash **hash = pc->phs.received + PACKET_CITY_OPTIONS_REQ;
29327#endif /* FREECIV_DELTA_PROTOCOL */
29328 RECEIVE_PACKET_START(packet_city_options_req, real_packet);
29329#ifdef FREECIV_JSON_CONNECTION
29330 struct plocation field_addr;
29331 {
29332 struct plocation *field_addr_tmp = plocation_field_new(NULL);
29333 field_addr = *field_addr_tmp;
29334 FC_FREE(field_addr_tmp);
29335 }
29336#endif /* FREECIV_JSON_CONNECTION */
29337
29338#ifdef FREECIV_DELTA_PROTOCOL
29339#ifdef FREECIV_JSON_CONNECTION
29340 field_addr.name = "fields";
29341#endif /* FREECIV_JSON_CONNECTION */
29342 DIO_BV_GET(&din, &field_addr, fields);
29343
29344#else /* FREECIV_DELTA_PROTOCOL */
29345 #ifdef FREECIV_JSON_CONNECTION
29346 field_addr.name = "city_id32";
29347 #endif /* FREECIV_JSON_CONNECTION */
29348 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
29349 RECEIVE_PACKET_FIELD_ERROR(city_id32);
29350 }
29351 #ifdef FREECIV_JSON_CONNECTION
29352 field_addr.name = "options";
29353 #endif /* FREECIV_JSON_CONNECTION */
29354 if (!DIO_BV_GET(&din, &field_addr, real_packet->options)) {
29355 RECEIVE_PACKET_FIELD_ERROR(options);
29356 }
29357
29358#endif
29359 log_packet_detailed("packet_city_options_req_100: got info about ()");
29360
29361#ifdef FREECIV_DELTA_PROTOCOL
29362 if (NULL == *hash) {
29363 *hash = genhash_new_full(hash_packet_city_options_req_100, cmp_packet_city_options_req_100,
29364 NULL, NULL, NULL, free);
29365 }
29366
29367 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
29368 *real_packet = *old;
29369 } else {
29370 log_packet_detailed(" no old info");
29371 memset(real_packet, 0, sizeof(*real_packet));
29372 }
29373
29374 if (BV_ISSET(fields, 0)) {
29375 log_packet_detailed(" got field 'city_id32'");
29376 #ifdef FREECIV_JSON_CONNECTION
29377 field_addr.name = "city_id32";
29378 #endif /* FREECIV_JSON_CONNECTION */
29379 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
29380 RECEIVE_PACKET_FIELD_ERROR(city_id32);
29381 }
29382 }
29383 if (BV_ISSET(fields, 1)) {
29384 log_packet_detailed(" got field 'options'");
29385 #ifdef FREECIV_JSON_CONNECTION
29386 field_addr.name = "options";
29387 #endif /* FREECIV_JSON_CONNECTION */
29388 if (!DIO_BV_GET(&din, &field_addr, real_packet->options)) {
29389 RECEIVE_PACKET_FIELD_ERROR(options);
29390 }
29391 }
29392
29393 if (NULL == old) {
29394 old = fc_malloc(sizeof(*old));
29395 *old = *real_packet;
29396 genhash_insert(*hash, old, old);
29397 } else {
29398 *old = *real_packet;
29399 }
29400
29401#endif /* FREECIV_DELTA_PROTOCOL */
29402 RECEIVE_PACKET_END(real_packet);
29403}
29404
29405 static int send_packet_city_options_req_100(struct connection *pc, const struct packet_city_options_req *packet)
29406{
29407 const struct packet_city_options_req *real_packet = packet;
29408#ifdef FREECIV_DELTA_PROTOCOL
29409 packet_city_options_req_100_fields fields;
29410 struct packet_city_options_req *old;
29411 bool differ;
29412 struct genhash **hash = pc->phs.sent + PACKET_CITY_OPTIONS_REQ;
29413#endif /* FREECIV_DELTA_PROTOCOL */
29414 SEND_PACKET_START(PACKET_CITY_OPTIONS_REQ);
29415#ifdef FREECIV_JSON_CONNECTION
29416 struct plocation field_addr;
29417 {
29418 struct plocation *field_addr_tmp = plocation_field_new(NULL);
29419 field_addr = *field_addr_tmp;
29420 FC_FREE(field_addr_tmp);
29421 }
29422#endif /* FREECIV_JSON_CONNECTION */
29423
29424 log_packet_detailed("packet_city_options_req_100: sending info about ()");
29425
29426#ifdef FREECIV_DELTA_PROTOCOL
29427 if (NULL == *hash) {
29428 *hash = genhash_new_full(hash_packet_city_options_req_100, cmp_packet_city_options_req_100,
29429 NULL, NULL, NULL, free);
29430 }
29431 BV_CLR_ALL(fields);
29432
29433 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
29434 old = fc_malloc(sizeof(*old));
29435 *old = *real_packet;
29436 genhash_insert(*hash, old, old);
29437 memset(old, 0, sizeof(*old));
29438 }
29439 differ = (old->city_id32 != real_packet->city_id32);
29440 if (differ) {
29441 BV_SET(fields, 0);
29442 }
29443
29444 differ = !BV_ARE_EQUAL(old->options, real_packet->options);
29445 if (differ) {
29446 BV_SET(fields, 1);
29447 }
29448
29449
29450#ifdef FREECIV_JSON_CONNECTION
29451 field_addr.name = "fields";
29452#endif /* FREECIV_JSON_CONNECTION */
29453 DIO_BV_PUT(&dout, &field_addr, fields);
29454
29455 if (BV_ISSET(fields, 0)) {
29456 log_packet_detailed(" field 'city_id32' has changed");
29457 #ifdef FREECIV_JSON_CONNECTION
29458 field_addr.name = "city_id32";
29459#endif /* FREECIV_JSON_CONNECTION */
29460 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
29461 }
29462 if (BV_ISSET(fields, 1)) {
29463 log_packet_detailed(" field 'options' has changed");
29464 #ifdef FREECIV_JSON_CONNECTION
29465 field_addr.name = "options";
29466#endif /* FREECIV_JSON_CONNECTION */
29467 DIO_BV_PUT(&dout, &field_addr, packet->options);
29468 }
29469
29470 *old = *real_packet;
29471#endif /* FREECIV_DELTA_PROTOCOL */
29472#ifndef FREECIV_DELTA_PROTOCOL
29473#ifdef FREECIV_JSON_CONNECTION
29474 field_addr.name = "city_id32";
29475#endif /* FREECIV_JSON_CONNECTION */
29476 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
29477#ifdef FREECIV_JSON_CONNECTION
29478 field_addr.name = "options";
29479#endif /* FREECIV_JSON_CONNECTION */
29480 DIO_BV_PUT(&dout, &field_addr, packet->options);
29481
29482#endif
29483 SEND_PACKET_END(PACKET_CITY_OPTIONS_REQ);
29484}
29485
29486#ifdef FREECIV_DELTA_PROTOCOL
29487#define hash_packet_city_options_req_101 hash_const
29488
29489#define cmp_packet_city_options_req_101 cmp_const
29490
29491 BV_DEFINE(packet_city_options_req_101_fields, 2);
29492#endif /* FREECIV_DELTA_PROTOCOL */
29493
29494 static struct packet_city_options_req *receive_packet_city_options_req_101(struct connection *pc)
29495{
29496#ifdef FREECIV_DELTA_PROTOCOL
29497 packet_city_options_req_101_fields fields;
29498 struct packet_city_options_req *old;
29499 struct genhash **hash = pc->phs.received + PACKET_CITY_OPTIONS_REQ;
29500#endif /* FREECIV_DELTA_PROTOCOL */
29501 RECEIVE_PACKET_START(packet_city_options_req, real_packet);
29502#ifdef FREECIV_JSON_CONNECTION
29503 struct plocation field_addr;
29504 {
29505 struct plocation *field_addr_tmp = plocation_field_new(NULL);
29506 field_addr = *field_addr_tmp;
29507 FC_FREE(field_addr_tmp);
29508 }
29509#endif /* FREECIV_JSON_CONNECTION */
29510
29511#ifdef FREECIV_DELTA_PROTOCOL
29512#ifdef FREECIV_JSON_CONNECTION
29513 field_addr.name = "fields";
29514#endif /* FREECIV_JSON_CONNECTION */
29515 DIO_BV_GET(&din, &field_addr, fields);
29516
29517#else /* FREECIV_DELTA_PROTOCOL */
29518 #ifdef FREECIV_JSON_CONNECTION
29519 field_addr.name = "city_id16";
29520 #endif /* FREECIV_JSON_CONNECTION */
29521 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
29522 RECEIVE_PACKET_FIELD_ERROR(city_id16);
29523 }
29524 #ifdef FREECIV_JSON_CONNECTION
29525 field_addr.name = "options";
29526 #endif /* FREECIV_JSON_CONNECTION */
29527 if (!DIO_BV_GET(&din, &field_addr, real_packet->options)) {
29528 RECEIVE_PACKET_FIELD_ERROR(options);
29529 }
29530
29531#endif
29532 log_packet_detailed("packet_city_options_req_101: got info about ()");
29533
29534#ifdef FREECIV_DELTA_PROTOCOL
29535 if (NULL == *hash) {
29536 *hash = genhash_new_full(hash_packet_city_options_req_101, cmp_packet_city_options_req_101,
29537 NULL, NULL, NULL, free);
29538 }
29539
29540 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
29541 *real_packet = *old;
29542 } else {
29543 log_packet_detailed(" no old info");
29544 memset(real_packet, 0, sizeof(*real_packet));
29545 }
29546
29547 if (BV_ISSET(fields, 0)) {
29548 log_packet_detailed(" got field 'city_id16'");
29549 #ifdef FREECIV_JSON_CONNECTION
29550 field_addr.name = "city_id16";
29551 #endif /* FREECIV_JSON_CONNECTION */
29552 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
29553 RECEIVE_PACKET_FIELD_ERROR(city_id16);
29554 }
29555 }
29556 if (BV_ISSET(fields, 1)) {
29557 log_packet_detailed(" got field 'options'");
29558 #ifdef FREECIV_JSON_CONNECTION
29559 field_addr.name = "options";
29560 #endif /* FREECIV_JSON_CONNECTION */
29561 if (!DIO_BV_GET(&din, &field_addr, real_packet->options)) {
29562 RECEIVE_PACKET_FIELD_ERROR(options);
29563 }
29564 }
29565
29566 if (NULL == old) {
29567 old = fc_malloc(sizeof(*old));
29568 *old = *real_packet;
29569 genhash_insert(*hash, old, old);
29570 } else {
29571 *old = *real_packet;
29572 }
29573
29574#endif /* FREECIV_DELTA_PROTOCOL */
29575 RECEIVE_PACKET_END(real_packet);
29576}
29577
29578 static int send_packet_city_options_req_101(struct connection *pc, const struct packet_city_options_req *packet)
29579{
29580 const struct packet_city_options_req *real_packet = packet;
29581#ifdef FREECIV_DELTA_PROTOCOL
29582 packet_city_options_req_101_fields fields;
29583 struct packet_city_options_req *old;
29584 bool differ;
29585 struct genhash **hash = pc->phs.sent + PACKET_CITY_OPTIONS_REQ;
29586#endif /* FREECIV_DELTA_PROTOCOL */
29587 SEND_PACKET_START(PACKET_CITY_OPTIONS_REQ);
29588#ifdef FREECIV_JSON_CONNECTION
29589 struct plocation field_addr;
29590 {
29591 struct plocation *field_addr_tmp = plocation_field_new(NULL);
29592 field_addr = *field_addr_tmp;
29593 FC_FREE(field_addr_tmp);
29594 }
29595#endif /* FREECIV_JSON_CONNECTION */
29596
29597 log_packet_detailed("packet_city_options_req_101: sending info about ()");
29598
29599#ifdef FREECIV_DELTA_PROTOCOL
29600 if (NULL == *hash) {
29601 *hash = genhash_new_full(hash_packet_city_options_req_101, cmp_packet_city_options_req_101,
29602 NULL, NULL, NULL, free);
29603 }
29604 BV_CLR_ALL(fields);
29605
29606 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
29607 old = fc_malloc(sizeof(*old));
29608 *old = *real_packet;
29609 genhash_insert(*hash, old, old);
29610 memset(old, 0, sizeof(*old));
29611 }
29612 differ = (old->city_id16 != real_packet->city_id16);
29613 if (differ) {
29614 BV_SET(fields, 0);
29615 }
29616
29617 differ = !BV_ARE_EQUAL(old->options, real_packet->options);
29618 if (differ) {
29619 BV_SET(fields, 1);
29620 }
29621
29622
29623#ifdef FREECIV_JSON_CONNECTION
29624 field_addr.name = "fields";
29625#endif /* FREECIV_JSON_CONNECTION */
29626 DIO_BV_PUT(&dout, &field_addr, fields);
29627
29628 if (BV_ISSET(fields, 0)) {
29629 log_packet_detailed(" field 'city_id16' has changed");
29630 #ifdef FREECIV_JSON_CONNECTION
29631 field_addr.name = "city_id16";
29632#endif /* FREECIV_JSON_CONNECTION */
29633 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
29634 }
29635 if (BV_ISSET(fields, 1)) {
29636 log_packet_detailed(" field 'options' has changed");
29637 #ifdef FREECIV_JSON_CONNECTION
29638 field_addr.name = "options";
29639#endif /* FREECIV_JSON_CONNECTION */
29640 DIO_BV_PUT(&dout, &field_addr, packet->options);
29641 }
29642
29643 *old = *real_packet;
29644#endif /* FREECIV_DELTA_PROTOCOL */
29645#ifndef FREECIV_DELTA_PROTOCOL
29646#ifdef FREECIV_JSON_CONNECTION
29647 field_addr.name = "city_id16";
29648#endif /* FREECIV_JSON_CONNECTION */
29649 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
29650#ifdef FREECIV_JSON_CONNECTION
29651 field_addr.name = "options";
29652#endif /* FREECIV_JSON_CONNECTION */
29653 DIO_BV_PUT(&dout, &field_addr, packet->options);
29654
29655#endif
29656 SEND_PACKET_END(PACKET_CITY_OPTIONS_REQ);
29657}
29658
29659 int send_packet_city_options_req(struct connection *pc, const struct packet_city_options_req *packet)
29660{
29661 if (!pc->used) {
29662 log_error("WARNING: trying to send data to the closed connection %s",
29663 conn_description(pc));
29664 return -1;
29665 }
29666 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_OPTIONS_REQ].packet != NULL, -1,
29667 "Handler for PACKET_CITY_OPTIONS_REQ not installed");
29668 return pc->phs.handlers->send[PACKET_CITY_OPTIONS_REQ].packet(pc, packet);
29669}
29670
29671 int dsend_packet_city_options_req(struct connection *pc, int city_id16, int city_id32, bv_city_options options)
29672{
29673 struct packet_city_options_req packet, *real_packet = &packet;
29674
29675 real_packet->city_id16 = city_id16;
29676 real_packet->city_id32 = city_id32;
29677 real_packet->options = options;
29678
29679 return send_packet_city_options_req(pc, real_packet);
29680}
29681
29682#ifdef FREECIV_DELTA_PROTOCOL
29683#define hash_packet_city_refresh_100 hash_const
29684
29685#define cmp_packet_city_refresh_100 cmp_const
29686
29687 BV_DEFINE(packet_city_refresh_100_fields, 1);
29688#endif /* FREECIV_DELTA_PROTOCOL */
29689
29690 static struct packet_city_refresh *receive_packet_city_refresh_100(struct connection *pc)
29691{
29692#ifdef FREECIV_DELTA_PROTOCOL
29693 packet_city_refresh_100_fields fields;
29694 struct packet_city_refresh *old;
29695 struct genhash **hash = pc->phs.received + PACKET_CITY_REFRESH;
29696#endif /* FREECIV_DELTA_PROTOCOL */
29697 RECEIVE_PACKET_START(packet_city_refresh, real_packet);
29698#ifdef FREECIV_JSON_CONNECTION
29699 struct plocation field_addr;
29700 {
29701 struct plocation *field_addr_tmp = plocation_field_new(NULL);
29702 field_addr = *field_addr_tmp;
29703 FC_FREE(field_addr_tmp);
29704 }
29705#endif /* FREECIV_JSON_CONNECTION */
29706
29707#ifdef FREECIV_DELTA_PROTOCOL
29708#ifdef FREECIV_JSON_CONNECTION
29709 field_addr.name = "fields";
29710#endif /* FREECIV_JSON_CONNECTION */
29711 DIO_BV_GET(&din, &field_addr, fields);
29712
29713#else /* FREECIV_DELTA_PROTOCOL */
29714 #ifdef FREECIV_JSON_CONNECTION
29715 field_addr.name = "city_id32";
29716 #endif /* FREECIV_JSON_CONNECTION */
29717 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
29718 RECEIVE_PACKET_FIELD_ERROR(city_id32);
29719 }
29720
29721#endif
29722 log_packet_detailed("packet_city_refresh_100: got info about ()");
29723
29724#ifdef FREECIV_DELTA_PROTOCOL
29725 if (NULL == *hash) {
29726 *hash = genhash_new_full(hash_packet_city_refresh_100, cmp_packet_city_refresh_100,
29727 NULL, NULL, NULL, free);
29728 }
29729
29730 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
29731 *real_packet = *old;
29732 } else {
29733 log_packet_detailed(" no old info");
29734 memset(real_packet, 0, sizeof(*real_packet));
29735 }
29736
29737 if (BV_ISSET(fields, 0)) {
29738 log_packet_detailed(" got field 'city_id32'");
29739 #ifdef FREECIV_JSON_CONNECTION
29740 field_addr.name = "city_id32";
29741 #endif /* FREECIV_JSON_CONNECTION */
29742 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
29743 RECEIVE_PACKET_FIELD_ERROR(city_id32);
29744 }
29745 }
29746
29747 if (NULL == old) {
29748 old = fc_malloc(sizeof(*old));
29749 *old = *real_packet;
29750 genhash_insert(*hash, old, old);
29751 } else {
29752 *old = *real_packet;
29753 }
29754
29755#endif /* FREECIV_DELTA_PROTOCOL */
29756 RECEIVE_PACKET_END(real_packet);
29757}
29758
29759 static int send_packet_city_refresh_100(struct connection *pc, const struct packet_city_refresh *packet)
29760{
29761 const struct packet_city_refresh *real_packet = packet;
29762#ifdef FREECIV_DELTA_PROTOCOL
29763 packet_city_refresh_100_fields fields;
29764 struct packet_city_refresh *old;
29765 bool differ;
29766 struct genhash **hash = pc->phs.sent + PACKET_CITY_REFRESH;
29767#endif /* FREECIV_DELTA_PROTOCOL */
29768 SEND_PACKET_START(PACKET_CITY_REFRESH);
29769#ifdef FREECIV_JSON_CONNECTION
29770 struct plocation field_addr;
29771 {
29772 struct plocation *field_addr_tmp = plocation_field_new(NULL);
29773 field_addr = *field_addr_tmp;
29774 FC_FREE(field_addr_tmp);
29775 }
29776#endif /* FREECIV_JSON_CONNECTION */
29777
29778 log_packet_detailed("packet_city_refresh_100: sending info about ()");
29779
29780#ifdef FREECIV_DELTA_PROTOCOL
29781 if (NULL == *hash) {
29782 *hash = genhash_new_full(hash_packet_city_refresh_100, cmp_packet_city_refresh_100,
29783 NULL, NULL, NULL, free);
29784 }
29785 BV_CLR_ALL(fields);
29786
29787 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
29788 old = fc_malloc(sizeof(*old));
29789 *old = *real_packet;
29790 genhash_insert(*hash, old, old);
29791 memset(old, 0, sizeof(*old));
29792 }
29793 differ = (old->city_id32 != real_packet->city_id32);
29794 if (differ) {
29795 BV_SET(fields, 0);
29796 }
29797
29798
29799#ifdef FREECIV_JSON_CONNECTION
29800 field_addr.name = "fields";
29801#endif /* FREECIV_JSON_CONNECTION */
29802 DIO_BV_PUT(&dout, &field_addr, fields);
29803
29804 if (BV_ISSET(fields, 0)) {
29805 log_packet_detailed(" field 'city_id32' has changed");
29806 #ifdef FREECIV_JSON_CONNECTION
29807 field_addr.name = "city_id32";
29808#endif /* FREECIV_JSON_CONNECTION */
29809 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
29810 }
29811
29812 *old = *real_packet;
29813#endif /* FREECIV_DELTA_PROTOCOL */
29814#ifndef FREECIV_DELTA_PROTOCOL
29815#ifdef FREECIV_JSON_CONNECTION
29816 field_addr.name = "city_id32";
29817#endif /* FREECIV_JSON_CONNECTION */
29818 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
29819
29820#endif
29821 SEND_PACKET_END(PACKET_CITY_REFRESH);
29822}
29823
29824#ifdef FREECIV_DELTA_PROTOCOL
29825#define hash_packet_city_refresh_101 hash_const
29826
29827#define cmp_packet_city_refresh_101 cmp_const
29828
29829 BV_DEFINE(packet_city_refresh_101_fields, 1);
29830#endif /* FREECIV_DELTA_PROTOCOL */
29831
29832 static struct packet_city_refresh *receive_packet_city_refresh_101(struct connection *pc)
29833{
29834#ifdef FREECIV_DELTA_PROTOCOL
29835 packet_city_refresh_101_fields fields;
29836 struct packet_city_refresh *old;
29837 struct genhash **hash = pc->phs.received + PACKET_CITY_REFRESH;
29838#endif /* FREECIV_DELTA_PROTOCOL */
29839 RECEIVE_PACKET_START(packet_city_refresh, real_packet);
29840#ifdef FREECIV_JSON_CONNECTION
29841 struct plocation field_addr;
29842 {
29843 struct plocation *field_addr_tmp = plocation_field_new(NULL);
29844 field_addr = *field_addr_tmp;
29845 FC_FREE(field_addr_tmp);
29846 }
29847#endif /* FREECIV_JSON_CONNECTION */
29848
29849#ifdef FREECIV_DELTA_PROTOCOL
29850#ifdef FREECIV_JSON_CONNECTION
29851 field_addr.name = "fields";
29852#endif /* FREECIV_JSON_CONNECTION */
29853 DIO_BV_GET(&din, &field_addr, fields);
29854
29855#else /* FREECIV_DELTA_PROTOCOL */
29856 #ifdef FREECIV_JSON_CONNECTION
29857 field_addr.name = "city_id16";
29858 #endif /* FREECIV_JSON_CONNECTION */
29859 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
29860 RECEIVE_PACKET_FIELD_ERROR(city_id16);
29861 }
29862
29863#endif
29864 log_packet_detailed("packet_city_refresh_101: got info about ()");
29865
29866#ifdef FREECIV_DELTA_PROTOCOL
29867 if (NULL == *hash) {
29868 *hash = genhash_new_full(hash_packet_city_refresh_101, cmp_packet_city_refresh_101,
29869 NULL, NULL, NULL, free);
29870 }
29871
29872 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
29873 *real_packet = *old;
29874 } else {
29875 log_packet_detailed(" no old info");
29876 memset(real_packet, 0, sizeof(*real_packet));
29877 }
29878
29879 if (BV_ISSET(fields, 0)) {
29880 log_packet_detailed(" got field 'city_id16'");
29881 #ifdef FREECIV_JSON_CONNECTION
29882 field_addr.name = "city_id16";
29883 #endif /* FREECIV_JSON_CONNECTION */
29884 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
29885 RECEIVE_PACKET_FIELD_ERROR(city_id16);
29886 }
29887 }
29888
29889 if (NULL == old) {
29890 old = fc_malloc(sizeof(*old));
29891 *old = *real_packet;
29892 genhash_insert(*hash, old, old);
29893 } else {
29894 *old = *real_packet;
29895 }
29896
29897#endif /* FREECIV_DELTA_PROTOCOL */
29898 RECEIVE_PACKET_END(real_packet);
29899}
29900
29901 static int send_packet_city_refresh_101(struct connection *pc, const struct packet_city_refresh *packet)
29902{
29903 const struct packet_city_refresh *real_packet = packet;
29904#ifdef FREECIV_DELTA_PROTOCOL
29905 packet_city_refresh_101_fields fields;
29906 struct packet_city_refresh *old;
29907 bool differ;
29908 struct genhash **hash = pc->phs.sent + PACKET_CITY_REFRESH;
29909#endif /* FREECIV_DELTA_PROTOCOL */
29910 SEND_PACKET_START(PACKET_CITY_REFRESH);
29911#ifdef FREECIV_JSON_CONNECTION
29912 struct plocation field_addr;
29913 {
29914 struct plocation *field_addr_tmp = plocation_field_new(NULL);
29915 field_addr = *field_addr_tmp;
29916 FC_FREE(field_addr_tmp);
29917 }
29918#endif /* FREECIV_JSON_CONNECTION */
29919
29920 log_packet_detailed("packet_city_refresh_101: sending info about ()");
29921
29922#ifdef FREECIV_DELTA_PROTOCOL
29923 if (NULL == *hash) {
29924 *hash = genhash_new_full(hash_packet_city_refresh_101, cmp_packet_city_refresh_101,
29925 NULL, NULL, NULL, free);
29926 }
29927 BV_CLR_ALL(fields);
29928
29929 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
29930 old = fc_malloc(sizeof(*old));
29931 *old = *real_packet;
29932 genhash_insert(*hash, old, old);
29933 memset(old, 0, sizeof(*old));
29934 }
29935 differ = (old->city_id16 != real_packet->city_id16);
29936 if (differ) {
29937 BV_SET(fields, 0);
29938 }
29939
29940
29941#ifdef FREECIV_JSON_CONNECTION
29942 field_addr.name = "fields";
29943#endif /* FREECIV_JSON_CONNECTION */
29944 DIO_BV_PUT(&dout, &field_addr, fields);
29945
29946 if (BV_ISSET(fields, 0)) {
29947 log_packet_detailed(" field 'city_id16' has changed");
29948 #ifdef FREECIV_JSON_CONNECTION
29949 field_addr.name = "city_id16";
29950#endif /* FREECIV_JSON_CONNECTION */
29951 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
29952 }
29953
29954 *old = *real_packet;
29955#endif /* FREECIV_DELTA_PROTOCOL */
29956#ifndef FREECIV_DELTA_PROTOCOL
29957#ifdef FREECIV_JSON_CONNECTION
29958 field_addr.name = "city_id16";
29959#endif /* FREECIV_JSON_CONNECTION */
29960 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
29961
29962#endif
29963 SEND_PACKET_END(PACKET_CITY_REFRESH);
29964}
29965
29966 int send_packet_city_refresh(struct connection *pc, const struct packet_city_refresh *packet)
29967{
29968 if (!pc->used) {
29969 log_error("WARNING: trying to send data to the closed connection %s",
29970 conn_description(pc));
29971 return -1;
29972 }
29973 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_REFRESH].packet != NULL, -1,
29974 "Handler for PACKET_CITY_REFRESH not installed");
29975 return pc->phs.handlers->send[PACKET_CITY_REFRESH].packet(pc, packet);
29976}
29977
29978 int dsend_packet_city_refresh(struct connection *pc, int city_id16, int city_id32)
29979{
29980 struct packet_city_refresh packet, *real_packet = &packet;
29981
29982 real_packet->city_id16 = city_id16;
29983 real_packet->city_id32 = city_id32;
29984
29985 return send_packet_city_refresh(pc, real_packet);
29986}
29987
29988#ifdef FREECIV_DELTA_PROTOCOL
29989#define hash_packet_city_name_suggestion_req_100 hash_const
29990
29991#define cmp_packet_city_name_suggestion_req_100 cmp_const
29992
29993 BV_DEFINE(packet_city_name_suggestion_req_100_fields, 1);
29994#endif /* FREECIV_DELTA_PROTOCOL */
29995
29996 static struct packet_city_name_suggestion_req *receive_packet_city_name_suggestion_req_100(struct connection *pc)
29997{
29998#ifdef FREECIV_DELTA_PROTOCOL
29999 packet_city_name_suggestion_req_100_fields fields;
30000 struct packet_city_name_suggestion_req *old;
30001 struct genhash **hash = pc->phs.received + PACKET_CITY_NAME_SUGGESTION_REQ;
30002#endif /* FREECIV_DELTA_PROTOCOL */
30003 RECEIVE_PACKET_START(packet_city_name_suggestion_req, real_packet);
30004#ifdef FREECIV_JSON_CONNECTION
30005 struct plocation field_addr;
30006 {
30007 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30008 field_addr = *field_addr_tmp;
30009 FC_FREE(field_addr_tmp);
30010 }
30011#endif /* FREECIV_JSON_CONNECTION */
30012
30013#ifdef FREECIV_DELTA_PROTOCOL
30014#ifdef FREECIV_JSON_CONNECTION
30015 field_addr.name = "fields";
30016#endif /* FREECIV_JSON_CONNECTION */
30017 DIO_BV_GET(&din, &field_addr, fields);
30018
30019#else /* FREECIV_DELTA_PROTOCOL */
30020 #ifdef FREECIV_JSON_CONNECTION
30021 field_addr.name = "unit_id32";
30022 #endif /* FREECIV_JSON_CONNECTION */
30023 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
30024 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
30025 }
30026
30027#endif
30028 log_packet_detailed("packet_city_name_suggestion_req_100: got info about ()");
30029
30030#ifdef FREECIV_DELTA_PROTOCOL
30031 if (NULL == *hash) {
30032 *hash = genhash_new_full(hash_packet_city_name_suggestion_req_100, cmp_packet_city_name_suggestion_req_100,
30033 NULL, NULL, NULL, free);
30034 }
30035
30036 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
30037 *real_packet = *old;
30038 } else {
30039 log_packet_detailed(" no old info");
30040 memset(real_packet, 0, sizeof(*real_packet));
30041 }
30042
30043 if (BV_ISSET(fields, 0)) {
30044 log_packet_detailed(" got field 'unit_id32'");
30045 #ifdef FREECIV_JSON_CONNECTION
30046 field_addr.name = "unit_id32";
30047 #endif /* FREECIV_JSON_CONNECTION */
30048 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
30049 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
30050 }
30051 }
30052
30053 if (NULL == old) {
30054 old = fc_malloc(sizeof(*old));
30055 *old = *real_packet;
30056 genhash_insert(*hash, old, old);
30057 } else {
30058 *old = *real_packet;
30059 }
30060
30061#endif /* FREECIV_DELTA_PROTOCOL */
30062 RECEIVE_PACKET_END(real_packet);
30063}
30064
30065 static int send_packet_city_name_suggestion_req_100(struct connection *pc, const struct packet_city_name_suggestion_req *packet)
30066{
30067 const struct packet_city_name_suggestion_req *real_packet = packet;
30068#ifdef FREECIV_DELTA_PROTOCOL
30069 packet_city_name_suggestion_req_100_fields fields;
30070 struct packet_city_name_suggestion_req *old;
30071 bool differ;
30072 struct genhash **hash = pc->phs.sent + PACKET_CITY_NAME_SUGGESTION_REQ;
30073#endif /* FREECIV_DELTA_PROTOCOL */
30074 SEND_PACKET_START(PACKET_CITY_NAME_SUGGESTION_REQ);
30075#ifdef FREECIV_JSON_CONNECTION
30076 struct plocation field_addr;
30077 {
30078 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30079 field_addr = *field_addr_tmp;
30080 FC_FREE(field_addr_tmp);
30081 }
30082#endif /* FREECIV_JSON_CONNECTION */
30083
30084 log_packet_detailed("packet_city_name_suggestion_req_100: sending info about ()");
30085
30086#ifdef FREECIV_DELTA_PROTOCOL
30087 if (NULL == *hash) {
30088 *hash = genhash_new_full(hash_packet_city_name_suggestion_req_100, cmp_packet_city_name_suggestion_req_100,
30089 NULL, NULL, NULL, free);
30090 }
30091 BV_CLR_ALL(fields);
30092
30093 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
30094 old = fc_malloc(sizeof(*old));
30095 *old = *real_packet;
30096 genhash_insert(*hash, old, old);
30097 memset(old, 0, sizeof(*old));
30098 }
30099 differ = (old->unit_id32 != real_packet->unit_id32);
30100 if (differ) {
30101 BV_SET(fields, 0);
30102 }
30103
30104
30105#ifdef FREECIV_JSON_CONNECTION
30106 field_addr.name = "fields";
30107#endif /* FREECIV_JSON_CONNECTION */
30108 DIO_BV_PUT(&dout, &field_addr, fields);
30109
30110 if (BV_ISSET(fields, 0)) {
30111 log_packet_detailed(" field 'unit_id32' has changed");
30112 #ifdef FREECIV_JSON_CONNECTION
30113 field_addr.name = "unit_id32";
30114#endif /* FREECIV_JSON_CONNECTION */
30115 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
30116 }
30117
30118 *old = *real_packet;
30119#endif /* FREECIV_DELTA_PROTOCOL */
30120#ifndef FREECIV_DELTA_PROTOCOL
30121#ifdef FREECIV_JSON_CONNECTION
30122 field_addr.name = "unit_id32";
30123#endif /* FREECIV_JSON_CONNECTION */
30124 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
30125
30126#endif
30127 SEND_PACKET_END(PACKET_CITY_NAME_SUGGESTION_REQ);
30128}
30129
30130#ifdef FREECIV_DELTA_PROTOCOL
30131#define hash_packet_city_name_suggestion_req_101 hash_const
30132
30133#define cmp_packet_city_name_suggestion_req_101 cmp_const
30134
30135 BV_DEFINE(packet_city_name_suggestion_req_101_fields, 1);
30136#endif /* FREECIV_DELTA_PROTOCOL */
30137
30138 static struct packet_city_name_suggestion_req *receive_packet_city_name_suggestion_req_101(struct connection *pc)
30139{
30140#ifdef FREECIV_DELTA_PROTOCOL
30141 packet_city_name_suggestion_req_101_fields fields;
30142 struct packet_city_name_suggestion_req *old;
30143 struct genhash **hash = pc->phs.received + PACKET_CITY_NAME_SUGGESTION_REQ;
30144#endif /* FREECIV_DELTA_PROTOCOL */
30145 RECEIVE_PACKET_START(packet_city_name_suggestion_req, real_packet);
30146#ifdef FREECIV_JSON_CONNECTION
30147 struct plocation field_addr;
30148 {
30149 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30150 field_addr = *field_addr_tmp;
30151 FC_FREE(field_addr_tmp);
30152 }
30153#endif /* FREECIV_JSON_CONNECTION */
30154
30155#ifdef FREECIV_DELTA_PROTOCOL
30156#ifdef FREECIV_JSON_CONNECTION
30157 field_addr.name = "fields";
30158#endif /* FREECIV_JSON_CONNECTION */
30159 DIO_BV_GET(&din, &field_addr, fields);
30160
30161#else /* FREECIV_DELTA_PROTOCOL */
30162 #ifdef FREECIV_JSON_CONNECTION
30163 field_addr.name = "unit_id16";
30164 #endif /* FREECIV_JSON_CONNECTION */
30165 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
30166 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
30167 }
30168
30169#endif
30170 log_packet_detailed("packet_city_name_suggestion_req_101: got info about ()");
30171
30172#ifdef FREECIV_DELTA_PROTOCOL
30173 if (NULL == *hash) {
30174 *hash = genhash_new_full(hash_packet_city_name_suggestion_req_101, cmp_packet_city_name_suggestion_req_101,
30175 NULL, NULL, NULL, free);
30176 }
30177
30178 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
30179 *real_packet = *old;
30180 } else {
30181 log_packet_detailed(" no old info");
30182 memset(real_packet, 0, sizeof(*real_packet));
30183 }
30184
30185 if (BV_ISSET(fields, 0)) {
30186 log_packet_detailed(" got field 'unit_id16'");
30187 #ifdef FREECIV_JSON_CONNECTION
30188 field_addr.name = "unit_id16";
30189 #endif /* FREECIV_JSON_CONNECTION */
30190 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
30191 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
30192 }
30193 }
30194
30195 if (NULL == old) {
30196 old = fc_malloc(sizeof(*old));
30197 *old = *real_packet;
30198 genhash_insert(*hash, old, old);
30199 } else {
30200 *old = *real_packet;
30201 }
30202
30203#endif /* FREECIV_DELTA_PROTOCOL */
30204 RECEIVE_PACKET_END(real_packet);
30205}
30206
30207 static int send_packet_city_name_suggestion_req_101(struct connection *pc, const struct packet_city_name_suggestion_req *packet)
30208{
30209 const struct packet_city_name_suggestion_req *real_packet = packet;
30210#ifdef FREECIV_DELTA_PROTOCOL
30211 packet_city_name_suggestion_req_101_fields fields;
30212 struct packet_city_name_suggestion_req *old;
30213 bool differ;
30214 struct genhash **hash = pc->phs.sent + PACKET_CITY_NAME_SUGGESTION_REQ;
30215#endif /* FREECIV_DELTA_PROTOCOL */
30216 SEND_PACKET_START(PACKET_CITY_NAME_SUGGESTION_REQ);
30217#ifdef FREECIV_JSON_CONNECTION
30218 struct plocation field_addr;
30219 {
30220 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30221 field_addr = *field_addr_tmp;
30222 FC_FREE(field_addr_tmp);
30223 }
30224#endif /* FREECIV_JSON_CONNECTION */
30225
30226 log_packet_detailed("packet_city_name_suggestion_req_101: sending info about ()");
30227
30228#ifdef FREECIV_DELTA_PROTOCOL
30229 if (NULL == *hash) {
30230 *hash = genhash_new_full(hash_packet_city_name_suggestion_req_101, cmp_packet_city_name_suggestion_req_101,
30231 NULL, NULL, NULL, free);
30232 }
30233 BV_CLR_ALL(fields);
30234
30235 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
30236 old = fc_malloc(sizeof(*old));
30237 *old = *real_packet;
30238 genhash_insert(*hash, old, old);
30239 memset(old, 0, sizeof(*old));
30240 }
30241 differ = (old->unit_id16 != real_packet->unit_id16);
30242 if (differ) {
30243 BV_SET(fields, 0);
30244 }
30245
30246
30247#ifdef FREECIV_JSON_CONNECTION
30248 field_addr.name = "fields";
30249#endif /* FREECIV_JSON_CONNECTION */
30250 DIO_BV_PUT(&dout, &field_addr, fields);
30251
30252 if (BV_ISSET(fields, 0)) {
30253 log_packet_detailed(" field 'unit_id16' has changed");
30254 #ifdef FREECIV_JSON_CONNECTION
30255 field_addr.name = "unit_id16";
30256#endif /* FREECIV_JSON_CONNECTION */
30257 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
30258 }
30259
30260 *old = *real_packet;
30261#endif /* FREECIV_DELTA_PROTOCOL */
30262#ifndef FREECIV_DELTA_PROTOCOL
30263#ifdef FREECIV_JSON_CONNECTION
30264 field_addr.name = "unit_id16";
30265#endif /* FREECIV_JSON_CONNECTION */
30266 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
30267
30268#endif
30269 SEND_PACKET_END(PACKET_CITY_NAME_SUGGESTION_REQ);
30270}
30271
30272 int send_packet_city_name_suggestion_req(struct connection *pc, const struct packet_city_name_suggestion_req *packet)
30273{
30274 if (!pc->used) {
30275 log_error("WARNING: trying to send data to the closed connection %s",
30276 conn_description(pc));
30277 return -1;
30278 }
30279 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_NAME_SUGGESTION_REQ].packet != NULL, -1,
30280 "Handler for PACKET_CITY_NAME_SUGGESTION_REQ not installed");
30281 return pc->phs.handlers->send[PACKET_CITY_NAME_SUGGESTION_REQ].packet(pc, packet);
30282}
30283
30284 int dsend_packet_city_name_suggestion_req(struct connection *pc, int unit_id16, int unit_id32)
30285{
30286 struct packet_city_name_suggestion_req packet, *real_packet = &packet;
30287
30288 real_packet->unit_id16 = unit_id16;
30289 real_packet->unit_id32 = unit_id32;
30290
30291 return send_packet_city_name_suggestion_req(pc, real_packet);
30292}
30293
30294#ifdef FREECIV_DELTA_PROTOCOL
30295#define hash_packet_city_name_suggestion_info_100 hash_const
30296
30297#define cmp_packet_city_name_suggestion_info_100 cmp_const
30298
30299 BV_DEFINE(packet_city_name_suggestion_info_100_fields, 2);
30300#endif /* FREECIV_DELTA_PROTOCOL */
30301
30302 static struct packet_city_name_suggestion_info *receive_packet_city_name_suggestion_info_100(struct connection *pc)
30303{
30304#ifdef FREECIV_DELTA_PROTOCOL
30305 packet_city_name_suggestion_info_100_fields fields;
30306 struct packet_city_name_suggestion_info *old;
30307 struct genhash **hash = pc->phs.received + PACKET_CITY_NAME_SUGGESTION_INFO;
30308#endif /* FREECIV_DELTA_PROTOCOL */
30309 RECEIVE_PACKET_START(packet_city_name_suggestion_info, real_packet);
30310#ifdef FREECIV_JSON_CONNECTION
30311 struct plocation field_addr;
30312 {
30313 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30314 field_addr = *field_addr_tmp;
30315 FC_FREE(field_addr_tmp);
30316 }
30317#endif /* FREECIV_JSON_CONNECTION */
30318
30319#ifdef FREECIV_DELTA_PROTOCOL
30320#ifdef FREECIV_JSON_CONNECTION
30321 field_addr.name = "fields";
30322#endif /* FREECIV_JSON_CONNECTION */
30323 DIO_BV_GET(&din, &field_addr, fields);
30324
30325#else /* FREECIV_DELTA_PROTOCOL */
30326 #ifdef FREECIV_JSON_CONNECTION
30327 field_addr.name = "unit_id32";
30328 #endif /* FREECIV_JSON_CONNECTION */
30329 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
30330 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
30331 }
30332 #ifdef FREECIV_JSON_CONNECTION
30333 field_addr.name = "name";
30334 #endif /* FREECIV_JSON_CONNECTION */
30335 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
30336 RECEIVE_PACKET_FIELD_ERROR(name);
30337 }
30338
30339#endif
30340 log_packet_detailed("packet_city_name_suggestion_info_100: got info about ()");
30341
30342#ifdef FREECIV_DELTA_PROTOCOL
30343 if (NULL == *hash) {
30344 *hash = genhash_new_full(hash_packet_city_name_suggestion_info_100, cmp_packet_city_name_suggestion_info_100,
30345 NULL, NULL, NULL, free);
30346 }
30347
30348 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
30349 *real_packet = *old;
30350 } else {
30351 log_packet_detailed(" no old info");
30352 memset(real_packet, 0, sizeof(*real_packet));
30353 }
30354
30355 if (BV_ISSET(fields, 0)) {
30356 log_packet_detailed(" got field 'unit_id32'");
30357 #ifdef FREECIV_JSON_CONNECTION
30358 field_addr.name = "unit_id32";
30359 #endif /* FREECIV_JSON_CONNECTION */
30360 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
30361 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
30362 }
30363 }
30364 if (BV_ISSET(fields, 1)) {
30365 log_packet_detailed(" got field 'name'");
30366 #ifdef FREECIV_JSON_CONNECTION
30367 field_addr.name = "name";
30368 #endif /* FREECIV_JSON_CONNECTION */
30369 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
30370 RECEIVE_PACKET_FIELD_ERROR(name);
30371 }
30372 }
30373
30374 if (NULL == old) {
30375 old = fc_malloc(sizeof(*old));
30376 *old = *real_packet;
30377 genhash_insert(*hash, old, old);
30378 } else {
30379 *old = *real_packet;
30380 }
30381
30382#endif /* FREECIV_DELTA_PROTOCOL */
30383 RECEIVE_PACKET_END(real_packet);
30384}
30385
30386 static int send_packet_city_name_suggestion_info_100(struct connection *pc, const struct packet_city_name_suggestion_info *packet)
30387{
30388 const struct packet_city_name_suggestion_info *real_packet = packet;
30389#ifdef FREECIV_DELTA_PROTOCOL
30390 packet_city_name_suggestion_info_100_fields fields;
30391 struct packet_city_name_suggestion_info *old;
30392 bool differ;
30393 struct genhash **hash = pc->phs.sent + PACKET_CITY_NAME_SUGGESTION_INFO;
30394#endif /* FREECIV_DELTA_PROTOCOL */
30395 SEND_PACKET_START(PACKET_CITY_NAME_SUGGESTION_INFO);
30396#ifdef FREECIV_JSON_CONNECTION
30397 struct plocation field_addr;
30398 {
30399 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30400 field_addr = *field_addr_tmp;
30401 FC_FREE(field_addr_tmp);
30402 }
30403#endif /* FREECIV_JSON_CONNECTION */
30404
30405 log_packet_detailed("packet_city_name_suggestion_info_100: sending info about ()");
30406
30407#ifdef FREECIV_DELTA_PROTOCOL
30408 if (NULL == *hash) {
30409 *hash = genhash_new_full(hash_packet_city_name_suggestion_info_100, cmp_packet_city_name_suggestion_info_100,
30410 NULL, NULL, NULL, free);
30411 }
30412 BV_CLR_ALL(fields);
30413
30414 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
30415 old = fc_malloc(sizeof(*old));
30416 *old = *real_packet;
30417 genhash_insert(*hash, old, old);
30418 memset(old, 0, sizeof(*old));
30419 }
30420 differ = (old->unit_id32 != real_packet->unit_id32);
30421 if (differ) {
30422 BV_SET(fields, 0);
30423 }
30424
30425 differ = (strcmp(old->name, real_packet->name) != 0);
30426 if (differ) {
30427 BV_SET(fields, 1);
30428 }
30429
30430
30431#ifdef FREECIV_JSON_CONNECTION
30432 field_addr.name = "fields";
30433#endif /* FREECIV_JSON_CONNECTION */
30434 DIO_BV_PUT(&dout, &field_addr, fields);
30435
30436 if (BV_ISSET(fields, 0)) {
30437 log_packet_detailed(" field 'unit_id32' has changed");
30438 #ifdef FREECIV_JSON_CONNECTION
30439 field_addr.name = "unit_id32";
30440#endif /* FREECIV_JSON_CONNECTION */
30441 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
30442 }
30443 if (BV_ISSET(fields, 1)) {
30444 log_packet_detailed(" field 'name' has changed");
30445 #ifdef FREECIV_JSON_CONNECTION
30446 field_addr.name = "name";
30447#endif /* FREECIV_JSON_CONNECTION */
30448 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
30449 }
30450
30451 *old = *real_packet;
30452#endif /* FREECIV_DELTA_PROTOCOL */
30453#ifndef FREECIV_DELTA_PROTOCOL
30454#ifdef FREECIV_JSON_CONNECTION
30455 field_addr.name = "unit_id32";
30456#endif /* FREECIV_JSON_CONNECTION */
30457 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
30458#ifdef FREECIV_JSON_CONNECTION
30459 field_addr.name = "name";
30460#endif /* FREECIV_JSON_CONNECTION */
30461 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
30462
30463#endif
30464 SEND_PACKET_END(PACKET_CITY_NAME_SUGGESTION_INFO);
30465}
30466
30467#ifdef FREECIV_DELTA_PROTOCOL
30468#define hash_packet_city_name_suggestion_info_101 hash_const
30469
30470#define cmp_packet_city_name_suggestion_info_101 cmp_const
30471
30472 BV_DEFINE(packet_city_name_suggestion_info_101_fields, 2);
30473#endif /* FREECIV_DELTA_PROTOCOL */
30474
30475 static struct packet_city_name_suggestion_info *receive_packet_city_name_suggestion_info_101(struct connection *pc)
30476{
30477#ifdef FREECIV_DELTA_PROTOCOL
30478 packet_city_name_suggestion_info_101_fields fields;
30479 struct packet_city_name_suggestion_info *old;
30480 struct genhash **hash = pc->phs.received + PACKET_CITY_NAME_SUGGESTION_INFO;
30481#endif /* FREECIV_DELTA_PROTOCOL */
30482 RECEIVE_PACKET_START(packet_city_name_suggestion_info, real_packet);
30483#ifdef FREECIV_JSON_CONNECTION
30484 struct plocation field_addr;
30485 {
30486 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30487 field_addr = *field_addr_tmp;
30488 FC_FREE(field_addr_tmp);
30489 }
30490#endif /* FREECIV_JSON_CONNECTION */
30491
30492#ifdef FREECIV_DELTA_PROTOCOL
30493#ifdef FREECIV_JSON_CONNECTION
30494 field_addr.name = "fields";
30495#endif /* FREECIV_JSON_CONNECTION */
30496 DIO_BV_GET(&din, &field_addr, fields);
30497
30498#else /* FREECIV_DELTA_PROTOCOL */
30499 #ifdef FREECIV_JSON_CONNECTION
30500 field_addr.name = "unit_id16";
30501 #endif /* FREECIV_JSON_CONNECTION */
30502 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
30503 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
30504 }
30505 #ifdef FREECIV_JSON_CONNECTION
30506 field_addr.name = "name";
30507 #endif /* FREECIV_JSON_CONNECTION */
30508 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
30509 RECEIVE_PACKET_FIELD_ERROR(name);
30510 }
30511
30512#endif
30513 log_packet_detailed("packet_city_name_suggestion_info_101: got info about ()");
30514
30515#ifdef FREECIV_DELTA_PROTOCOL
30516 if (NULL == *hash) {
30517 *hash = genhash_new_full(hash_packet_city_name_suggestion_info_101, cmp_packet_city_name_suggestion_info_101,
30518 NULL, NULL, NULL, free);
30519 }
30520
30521 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
30522 *real_packet = *old;
30523 } else {
30524 log_packet_detailed(" no old info");
30525 memset(real_packet, 0, sizeof(*real_packet));
30526 }
30527
30528 if (BV_ISSET(fields, 0)) {
30529 log_packet_detailed(" got field 'unit_id16'");
30530 #ifdef FREECIV_JSON_CONNECTION
30531 field_addr.name = "unit_id16";
30532 #endif /* FREECIV_JSON_CONNECTION */
30533 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
30534 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
30535 }
30536 }
30537 if (BV_ISSET(fields, 1)) {
30538 log_packet_detailed(" got field 'name'");
30539 #ifdef FREECIV_JSON_CONNECTION
30540 field_addr.name = "name";
30541 #endif /* FREECIV_JSON_CONNECTION */
30542 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
30543 RECEIVE_PACKET_FIELD_ERROR(name);
30544 }
30545 }
30546
30547 if (NULL == old) {
30548 old = fc_malloc(sizeof(*old));
30549 *old = *real_packet;
30550 genhash_insert(*hash, old, old);
30551 } else {
30552 *old = *real_packet;
30553 }
30554
30555#endif /* FREECIV_DELTA_PROTOCOL */
30556 RECEIVE_PACKET_END(real_packet);
30557}
30558
30559 static int send_packet_city_name_suggestion_info_101(struct connection *pc, const struct packet_city_name_suggestion_info *packet)
30560{
30561 const struct packet_city_name_suggestion_info *real_packet = packet;
30562#ifdef FREECIV_DELTA_PROTOCOL
30563 packet_city_name_suggestion_info_101_fields fields;
30564 struct packet_city_name_suggestion_info *old;
30565 bool differ;
30566 struct genhash **hash = pc->phs.sent + PACKET_CITY_NAME_SUGGESTION_INFO;
30567#endif /* FREECIV_DELTA_PROTOCOL */
30568 SEND_PACKET_START(PACKET_CITY_NAME_SUGGESTION_INFO);
30569#ifdef FREECIV_JSON_CONNECTION
30570 struct plocation field_addr;
30571 {
30572 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30573 field_addr = *field_addr_tmp;
30574 FC_FREE(field_addr_tmp);
30575 }
30576#endif /* FREECIV_JSON_CONNECTION */
30577
30578 log_packet_detailed("packet_city_name_suggestion_info_101: sending info about ()");
30579
30580#ifdef FREECIV_DELTA_PROTOCOL
30581 if (NULL == *hash) {
30582 *hash = genhash_new_full(hash_packet_city_name_suggestion_info_101, cmp_packet_city_name_suggestion_info_101,
30583 NULL, NULL, NULL, free);
30584 }
30585 BV_CLR_ALL(fields);
30586
30587 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
30588 old = fc_malloc(sizeof(*old));
30589 *old = *real_packet;
30590 genhash_insert(*hash, old, old);
30591 memset(old, 0, sizeof(*old));
30592 }
30593 differ = (old->unit_id16 != real_packet->unit_id16);
30594 if (differ) {
30595 BV_SET(fields, 0);
30596 }
30597
30598 differ = (strcmp(old->name, real_packet->name) != 0);
30599 if (differ) {
30600 BV_SET(fields, 1);
30601 }
30602
30603
30604#ifdef FREECIV_JSON_CONNECTION
30605 field_addr.name = "fields";
30606#endif /* FREECIV_JSON_CONNECTION */
30607 DIO_BV_PUT(&dout, &field_addr, fields);
30608
30609 if (BV_ISSET(fields, 0)) {
30610 log_packet_detailed(" field 'unit_id16' has changed");
30611 #ifdef FREECIV_JSON_CONNECTION
30612 field_addr.name = "unit_id16";
30613#endif /* FREECIV_JSON_CONNECTION */
30614 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
30615 }
30616 if (BV_ISSET(fields, 1)) {
30617 log_packet_detailed(" field 'name' has changed");
30618 #ifdef FREECIV_JSON_CONNECTION
30619 field_addr.name = "name";
30620#endif /* FREECIV_JSON_CONNECTION */
30621 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
30622 }
30623
30624 *old = *real_packet;
30625#endif /* FREECIV_DELTA_PROTOCOL */
30626#ifndef FREECIV_DELTA_PROTOCOL
30627#ifdef FREECIV_JSON_CONNECTION
30628 field_addr.name = "unit_id16";
30629#endif /* FREECIV_JSON_CONNECTION */
30630 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
30631#ifdef FREECIV_JSON_CONNECTION
30632 field_addr.name = "name";
30633#endif /* FREECIV_JSON_CONNECTION */
30634 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
30635
30636#endif
30637 SEND_PACKET_END(PACKET_CITY_NAME_SUGGESTION_INFO);
30638}
30639
30640 int send_packet_city_name_suggestion_info(struct connection *pc, const struct packet_city_name_suggestion_info *packet)
30641{
30642 if (!pc->used) {
30643 log_error("WARNING: trying to send data to the closed connection %s",
30644 conn_description(pc));
30645 return -1;
30646 }
30647 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_NAME_SUGGESTION_INFO].packet != NULL, -1,
30648 "Handler for PACKET_CITY_NAME_SUGGESTION_INFO not installed");
30649 return pc->phs.handlers->send[PACKET_CITY_NAME_SUGGESTION_INFO].packet(pc, packet);
30650}
30651
30652 void lsend_packet_city_name_suggestion_info(struct conn_list *dest, const struct packet_city_name_suggestion_info *packet)
30653{
30654 conn_list_iterate(dest, pconn) {
30655 send_packet_city_name_suggestion_info(pconn, packet);
30656 } conn_list_iterate_end;
30657}
30658
30659 int dsend_packet_city_name_suggestion_info(struct connection *pc, int unit_id16, int unit_id32, const char *name)
30660{
30661 struct packet_city_name_suggestion_info packet, *real_packet = &packet;
30662
30663 real_packet->unit_id16 = unit_id16;
30664 real_packet->unit_id32 = unit_id32;
30665 sz_strlcpy(real_packet->name, name);
30666
30667 return send_packet_city_name_suggestion_info(pc, real_packet);
30668}
30669
30670 void dlsend_packet_city_name_suggestion_info(struct conn_list *dest, int unit_id16, int unit_id32, const char *name)
30671{
30672 struct packet_city_name_suggestion_info packet, *real_packet = &packet;
30673
30674 real_packet->unit_id16 = unit_id16;
30675 real_packet->unit_id32 = unit_id32;
30676 sz_strlcpy(real_packet->name, name);
30677
30678 lsend_packet_city_name_suggestion_info(dest, real_packet);
30679}
30680
30681#ifdef FREECIV_DELTA_PROTOCOL
30682#define hash_packet_city_sabotage_list_100 hash_const
30683
30684#define cmp_packet_city_sabotage_list_100 cmp_const
30685
30686 BV_DEFINE(packet_city_sabotage_list_100_fields, 5);
30687#endif /* FREECIV_DELTA_PROTOCOL */
30688
30689 static struct packet_city_sabotage_list *receive_packet_city_sabotage_list_100(struct connection *pc)
30690{
30691#ifdef FREECIV_DELTA_PROTOCOL
30692 packet_city_sabotage_list_100_fields fields;
30693 struct packet_city_sabotage_list *old;
30694 struct genhash **hash = pc->phs.received + PACKET_CITY_SABOTAGE_LIST;
30695#endif /* FREECIV_DELTA_PROTOCOL */
30696 RECEIVE_PACKET_START(packet_city_sabotage_list, real_packet);
30697#ifdef FREECIV_JSON_CONNECTION
30698 struct plocation field_addr;
30699 {
30700 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30701 field_addr = *field_addr_tmp;
30702 FC_FREE(field_addr_tmp);
30703 }
30704#endif /* FREECIV_JSON_CONNECTION */
30705
30706#ifdef FREECIV_DELTA_PROTOCOL
30707#ifdef FREECIV_JSON_CONNECTION
30708 field_addr.name = "fields";
30709#endif /* FREECIV_JSON_CONNECTION */
30710 DIO_BV_GET(&din, &field_addr, fields);
30711
30712#else /* FREECIV_DELTA_PROTOCOL */
30713 #ifdef FREECIV_JSON_CONNECTION
30714 field_addr.name = "actor_id32";
30715 #endif /* FREECIV_JSON_CONNECTION */
30716 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id32)) {
30717 RECEIVE_PACKET_FIELD_ERROR(actor_id32);
30718 }
30719 #ifdef FREECIV_JSON_CONNECTION
30720 field_addr.name = "city_id32";
30721 #endif /* FREECIV_JSON_CONNECTION */
30722 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
30723 RECEIVE_PACKET_FIELD_ERROR(city_id32);
30724 }
30725 #ifdef FREECIV_JSON_CONNECTION
30726 field_addr.name = "improvements";
30727 #endif /* FREECIV_JSON_CONNECTION */
30728 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
30729 RECEIVE_PACKET_FIELD_ERROR(improvements);
30730 }
30731 #ifdef FREECIV_JSON_CONNECTION
30732 field_addr.name = "act_id";
30733 #endif /* FREECIV_JSON_CONNECTION */
30734 {
30735 int readin;
30736
30737 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
30738 RECEIVE_PACKET_FIELD_ERROR(act_id);
30739 }
30740 real_packet->act_id = readin;
30741 }
30742 #ifdef FREECIV_JSON_CONNECTION
30743 field_addr.name = "request_kind";
30744 #endif /* FREECIV_JSON_CONNECTION */
30745 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
30746 RECEIVE_PACKET_FIELD_ERROR(request_kind);
30747 }
30748
30749#endif
30750 log_packet_detailed("packet_city_sabotage_list_100: got info about ()");
30751
30752#ifdef FREECIV_DELTA_PROTOCOL
30753 if (NULL == *hash) {
30754 *hash = genhash_new_full(hash_packet_city_sabotage_list_100, cmp_packet_city_sabotage_list_100,
30755 NULL, NULL, NULL, free);
30756 }
30757
30758 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
30759 *real_packet = *old;
30760 } else {
30761 log_packet_detailed(" no old info");
30762 memset(real_packet, 0, sizeof(*real_packet));
30763 }
30764
30765 if (BV_ISSET(fields, 0)) {
30766 log_packet_detailed(" got field 'actor_id32'");
30767 #ifdef FREECIV_JSON_CONNECTION
30768 field_addr.name = "actor_id32";
30769 #endif /* FREECIV_JSON_CONNECTION */
30770 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id32)) {
30771 RECEIVE_PACKET_FIELD_ERROR(actor_id32);
30772 }
30773 }
30774 if (BV_ISSET(fields, 1)) {
30775 log_packet_detailed(" got field 'city_id32'");
30776 #ifdef FREECIV_JSON_CONNECTION
30777 field_addr.name = "city_id32";
30778 #endif /* FREECIV_JSON_CONNECTION */
30779 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
30780 RECEIVE_PACKET_FIELD_ERROR(city_id32);
30781 }
30782 }
30783 if (BV_ISSET(fields, 2)) {
30784 log_packet_detailed(" got field 'improvements'");
30785 #ifdef FREECIV_JSON_CONNECTION
30786 field_addr.name = "improvements";
30787 #endif /* FREECIV_JSON_CONNECTION */
30788 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
30789 RECEIVE_PACKET_FIELD_ERROR(improvements);
30790 }
30791 }
30792 if (BV_ISSET(fields, 3)) {
30793 log_packet_detailed(" got field 'act_id'");
30794 #ifdef FREECIV_JSON_CONNECTION
30795 field_addr.name = "act_id";
30796 #endif /* FREECIV_JSON_CONNECTION */
30797 {
30798 int readin;
30799
30800 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
30801 RECEIVE_PACKET_FIELD_ERROR(act_id);
30802 }
30803 real_packet->act_id = readin;
30804 }
30805 }
30806 if (BV_ISSET(fields, 4)) {
30807 log_packet_detailed(" got field 'request_kind'");
30808 #ifdef FREECIV_JSON_CONNECTION
30809 field_addr.name = "request_kind";
30810 #endif /* FREECIV_JSON_CONNECTION */
30811 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
30812 RECEIVE_PACKET_FIELD_ERROR(request_kind);
30813 }
30814 }
30815
30816 if (NULL == old) {
30817 old = fc_malloc(sizeof(*old));
30818 *old = *real_packet;
30819 genhash_insert(*hash, old, old);
30820 } else {
30821 *old = *real_packet;
30822 }
30823
30824#endif /* FREECIV_DELTA_PROTOCOL */
30825 RECEIVE_PACKET_END(real_packet);
30826}
30827
30828 static int send_packet_city_sabotage_list_100(struct connection *pc, const struct packet_city_sabotage_list *packet)
30829{
30830 const struct packet_city_sabotage_list *real_packet = packet;
30831#ifdef FREECIV_DELTA_PROTOCOL
30832 packet_city_sabotage_list_100_fields fields;
30833 struct packet_city_sabotage_list *old;
30834 bool differ;
30835 struct genhash **hash = pc->phs.sent + PACKET_CITY_SABOTAGE_LIST;
30836#endif /* FREECIV_DELTA_PROTOCOL */
30837 SEND_PACKET_START(PACKET_CITY_SABOTAGE_LIST);
30838#ifdef FREECIV_JSON_CONNECTION
30839 struct plocation field_addr;
30840 {
30841 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30842 field_addr = *field_addr_tmp;
30843 FC_FREE(field_addr_tmp);
30844 }
30845#endif /* FREECIV_JSON_CONNECTION */
30846
30847 log_packet_detailed("packet_city_sabotage_list_100: sending info about ()");
30848
30849#ifdef FREECIV_DELTA_PROTOCOL
30850 if (NULL == *hash) {
30851 *hash = genhash_new_full(hash_packet_city_sabotage_list_100, cmp_packet_city_sabotage_list_100,
30852 NULL, NULL, NULL, free);
30853 }
30854 BV_CLR_ALL(fields);
30855
30856 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
30857 old = fc_malloc(sizeof(*old));
30858 *old = *real_packet;
30859 genhash_insert(*hash, old, old);
30860 memset(old, 0, sizeof(*old));
30861 }
30862 differ = (old->actor_id32 != real_packet->actor_id32);
30863 if (differ) {
30864 BV_SET(fields, 0);
30865 }
30866
30867 differ = (old->city_id32 != real_packet->city_id32);
30868 if (differ) {
30869 BV_SET(fields, 1);
30870 }
30871
30872 differ = !BV_ARE_EQUAL(old->improvements, real_packet->improvements);
30873 if (differ) {
30874 BV_SET(fields, 2);
30875 }
30876
30877 differ = (old->act_id != real_packet->act_id);
30878 if (differ) {
30879 BV_SET(fields, 3);
30880 }
30881
30882 differ = (old->request_kind != real_packet->request_kind);
30883 if (differ) {
30884 BV_SET(fields, 4);
30885 }
30886
30887
30888#ifdef FREECIV_JSON_CONNECTION
30889 field_addr.name = "fields";
30890#endif /* FREECIV_JSON_CONNECTION */
30891 DIO_BV_PUT(&dout, &field_addr, fields);
30892
30893 if (BV_ISSET(fields, 0)) {
30894 log_packet_detailed(" field 'actor_id32' has changed");
30895 #ifdef FREECIV_JSON_CONNECTION
30896 field_addr.name = "actor_id32";
30897#endif /* FREECIV_JSON_CONNECTION */
30898 DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id32);
30899 }
30900 if (BV_ISSET(fields, 1)) {
30901 log_packet_detailed(" field 'city_id32' has changed");
30902 #ifdef FREECIV_JSON_CONNECTION
30903 field_addr.name = "city_id32";
30904#endif /* FREECIV_JSON_CONNECTION */
30905 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
30906 }
30907 if (BV_ISSET(fields, 2)) {
30908 log_packet_detailed(" field 'improvements' has changed");
30909 #ifdef FREECIV_JSON_CONNECTION
30910 field_addr.name = "improvements";
30911#endif /* FREECIV_JSON_CONNECTION */
30912 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
30913 }
30914 if (BV_ISSET(fields, 3)) {
30915 log_packet_detailed(" field 'act_id' has changed");
30916 #ifdef FREECIV_JSON_CONNECTION
30917 field_addr.name = "act_id";
30918#endif /* FREECIV_JSON_CONNECTION */
30919 DIO_PUT(uint8, &dout, &field_addr, real_packet->act_id);
30920 }
30921 if (BV_ISSET(fields, 4)) {
30922 log_packet_detailed(" field 'request_kind' has changed");
30923 #ifdef FREECIV_JSON_CONNECTION
30924 field_addr.name = "request_kind";
30925#endif /* FREECIV_JSON_CONNECTION */
30926 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
30927 }
30928
30929 *old = *real_packet;
30930#endif /* FREECIV_DELTA_PROTOCOL */
30931#ifndef FREECIV_DELTA_PROTOCOL
30932#ifdef FREECIV_JSON_CONNECTION
30933 field_addr.name = "actor_id32";
30934#endif /* FREECIV_JSON_CONNECTION */
30935 DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id32);
30936#ifdef FREECIV_JSON_CONNECTION
30937 field_addr.name = "city_id32";
30938#endif /* FREECIV_JSON_CONNECTION */
30939 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
30940#ifdef FREECIV_JSON_CONNECTION
30941 field_addr.name = "improvements";
30942#endif /* FREECIV_JSON_CONNECTION */
30943 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
30944#ifdef FREECIV_JSON_CONNECTION
30945 field_addr.name = "act_id";
30946#endif /* FREECIV_JSON_CONNECTION */
30947 DIO_PUT(uint8, &dout, &field_addr, real_packet->act_id);
30948#ifdef FREECIV_JSON_CONNECTION
30949 field_addr.name = "request_kind";
30950#endif /* FREECIV_JSON_CONNECTION */
30951 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
30952
30953#endif
30954 SEND_PACKET_END(PACKET_CITY_SABOTAGE_LIST);
30955}
30956
30957#ifdef FREECIV_DELTA_PROTOCOL
30958#define hash_packet_city_sabotage_list_101 hash_const
30959
30960#define cmp_packet_city_sabotage_list_101 cmp_const
30961
30962 BV_DEFINE(packet_city_sabotage_list_101_fields, 5);
30963#endif /* FREECIV_DELTA_PROTOCOL */
30964
30965 static struct packet_city_sabotage_list *receive_packet_city_sabotage_list_101(struct connection *pc)
30966{
30967#ifdef FREECIV_DELTA_PROTOCOL
30968 packet_city_sabotage_list_101_fields fields;
30969 struct packet_city_sabotage_list *old;
30970 struct genhash **hash = pc->phs.received + PACKET_CITY_SABOTAGE_LIST;
30971#endif /* FREECIV_DELTA_PROTOCOL */
30972 RECEIVE_PACKET_START(packet_city_sabotage_list, real_packet);
30973#ifdef FREECIV_JSON_CONNECTION
30974 struct plocation field_addr;
30975 {
30976 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30977 field_addr = *field_addr_tmp;
30978 FC_FREE(field_addr_tmp);
30979 }
30980#endif /* FREECIV_JSON_CONNECTION */
30981
30982#ifdef FREECIV_DELTA_PROTOCOL
30983#ifdef FREECIV_JSON_CONNECTION
30984 field_addr.name = "fields";
30985#endif /* FREECIV_JSON_CONNECTION */
30986 DIO_BV_GET(&din, &field_addr, fields);
30987
30988#else /* FREECIV_DELTA_PROTOCOL */
30989 #ifdef FREECIV_JSON_CONNECTION
30990 field_addr.name = "actor_id16";
30991 #endif /* FREECIV_JSON_CONNECTION */
30992 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->actor_id16)) {
30993 RECEIVE_PACKET_FIELD_ERROR(actor_id16);
30994 }
30995 #ifdef FREECIV_JSON_CONNECTION
30996 field_addr.name = "city_id16";
30997 #endif /* FREECIV_JSON_CONNECTION */
30998 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
30999 RECEIVE_PACKET_FIELD_ERROR(city_id16);
31000 }
31001 #ifdef FREECIV_JSON_CONNECTION
31002 field_addr.name = "improvements";
31003 #endif /* FREECIV_JSON_CONNECTION */
31004 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
31005 RECEIVE_PACKET_FIELD_ERROR(improvements);
31006 }
31007 #ifdef FREECIV_JSON_CONNECTION
31008 field_addr.name = "act_id";
31009 #endif /* FREECIV_JSON_CONNECTION */
31010 {
31011 int readin;
31012
31013 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
31014 RECEIVE_PACKET_FIELD_ERROR(act_id);
31015 }
31016 real_packet->act_id = readin;
31017 }
31018 #ifdef FREECIV_JSON_CONNECTION
31019 field_addr.name = "request_kind";
31020 #endif /* FREECIV_JSON_CONNECTION */
31021 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
31022 RECEIVE_PACKET_FIELD_ERROR(request_kind);
31023 }
31024
31025#endif
31026 log_packet_detailed("packet_city_sabotage_list_101: got info about ()");
31027
31028#ifdef FREECIV_DELTA_PROTOCOL
31029 if (NULL == *hash) {
31030 *hash = genhash_new_full(hash_packet_city_sabotage_list_101, cmp_packet_city_sabotage_list_101,
31031 NULL, NULL, NULL, free);
31032 }
31033
31034 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
31035 *real_packet = *old;
31036 } else {
31037 log_packet_detailed(" no old info");
31038 memset(real_packet, 0, sizeof(*real_packet));
31039 }
31040
31041 if (BV_ISSET(fields, 0)) {
31042 log_packet_detailed(" got field 'actor_id16'");
31043 #ifdef FREECIV_JSON_CONNECTION
31044 field_addr.name = "actor_id16";
31045 #endif /* FREECIV_JSON_CONNECTION */
31046 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->actor_id16)) {
31047 RECEIVE_PACKET_FIELD_ERROR(actor_id16);
31048 }
31049 }
31050 if (BV_ISSET(fields, 1)) {
31051 log_packet_detailed(" got field 'city_id16'");
31052 #ifdef FREECIV_JSON_CONNECTION
31053 field_addr.name = "city_id16";
31054 #endif /* FREECIV_JSON_CONNECTION */
31055 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
31056 RECEIVE_PACKET_FIELD_ERROR(city_id16);
31057 }
31058 }
31059 if (BV_ISSET(fields, 2)) {
31060 log_packet_detailed(" got field 'improvements'");
31061 #ifdef FREECIV_JSON_CONNECTION
31062 field_addr.name = "improvements";
31063 #endif /* FREECIV_JSON_CONNECTION */
31064 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
31065 RECEIVE_PACKET_FIELD_ERROR(improvements);
31066 }
31067 }
31068 if (BV_ISSET(fields, 3)) {
31069 log_packet_detailed(" got field 'act_id'");
31070 #ifdef FREECIV_JSON_CONNECTION
31071 field_addr.name = "act_id";
31072 #endif /* FREECIV_JSON_CONNECTION */
31073 {
31074 int readin;
31075
31076 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
31077 RECEIVE_PACKET_FIELD_ERROR(act_id);
31078 }
31079 real_packet->act_id = readin;
31080 }
31081 }
31082 if (BV_ISSET(fields, 4)) {
31083 log_packet_detailed(" got field 'request_kind'");
31084 #ifdef FREECIV_JSON_CONNECTION
31085 field_addr.name = "request_kind";
31086 #endif /* FREECIV_JSON_CONNECTION */
31087 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
31088 RECEIVE_PACKET_FIELD_ERROR(request_kind);
31089 }
31090 }
31091
31092 if (NULL == old) {
31093 old = fc_malloc(sizeof(*old));
31094 *old = *real_packet;
31095 genhash_insert(*hash, old, old);
31096 } else {
31097 *old = *real_packet;
31098 }
31099
31100#endif /* FREECIV_DELTA_PROTOCOL */
31101 RECEIVE_PACKET_END(real_packet);
31102}
31103
31104 static int send_packet_city_sabotage_list_101(struct connection *pc, const struct packet_city_sabotage_list *packet)
31105{
31106 const struct packet_city_sabotage_list *real_packet = packet;
31107#ifdef FREECIV_DELTA_PROTOCOL
31108 packet_city_sabotage_list_101_fields fields;
31109 struct packet_city_sabotage_list *old;
31110 bool differ;
31111 struct genhash **hash = pc->phs.sent + PACKET_CITY_SABOTAGE_LIST;
31112#endif /* FREECIV_DELTA_PROTOCOL */
31113 SEND_PACKET_START(PACKET_CITY_SABOTAGE_LIST);
31114#ifdef FREECIV_JSON_CONNECTION
31115 struct plocation field_addr;
31116 {
31117 struct plocation *field_addr_tmp = plocation_field_new(NULL);
31118 field_addr = *field_addr_tmp;
31119 FC_FREE(field_addr_tmp);
31120 }
31121#endif /* FREECIV_JSON_CONNECTION */
31122
31123 log_packet_detailed("packet_city_sabotage_list_101: sending info about ()");
31124
31125#ifdef FREECIV_DELTA_PROTOCOL
31126 if (NULL == *hash) {
31127 *hash = genhash_new_full(hash_packet_city_sabotage_list_101, cmp_packet_city_sabotage_list_101,
31128 NULL, NULL, NULL, free);
31129 }
31130 BV_CLR_ALL(fields);
31131
31132 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
31133 old = fc_malloc(sizeof(*old));
31134 *old = *real_packet;
31135 genhash_insert(*hash, old, old);
31136 memset(old, 0, sizeof(*old));
31137 }
31138 differ = (old->actor_id16 != real_packet->actor_id16);
31139 if (differ) {
31140 BV_SET(fields, 0);
31141 }
31142
31143 differ = (old->city_id16 != real_packet->city_id16);
31144 if (differ) {
31145 BV_SET(fields, 1);
31146 }
31147
31148 differ = !BV_ARE_EQUAL(old->improvements, real_packet->improvements);
31149 if (differ) {
31150 BV_SET(fields, 2);
31151 }
31152
31153 differ = (old->act_id != real_packet->act_id);
31154 if (differ) {
31155 BV_SET(fields, 3);
31156 }
31157
31158 differ = (old->request_kind != real_packet->request_kind);
31159 if (differ) {
31160 BV_SET(fields, 4);
31161 }
31162
31163
31164#ifdef FREECIV_JSON_CONNECTION
31165 field_addr.name = "fields";
31166#endif /* FREECIV_JSON_CONNECTION */
31167 DIO_BV_PUT(&dout, &field_addr, fields);
31168
31169 if (BV_ISSET(fields, 0)) {
31170 log_packet_detailed(" field 'actor_id16' has changed");
31171 #ifdef FREECIV_JSON_CONNECTION
31172 field_addr.name = "actor_id16";
31173#endif /* FREECIV_JSON_CONNECTION */
31174 DIO_PUT(uint16, &dout, &field_addr, real_packet->actor_id16);
31175 }
31176 if (BV_ISSET(fields, 1)) {
31177 log_packet_detailed(" field 'city_id16' has changed");
31178 #ifdef FREECIV_JSON_CONNECTION
31179 field_addr.name = "city_id16";
31180#endif /* FREECIV_JSON_CONNECTION */
31181 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
31182 }
31183 if (BV_ISSET(fields, 2)) {
31184 log_packet_detailed(" field 'improvements' has changed");
31185 #ifdef FREECIV_JSON_CONNECTION
31186 field_addr.name = "improvements";
31187#endif /* FREECIV_JSON_CONNECTION */
31188 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
31189 }
31190 if (BV_ISSET(fields, 3)) {
31191 log_packet_detailed(" field 'act_id' has changed");
31192 #ifdef FREECIV_JSON_CONNECTION
31193 field_addr.name = "act_id";
31194#endif /* FREECIV_JSON_CONNECTION */
31195 DIO_PUT(uint8, &dout, &field_addr, real_packet->act_id);
31196 }
31197 if (BV_ISSET(fields, 4)) {
31198 log_packet_detailed(" field 'request_kind' has changed");
31199 #ifdef FREECIV_JSON_CONNECTION
31200 field_addr.name = "request_kind";
31201#endif /* FREECIV_JSON_CONNECTION */
31202 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
31203 }
31204
31205 *old = *real_packet;
31206#endif /* FREECIV_DELTA_PROTOCOL */
31207#ifndef FREECIV_DELTA_PROTOCOL
31208#ifdef FREECIV_JSON_CONNECTION
31209 field_addr.name = "actor_id16";
31210#endif /* FREECIV_JSON_CONNECTION */
31211 DIO_PUT(uint16, &dout, &field_addr, real_packet->actor_id16);
31212#ifdef FREECIV_JSON_CONNECTION
31213 field_addr.name = "city_id16";
31214#endif /* FREECIV_JSON_CONNECTION */
31215 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
31216#ifdef FREECIV_JSON_CONNECTION
31217 field_addr.name = "improvements";
31218#endif /* FREECIV_JSON_CONNECTION */
31219 DIO_BV_PUT(&dout, &field_addr, packet->improvements);
31220#ifdef FREECIV_JSON_CONNECTION
31221 field_addr.name = "act_id";
31222#endif /* FREECIV_JSON_CONNECTION */
31223 DIO_PUT(uint8, &dout, &field_addr, real_packet->act_id);
31224#ifdef FREECIV_JSON_CONNECTION
31225 field_addr.name = "request_kind";
31226#endif /* FREECIV_JSON_CONNECTION */
31227 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
31228
31229#endif
31230 SEND_PACKET_END(PACKET_CITY_SABOTAGE_LIST);
31231}
31232
31233 int send_packet_city_sabotage_list(struct connection *pc, const struct packet_city_sabotage_list *packet)
31234{
31235 if (!pc->used) {
31236 log_error("WARNING: trying to send data to the closed connection %s",
31237 conn_description(pc));
31238 return -1;
31239 }
31240 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_SABOTAGE_LIST].packet != NULL, -1,
31241 "Handler for PACKET_CITY_SABOTAGE_LIST not installed");
31242 return pc->phs.handlers->send[PACKET_CITY_SABOTAGE_LIST].packet(pc, packet);
31243}
31244
31245 void lsend_packet_city_sabotage_list(struct conn_list *dest, const struct packet_city_sabotage_list *packet)
31246{
31247 conn_list_iterate(dest, pconn) {
31248 send_packet_city_sabotage_list(pconn, packet);
31249 } conn_list_iterate_end;
31250}
31251
31252#ifdef FREECIV_DELTA_PROTOCOL
31253#define hash_packet_city_rally_point_100 hash_const
31254
31255#define cmp_packet_city_rally_point_100 cmp_const
31256
31257 BV_DEFINE(packet_city_rally_point_100_fields, 5);
31258#endif /* FREECIV_DELTA_PROTOCOL */
31259
31260 static struct packet_city_rally_point *receive_packet_city_rally_point_100(struct connection *pc)
31261{
31262#ifdef FREECIV_DELTA_PROTOCOL
31263 packet_city_rally_point_100_fields fields;
31264 struct packet_city_rally_point *old;
31265 struct genhash **hash = pc->phs.received + PACKET_CITY_RALLY_POINT;
31266#endif /* FREECIV_DELTA_PROTOCOL */
31267 RECEIVE_PACKET_START(packet_city_rally_point, real_packet);
31268#ifdef FREECIV_JSON_CONNECTION
31269 struct plocation field_addr;
31270 {
31271 struct plocation *field_addr_tmp = plocation_field_new(NULL);
31272 field_addr = *field_addr_tmp;
31273 FC_FREE(field_addr_tmp);
31274 }
31275#endif /* FREECIV_JSON_CONNECTION */
31276
31277#ifdef FREECIV_DELTA_PROTOCOL
31278#ifdef FREECIV_JSON_CONNECTION
31279 field_addr.name = "fields";
31280#endif /* FREECIV_JSON_CONNECTION */
31281 DIO_BV_GET(&din, &field_addr, fields);
31282
31283#else /* FREECIV_DELTA_PROTOCOL */
31284 #ifdef FREECIV_JSON_CONNECTION
31285 field_addr.name = "city_id32";
31286 #endif /* FREECIV_JSON_CONNECTION */
31287 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
31288 RECEIVE_PACKET_FIELD_ERROR(city_id32);
31289 }
31290 #ifdef FREECIV_JSON_CONNECTION
31291 field_addr.name = "length";
31292 #endif /* FREECIV_JSON_CONNECTION */
31293 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
31294 RECEIVE_PACKET_FIELD_ERROR(length);
31295 }
31296 #ifdef FREECIV_JSON_CONNECTION
31297 field_addr.name = "persistent";
31298 #endif /* FREECIV_JSON_CONNECTION */
31299 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->persistent)) {
31300 RECEIVE_PACKET_FIELD_ERROR(persistent);
31301 }
31302 #ifdef FREECIV_JSON_CONNECTION
31303 field_addr.name = "vigilant";
31304 #endif /* FREECIV_JSON_CONNECTION */
31305 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->vigilant)) {
31306 RECEIVE_PACKET_FIELD_ERROR(vigilant);
31307 }
31308 #ifdef FREECIV_JSON_CONNECTION
31309 field_addr.name = "orders";
31310 #endif /* FREECIV_JSON_CONNECTION */
31311
31312 {
31313 int i;
31314
31315 #ifdef FREECIV_JSON_CONNECTION
31316 /* Enter array. */
31317 field_addr.sub_location = plocation_elem_new(0);
31318 #endif /* FREECIV_JSON_CONNECTION */
31319
31320 if (real_packet->length > MAX_LEN_ROUTE) {
31321 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
31322 }
31323 for (i = 0; i < real_packet->length; i++) {
31324 #ifdef FREECIV_JSON_CONNECTION
31325 field_addr.sub_location->number = i;
31326 #endif /* FREECIV_JSON_CONNECTION */
31327 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
31328 RECEIVE_PACKET_FIELD_ERROR(orders);
31329 }
31330 }
31331
31332 #ifdef FREECIV_JSON_CONNECTION
31333 /* Exit array. */
31334 free(field_addr.sub_location);
31335 field_addr.sub_location = NULL;
31336 #endif /* FREECIV_JSON_CONNECTION */
31337 }
31338
31339#endif
31340 log_packet_detailed("packet_city_rally_point_100: got info about ()");
31341
31342#ifdef FREECIV_DELTA_PROTOCOL
31343 if (NULL == *hash) {
31344 *hash = genhash_new_full(hash_packet_city_rally_point_100, cmp_packet_city_rally_point_100,
31345 NULL, NULL, NULL, free);
31346 }
31347
31348 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
31349 *real_packet = *old;
31350 } else {
31351 log_packet_detailed(" no old info");
31352 memset(real_packet, 0, sizeof(*real_packet));
31353 }
31354
31355 if (BV_ISSET(fields, 0)) {
31356 log_packet_detailed(" got field 'city_id32'");
31357 #ifdef FREECIV_JSON_CONNECTION
31358 field_addr.name = "city_id32";
31359 #endif /* FREECIV_JSON_CONNECTION */
31360 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
31361 RECEIVE_PACKET_FIELD_ERROR(city_id32);
31362 }
31363 }
31364 if (BV_ISSET(fields, 1)) {
31365 log_packet_detailed(" got field 'length'");
31366 #ifdef FREECIV_JSON_CONNECTION
31367 field_addr.name = "length";
31368 #endif /* FREECIV_JSON_CONNECTION */
31369 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
31370 RECEIVE_PACKET_FIELD_ERROR(length);
31371 }
31372 }
31373 real_packet->persistent = BV_ISSET(fields, 2);
31374 real_packet->vigilant = BV_ISSET(fields, 3);
31375 if (BV_ISSET(fields, 4)) {
31376 log_packet_detailed(" got field 'orders'");
31377 #ifdef FREECIV_JSON_CONNECTION
31378 field_addr.name = "orders";
31379 #endif /* FREECIV_JSON_CONNECTION */
31380
31381 {
31382 int i;
31383
31384 #ifdef FREECIV_JSON_CONNECTION
31385 /* Enter array. */
31386 field_addr.sub_location = plocation_elem_new(0);
31387 #endif /* FREECIV_JSON_CONNECTION */
31388
31389 if (real_packet->length > MAX_LEN_ROUTE) {
31390 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
31391 }
31392 for (i = 0; i < real_packet->length; i++) {
31393 #ifdef FREECIV_JSON_CONNECTION
31394 field_addr.sub_location->number = i;
31395 #endif /* FREECIV_JSON_CONNECTION */
31396 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
31397 RECEIVE_PACKET_FIELD_ERROR(orders);
31398 }
31399 }
31400
31401 #ifdef FREECIV_JSON_CONNECTION
31402 /* Exit array. */
31403 free(field_addr.sub_location);
31404 field_addr.sub_location = NULL;
31405 #endif /* FREECIV_JSON_CONNECTION */
31406 }
31407 }
31408
31409 if (NULL == old) {
31410 old = fc_malloc(sizeof(*old));
31411 *old = *real_packet;
31412 genhash_insert(*hash, old, old);
31413 } else {
31414 *old = *real_packet;
31415 }
31416
31417#endif /* FREECIV_DELTA_PROTOCOL */
31418 RECEIVE_PACKET_END(real_packet);
31419}
31420
31421 static int send_packet_city_rally_point_100(struct connection *pc, const struct packet_city_rally_point *packet, bool force_to_send)
31422{
31423 const struct packet_city_rally_point *real_packet = packet;
31424#ifdef FREECIV_DELTA_PROTOCOL
31425 packet_city_rally_point_100_fields fields;
31426 struct packet_city_rally_point *old;
31427 bool differ;
31428 struct genhash **hash = pc->phs.sent + PACKET_CITY_RALLY_POINT;
31429 int different = force_to_send;
31430#endif /* FREECIV_DELTA_PROTOCOL */
31431 SEND_PACKET_START(PACKET_CITY_RALLY_POINT);
31432#ifdef FREECIV_JSON_CONNECTION
31433 struct plocation field_addr;
31434 {
31435 struct plocation *field_addr_tmp = plocation_field_new(NULL);
31436 field_addr = *field_addr_tmp;
31437 FC_FREE(field_addr_tmp);
31438 }
31439#endif /* FREECIV_JSON_CONNECTION */
31440
31441 log_packet_detailed("packet_city_rally_point_100: sending info about ()");
31442
31443#ifdef FREECIV_DELTA_PROTOCOL
31444 if (NULL == *hash) {
31445 *hash = genhash_new_full(hash_packet_city_rally_point_100, cmp_packet_city_rally_point_100,
31446 NULL, NULL, NULL, free);
31447 }
31448 BV_CLR_ALL(fields);
31449
31450 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
31451 old = fc_malloc(sizeof(*old));
31452 *old = *real_packet;
31453 genhash_insert(*hash, old, old);
31454 memset(old, 0, sizeof(*old));
31455 different = 1; /* Force to send. */
31456 }
31457 differ = (old->city_id32 != real_packet->city_id32);
31458 if (differ) {
31459 different++;
31460 BV_SET(fields, 0);
31461 }
31462
31463 differ = (old->length != real_packet->length);
31464 if (differ) {
31465 different++;
31466 BV_SET(fields, 1);
31467 }
31468
31469 differ = (old->persistent != real_packet->persistent);
31470 if (differ) {
31471 different++;
31472 }
31473 if (packet->persistent) {
31474 BV_SET(fields, 2);
31475 }
31476
31477 differ = (old->vigilant != real_packet->vigilant);
31478 if (differ) {
31479 different++;
31480 }
31481 if (packet->vigilant) {
31482 BV_SET(fields, 3);
31483 }
31484
31485
31486 {
31487 differ = (old->length != real_packet->length);
31488 if (!differ) {
31489 int i;
31490
31491 for (i = 0; i < real_packet->length; i++) {
31492 if (!are_unit_orders_equal(&old->orders[i], &real_packet->orders[i])) {
31493 differ = TRUE;
31494 break;
31495 }
31496 }
31497 }
31498 }
31499 if (differ) {
31500 different++;
31501 BV_SET(fields, 4);
31502 }
31503
31504
31505 if (different == 0) {
31506 log_packet_detailed(" no change -> discard");
31507 return 0;
31508 }
31509
31510#ifdef FREECIV_JSON_CONNECTION
31511 field_addr.name = "fields";
31512#endif /* FREECIV_JSON_CONNECTION */
31513 DIO_BV_PUT(&dout, &field_addr, fields);
31514
31515 if (BV_ISSET(fields, 0)) {
31516 log_packet_detailed(" field 'city_id32' has changed");
31517 #ifdef FREECIV_JSON_CONNECTION
31518 field_addr.name = "city_id32";
31519#endif /* FREECIV_JSON_CONNECTION */
31520 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
31521 }
31522 if (BV_ISSET(fields, 1)) {
31523 log_packet_detailed(" field 'length' has changed");
31524 #ifdef FREECIV_JSON_CONNECTION
31525 field_addr.name = "length";
31526#endif /* FREECIV_JSON_CONNECTION */
31527 DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
31528 }
31529 /* field 2 is folded into the header */
31530 /* field 3 is folded into the header */
31531 if (BV_ISSET(fields, 4)) {
31532 log_packet_detailed(" field 'orders' has changed");
31533 #ifdef FREECIV_JSON_CONNECTION
31534 field_addr.name = "orders";
31535#endif /* FREECIV_JSON_CONNECTION */
31536
31537 {
31538 int i;
31539
31540#ifdef FREECIV_JSON_CONNECTION
31541 /* Create the array. */
31542 DIO_PUT(farray, &dout, &field_addr, real_packet->length);
31543
31544 /* Enter the array. */
31545 field_addr.sub_location = plocation_elem_new(0);
31546#endif /* FREECIV_JSON_CONNECTION */
31547
31548 for (i = 0; i < real_packet->length; i++) {
31549#ifdef FREECIV_JSON_CONNECTION
31550 /* Next array element. */
31551 field_addr.sub_location->number = i;
31552#endif /* FREECIV_JSON_CONNECTION */
31553 DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
31554 }
31555
31556#ifdef FREECIV_JSON_CONNECTION
31557 /* Exit array. */
31558 free(field_addr.sub_location);
31559 field_addr.sub_location = NULL;
31560#endif /* FREECIV_JSON_CONNECTION */
31561 }
31562 }
31563
31564 *old = *real_packet;
31565#endif /* FREECIV_DELTA_PROTOCOL */
31566#ifndef FREECIV_DELTA_PROTOCOL
31567#ifdef FREECIV_JSON_CONNECTION
31568 field_addr.name = "city_id32";
31569#endif /* FREECIV_JSON_CONNECTION */
31570 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
31571#ifdef FREECIV_JSON_CONNECTION
31572 field_addr.name = "length";
31573#endif /* FREECIV_JSON_CONNECTION */
31574 DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
31575#ifdef FREECIV_JSON_CONNECTION
31576 field_addr.name = "persistent";
31577#endif /* FREECIV_JSON_CONNECTION */
31578 DIO_PUT(bool8, &dout, &field_addr, real_packet->persistent);
31579#ifdef FREECIV_JSON_CONNECTION
31580 field_addr.name = "vigilant";
31581#endif /* FREECIV_JSON_CONNECTION */
31582 DIO_PUT(bool8, &dout, &field_addr, real_packet->vigilant);
31583#ifdef FREECIV_JSON_CONNECTION
31584 field_addr.name = "orders";
31585#endif /* FREECIV_JSON_CONNECTION */
31586
31587 {
31588 int i;
31589
31590#ifdef FREECIV_JSON_CONNECTION
31591 /* Create the array. */
31592 DIO_PUT(farray, &dout, &field_addr, real_packet->length);
31593
31594 /* Enter the array. */
31595 field_addr.sub_location = plocation_elem_new(0);
31596#endif /* FREECIV_JSON_CONNECTION */
31597
31598 for (i = 0; i < real_packet->length; i++) {
31599#ifdef FREECIV_JSON_CONNECTION
31600 /* Next array element. */
31601 field_addr.sub_location->number = i;
31602#endif /* FREECIV_JSON_CONNECTION */
31603 DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
31604 }
31605
31606#ifdef FREECIV_JSON_CONNECTION
31607 /* Exit array. */
31608 free(field_addr.sub_location);
31609 field_addr.sub_location = NULL;
31610#endif /* FREECIV_JSON_CONNECTION */
31611 }
31612
31613#endif
31614 SEND_PACKET_END(PACKET_CITY_RALLY_POINT);
31615}
31616
31617#ifdef FREECIV_DELTA_PROTOCOL
31618#define hash_packet_city_rally_point_101 hash_const
31619
31620#define cmp_packet_city_rally_point_101 cmp_const
31621
31622 BV_DEFINE(packet_city_rally_point_101_fields, 5);
31623#endif /* FREECIV_DELTA_PROTOCOL */
31624
31625 static struct packet_city_rally_point *receive_packet_city_rally_point_101(struct connection *pc)
31626{
31627#ifdef FREECIV_DELTA_PROTOCOL
31628 packet_city_rally_point_101_fields fields;
31629 struct packet_city_rally_point *old;
31630 struct genhash **hash = pc->phs.received + PACKET_CITY_RALLY_POINT;
31631#endif /* FREECIV_DELTA_PROTOCOL */
31632 RECEIVE_PACKET_START(packet_city_rally_point, real_packet);
31633#ifdef FREECIV_JSON_CONNECTION
31634 struct plocation field_addr;
31635 {
31636 struct plocation *field_addr_tmp = plocation_field_new(NULL);
31637 field_addr = *field_addr_tmp;
31638 FC_FREE(field_addr_tmp);
31639 }
31640#endif /* FREECIV_JSON_CONNECTION */
31641
31642#ifdef FREECIV_DELTA_PROTOCOL
31643#ifdef FREECIV_JSON_CONNECTION
31644 field_addr.name = "fields";
31645#endif /* FREECIV_JSON_CONNECTION */
31646 DIO_BV_GET(&din, &field_addr, fields);
31647
31648#else /* FREECIV_DELTA_PROTOCOL */
31649 #ifdef FREECIV_JSON_CONNECTION
31650 field_addr.name = "city_id16";
31651 #endif /* FREECIV_JSON_CONNECTION */
31652 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
31653 RECEIVE_PACKET_FIELD_ERROR(city_id16);
31654 }
31655 #ifdef FREECIV_JSON_CONNECTION
31656 field_addr.name = "length";
31657 #endif /* FREECIV_JSON_CONNECTION */
31658 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
31659 RECEIVE_PACKET_FIELD_ERROR(length);
31660 }
31661 #ifdef FREECIV_JSON_CONNECTION
31662 field_addr.name = "persistent";
31663 #endif /* FREECIV_JSON_CONNECTION */
31664 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->persistent)) {
31665 RECEIVE_PACKET_FIELD_ERROR(persistent);
31666 }
31667 #ifdef FREECIV_JSON_CONNECTION
31668 field_addr.name = "vigilant";
31669 #endif /* FREECIV_JSON_CONNECTION */
31670 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->vigilant)) {
31671 RECEIVE_PACKET_FIELD_ERROR(vigilant);
31672 }
31673 #ifdef FREECIV_JSON_CONNECTION
31674 field_addr.name = "orders";
31675 #endif /* FREECIV_JSON_CONNECTION */
31676
31677 {
31678 int i;
31679
31680 #ifdef FREECIV_JSON_CONNECTION
31681 /* Enter array. */
31682 field_addr.sub_location = plocation_elem_new(0);
31683 #endif /* FREECIV_JSON_CONNECTION */
31684
31685 if (real_packet->length > MAX_LEN_ROUTE) {
31686 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
31687 }
31688 for (i = 0; i < real_packet->length; i++) {
31689 #ifdef FREECIV_JSON_CONNECTION
31690 field_addr.sub_location->number = i;
31691 #endif /* FREECIV_JSON_CONNECTION */
31692 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
31693 RECEIVE_PACKET_FIELD_ERROR(orders);
31694 }
31695 }
31696
31697 #ifdef FREECIV_JSON_CONNECTION
31698 /* Exit array. */
31699 free(field_addr.sub_location);
31700 field_addr.sub_location = NULL;
31701 #endif /* FREECIV_JSON_CONNECTION */
31702 }
31703
31704#endif
31705 log_packet_detailed("packet_city_rally_point_101: got info about ()");
31706
31707#ifdef FREECIV_DELTA_PROTOCOL
31708 if (NULL == *hash) {
31709 *hash = genhash_new_full(hash_packet_city_rally_point_101, cmp_packet_city_rally_point_101,
31710 NULL, NULL, NULL, free);
31711 }
31712
31713 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
31714 *real_packet = *old;
31715 } else {
31716 log_packet_detailed(" no old info");
31717 memset(real_packet, 0, sizeof(*real_packet));
31718 }
31719
31720 if (BV_ISSET(fields, 0)) {
31721 log_packet_detailed(" got field 'city_id16'");
31722 #ifdef FREECIV_JSON_CONNECTION
31723 field_addr.name = "city_id16";
31724 #endif /* FREECIV_JSON_CONNECTION */
31725 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
31726 RECEIVE_PACKET_FIELD_ERROR(city_id16);
31727 }
31728 }
31729 if (BV_ISSET(fields, 1)) {
31730 log_packet_detailed(" got field 'length'");
31731 #ifdef FREECIV_JSON_CONNECTION
31732 field_addr.name = "length";
31733 #endif /* FREECIV_JSON_CONNECTION */
31734 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
31735 RECEIVE_PACKET_FIELD_ERROR(length);
31736 }
31737 }
31738 real_packet->persistent = BV_ISSET(fields, 2);
31739 real_packet->vigilant = BV_ISSET(fields, 3);
31740 if (BV_ISSET(fields, 4)) {
31741 log_packet_detailed(" got field 'orders'");
31742 #ifdef FREECIV_JSON_CONNECTION
31743 field_addr.name = "orders";
31744 #endif /* FREECIV_JSON_CONNECTION */
31745
31746 {
31747 int i;
31748
31749 #ifdef FREECIV_JSON_CONNECTION
31750 /* Enter array. */
31751 field_addr.sub_location = plocation_elem_new(0);
31752 #endif /* FREECIV_JSON_CONNECTION */
31753
31754 if (real_packet->length > MAX_LEN_ROUTE) {
31755 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
31756 }
31757 for (i = 0; i < real_packet->length; i++) {
31758 #ifdef FREECIV_JSON_CONNECTION
31759 field_addr.sub_location->number = i;
31760 #endif /* FREECIV_JSON_CONNECTION */
31761 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
31762 RECEIVE_PACKET_FIELD_ERROR(orders);
31763 }
31764 }
31765
31766 #ifdef FREECIV_JSON_CONNECTION
31767 /* Exit array. */
31768 free(field_addr.sub_location);
31769 field_addr.sub_location = NULL;
31770 #endif /* FREECIV_JSON_CONNECTION */
31771 }
31772 }
31773
31774 if (NULL == old) {
31775 old = fc_malloc(sizeof(*old));
31776 *old = *real_packet;
31777 genhash_insert(*hash, old, old);
31778 } else {
31779 *old = *real_packet;
31780 }
31781
31782#endif /* FREECIV_DELTA_PROTOCOL */
31783 RECEIVE_PACKET_END(real_packet);
31784}
31785
31786 static int send_packet_city_rally_point_101(struct connection *pc, const struct packet_city_rally_point *packet, bool force_to_send)
31787{
31788 const struct packet_city_rally_point *real_packet = packet;
31789#ifdef FREECIV_DELTA_PROTOCOL
31790 packet_city_rally_point_101_fields fields;
31791 struct packet_city_rally_point *old;
31792 bool differ;
31793 struct genhash **hash = pc->phs.sent + PACKET_CITY_RALLY_POINT;
31794 int different = force_to_send;
31795#endif /* FREECIV_DELTA_PROTOCOL */
31796 SEND_PACKET_START(PACKET_CITY_RALLY_POINT);
31797#ifdef FREECIV_JSON_CONNECTION
31798 struct plocation field_addr;
31799 {
31800 struct plocation *field_addr_tmp = plocation_field_new(NULL);
31801 field_addr = *field_addr_tmp;
31802 FC_FREE(field_addr_tmp);
31803 }
31804#endif /* FREECIV_JSON_CONNECTION */
31805
31806 log_packet_detailed("packet_city_rally_point_101: sending info about ()");
31807
31808#ifdef FREECIV_DELTA_PROTOCOL
31809 if (NULL == *hash) {
31810 *hash = genhash_new_full(hash_packet_city_rally_point_101, cmp_packet_city_rally_point_101,
31811 NULL, NULL, NULL, free);
31812 }
31813 BV_CLR_ALL(fields);
31814
31815 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
31816 old = fc_malloc(sizeof(*old));
31817 *old = *real_packet;
31818 genhash_insert(*hash, old, old);
31819 memset(old, 0, sizeof(*old));
31820 different = 1; /* Force to send. */
31821 }
31822 differ = (old->city_id16 != real_packet->city_id16);
31823 if (differ) {
31824 different++;
31825 BV_SET(fields, 0);
31826 }
31827
31828 differ = (old->length != real_packet->length);
31829 if (differ) {
31830 different++;
31831 BV_SET(fields, 1);
31832 }
31833
31834 differ = (old->persistent != real_packet->persistent);
31835 if (differ) {
31836 different++;
31837 }
31838 if (packet->persistent) {
31839 BV_SET(fields, 2);
31840 }
31841
31842 differ = (old->vigilant != real_packet->vigilant);
31843 if (differ) {
31844 different++;
31845 }
31846 if (packet->vigilant) {
31847 BV_SET(fields, 3);
31848 }
31849
31850
31851 {
31852 differ = (old->length != real_packet->length);
31853 if (!differ) {
31854 int i;
31855
31856 for (i = 0; i < real_packet->length; i++) {
31857 if (!are_unit_orders_equal(&old->orders[i], &real_packet->orders[i])) {
31858 differ = TRUE;
31859 break;
31860 }
31861 }
31862 }
31863 }
31864 if (differ) {
31865 different++;
31866 BV_SET(fields, 4);
31867 }
31868
31869
31870 if (different == 0) {
31871 log_packet_detailed(" no change -> discard");
31872 return 0;
31873 }
31874
31875#ifdef FREECIV_JSON_CONNECTION
31876 field_addr.name = "fields";
31877#endif /* FREECIV_JSON_CONNECTION */
31878 DIO_BV_PUT(&dout, &field_addr, fields);
31879
31880 if (BV_ISSET(fields, 0)) {
31881 log_packet_detailed(" field 'city_id16' has changed");
31882 #ifdef FREECIV_JSON_CONNECTION
31883 field_addr.name = "city_id16";
31884#endif /* FREECIV_JSON_CONNECTION */
31885 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
31886 }
31887 if (BV_ISSET(fields, 1)) {
31888 log_packet_detailed(" field 'length' has changed");
31889 #ifdef FREECIV_JSON_CONNECTION
31890 field_addr.name = "length";
31891#endif /* FREECIV_JSON_CONNECTION */
31892 DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
31893 }
31894 /* field 2 is folded into the header */
31895 /* field 3 is folded into the header */
31896 if (BV_ISSET(fields, 4)) {
31897 log_packet_detailed(" field 'orders' has changed");
31898 #ifdef FREECIV_JSON_CONNECTION
31899 field_addr.name = "orders";
31900#endif /* FREECIV_JSON_CONNECTION */
31901
31902 {
31903 int i;
31904
31905#ifdef FREECIV_JSON_CONNECTION
31906 /* Create the array. */
31907 DIO_PUT(farray, &dout, &field_addr, real_packet->length);
31908
31909 /* Enter the array. */
31910 field_addr.sub_location = plocation_elem_new(0);
31911#endif /* FREECIV_JSON_CONNECTION */
31912
31913 for (i = 0; i < real_packet->length; i++) {
31914#ifdef FREECIV_JSON_CONNECTION
31915 /* Next array element. */
31916 field_addr.sub_location->number = i;
31917#endif /* FREECIV_JSON_CONNECTION */
31918 DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
31919 }
31920
31921#ifdef FREECIV_JSON_CONNECTION
31922 /* Exit array. */
31923 free(field_addr.sub_location);
31924 field_addr.sub_location = NULL;
31925#endif /* FREECIV_JSON_CONNECTION */
31926 }
31927 }
31928
31929 *old = *real_packet;
31930#endif /* FREECIV_DELTA_PROTOCOL */
31931#ifndef FREECIV_DELTA_PROTOCOL
31932#ifdef FREECIV_JSON_CONNECTION
31933 field_addr.name = "city_id16";
31934#endif /* FREECIV_JSON_CONNECTION */
31935 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
31936#ifdef FREECIV_JSON_CONNECTION
31937 field_addr.name = "length";
31938#endif /* FREECIV_JSON_CONNECTION */
31939 DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
31940#ifdef FREECIV_JSON_CONNECTION
31941 field_addr.name = "persistent";
31942#endif /* FREECIV_JSON_CONNECTION */
31943 DIO_PUT(bool8, &dout, &field_addr, real_packet->persistent);
31944#ifdef FREECIV_JSON_CONNECTION
31945 field_addr.name = "vigilant";
31946#endif /* FREECIV_JSON_CONNECTION */
31947 DIO_PUT(bool8, &dout, &field_addr, real_packet->vigilant);
31948#ifdef FREECIV_JSON_CONNECTION
31949 field_addr.name = "orders";
31950#endif /* FREECIV_JSON_CONNECTION */
31951
31952 {
31953 int i;
31954
31955#ifdef FREECIV_JSON_CONNECTION
31956 /* Create the array. */
31957 DIO_PUT(farray, &dout, &field_addr, real_packet->length);
31958
31959 /* Enter the array. */
31960 field_addr.sub_location = plocation_elem_new(0);
31961#endif /* FREECIV_JSON_CONNECTION */
31962
31963 for (i = 0; i < real_packet->length; i++) {
31964#ifdef FREECIV_JSON_CONNECTION
31965 /* Next array element. */
31966 field_addr.sub_location->number = i;
31967#endif /* FREECIV_JSON_CONNECTION */
31968 DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
31969 }
31970
31971#ifdef FREECIV_JSON_CONNECTION
31972 /* Exit array. */
31973 free(field_addr.sub_location);
31974 field_addr.sub_location = NULL;
31975#endif /* FREECIV_JSON_CONNECTION */
31976 }
31977
31978#endif
31979 SEND_PACKET_END(PACKET_CITY_RALLY_POINT);
31980}
31981
31982 int send_packet_city_rally_point(struct connection *pc, const struct packet_city_rally_point *packet, bool force_to_send)
31983{
31984 if (!pc->used) {
31985 log_error("WARNING: trying to send data to the closed connection %s",
31986 conn_description(pc));
31987 return -1;
31988 }
31989 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_RALLY_POINT].force_to_send != NULL, -1,
31990 "Handler for PACKET_CITY_RALLY_POINT not installed");
31991 return pc->phs.handlers->send[PACKET_CITY_RALLY_POINT].force_to_send(pc, packet, force_to_send);
31992}
31993
31994 void lsend_packet_city_rally_point(struct conn_list *dest, const struct packet_city_rally_point *packet, bool force_to_send)
31995{
31996 conn_list_iterate(dest, pconn) {
31997 send_packet_city_rally_point(pconn, packet, force_to_send);
31998 } conn_list_iterate_end;
31999}
32000
32001#ifdef FREECIV_DELTA_PROTOCOL
32002#define hash_packet_worker_task_100 hash_const
32003
32004#define cmp_packet_worker_task_100 cmp_const
32005
32006 BV_DEFINE(packet_worker_task_100_fields, 5);
32007#endif /* FREECIV_DELTA_PROTOCOL */
32008
32009 static struct packet_worker_task *receive_packet_worker_task_100(struct connection *pc)
32010{
32011#ifdef FREECIV_DELTA_PROTOCOL
32012 packet_worker_task_100_fields fields;
32013 struct packet_worker_task *old;
32014 struct genhash **hash = pc->phs.received + PACKET_WORKER_TASK;
32015#endif /* FREECIV_DELTA_PROTOCOL */
32016 RECEIVE_PACKET_START(packet_worker_task, real_packet);
32017#ifdef FREECIV_JSON_CONNECTION
32018 struct plocation field_addr;
32019 {
32020 struct plocation *field_addr_tmp = plocation_field_new(NULL);
32021 field_addr = *field_addr_tmp;
32022 FC_FREE(field_addr_tmp);
32023 }
32024#endif /* FREECIV_JSON_CONNECTION */
32025
32026#ifdef FREECIV_DELTA_PROTOCOL
32027#ifdef FREECIV_JSON_CONNECTION
32028 field_addr.name = "fields";
32029#endif /* FREECIV_JSON_CONNECTION */
32030 DIO_BV_GET(&din, &field_addr, fields);
32031
32032#else /* FREECIV_DELTA_PROTOCOL */
32033 #ifdef FREECIV_JSON_CONNECTION
32034 field_addr.name = "city_id32";
32035 #endif /* FREECIV_JSON_CONNECTION */
32036 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
32037 RECEIVE_PACKET_FIELD_ERROR(city_id32);
32038 }
32039 #ifdef FREECIV_JSON_CONNECTION
32040 field_addr.name = "tile_id";
32041 #endif /* FREECIV_JSON_CONNECTION */
32042 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
32043 RECEIVE_PACKET_FIELD_ERROR(tile_id);
32044 }
32045 #ifdef FREECIV_JSON_CONNECTION
32046 field_addr.name = "activity";
32047 #endif /* FREECIV_JSON_CONNECTION */
32048 {
32049 int readin;
32050
32051 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
32052 RECEIVE_PACKET_FIELD_ERROR(activity);
32053 }
32054 real_packet->activity = readin;
32055 }
32056 #ifdef FREECIV_JSON_CONNECTION
32057 field_addr.name = "tgt";
32058 #endif /* FREECIV_JSON_CONNECTION */
32059 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->tgt)) {
32060 RECEIVE_PACKET_FIELD_ERROR(tgt);
32061 }
32062 #ifdef FREECIV_JSON_CONNECTION
32063 field_addr.name = "want";
32064 #endif /* FREECIV_JSON_CONNECTION */
32065 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->want)) {
32066 RECEIVE_PACKET_FIELD_ERROR(want);
32067 }
32068
32069#endif
32070 log_packet_detailed("packet_worker_task_100: got info about ()");
32071
32072#ifdef FREECIV_DELTA_PROTOCOL
32073 if (NULL == *hash) {
32074 *hash = genhash_new_full(hash_packet_worker_task_100, cmp_packet_worker_task_100,
32075 NULL, NULL, NULL, free);
32076 }
32077
32078 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
32079 *real_packet = *old;
32080 } else {
32081 log_packet_detailed(" no old info");
32082 memset(real_packet, 0, sizeof(*real_packet));
32083 }
32084
32085 if (BV_ISSET(fields, 0)) {
32086 log_packet_detailed(" got field 'city_id32'");
32087 #ifdef FREECIV_JSON_CONNECTION
32088 field_addr.name = "city_id32";
32089 #endif /* FREECIV_JSON_CONNECTION */
32090 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id32)) {
32091 RECEIVE_PACKET_FIELD_ERROR(city_id32);
32092 }
32093 }
32094 if (BV_ISSET(fields, 1)) {
32095 log_packet_detailed(" got field 'tile_id'");
32096 #ifdef FREECIV_JSON_CONNECTION
32097 field_addr.name = "tile_id";
32098 #endif /* FREECIV_JSON_CONNECTION */
32099 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
32100 RECEIVE_PACKET_FIELD_ERROR(tile_id);
32101 }
32102 }
32103 if (BV_ISSET(fields, 2)) {
32104 log_packet_detailed(" got field 'activity'");
32105 #ifdef FREECIV_JSON_CONNECTION
32106 field_addr.name = "activity";
32107 #endif /* FREECIV_JSON_CONNECTION */
32108 {
32109 int readin;
32110
32111 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
32112 RECEIVE_PACKET_FIELD_ERROR(activity);
32113 }
32114 real_packet->activity = readin;
32115 }
32116 }
32117 if (BV_ISSET(fields, 3)) {
32118 log_packet_detailed(" got field 'tgt'");
32119 #ifdef FREECIV_JSON_CONNECTION
32120 field_addr.name = "tgt";
32121 #endif /* FREECIV_JSON_CONNECTION */
32122 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->tgt)) {
32123 RECEIVE_PACKET_FIELD_ERROR(tgt);
32124 }
32125 }
32126 if (BV_ISSET(fields, 4)) {
32127 log_packet_detailed(" got field 'want'");
32128 #ifdef FREECIV_JSON_CONNECTION
32129 field_addr.name = "want";
32130 #endif /* FREECIV_JSON_CONNECTION */
32131 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->want)) {
32132 RECEIVE_PACKET_FIELD_ERROR(want);
32133 }
32134 }
32135
32136 if (NULL == old) {
32137 old = fc_malloc(sizeof(*old));
32138 *old = *real_packet;
32139 genhash_insert(*hash, old, old);
32140 } else {
32141 *old = *real_packet;
32142 }
32143
32144#endif /* FREECIV_DELTA_PROTOCOL */
32145 RECEIVE_PACKET_END(real_packet);
32146}
32147
32148 static int send_packet_worker_task_100(struct connection *pc, const struct packet_worker_task *packet)
32149{
32150 const struct packet_worker_task *real_packet = packet;
32151#ifdef FREECIV_DELTA_PROTOCOL
32152 packet_worker_task_100_fields fields;
32153 struct packet_worker_task *old;
32154 bool differ;
32155 struct genhash **hash = pc->phs.sent + PACKET_WORKER_TASK;
32156#endif /* FREECIV_DELTA_PROTOCOL */
32157 SEND_PACKET_START(PACKET_WORKER_TASK);
32158#ifdef FREECIV_JSON_CONNECTION
32159 struct plocation field_addr;
32160 {
32161 struct plocation *field_addr_tmp = plocation_field_new(NULL);
32162 field_addr = *field_addr_tmp;
32163 FC_FREE(field_addr_tmp);
32164 }
32165#endif /* FREECIV_JSON_CONNECTION */
32166
32167 log_packet_detailed("packet_worker_task_100: sending info about ()");
32168
32169#ifdef FREECIV_DELTA_PROTOCOL
32170 if (NULL == *hash) {
32171 *hash = genhash_new_full(hash_packet_worker_task_100, cmp_packet_worker_task_100,
32172 NULL, NULL, NULL, free);
32173 }
32174 BV_CLR_ALL(fields);
32175
32176 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
32177 old = fc_malloc(sizeof(*old));
32178 *old = *real_packet;
32179 genhash_insert(*hash, old, old);
32180 memset(old, 0, sizeof(*old));
32181 }
32182 differ = (old->city_id32 != real_packet->city_id32);
32183 if (differ) {
32184 BV_SET(fields, 0);
32185 }
32186
32187 differ = (old->tile_id != real_packet->tile_id);
32188 if (differ) {
32189 BV_SET(fields, 1);
32190 }
32191
32192 differ = (old->activity != real_packet->activity);
32193 if (differ) {
32194 BV_SET(fields, 2);
32195 }
32196
32197 differ = (old->tgt != real_packet->tgt);
32198 if (differ) {
32199 BV_SET(fields, 3);
32200 }
32201
32202 differ = (old->want != real_packet->want);
32203 if (differ) {
32204 BV_SET(fields, 4);
32205 }
32206
32207
32208#ifdef FREECIV_JSON_CONNECTION
32209 field_addr.name = "fields";
32210#endif /* FREECIV_JSON_CONNECTION */
32211 DIO_BV_PUT(&dout, &field_addr, fields);
32212
32213 if (BV_ISSET(fields, 0)) {
32214 log_packet_detailed(" field 'city_id32' has changed");
32215 #ifdef FREECIV_JSON_CONNECTION
32216 field_addr.name = "city_id32";
32217#endif /* FREECIV_JSON_CONNECTION */
32218 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
32219 }
32220 if (BV_ISSET(fields, 1)) {
32221 log_packet_detailed(" field 'tile_id' has changed");
32222 #ifdef FREECIV_JSON_CONNECTION
32223 field_addr.name = "tile_id";
32224#endif /* FREECIV_JSON_CONNECTION */
32225 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
32226 }
32227 if (BV_ISSET(fields, 2)) {
32228 log_packet_detailed(" field 'activity' has changed");
32229 #ifdef FREECIV_JSON_CONNECTION
32230 field_addr.name = "activity";
32231#endif /* FREECIV_JSON_CONNECTION */
32232 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
32233 }
32234 if (BV_ISSET(fields, 3)) {
32235 log_packet_detailed(" field 'tgt' has changed");
32236 #ifdef FREECIV_JSON_CONNECTION
32237 field_addr.name = "tgt";
32238#endif /* FREECIV_JSON_CONNECTION */
32239 DIO_PUT(sint8, &dout, &field_addr, real_packet->tgt);
32240 }
32241 if (BV_ISSET(fields, 4)) {
32242 log_packet_detailed(" field 'want' has changed");
32243 #ifdef FREECIV_JSON_CONNECTION
32244 field_addr.name = "want";
32245#endif /* FREECIV_JSON_CONNECTION */
32246 DIO_PUT(uint16, &dout, &field_addr, real_packet->want);
32247 }
32248
32249 *old = *real_packet;
32250#endif /* FREECIV_DELTA_PROTOCOL */
32251#ifndef FREECIV_DELTA_PROTOCOL
32252#ifdef FREECIV_JSON_CONNECTION
32253 field_addr.name = "city_id32";
32254#endif /* FREECIV_JSON_CONNECTION */
32255 DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id32);
32256#ifdef FREECIV_JSON_CONNECTION
32257 field_addr.name = "tile_id";
32258#endif /* FREECIV_JSON_CONNECTION */
32259 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
32260#ifdef FREECIV_JSON_CONNECTION
32261 field_addr.name = "activity";
32262#endif /* FREECIV_JSON_CONNECTION */
32263 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
32264#ifdef FREECIV_JSON_CONNECTION
32265 field_addr.name = "tgt";
32266#endif /* FREECIV_JSON_CONNECTION */
32267 DIO_PUT(sint8, &dout, &field_addr, real_packet->tgt);
32268#ifdef FREECIV_JSON_CONNECTION
32269 field_addr.name = "want";
32270#endif /* FREECIV_JSON_CONNECTION */
32271 DIO_PUT(uint16, &dout, &field_addr, real_packet->want);
32272
32273#endif
32274 SEND_PACKET_END(PACKET_WORKER_TASK);
32275}
32276
32277#ifdef FREECIV_DELTA_PROTOCOL
32278#define hash_packet_worker_task_101 hash_const
32279
32280#define cmp_packet_worker_task_101 cmp_const
32281
32282 BV_DEFINE(packet_worker_task_101_fields, 5);
32283#endif /* FREECIV_DELTA_PROTOCOL */
32284
32285 static struct packet_worker_task *receive_packet_worker_task_101(struct connection *pc)
32286{
32287#ifdef FREECIV_DELTA_PROTOCOL
32288 packet_worker_task_101_fields fields;
32289 struct packet_worker_task *old;
32290 struct genhash **hash = pc->phs.received + PACKET_WORKER_TASK;
32291#endif /* FREECIV_DELTA_PROTOCOL */
32292 RECEIVE_PACKET_START(packet_worker_task, real_packet);
32293#ifdef FREECIV_JSON_CONNECTION
32294 struct plocation field_addr;
32295 {
32296 struct plocation *field_addr_tmp = plocation_field_new(NULL);
32297 field_addr = *field_addr_tmp;
32298 FC_FREE(field_addr_tmp);
32299 }
32300#endif /* FREECIV_JSON_CONNECTION */
32301
32302#ifdef FREECIV_DELTA_PROTOCOL
32303#ifdef FREECIV_JSON_CONNECTION
32304 field_addr.name = "fields";
32305#endif /* FREECIV_JSON_CONNECTION */
32306 DIO_BV_GET(&din, &field_addr, fields);
32307
32308#else /* FREECIV_DELTA_PROTOCOL */
32309 #ifdef FREECIV_JSON_CONNECTION
32310 field_addr.name = "city_id16";
32311 #endif /* FREECIV_JSON_CONNECTION */
32312 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
32313 RECEIVE_PACKET_FIELD_ERROR(city_id16);
32314 }
32315 #ifdef FREECIV_JSON_CONNECTION
32316 field_addr.name = "tile_id";
32317 #endif /* FREECIV_JSON_CONNECTION */
32318 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
32319 RECEIVE_PACKET_FIELD_ERROR(tile_id);
32320 }
32321 #ifdef FREECIV_JSON_CONNECTION
32322 field_addr.name = "activity";
32323 #endif /* FREECIV_JSON_CONNECTION */
32324 {
32325 int readin;
32326
32327 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
32328 RECEIVE_PACKET_FIELD_ERROR(activity);
32329 }
32330 real_packet->activity = readin;
32331 }
32332 #ifdef FREECIV_JSON_CONNECTION
32333 field_addr.name = "tgt";
32334 #endif /* FREECIV_JSON_CONNECTION */
32335 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->tgt)) {
32336 RECEIVE_PACKET_FIELD_ERROR(tgt);
32337 }
32338 #ifdef FREECIV_JSON_CONNECTION
32339 field_addr.name = "want";
32340 #endif /* FREECIV_JSON_CONNECTION */
32341 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->want)) {
32342 RECEIVE_PACKET_FIELD_ERROR(want);
32343 }
32344
32345#endif
32346 log_packet_detailed("packet_worker_task_101: got info about ()");
32347
32348#ifdef FREECIV_DELTA_PROTOCOL
32349 if (NULL == *hash) {
32350 *hash = genhash_new_full(hash_packet_worker_task_101, cmp_packet_worker_task_101,
32351 NULL, NULL, NULL, free);
32352 }
32353
32354 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
32355 *real_packet = *old;
32356 } else {
32357 log_packet_detailed(" no old info");
32358 memset(real_packet, 0, sizeof(*real_packet));
32359 }
32360
32361 if (BV_ISSET(fields, 0)) {
32362 log_packet_detailed(" got field 'city_id16'");
32363 #ifdef FREECIV_JSON_CONNECTION
32364 field_addr.name = "city_id16";
32365 #endif /* FREECIV_JSON_CONNECTION */
32366 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->city_id16)) {
32367 RECEIVE_PACKET_FIELD_ERROR(city_id16);
32368 }
32369 }
32370 if (BV_ISSET(fields, 1)) {
32371 log_packet_detailed(" got field 'tile_id'");
32372 #ifdef FREECIV_JSON_CONNECTION
32373 field_addr.name = "tile_id";
32374 #endif /* FREECIV_JSON_CONNECTION */
32375 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
32376 RECEIVE_PACKET_FIELD_ERROR(tile_id);
32377 }
32378 }
32379 if (BV_ISSET(fields, 2)) {
32380 log_packet_detailed(" got field 'activity'");
32381 #ifdef FREECIV_JSON_CONNECTION
32382 field_addr.name = "activity";
32383 #endif /* FREECIV_JSON_CONNECTION */
32384 {
32385 int readin;
32386
32387 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
32388 RECEIVE_PACKET_FIELD_ERROR(activity);
32389 }
32390 real_packet->activity = readin;
32391 }
32392 }
32393 if (BV_ISSET(fields, 3)) {
32394 log_packet_detailed(" got field 'tgt'");
32395 #ifdef FREECIV_JSON_CONNECTION
32396 field_addr.name = "tgt";
32397 #endif /* FREECIV_JSON_CONNECTION */
32398 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->tgt)) {
32399 RECEIVE_PACKET_FIELD_ERROR(tgt);
32400 }
32401 }
32402 if (BV_ISSET(fields, 4)) {
32403 log_packet_detailed(" got field 'want'");
32404 #ifdef FREECIV_JSON_CONNECTION
32405 field_addr.name = "want";
32406 #endif /* FREECIV_JSON_CONNECTION */
32407 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->want)) {
32408 RECEIVE_PACKET_FIELD_ERROR(want);
32409 }
32410 }
32411
32412 if (NULL == old) {
32413 old = fc_malloc(sizeof(*old));
32414 *old = *real_packet;
32415 genhash_insert(*hash, old, old);
32416 } else {
32417 *old = *real_packet;
32418 }
32419
32420#endif /* FREECIV_DELTA_PROTOCOL */
32421 RECEIVE_PACKET_END(real_packet);
32422}
32423
32424 static int send_packet_worker_task_101(struct connection *pc, const struct packet_worker_task *packet)
32425{
32426 const struct packet_worker_task *real_packet = packet;
32427#ifdef FREECIV_DELTA_PROTOCOL
32428 packet_worker_task_101_fields fields;
32429 struct packet_worker_task *old;
32430 bool differ;
32431 struct genhash **hash = pc->phs.sent + PACKET_WORKER_TASK;
32432#endif /* FREECIV_DELTA_PROTOCOL */
32433 SEND_PACKET_START(PACKET_WORKER_TASK);
32434#ifdef FREECIV_JSON_CONNECTION
32435 struct plocation field_addr;
32436 {
32437 struct plocation *field_addr_tmp = plocation_field_new(NULL);
32438 field_addr = *field_addr_tmp;
32439 FC_FREE(field_addr_tmp);
32440 }
32441#endif /* FREECIV_JSON_CONNECTION */
32442
32443 log_packet_detailed("packet_worker_task_101: sending info about ()");
32444
32445#ifdef FREECIV_DELTA_PROTOCOL
32446 if (NULL == *hash) {
32447 *hash = genhash_new_full(hash_packet_worker_task_101, cmp_packet_worker_task_101,
32448 NULL, NULL, NULL, free);
32449 }
32450 BV_CLR_ALL(fields);
32451
32452 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
32453 old = fc_malloc(sizeof(*old));
32454 *old = *real_packet;
32455 genhash_insert(*hash, old, old);
32456 memset(old, 0, sizeof(*old));
32457 }
32458 differ = (old->city_id16 != real_packet->city_id16);
32459 if (differ) {
32460 BV_SET(fields, 0);
32461 }
32462
32463 differ = (old->tile_id != real_packet->tile_id);
32464 if (differ) {
32465 BV_SET(fields, 1);
32466 }
32467
32468 differ = (old->activity != real_packet->activity);
32469 if (differ) {
32470 BV_SET(fields, 2);
32471 }
32472
32473 differ = (old->tgt != real_packet->tgt);
32474 if (differ) {
32475 BV_SET(fields, 3);
32476 }
32477
32478 differ = (old->want != real_packet->want);
32479 if (differ) {
32480 BV_SET(fields, 4);
32481 }
32482
32483
32484#ifdef FREECIV_JSON_CONNECTION
32485 field_addr.name = "fields";
32486#endif /* FREECIV_JSON_CONNECTION */
32487 DIO_BV_PUT(&dout, &field_addr, fields);
32488
32489 if (BV_ISSET(fields, 0)) {
32490 log_packet_detailed(" field 'city_id16' has changed");
32491 #ifdef FREECIV_JSON_CONNECTION
32492 field_addr.name = "city_id16";
32493#endif /* FREECIV_JSON_CONNECTION */
32494 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
32495 }
32496 if (BV_ISSET(fields, 1)) {
32497 log_packet_detailed(" field 'tile_id' has changed");
32498 #ifdef FREECIV_JSON_CONNECTION
32499 field_addr.name = "tile_id";
32500#endif /* FREECIV_JSON_CONNECTION */
32501 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
32502 }
32503 if (BV_ISSET(fields, 2)) {
32504 log_packet_detailed(" field 'activity' has changed");
32505 #ifdef FREECIV_JSON_CONNECTION
32506 field_addr.name = "activity";
32507#endif /* FREECIV_JSON_CONNECTION */
32508 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
32509 }
32510 if (BV_ISSET(fields, 3)) {
32511 log_packet_detailed(" field 'tgt' has changed");
32512 #ifdef FREECIV_JSON_CONNECTION
32513 field_addr.name = "tgt";
32514#endif /* FREECIV_JSON_CONNECTION */
32515 DIO_PUT(sint8, &dout, &field_addr, real_packet->tgt);
32516 }
32517 if (BV_ISSET(fields, 4)) {
32518 log_packet_detailed(" field 'want' has changed");
32519 #ifdef FREECIV_JSON_CONNECTION
32520 field_addr.name = "want";
32521#endif /* FREECIV_JSON_CONNECTION */
32522 DIO_PUT(uint16, &dout, &field_addr, real_packet->want);
32523 }
32524
32525 *old = *real_packet;
32526#endif /* FREECIV_DELTA_PROTOCOL */
32527#ifndef FREECIV_DELTA_PROTOCOL
32528#ifdef FREECIV_JSON_CONNECTION
32529 field_addr.name = "city_id16";
32530#endif /* FREECIV_JSON_CONNECTION */
32531 DIO_PUT(uint16, &dout, &field_addr, real_packet->city_id16);
32532#ifdef FREECIV_JSON_CONNECTION
32533 field_addr.name = "tile_id";
32534#endif /* FREECIV_JSON_CONNECTION */
32535 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
32536#ifdef FREECIV_JSON_CONNECTION
32537 field_addr.name = "activity";
32538#endif /* FREECIV_JSON_CONNECTION */
32539 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
32540#ifdef FREECIV_JSON_CONNECTION
32541 field_addr.name = "tgt";
32542#endif /* FREECIV_JSON_CONNECTION */
32543 DIO_PUT(sint8, &dout, &field_addr, real_packet->tgt);
32544#ifdef FREECIV_JSON_CONNECTION
32545 field_addr.name = "want";
32546#endif /* FREECIV_JSON_CONNECTION */
32547 DIO_PUT(uint16, &dout, &field_addr, real_packet->want);
32548
32549#endif
32550 SEND_PACKET_END(PACKET_WORKER_TASK);
32551}
32552
32553 int send_packet_worker_task(struct connection *pc, const struct packet_worker_task *packet)
32554{
32555 if (!pc->used) {
32556 log_error("WARNING: trying to send data to the closed connection %s",
32557 conn_description(pc));
32558 return -1;
32559 }
32560 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WORKER_TASK].packet != NULL, -1,
32561 "Handler for PACKET_WORKER_TASK not installed");
32562 return pc->phs.handlers->send[PACKET_WORKER_TASK].packet(pc, packet);
32563}
32564
32565 void lsend_packet_worker_task(struct conn_list *dest, const struct packet_worker_task *packet)
32566{
32567 conn_list_iterate(dest, pconn) {
32568 send_packet_worker_task(pconn, packet);
32569 } conn_list_iterate_end;
32570}
32571
32572#ifdef FREECIV_DELTA_PROTOCOL
32573#define hash_packet_player_remove_100 hash_const
32574
32575#define cmp_packet_player_remove_100 cmp_const
32576
32577 BV_DEFINE(packet_player_remove_100_fields, 1);
32578#endif /* FREECIV_DELTA_PROTOCOL */
32579
32580 static struct packet_player_remove *receive_packet_player_remove_100(struct connection *pc)
32581{
32582#ifdef FREECIV_DELTA_PROTOCOL
32583 packet_player_remove_100_fields fields;
32584 struct packet_player_remove *old;
32585 struct genhash **hash = pc->phs.received + PACKET_PLAYER_REMOVE;
32586#endif /* FREECIV_DELTA_PROTOCOL */
32587 RECEIVE_PACKET_START(packet_player_remove, real_packet);
32588#ifdef FREECIV_JSON_CONNECTION
32589 struct plocation field_addr;
32590 {
32591 struct plocation *field_addr_tmp = plocation_field_new(NULL);
32592 field_addr = *field_addr_tmp;
32593 FC_FREE(field_addr_tmp);
32594 }
32595#endif /* FREECIV_JSON_CONNECTION */
32596
32597#ifdef FREECIV_DELTA_PROTOCOL
32598#ifdef FREECIV_JSON_CONNECTION
32599 field_addr.name = "fields";
32600#endif /* FREECIV_JSON_CONNECTION */
32601 DIO_BV_GET(&din, &field_addr, fields);
32602
32603#else /* FREECIV_DELTA_PROTOCOL */
32604 #ifdef FREECIV_JSON_CONNECTION
32605 field_addr.name = "playerno";
32606 #endif /* FREECIV_JSON_CONNECTION */
32607 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->playerno)) {
32608 RECEIVE_PACKET_FIELD_ERROR(playerno);
32609 }
32610
32611#endif
32612 log_packet_detailed("packet_player_remove_100: got info about ()");
32613
32614#ifdef FREECIV_DELTA_PROTOCOL
32615 if (NULL == *hash) {
32616 *hash = genhash_new_full(hash_packet_player_remove_100, cmp_packet_player_remove_100,
32617 NULL, NULL, NULL, free);
32618 }
32619
32620 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
32621 *real_packet = *old;
32622 } else {
32623 log_packet_detailed(" no old info");
32624 memset(real_packet, 0, sizeof(*real_packet));
32625 }
32626
32627 if (BV_ISSET(fields, 0)) {
32628 log_packet_detailed(" got field 'playerno'");
32629 #ifdef FREECIV_JSON_CONNECTION
32630 field_addr.name = "playerno";
32631 #endif /* FREECIV_JSON_CONNECTION */
32632 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->playerno)) {
32633 RECEIVE_PACKET_FIELD_ERROR(playerno);
32634 }
32635 }
32636
32637 if (NULL == old) {
32638 old = fc_malloc(sizeof(*old));
32639 *old = *real_packet;
32640 genhash_insert(*hash, old, old);
32641 } else {
32642 *old = *real_packet;
32643 }
32644
32645 hash = pc->phs.received + PACKET_PLAYER_INFO;
32646 if (NULL != *hash) {
32647 genhash_remove(*hash, real_packet);
32648 }
32649
32650#endif /* FREECIV_DELTA_PROTOCOL */
32651 RECEIVE_PACKET_END(real_packet);
32652}
32653
32654 static int send_packet_player_remove_100(struct connection *pc, const struct packet_player_remove *packet)
32655{
32656 const struct packet_player_remove *real_packet = packet;
32657#ifdef FREECIV_DELTA_PROTOCOL
32658 packet_player_remove_100_fields fields;
32659 struct packet_player_remove *old;
32660 bool differ;
32661 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_REMOVE;
32662#endif /* FREECIV_DELTA_PROTOCOL */
32663 SEND_PACKET_START(PACKET_PLAYER_REMOVE);
32664#ifdef FREECIV_JSON_CONNECTION
32665 struct plocation field_addr;
32666 {
32667 struct plocation *field_addr_tmp = plocation_field_new(NULL);
32668 field_addr = *field_addr_tmp;
32669 FC_FREE(field_addr_tmp);
32670 }
32671#endif /* FREECIV_JSON_CONNECTION */
32672
32673 log_packet_detailed("packet_player_remove_100: sending info about ()");
32674
32675#ifdef FREECIV_DELTA_PROTOCOL
32676 if (NULL == *hash) {
32677 *hash = genhash_new_full(hash_packet_player_remove_100, cmp_packet_player_remove_100,
32678 NULL, NULL, NULL, free);
32679 }
32680 BV_CLR_ALL(fields);
32681
32682 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
32683 old = fc_malloc(sizeof(*old));
32684 *old = *real_packet;
32685 genhash_insert(*hash, old, old);
32686 memset(old, 0, sizeof(*old));
32687 }
32688 differ = (old->playerno != real_packet->playerno);
32689 if (differ) {
32690 BV_SET(fields, 0);
32691 }
32692
32693
32694#ifdef FREECIV_JSON_CONNECTION
32695 field_addr.name = "fields";
32696#endif /* FREECIV_JSON_CONNECTION */
32697 DIO_BV_PUT(&dout, &field_addr, fields);
32698
32699 if (BV_ISSET(fields, 0)) {
32700 log_packet_detailed(" field 'playerno' has changed");
32701 #ifdef FREECIV_JSON_CONNECTION
32702 field_addr.name = "playerno";
32703#endif /* FREECIV_JSON_CONNECTION */
32704 DIO_PUT(uint16, &dout, &field_addr, real_packet->playerno);
32705 }
32706
32707 *old = *real_packet;
32708
32709 hash = pc->phs.sent + PACKET_PLAYER_INFO;
32710 if (NULL != *hash) {
32711 genhash_remove(*hash, real_packet);
32712 }
32713#endif /* FREECIV_DELTA_PROTOCOL */
32714#ifndef FREECIV_DELTA_PROTOCOL
32715#ifdef FREECIV_JSON_CONNECTION
32716 field_addr.name = "playerno";
32717#endif /* FREECIV_JSON_CONNECTION */
32718 DIO_PUT(uint16, &dout, &field_addr, real_packet->playerno);
32719
32720#endif
32721 SEND_PACKET_END(PACKET_PLAYER_REMOVE);
32722}
32723
32724 int send_packet_player_remove(struct connection *pc, const struct packet_player_remove *packet)
32725{
32726 if (!pc->used) {
32727 log_error("WARNING: trying to send data to the closed connection %s",
32728 conn_description(pc));
32729 return -1;
32730 }
32731 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_REMOVE].packet != NULL, -1,
32732 "Handler for PACKET_PLAYER_REMOVE not installed");
32733 return pc->phs.handlers->send[PACKET_PLAYER_REMOVE].packet(pc, packet);
32734}
32735
32736 int dsend_packet_player_remove(struct connection *pc, int playerno)
32737{
32738 struct packet_player_remove packet, *real_packet = &packet;
32739
32740 real_packet->playerno = playerno;
32741
32742 return send_packet_player_remove(pc, real_packet);
32743}
32744
32745#ifdef FREECIV_DELTA_PROTOCOL
32746static genhash_val_t hash_packet_player_info_100(const void *vkey)
32747{
32748 const struct packet_player_info *key = (const struct packet_player_info *) vkey;
32749
32750 return key->playerno;
32751}
32752
32753static bool cmp_packet_player_info_100(const void *vkey1, const void *vkey2)
32754{
32755 const struct packet_player_info *key1 = (const struct packet_player_info *) vkey1;
32756 const struct packet_player_info *key2 = (const struct packet_player_info *) vkey2;
32757
32758 return key1->playerno == key2->playerno;
32759}
32760 BV_DEFINE(packet_player_info_100_fields, 45);
32761#endif /* FREECIV_DELTA_PROTOCOL */
32762
32763 static struct packet_player_info *receive_packet_player_info_100(struct connection *pc)
32764{
32765#ifdef FREECIV_DELTA_PROTOCOL
32766 packet_player_info_100_fields fields;
32767 struct packet_player_info *old;
32768 struct genhash **hash = pc->phs.received + PACKET_PLAYER_INFO;
32769#endif /* FREECIV_DELTA_PROTOCOL */
32770 RECEIVE_PACKET_START(packet_player_info, real_packet);
32771#ifdef FREECIV_JSON_CONNECTION
32772 struct plocation field_addr;
32773 {
32774 struct plocation *field_addr_tmp = plocation_field_new(NULL);
32775 field_addr = *field_addr_tmp;
32776 FC_FREE(field_addr_tmp);
32777 }
32778#endif /* FREECIV_JSON_CONNECTION */
32779
32780#ifdef FREECIV_DELTA_PROTOCOL
32781#ifdef FREECIV_JSON_CONNECTION
32782 field_addr.name = "fields";
32783#endif /* FREECIV_JSON_CONNECTION */
32784 DIO_BV_GET(&din, &field_addr, fields);
32785 #ifdef FREECIV_JSON_CONNECTION
32786 field_addr.name = "playerno";
32787 #endif /* FREECIV_JSON_CONNECTION */
32788 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->playerno)) {
32789 RECEIVE_PACKET_FIELD_ERROR(playerno);
32790 }
32791
32792#else /* FREECIV_DELTA_PROTOCOL */
32793 #ifdef FREECIV_JSON_CONNECTION
32794 field_addr.name = "playerno";
32795 #endif /* FREECIV_JSON_CONNECTION */
32796 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->playerno)) {
32797 RECEIVE_PACKET_FIELD_ERROR(playerno);
32798 }
32799 #ifdef FREECIV_JSON_CONNECTION
32800 field_addr.name = "name";
32801 #endif /* FREECIV_JSON_CONNECTION */
32802 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
32803 RECEIVE_PACKET_FIELD_ERROR(name);
32804 }
32805 #ifdef FREECIV_JSON_CONNECTION
32806 field_addr.name = "username";
32807 #endif /* FREECIV_JSON_CONNECTION */
32808 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
32809 RECEIVE_PACKET_FIELD_ERROR(username);
32810 }
32811 #ifdef FREECIV_JSON_CONNECTION
32812 field_addr.name = "unassigned_user";
32813 #endif /* FREECIV_JSON_CONNECTION */
32814 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unassigned_user)) {
32815 RECEIVE_PACKET_FIELD_ERROR(unassigned_user);
32816 }
32817 #ifdef FREECIV_JSON_CONNECTION
32818 field_addr.name = "score";
32819 #endif /* FREECIV_JSON_CONNECTION */
32820 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->score)) {
32821 RECEIVE_PACKET_FIELD_ERROR(score);
32822 }
32823 #ifdef FREECIV_JSON_CONNECTION
32824 field_addr.name = "is_male";
32825 #endif /* FREECIV_JSON_CONNECTION */
32826 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_male)) {
32827 RECEIVE_PACKET_FIELD_ERROR(is_male);
32828 }
32829 #ifdef FREECIV_JSON_CONNECTION
32830 field_addr.name = "was_created";
32831 #endif /* FREECIV_JSON_CONNECTION */
32832 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->was_created)) {
32833 RECEIVE_PACKET_FIELD_ERROR(was_created);
32834 }
32835 #ifdef FREECIV_JSON_CONNECTION
32836 field_addr.name = "government";
32837 #endif /* FREECIV_JSON_CONNECTION */
32838 {
32839 int readin;
32840
32841 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
32842 RECEIVE_PACKET_FIELD_ERROR(government);
32843 }
32844 real_packet->government = readin;
32845 }
32846 #ifdef FREECIV_JSON_CONNECTION
32847 field_addr.name = "target_government";
32848 #endif /* FREECIV_JSON_CONNECTION */
32849 {
32850 int readin;
32851
32852 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
32853 RECEIVE_PACKET_FIELD_ERROR(target_government);
32854 }
32855 real_packet->target_government = readin;
32856 }
32857 #ifdef FREECIV_JSON_CONNECTION
32858 field_addr.name = "real_embassy";
32859 #endif /* FREECIV_JSON_CONNECTION */
32860
32861 {
32862 int i;
32863
32864 #ifdef FREECIV_JSON_CONNECTION
32865 /* Enter array. */
32866 field_addr.sub_location = plocation_elem_new(0);
32867 #endif /* FREECIV_JSON_CONNECTION */
32868
32869 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
32870 #ifdef FREECIV_JSON_CONNECTION
32871 field_addr.sub_location->number = i;
32872 #endif /* FREECIV_JSON_CONNECTION */
32873 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->real_embassy[i])) {
32874 RECEIVE_PACKET_FIELD_ERROR(real_embassy);
32875 }
32876 }
32877
32878 #ifdef FREECIV_JSON_CONNECTION
32879 /* Exit array. */
32880 free(field_addr.sub_location);
32881 field_addr.sub_location = NULL;
32882 #endif /* FREECIV_JSON_CONNECTION */
32883 }
32884 #ifdef FREECIV_JSON_CONNECTION
32885 field_addr.name = "mood";
32886 #endif /* FREECIV_JSON_CONNECTION */
32887 {
32888 int readin;
32889
32890 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
32891 RECEIVE_PACKET_FIELD_ERROR(mood);
32892 }
32893 real_packet->mood = readin;
32894 }
32895 #ifdef FREECIV_JSON_CONNECTION
32896 field_addr.name = "style";
32897 #endif /* FREECIV_JSON_CONNECTION */
32898 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
32899 RECEIVE_PACKET_FIELD_ERROR(style);
32900 }
32901 #ifdef FREECIV_JSON_CONNECTION
32902 field_addr.name = "music_style";
32903 #endif /* FREECIV_JSON_CONNECTION */
32904 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->music_style)) {
32905 RECEIVE_PACKET_FIELD_ERROR(music_style);
32906 }
32907 #ifdef FREECIV_JSON_CONNECTION
32908 field_addr.name = "nation";
32909 #endif /* FREECIV_JSON_CONNECTION */
32910 {
32911 int readin;
32912
32913 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
32914 RECEIVE_PACKET_FIELD_ERROR(nation);
32915 }
32916 real_packet->nation = readin;
32917 }
32918 #ifdef FREECIV_JSON_CONNECTION
32919 field_addr.name = "team";
32920 #endif /* FREECIV_JSON_CONNECTION */
32921 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->team)) {
32922 RECEIVE_PACKET_FIELD_ERROR(team);
32923 }
32924 #ifdef FREECIV_JSON_CONNECTION
32925 field_addr.name = "is_ready";
32926 #endif /* FREECIV_JSON_CONNECTION */
32927 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_ready)) {
32928 RECEIVE_PACKET_FIELD_ERROR(is_ready);
32929 }
32930 #ifdef FREECIV_JSON_CONNECTION
32931 field_addr.name = "phase_done";
32932 #endif /* FREECIV_JSON_CONNECTION */
32933 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->phase_done)) {
32934 RECEIVE_PACKET_FIELD_ERROR(phase_done);
32935 }
32936 #ifdef FREECIV_JSON_CONNECTION
32937 field_addr.name = "nturns_idle";
32938 #endif /* FREECIV_JSON_CONNECTION */
32939 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nturns_idle)) {
32940 RECEIVE_PACKET_FIELD_ERROR(nturns_idle);
32941 }
32942 #ifdef FREECIV_JSON_CONNECTION
32943 field_addr.name = "turns_alive";
32944 #endif /* FREECIV_JSON_CONNECTION */
32945 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turns_alive)) {
32946 RECEIVE_PACKET_FIELD_ERROR(turns_alive);
32947 }
32948 #ifdef FREECIV_JSON_CONNECTION
32949 field_addr.name = "is_alive";
32950 #endif /* FREECIV_JSON_CONNECTION */
32951 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_alive)) {
32952 RECEIVE_PACKET_FIELD_ERROR(is_alive);
32953 }
32954 #ifdef FREECIV_JSON_CONNECTION
32955 field_addr.name = "gold";
32956 #endif /* FREECIV_JSON_CONNECTION */
32957 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
32958 RECEIVE_PACKET_FIELD_ERROR(gold);
32959 }
32960 #ifdef FREECIV_JSON_CONNECTION
32961 field_addr.name = "tax";
32962 #endif /* FREECIV_JSON_CONNECTION */
32963 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
32964 RECEIVE_PACKET_FIELD_ERROR(tax);
32965 }
32966 #ifdef FREECIV_JSON_CONNECTION
32967 field_addr.name = "science";
32968 #endif /* FREECIV_JSON_CONNECTION */
32969 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
32970 RECEIVE_PACKET_FIELD_ERROR(science);
32971 }
32972 #ifdef FREECIV_JSON_CONNECTION
32973 field_addr.name = "luxury";
32974 #endif /* FREECIV_JSON_CONNECTION */
32975 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
32976 RECEIVE_PACKET_FIELD_ERROR(luxury);
32977 }
32978 #ifdef FREECIV_JSON_CONNECTION
32979 field_addr.name = "infrapoints";
32980 #endif /* FREECIV_JSON_CONNECTION */
32981 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->infrapoints)) {
32982 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
32983 }
32984 #ifdef FREECIV_JSON_CONNECTION
32985 field_addr.name = "tech_upkeep";
32986 #endif /* FREECIV_JSON_CONNECTION */
32987 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_upkeep)) {
32988 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep);
32989 }
32990 #ifdef FREECIV_JSON_CONNECTION
32991 field_addr.name = "science_cost";
32992 #endif /* FREECIV_JSON_CONNECTION */
32993 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->science_cost)) {
32994 RECEIVE_PACKET_FIELD_ERROR(science_cost);
32995 }
32996 #ifdef FREECIV_JSON_CONNECTION
32997 field_addr.name = "is_connected";
32998 #endif /* FREECIV_JSON_CONNECTION */
32999 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_connected)) {
33000 RECEIVE_PACKET_FIELD_ERROR(is_connected);
33001 }
33002 #ifdef FREECIV_JSON_CONNECTION
33003 field_addr.name = "revolution_finishes";
33004 #endif /* FREECIV_JSON_CONNECTION */
33005 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->revolution_finishes)) {
33006 RECEIVE_PACKET_FIELD_ERROR(revolution_finishes);
33007 }
33008 #ifdef FREECIV_JSON_CONNECTION
33009 field_addr.name = "ai_skill_level";
33010 #endif /* FREECIV_JSON_CONNECTION */
33011 {
33012 int readin;
33013
33014 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
33015 RECEIVE_PACKET_FIELD_ERROR(ai_skill_level);
33016 }
33017 real_packet->ai_skill_level = readin;
33018 }
33019 #ifdef FREECIV_JSON_CONNECTION
33020 field_addr.name = "barbarian_type";
33021 #endif /* FREECIV_JSON_CONNECTION */
33022 {
33023 int readin;
33024
33025 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
33026 RECEIVE_PACKET_FIELD_ERROR(barbarian_type);
33027 }
33028 real_packet->barbarian_type = readin;
33029 }
33030 #ifdef FREECIV_JSON_CONNECTION
33031 field_addr.name = "gives_shared_vision";
33032 #endif /* FREECIV_JSON_CONNECTION */
33033 if (!DIO_BV_GET(&din, &field_addr, real_packet->gives_shared_vision)) {
33034 RECEIVE_PACKET_FIELD_ERROR(gives_shared_vision);
33035 }
33036 #ifdef FREECIV_JSON_CONNECTION
33037 field_addr.name = "history";
33038 #endif /* FREECIV_JSON_CONNECTION */
33039 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
33040 RECEIVE_PACKET_FIELD_ERROR(history);
33041 }
33042 #ifdef FREECIV_JSON_CONNECTION
33043 field_addr.name = "culture";
33044 #endif /* FREECIV_JSON_CONNECTION */
33045 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
33046 RECEIVE_PACKET_FIELD_ERROR(culture);
33047 }
33048 #ifdef FREECIV_JSON_CONNECTION
33049 field_addr.name = "love";
33050 #endif /* FREECIV_JSON_CONNECTION */
33051
33052 {
33053 int i;
33054
33055 #ifdef FREECIV_JSON_CONNECTION
33056 /* Enter array. */
33057 field_addr.sub_location = plocation_elem_new(0);
33058 #endif /* FREECIV_JSON_CONNECTION */
33059
33060 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
33061 #ifdef FREECIV_JSON_CONNECTION
33062 field_addr.sub_location->number = i;
33063 #endif /* FREECIV_JSON_CONNECTION */
33064 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->love[i])) {
33065 RECEIVE_PACKET_FIELD_ERROR(love);
33066 }
33067 }
33068
33069 #ifdef FREECIV_JSON_CONNECTION
33070 /* Exit array. */
33071 free(field_addr.sub_location);
33072 field_addr.sub_location = NULL;
33073 #endif /* FREECIV_JSON_CONNECTION */
33074 }
33075 #ifdef FREECIV_JSON_CONNECTION
33076 field_addr.name = "color_valid";
33077 #endif /* FREECIV_JSON_CONNECTION */
33078 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->color_valid)) {
33079 RECEIVE_PACKET_FIELD_ERROR(color_valid);
33080 }
33081 #ifdef FREECIV_JSON_CONNECTION
33082 field_addr.name = "color_changeable";
33083 #endif /* FREECIV_JSON_CONNECTION */
33084 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->color_changeable)) {
33085 RECEIVE_PACKET_FIELD_ERROR(color_changeable);
33086 }
33087 #ifdef FREECIV_JSON_CONNECTION
33088 field_addr.name = "color_red";
33089 #endif /* FREECIV_JSON_CONNECTION */
33090 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_red)) {
33091 RECEIVE_PACKET_FIELD_ERROR(color_red);
33092 }
33093 #ifdef FREECIV_JSON_CONNECTION
33094 field_addr.name = "color_green";
33095 #endif /* FREECIV_JSON_CONNECTION */
33096 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_green)) {
33097 RECEIVE_PACKET_FIELD_ERROR(color_green);
33098 }
33099 #ifdef FREECIV_JSON_CONNECTION
33100 field_addr.name = "color_blue";
33101 #endif /* FREECIV_JSON_CONNECTION */
33102 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_blue)) {
33103 RECEIVE_PACKET_FIELD_ERROR(color_blue);
33104 }
33105 #ifdef FREECIV_JSON_CONNECTION
33106 field_addr.name = "flags";
33107 #endif /* FREECIV_JSON_CONNECTION */
33108 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
33109 RECEIVE_PACKET_FIELD_ERROR(flags);
33110 }
33111 #ifdef FREECIV_JSON_CONNECTION
33112 field_addr.name = "wonders";
33113 #endif /* FREECIV_JSON_CONNECTION */
33114
33115 {
33116 int i;
33117
33118 for (i = 0; i < B_LAST; i++) {
33119 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->wonders[i])) {
33120 RECEIVE_PACKET_FIELD_ERROR(wonders);
33121 }
33122 }
33123 }
33124 #ifdef FREECIV_JSON_CONNECTION
33125 field_addr.name = "multip_count";
33126 #endif /* FREECIV_JSON_CONNECTION */
33127 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->multip_count)) {
33128 RECEIVE_PACKET_FIELD_ERROR(multip_count);
33129 }
33130 #ifdef FREECIV_JSON_CONNECTION
33131 field_addr.name = "multiplier";
33132 #endif /* FREECIV_JSON_CONNECTION */
33133
33134 {
33135 int i;
33136
33137 #ifdef FREECIV_JSON_CONNECTION
33138 /* Enter array. */
33139 field_addr.sub_location = plocation_elem_new(0);
33140 #endif /* FREECIV_JSON_CONNECTION */
33141
33142 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
33143 RECEIVE_PACKET_FIELD_ERROR(multiplier, ": truncation array");
33144 }
33145 for (i = 0; i < real_packet->multip_count; i++) {
33146 #ifdef FREECIV_JSON_CONNECTION
33147 field_addr.sub_location->number = i;
33148 #endif /* FREECIV_JSON_CONNECTION */
33149 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multiplier[i])) {
33150 RECEIVE_PACKET_FIELD_ERROR(multiplier);
33151 }
33152 }
33153
33154 #ifdef FREECIV_JSON_CONNECTION
33155 /* Exit array. */
33156 free(field_addr.sub_location);
33157 field_addr.sub_location = NULL;
33158 #endif /* FREECIV_JSON_CONNECTION */
33159 }
33160 #ifdef FREECIV_JSON_CONNECTION
33161 field_addr.name = "multiplier_target";
33162 #endif /* FREECIV_JSON_CONNECTION */
33163
33164 {
33165 int i;
33166
33167 #ifdef FREECIV_JSON_CONNECTION
33168 /* Enter array. */
33169 field_addr.sub_location = plocation_elem_new(0);
33170 #endif /* FREECIV_JSON_CONNECTION */
33171
33172 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
33173 RECEIVE_PACKET_FIELD_ERROR(multiplier_target, ": truncation array");
33174 }
33175 for (i = 0; i < real_packet->multip_count; i++) {
33176 #ifdef FREECIV_JSON_CONNECTION
33177 field_addr.sub_location->number = i;
33178 #endif /* FREECIV_JSON_CONNECTION */
33179 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multiplier_target[i])) {
33180 RECEIVE_PACKET_FIELD_ERROR(multiplier_target);
33181 }
33182 }
33183
33184 #ifdef FREECIV_JSON_CONNECTION
33185 /* Exit array. */
33186 free(field_addr.sub_location);
33187 field_addr.sub_location = NULL;
33188 #endif /* FREECIV_JSON_CONNECTION */
33189 }
33190 #ifdef FREECIV_JSON_CONNECTION
33191 field_addr.name = "multiplier_changed";
33192 #endif /* FREECIV_JSON_CONNECTION */
33193
33194 {
33195 int i;
33196
33197 #ifdef FREECIV_JSON_CONNECTION
33198 /* Enter array. */
33199 field_addr.sub_location = plocation_elem_new(0);
33200 #endif /* FREECIV_JSON_CONNECTION */
33201
33202 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
33203 RECEIVE_PACKET_FIELD_ERROR(multiplier_changed, ": truncation array");
33204 }
33205 for (i = 0; i < real_packet->multip_count; i++) {
33206 #ifdef FREECIV_JSON_CONNECTION
33207 field_addr.sub_location->number = i;
33208 #endif /* FREECIV_JSON_CONNECTION */
33209 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->multiplier_changed[i])) {
33210 RECEIVE_PACKET_FIELD_ERROR(multiplier_changed);
33211 }
33212 }
33213
33214 #ifdef FREECIV_JSON_CONNECTION
33215 /* Exit array. */
33216 free(field_addr.sub_location);
33217 field_addr.sub_location = NULL;
33218 #endif /* FREECIV_JSON_CONNECTION */
33219 }
33220
33221#endif
33222 log_packet_detailed("packet_player_info_100: got info about (%d)",
33223 real_packet->playerno);
33224
33225#ifdef FREECIV_DELTA_PROTOCOL
33226 if (NULL == *hash) {
33227 *hash = genhash_new_full(hash_packet_player_info_100, cmp_packet_player_info_100,
33228 NULL, NULL, NULL, free);
33229 }
33230
33231 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
33232 *real_packet = *old;
33233 } else {
33234 int playerno = real_packet->playerno;
33235
33236 log_packet_detailed(" no old info");
33237 memset(real_packet, 0, sizeof(*real_packet));
33238
33239 real_packet->playerno = playerno;
33240 }
33241
33242 if (BV_ISSET(fields, 0)) {
33243 log_packet_detailed(" got field 'name'");
33244 #ifdef FREECIV_JSON_CONNECTION
33245 field_addr.name = "name";
33246 #endif /* FREECIV_JSON_CONNECTION */
33247 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
33248 RECEIVE_PACKET_FIELD_ERROR(name);
33249 }
33250 }
33251 if (BV_ISSET(fields, 1)) {
33252 log_packet_detailed(" got field 'username'");
33253 #ifdef FREECIV_JSON_CONNECTION
33254 field_addr.name = "username";
33255 #endif /* FREECIV_JSON_CONNECTION */
33256 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
33257 RECEIVE_PACKET_FIELD_ERROR(username);
33258 }
33259 }
33260 real_packet->unassigned_user = BV_ISSET(fields, 2);
33261 if (BV_ISSET(fields, 3)) {
33262 log_packet_detailed(" got field 'score'");
33263 #ifdef FREECIV_JSON_CONNECTION
33264 field_addr.name = "score";
33265 #endif /* FREECIV_JSON_CONNECTION */
33266 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->score)) {
33267 RECEIVE_PACKET_FIELD_ERROR(score);
33268 }
33269 }
33270 real_packet->is_male = BV_ISSET(fields, 4);
33271 real_packet->was_created = BV_ISSET(fields, 5);
33272 if (BV_ISSET(fields, 6)) {
33273 log_packet_detailed(" got field 'government'");
33274 #ifdef FREECIV_JSON_CONNECTION
33275 field_addr.name = "government";
33276 #endif /* FREECIV_JSON_CONNECTION */
33277 {
33278 int readin;
33279
33280 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
33281 RECEIVE_PACKET_FIELD_ERROR(government);
33282 }
33283 real_packet->government = readin;
33284 }
33285 }
33286 if (BV_ISSET(fields, 7)) {
33287 log_packet_detailed(" got field 'target_government'");
33288 #ifdef FREECIV_JSON_CONNECTION
33289 field_addr.name = "target_government";
33290 #endif /* FREECIV_JSON_CONNECTION */
33291 {
33292 int readin;
33293
33294 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
33295 RECEIVE_PACKET_FIELD_ERROR(target_government);
33296 }
33297 real_packet->target_government = readin;
33298 }
33299 }
33300 if (BV_ISSET(fields, 8)) {
33301 log_packet_detailed(" got field 'real_embassy'");
33302 #ifdef FREECIV_JSON_CONNECTION
33303 field_addr.name = "real_embassy";
33304 #endif /* FREECIV_JSON_CONNECTION */
33305
33306 {
33307 int i;
33308
33309 #ifdef FREECIV_JSON_CONNECTION
33310 /* Enter array. */
33311 field_addr.sub_location = plocation_elem_new(0);
33312 #endif /* FREECIV_JSON_CONNECTION */
33313
33314 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
33315 #ifdef FREECIV_JSON_CONNECTION
33316 field_addr.sub_location->number = i;
33317 #endif /* FREECIV_JSON_CONNECTION */
33318 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->real_embassy[i])) {
33319 RECEIVE_PACKET_FIELD_ERROR(real_embassy);
33320 }
33321 }
33322
33323 #ifdef FREECIV_JSON_CONNECTION
33324 /* Exit array. */
33325 free(field_addr.sub_location);
33326 field_addr.sub_location = NULL;
33327 #endif /* FREECIV_JSON_CONNECTION */
33328 }
33329 }
33330 if (BV_ISSET(fields, 9)) {
33331 log_packet_detailed(" got field 'mood'");
33332 #ifdef FREECIV_JSON_CONNECTION
33333 field_addr.name = "mood";
33334 #endif /* FREECIV_JSON_CONNECTION */
33335 {
33336 int readin;
33337
33338 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
33339 RECEIVE_PACKET_FIELD_ERROR(mood);
33340 }
33341 real_packet->mood = readin;
33342 }
33343 }
33344 if (BV_ISSET(fields, 10)) {
33345 log_packet_detailed(" got field 'style'");
33346 #ifdef FREECIV_JSON_CONNECTION
33347 field_addr.name = "style";
33348 #endif /* FREECIV_JSON_CONNECTION */
33349 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
33350 RECEIVE_PACKET_FIELD_ERROR(style);
33351 }
33352 }
33353 if (BV_ISSET(fields, 11)) {
33354 log_packet_detailed(" got field 'music_style'");
33355 #ifdef FREECIV_JSON_CONNECTION
33356 field_addr.name = "music_style";
33357 #endif /* FREECIV_JSON_CONNECTION */
33358 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->music_style)) {
33359 RECEIVE_PACKET_FIELD_ERROR(music_style);
33360 }
33361 }
33362 if (BV_ISSET(fields, 12)) {
33363 log_packet_detailed(" got field 'nation'");
33364 #ifdef FREECIV_JSON_CONNECTION
33365 field_addr.name = "nation";
33366 #endif /* FREECIV_JSON_CONNECTION */
33367 {
33368 int readin;
33369
33370 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
33371 RECEIVE_PACKET_FIELD_ERROR(nation);
33372 }
33373 real_packet->nation = readin;
33374 }
33375 }
33376 if (BV_ISSET(fields, 13)) {
33377 log_packet_detailed(" got field 'team'");
33378 #ifdef FREECIV_JSON_CONNECTION
33379 field_addr.name = "team";
33380 #endif /* FREECIV_JSON_CONNECTION */
33381 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->team)) {
33382 RECEIVE_PACKET_FIELD_ERROR(team);
33383 }
33384 }
33385 real_packet->is_ready = BV_ISSET(fields, 14);
33386 real_packet->phase_done = BV_ISSET(fields, 15);
33387 if (BV_ISSET(fields, 16)) {
33388 log_packet_detailed(" got field 'nturns_idle'");
33389 #ifdef FREECIV_JSON_CONNECTION
33390 field_addr.name = "nturns_idle";
33391 #endif /* FREECIV_JSON_CONNECTION */
33392 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nturns_idle)) {
33393 RECEIVE_PACKET_FIELD_ERROR(nturns_idle);
33394 }
33395 }
33396 if (BV_ISSET(fields, 17)) {
33397 log_packet_detailed(" got field 'turns_alive'");
33398 #ifdef FREECIV_JSON_CONNECTION
33399 field_addr.name = "turns_alive";
33400 #endif /* FREECIV_JSON_CONNECTION */
33401 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turns_alive)) {
33402 RECEIVE_PACKET_FIELD_ERROR(turns_alive);
33403 }
33404 }
33405 real_packet->is_alive = BV_ISSET(fields, 18);
33406 if (BV_ISSET(fields, 19)) {
33407 log_packet_detailed(" got field 'gold'");
33408 #ifdef FREECIV_JSON_CONNECTION
33409 field_addr.name = "gold";
33410 #endif /* FREECIV_JSON_CONNECTION */
33411 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
33412 RECEIVE_PACKET_FIELD_ERROR(gold);
33413 }
33414 }
33415 if (BV_ISSET(fields, 20)) {
33416 log_packet_detailed(" got field 'tax'");
33417 #ifdef FREECIV_JSON_CONNECTION
33418 field_addr.name = "tax";
33419 #endif /* FREECIV_JSON_CONNECTION */
33420 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
33421 RECEIVE_PACKET_FIELD_ERROR(tax);
33422 }
33423 }
33424 if (BV_ISSET(fields, 21)) {
33425 log_packet_detailed(" got field 'science'");
33426 #ifdef FREECIV_JSON_CONNECTION
33427 field_addr.name = "science";
33428 #endif /* FREECIV_JSON_CONNECTION */
33429 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
33430 RECEIVE_PACKET_FIELD_ERROR(science);
33431 }
33432 }
33433 if (BV_ISSET(fields, 22)) {
33434 log_packet_detailed(" got field 'luxury'");
33435 #ifdef FREECIV_JSON_CONNECTION
33436 field_addr.name = "luxury";
33437 #endif /* FREECIV_JSON_CONNECTION */
33438 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
33439 RECEIVE_PACKET_FIELD_ERROR(luxury);
33440 }
33441 }
33442 if (BV_ISSET(fields, 23)) {
33443 log_packet_detailed(" got field 'infrapoints'");
33444 #ifdef FREECIV_JSON_CONNECTION
33445 field_addr.name = "infrapoints";
33446 #endif /* FREECIV_JSON_CONNECTION */
33447 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->infrapoints)) {
33448 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
33449 }
33450 }
33451 if (BV_ISSET(fields, 24)) {
33452 log_packet_detailed(" got field 'tech_upkeep'");
33453 #ifdef FREECIV_JSON_CONNECTION
33454 field_addr.name = "tech_upkeep";
33455 #endif /* FREECIV_JSON_CONNECTION */
33456 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_upkeep)) {
33457 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep);
33458 }
33459 }
33460 if (BV_ISSET(fields, 25)) {
33461 log_packet_detailed(" got field 'science_cost'");
33462 #ifdef FREECIV_JSON_CONNECTION
33463 field_addr.name = "science_cost";
33464 #endif /* FREECIV_JSON_CONNECTION */
33465 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->science_cost)) {
33466 RECEIVE_PACKET_FIELD_ERROR(science_cost);
33467 }
33468 }
33469 real_packet->is_connected = BV_ISSET(fields, 26);
33470 if (BV_ISSET(fields, 27)) {
33471 log_packet_detailed(" got field 'revolution_finishes'");
33472 #ifdef FREECIV_JSON_CONNECTION
33473 field_addr.name = "revolution_finishes";
33474 #endif /* FREECIV_JSON_CONNECTION */
33475 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->revolution_finishes)) {
33476 RECEIVE_PACKET_FIELD_ERROR(revolution_finishes);
33477 }
33478 }
33479 if (BV_ISSET(fields, 28)) {
33480 log_packet_detailed(" got field 'ai_skill_level'");
33481 #ifdef FREECIV_JSON_CONNECTION
33482 field_addr.name = "ai_skill_level";
33483 #endif /* FREECIV_JSON_CONNECTION */
33484 {
33485 int readin;
33486
33487 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
33488 RECEIVE_PACKET_FIELD_ERROR(ai_skill_level);
33489 }
33490 real_packet->ai_skill_level = readin;
33491 }
33492 }
33493 if (BV_ISSET(fields, 29)) {
33494 log_packet_detailed(" got field 'barbarian_type'");
33495 #ifdef FREECIV_JSON_CONNECTION
33496 field_addr.name = "barbarian_type";
33497 #endif /* FREECIV_JSON_CONNECTION */
33498 {
33499 int readin;
33500
33501 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
33502 RECEIVE_PACKET_FIELD_ERROR(barbarian_type);
33503 }
33504 real_packet->barbarian_type = readin;
33505 }
33506 }
33507 if (BV_ISSET(fields, 30)) {
33508 log_packet_detailed(" got field 'gives_shared_vision'");
33509 #ifdef FREECIV_JSON_CONNECTION
33510 field_addr.name = "gives_shared_vision";
33511 #endif /* FREECIV_JSON_CONNECTION */
33512 if (!DIO_BV_GET(&din, &field_addr, real_packet->gives_shared_vision)) {
33513 RECEIVE_PACKET_FIELD_ERROR(gives_shared_vision);
33514 }
33515 }
33516 if (BV_ISSET(fields, 31)) {
33517 log_packet_detailed(" got field 'history'");
33518 #ifdef FREECIV_JSON_CONNECTION
33519 field_addr.name = "history";
33520 #endif /* FREECIV_JSON_CONNECTION */
33521 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
33522 RECEIVE_PACKET_FIELD_ERROR(history);
33523 }
33524 }
33525 if (BV_ISSET(fields, 32)) {
33526 log_packet_detailed(" got field 'culture'");
33527 #ifdef FREECIV_JSON_CONNECTION
33528 field_addr.name = "culture";
33529 #endif /* FREECIV_JSON_CONNECTION */
33530 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
33531 RECEIVE_PACKET_FIELD_ERROR(culture);
33532 }
33533 }
33534 if (BV_ISSET(fields, 33)) {
33535 log_packet_detailed(" got field 'love'");
33536 #ifdef FREECIV_JSON_CONNECTION
33537 field_addr.name = "love";
33538 #endif /* FREECIV_JSON_CONNECTION */
33539
33540 {
33541 int i;
33542
33543 #ifdef FREECIV_JSON_CONNECTION
33544 /* Enter array. */
33545 field_addr.sub_location = plocation_elem_new(0);
33546 #endif /* FREECIV_JSON_CONNECTION */
33547
33548 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
33549 #ifdef FREECIV_JSON_CONNECTION
33550 field_addr.sub_location->number = i;
33551 #endif /* FREECIV_JSON_CONNECTION */
33552 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->love[i])) {
33553 RECEIVE_PACKET_FIELD_ERROR(love);
33554 }
33555 }
33556
33557 #ifdef FREECIV_JSON_CONNECTION
33558 /* Exit array. */
33559 free(field_addr.sub_location);
33560 field_addr.sub_location = NULL;
33561 #endif /* FREECIV_JSON_CONNECTION */
33562 }
33563 }
33564 real_packet->color_valid = BV_ISSET(fields, 34);
33565 real_packet->color_changeable = BV_ISSET(fields, 35);
33566 if (BV_ISSET(fields, 36)) {
33567 log_packet_detailed(" got field 'color_red'");
33568 #ifdef FREECIV_JSON_CONNECTION
33569 field_addr.name = "color_red";
33570 #endif /* FREECIV_JSON_CONNECTION */
33571 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_red)) {
33572 RECEIVE_PACKET_FIELD_ERROR(color_red);
33573 }
33574 }
33575 if (BV_ISSET(fields, 37)) {
33576 log_packet_detailed(" got field 'color_green'");
33577 #ifdef FREECIV_JSON_CONNECTION
33578 field_addr.name = "color_green";
33579 #endif /* FREECIV_JSON_CONNECTION */
33580 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_green)) {
33581 RECEIVE_PACKET_FIELD_ERROR(color_green);
33582 }
33583 }
33584 if (BV_ISSET(fields, 38)) {
33585 log_packet_detailed(" got field 'color_blue'");
33586 #ifdef FREECIV_JSON_CONNECTION
33587 field_addr.name = "color_blue";
33588 #endif /* FREECIV_JSON_CONNECTION */
33589 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_blue)) {
33590 RECEIVE_PACKET_FIELD_ERROR(color_blue);
33591 }
33592 }
33593 if (BV_ISSET(fields, 39)) {
33594 log_packet_detailed(" got field 'flags'");
33595 #ifdef FREECIV_JSON_CONNECTION
33596 field_addr.name = "flags";
33597 #endif /* FREECIV_JSON_CONNECTION */
33598 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
33599 RECEIVE_PACKET_FIELD_ERROR(flags);
33600 }
33601 }
33602 if (BV_ISSET(fields, 40)) {
33603 log_packet_detailed(" got field 'wonders'");
33604 #ifdef FREECIV_JSON_CONNECTION
33605 field_addr.name = "wonders";
33606 #endif /* FREECIV_JSON_CONNECTION */
33607
33608 {
33609 #ifdef FREECIV_JSON_CONNECTION
33610 int count;
33611
33612 /* Enter array. */
33613 field_addr.sub_location = plocation_elem_new(0);
33614
33615 for (count = 0;; count++) {
33616 int i;
33617
33618 field_addr.sub_location->number = count;
33619
33620 /* Enter diff array element (start at the index address). */
33621 field_addr.sub_location->sub_location = plocation_elem_new(0);
33622 #else /* FREECIV_JSON_CONNECTION */
33623 while (TRUE) {
33624 int i;
33625 #endif /* FREECIV_JSON_CONNECTION */
33626
33627 if (!DIO_GET(uint8, &din, &field_addr, &i)) {
33628 RECEIVE_PACKET_FIELD_ERROR(wonders);
33629 }
33630 if (i == 255) {
33631 #ifdef FREECIV_JSON_CONNECTION
33632 /* Exit diff array element. */
33633 free(field_addr.sub_location->sub_location);
33634 field_addr.sub_location->sub_location = NULL;
33635
33636 /* Exit diff array. */
33637 free(field_addr.sub_location);
33638 field_addr.sub_location = NULL;
33639 #endif /* FREECIV_JSON_CONNECTION */
33640
33641 break;
33642 }
33643 if (i > B_LAST) {
33644 RECEIVE_PACKET_FIELD_ERROR(wonders,
33645 ": unexpected value %d "
33646 "(> B_LAST) in array diff",
33647 i);
33648 } else {
33649 #ifdef FREECIV_JSON_CONNECTION
33650 /* Content address. */
33651 field_addr.sub_location->sub_location->number = 1;
33652 #endif /* FREECIV_JSON_CONNECTION */
33653 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->wonders[i])) {
33654 RECEIVE_PACKET_FIELD_ERROR(wonders);
33655 }
33656 }
33657
33658 #ifdef FREECIV_JSON_CONNECTION
33659 /* Exit diff array element. */
33660 free(field_addr.sub_location->sub_location);
33661 field_addr.sub_location->sub_location = NULL;
33662 #endif /* FREECIV_JSON_CONNECTION */
33663 }
33664
33665 #ifdef FREECIV_JSON_CONNECTION
33666 /* Exit array. */
33667 free(field_addr.sub_location);
33668 field_addr.sub_location = NULL;
33669 #endif /* FREECIV_JSON_CONNECTION */
33670 }
33671 }
33672 if (BV_ISSET(fields, 41)) {
33673 log_packet_detailed(" got field 'multip_count'");
33674 #ifdef FREECIV_JSON_CONNECTION
33675 field_addr.name = "multip_count";
33676 #endif /* FREECIV_JSON_CONNECTION */
33677 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->multip_count)) {
33678 RECEIVE_PACKET_FIELD_ERROR(multip_count);
33679 }
33680 }
33681 if (BV_ISSET(fields, 42)) {
33682 log_packet_detailed(" got field 'multiplier'");
33683 #ifdef FREECIV_JSON_CONNECTION
33684 field_addr.name = "multiplier";
33685 #endif /* FREECIV_JSON_CONNECTION */
33686
33687 {
33688 int i;
33689
33690 #ifdef FREECIV_JSON_CONNECTION
33691 /* Enter array. */
33692 field_addr.sub_location = plocation_elem_new(0);
33693 #endif /* FREECIV_JSON_CONNECTION */
33694
33695 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
33696 RECEIVE_PACKET_FIELD_ERROR(multiplier, ": truncation array");
33697 }
33698 for (i = 0; i < real_packet->multip_count; i++) {
33699 #ifdef FREECIV_JSON_CONNECTION
33700 field_addr.sub_location->number = i;
33701 #endif /* FREECIV_JSON_CONNECTION */
33702 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multiplier[i])) {
33703 RECEIVE_PACKET_FIELD_ERROR(multiplier);
33704 }
33705 }
33706
33707 #ifdef FREECIV_JSON_CONNECTION
33708 /* Exit array. */
33709 free(field_addr.sub_location);
33710 field_addr.sub_location = NULL;
33711 #endif /* FREECIV_JSON_CONNECTION */
33712 }
33713 }
33714 if (BV_ISSET(fields, 43)) {
33715 log_packet_detailed(" got field 'multiplier_target'");
33716 #ifdef FREECIV_JSON_CONNECTION
33717 field_addr.name = "multiplier_target";
33718 #endif /* FREECIV_JSON_CONNECTION */
33719
33720 {
33721 int i;
33722
33723 #ifdef FREECIV_JSON_CONNECTION
33724 /* Enter array. */
33725 field_addr.sub_location = plocation_elem_new(0);
33726 #endif /* FREECIV_JSON_CONNECTION */
33727
33728 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
33729 RECEIVE_PACKET_FIELD_ERROR(multiplier_target, ": truncation array");
33730 }
33731 for (i = 0; i < real_packet->multip_count; i++) {
33732 #ifdef FREECIV_JSON_CONNECTION
33733 field_addr.sub_location->number = i;
33734 #endif /* FREECIV_JSON_CONNECTION */
33735 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multiplier_target[i])) {
33736 RECEIVE_PACKET_FIELD_ERROR(multiplier_target);
33737 }
33738 }
33739
33740 #ifdef FREECIV_JSON_CONNECTION
33741 /* Exit array. */
33742 free(field_addr.sub_location);
33743 field_addr.sub_location = NULL;
33744 #endif /* FREECIV_JSON_CONNECTION */
33745 }
33746 }
33747 if (BV_ISSET(fields, 44)) {
33748 log_packet_detailed(" got field 'multiplier_changed'");
33749 #ifdef FREECIV_JSON_CONNECTION
33750 field_addr.name = "multiplier_changed";
33751 #endif /* FREECIV_JSON_CONNECTION */
33752
33753 {
33754 int i;
33755
33756 #ifdef FREECIV_JSON_CONNECTION
33757 /* Enter array. */
33758 field_addr.sub_location = plocation_elem_new(0);
33759 #endif /* FREECIV_JSON_CONNECTION */
33760
33761 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
33762 RECEIVE_PACKET_FIELD_ERROR(multiplier_changed, ": truncation array");
33763 }
33764 for (i = 0; i < real_packet->multip_count; i++) {
33765 #ifdef FREECIV_JSON_CONNECTION
33766 field_addr.sub_location->number = i;
33767 #endif /* FREECIV_JSON_CONNECTION */
33768 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->multiplier_changed[i])) {
33769 RECEIVE_PACKET_FIELD_ERROR(multiplier_changed);
33770 }
33771 }
33772
33773 #ifdef FREECIV_JSON_CONNECTION
33774 /* Exit array. */
33775 free(field_addr.sub_location);
33776 field_addr.sub_location = NULL;
33777 #endif /* FREECIV_JSON_CONNECTION */
33778 }
33779 }
33780
33781 if (NULL == old) {
33782 old = fc_malloc(sizeof(*old));
33783 *old = *real_packet;
33784 genhash_insert(*hash, old, old);
33785 } else {
33786 *old = *real_packet;
33787 }
33788
33789#endif /* FREECIV_DELTA_PROTOCOL */
33790 RECEIVE_PACKET_END(real_packet);
33791}
33792
33793 static int send_packet_player_info_100(struct connection *pc, const struct packet_player_info *packet)
33794{
33795 const struct packet_player_info *real_packet = packet;
33796#ifdef FREECIV_DELTA_PROTOCOL
33797 packet_player_info_100_fields fields;
33798 struct packet_player_info *old;
33799 bool differ;
33800 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_INFO;
33801 int different = 0;
33802#endif /* FREECIV_DELTA_PROTOCOL */
33803 SEND_PACKET_START(PACKET_PLAYER_INFO);
33804#ifdef FREECIV_JSON_CONNECTION
33805 struct plocation field_addr;
33806 {
33807 struct plocation *field_addr_tmp = plocation_field_new(NULL);
33808 field_addr = *field_addr_tmp;
33809 FC_FREE(field_addr_tmp);
33810 }
33811#endif /* FREECIV_JSON_CONNECTION */
33812
33813 log_packet_detailed("packet_player_info_100: sending info about (%d)",
33814 real_packet->playerno);
33815
33816#ifdef FREECIV_DELTA_PROTOCOL
33817 if (NULL == *hash) {
33818 *hash = genhash_new_full(hash_packet_player_info_100, cmp_packet_player_info_100,
33819 NULL, NULL, NULL, free);
33820 }
33821 BV_CLR_ALL(fields);
33822
33823 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
33824 old = fc_malloc(sizeof(*old));
33825 *old = *real_packet;
33826 genhash_insert(*hash, old, old);
33827 memset(old, 0, sizeof(*old));
33828 different = 1; /* Force to send. */
33829 }
33830 differ = (strcmp(old->name, real_packet->name) != 0);
33831 if (differ) {
33832 different++;
33833 BV_SET(fields, 0);
33834 }
33835
33836 differ = (strcmp(old->username, real_packet->username) != 0);
33837 if (differ) {
33838 different++;
33839 BV_SET(fields, 1);
33840 }
33841
33842 differ = (old->unassigned_user != real_packet->unassigned_user);
33843 if (differ) {
33844 different++;
33845 }
33846 if (packet->unassigned_user) {
33847 BV_SET(fields, 2);
33848 }
33849
33850 differ = (old->score != real_packet->score);
33851 if (differ) {
33852 different++;
33853 BV_SET(fields, 3);
33854 }
33855
33856 differ = (old->is_male != real_packet->is_male);
33857 if (differ) {
33858 different++;
33859 }
33860 if (packet->is_male) {
33861 BV_SET(fields, 4);
33862 }
33863
33864 differ = (old->was_created != real_packet->was_created);
33865 if (differ) {
33866 different++;
33867 }
33868 if (packet->was_created) {
33869 BV_SET(fields, 5);
33870 }
33871
33872 differ = (old->government != real_packet->government);
33873 if (differ) {
33874 different++;
33875 BV_SET(fields, 6);
33876 }
33877
33878 differ = (old->target_government != real_packet->target_government);
33879 if (differ) {
33880 different++;
33881 BV_SET(fields, 7);
33882 }
33883
33884
33885 {
33886 differ = FALSE;
33887 {
33888 int i;
33889
33890 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
33891 if (old->real_embassy[i] != real_packet->real_embassy[i]) {
33892 differ = TRUE;
33893 break;
33894 }
33895 }
33896 }
33897 }
33898 if (differ) {
33899 different++;
33900 BV_SET(fields, 8);
33901 }
33902
33903 differ = (old->mood != real_packet->mood);
33904 if (differ) {
33905 different++;
33906 BV_SET(fields, 9);
33907 }
33908
33909 differ = (old->style != real_packet->style);
33910 if (differ) {
33911 different++;
33912 BV_SET(fields, 10);
33913 }
33914
33915 differ = (old->music_style != real_packet->music_style);
33916 if (differ) {
33917 different++;
33918 BV_SET(fields, 11);
33919 }
33920
33921 differ = (old->nation != real_packet->nation);
33922 if (differ) {
33923 different++;
33924 BV_SET(fields, 12);
33925 }
33926
33927 differ = (old->team != real_packet->team);
33928 if (differ) {
33929 different++;
33930 BV_SET(fields, 13);
33931 }
33932
33933 differ = (old->is_ready != real_packet->is_ready);
33934 if (differ) {
33935 different++;
33936 }
33937 if (packet->is_ready) {
33938 BV_SET(fields, 14);
33939 }
33940
33941 differ = (old->phase_done != real_packet->phase_done);
33942 if (differ) {
33943 different++;
33944 }
33945 if (packet->phase_done) {
33946 BV_SET(fields, 15);
33947 }
33948
33949 differ = (old->nturns_idle != real_packet->nturns_idle);
33950 if (differ) {
33951 different++;
33952 BV_SET(fields, 16);
33953 }
33954
33955 differ = (old->turns_alive != real_packet->turns_alive);
33956 if (differ) {
33957 different++;
33958 BV_SET(fields, 17);
33959 }
33960
33961 differ = (old->is_alive != real_packet->is_alive);
33962 if (differ) {
33963 different++;
33964 }
33965 if (packet->is_alive) {
33966 BV_SET(fields, 18);
33967 }
33968
33969 differ = (old->gold != real_packet->gold);
33970 if (differ) {
33971 different++;
33972 BV_SET(fields, 19);
33973 }
33974
33975 differ = (old->tax != real_packet->tax);
33976 if (differ) {
33977 different++;
33978 BV_SET(fields, 20);
33979 }
33980
33981 differ = (old->science != real_packet->science);
33982 if (differ) {
33983 different++;
33984 BV_SET(fields, 21);
33985 }
33986
33987 differ = (old->luxury != real_packet->luxury);
33988 if (differ) {
33989 different++;
33990 BV_SET(fields, 22);
33991 }
33992
33993 differ = (old->infrapoints != real_packet->infrapoints);
33994 if (differ) {
33995 different++;
33996 BV_SET(fields, 23);
33997 }
33998
33999 differ = (old->tech_upkeep != real_packet->tech_upkeep);
34000 if (differ) {
34001 different++;
34002 BV_SET(fields, 24);
34003 }
34004
34005 differ = (old->science_cost != real_packet->science_cost);
34006 if (differ) {
34007 different++;
34008 BV_SET(fields, 25);
34009 }
34010
34011 differ = (old->is_connected != real_packet->is_connected);
34012 if (differ) {
34013 different++;
34014 }
34015 if (packet->is_connected) {
34016 BV_SET(fields, 26);
34017 }
34018
34019 differ = (old->revolution_finishes != real_packet->revolution_finishes);
34020 if (differ) {
34021 different++;
34022 BV_SET(fields, 27);
34023 }
34024
34025 differ = (old->ai_skill_level != real_packet->ai_skill_level);
34026 if (differ) {
34027 different++;
34028 BV_SET(fields, 28);
34029 }
34030
34031 differ = (old->barbarian_type != real_packet->barbarian_type);
34032 if (differ) {
34033 different++;
34034 BV_SET(fields, 29);
34035 }
34036
34037 differ = !BV_ARE_EQUAL(old->gives_shared_vision, real_packet->gives_shared_vision);
34038 if (differ) {
34039 different++;
34040 BV_SET(fields, 30);
34041 }
34042
34043 differ = (old->history != real_packet->history);
34044 if (differ) {
34045 different++;
34046 BV_SET(fields, 31);
34047 }
34048
34049 differ = (old->culture != real_packet->culture);
34050 if (differ) {
34051 different++;
34052 BV_SET(fields, 32);
34053 }
34054
34055
34056 {
34057 differ = FALSE;
34058 {
34059 int i;
34060
34061 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
34062 if (old->love[i] != real_packet->love[i]) {
34063 differ = TRUE;
34064 break;
34065 }
34066 }
34067 }
34068 }
34069 if (differ) {
34070 different++;
34071 BV_SET(fields, 33);
34072 }
34073
34074 differ = (old->color_valid != real_packet->color_valid);
34075 if (differ) {
34076 different++;
34077 }
34078 if (packet->color_valid) {
34079 BV_SET(fields, 34);
34080 }
34081
34082 differ = (old->color_changeable != real_packet->color_changeable);
34083 if (differ) {
34084 different++;
34085 }
34086 if (packet->color_changeable) {
34087 BV_SET(fields, 35);
34088 }
34089
34090 differ = (old->color_red != real_packet->color_red);
34091 if (differ) {
34092 different++;
34093 BV_SET(fields, 36);
34094 }
34095
34096 differ = (old->color_green != real_packet->color_green);
34097 if (differ) {
34098 different++;
34099 BV_SET(fields, 37);
34100 }
34101
34102 differ = (old->color_blue != real_packet->color_blue);
34103 if (differ) {
34104 different++;
34105 BV_SET(fields, 38);
34106 }
34107
34108 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
34109 if (differ) {
34110 different++;
34111 BV_SET(fields, 39);
34112 }
34113
34114
34115 {
34116 differ = FALSE;
34117 {
34118 int i;
34119
34120 for (i = 0; i < B_LAST; i++) {
34121 if (old->wonders[i] != real_packet->wonders[i]) {
34122 differ = TRUE;
34123 break;
34124 }
34125 }
34126 }
34127 }
34128 if (differ) {
34129 different++;
34130 BV_SET(fields, 40);
34131 }
34132
34133 differ = (old->multip_count != real_packet->multip_count);
34134 if (differ) {
34135 different++;
34136 BV_SET(fields, 41);
34137 }
34138
34139
34140 {
34141 differ = (old->multip_count != real_packet->multip_count);
34142 if (!differ) {
34143 int i;
34144
34145 for (i = 0; i < real_packet->multip_count; i++) {
34146 if (old->multiplier[i] != real_packet->multiplier[i]) {
34147 differ = TRUE;
34148 break;
34149 }
34150 }
34151 }
34152 }
34153 if (differ) {
34154 different++;
34155 BV_SET(fields, 42);
34156 }
34157
34158
34159 {
34160 differ = (old->multip_count != real_packet->multip_count);
34161 if (!differ) {
34162 int i;
34163
34164 for (i = 0; i < real_packet->multip_count; i++) {
34165 if (old->multiplier_target[i] != real_packet->multiplier_target[i]) {
34166 differ = TRUE;
34167 break;
34168 }
34169 }
34170 }
34171 }
34172 if (differ) {
34173 different++;
34174 BV_SET(fields, 43);
34175 }
34176
34177
34178 {
34179 differ = (old->multip_count != real_packet->multip_count);
34180 if (!differ) {
34181 int i;
34182
34183 for (i = 0; i < real_packet->multip_count; i++) {
34184 if (old->multiplier_changed[i] != real_packet->multiplier_changed[i]) {
34185 differ = TRUE;
34186 break;
34187 }
34188 }
34189 }
34190 }
34191 if (differ) {
34192 different++;
34193 BV_SET(fields, 44);
34194 }
34195
34196
34197 if (different == 0) {
34198 log_packet_detailed(" no change -> discard");
34199 return 0;
34200 }
34201
34202#ifdef FREECIV_JSON_CONNECTION
34203 field_addr.name = "fields";
34204#endif /* FREECIV_JSON_CONNECTION */
34205 DIO_BV_PUT(&dout, &field_addr, fields);
34206#ifdef FREECIV_JSON_CONNECTION
34207 field_addr.name = "playerno";
34208#endif /* FREECIV_JSON_CONNECTION */
34209 DIO_PUT(uint16, &dout, &field_addr, real_packet->playerno);
34210
34211 if (BV_ISSET(fields, 0)) {
34212 log_packet_detailed(" field 'name' has changed");
34213 #ifdef FREECIV_JSON_CONNECTION
34214 field_addr.name = "name";
34215#endif /* FREECIV_JSON_CONNECTION */
34216 DIO_PUT(string, &dout, &field_addr, real_packet->name);
34217 }
34218 if (BV_ISSET(fields, 1)) {
34219 log_packet_detailed(" field 'username' has changed");
34220 #ifdef FREECIV_JSON_CONNECTION
34221 field_addr.name = "username";
34222#endif /* FREECIV_JSON_CONNECTION */
34223 DIO_PUT(string, &dout, &field_addr, real_packet->username);
34224 }
34225 /* field 2 is folded into the header */
34226 if (BV_ISSET(fields, 3)) {
34227 log_packet_detailed(" field 'score' has changed");
34228 #ifdef FREECIV_JSON_CONNECTION
34229 field_addr.name = "score";
34230#endif /* FREECIV_JSON_CONNECTION */
34231 DIO_PUT(sint32, &dout, &field_addr, real_packet->score);
34232 }
34233 /* field 4 is folded into the header */
34234 /* field 5 is folded into the header */
34235 if (BV_ISSET(fields, 6)) {
34236 log_packet_detailed(" field 'government' has changed");
34237 #ifdef FREECIV_JSON_CONNECTION
34238 field_addr.name = "government";
34239#endif /* FREECIV_JSON_CONNECTION */
34240 DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
34241 }
34242 if (BV_ISSET(fields, 7)) {
34243 log_packet_detailed(" field 'target_government' has changed");
34244 #ifdef FREECIV_JSON_CONNECTION
34245 field_addr.name = "target_government";
34246#endif /* FREECIV_JSON_CONNECTION */
34247 DIO_PUT(sint8, &dout, &field_addr, real_packet->target_government);
34248 }
34249 if (BV_ISSET(fields, 8)) {
34250 log_packet_detailed(" field 'real_embassy' has changed");
34251 #ifdef FREECIV_JSON_CONNECTION
34252 field_addr.name = "real_embassy";
34253#endif /* FREECIV_JSON_CONNECTION */
34254
34255 {
34256 int i;
34257
34258#ifdef FREECIV_JSON_CONNECTION
34259 /* Create the array. */
34260 DIO_PUT(farray, &dout, &field_addr, MAX_NUM_PLAYER_SLOTS);
34261
34262 /* Enter the array. */
34263 field_addr.sub_location = plocation_elem_new(0);
34264#endif /* FREECIV_JSON_CONNECTION */
34265
34266 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
34267#ifdef FREECIV_JSON_CONNECTION
34268 /* Next array element. */
34269 field_addr.sub_location->number = i;
34270#endif /* FREECIV_JSON_CONNECTION */
34271 DIO_PUT(bool8, &dout, &field_addr, real_packet->real_embassy[i]);
34272 }
34273
34274#ifdef FREECIV_JSON_CONNECTION
34275 /* Exit array. */
34276 free(field_addr.sub_location);
34277 field_addr.sub_location = NULL;
34278#endif /* FREECIV_JSON_CONNECTION */
34279 }
34280 }
34281 if (BV_ISSET(fields, 9)) {
34282 log_packet_detailed(" field 'mood' has changed");
34283 #ifdef FREECIV_JSON_CONNECTION
34284 field_addr.name = "mood";
34285#endif /* FREECIV_JSON_CONNECTION */
34286 DIO_PUT(uint8, &dout, &field_addr, real_packet->mood);
34287 }
34288 if (BV_ISSET(fields, 10)) {
34289 log_packet_detailed(" field 'style' has changed");
34290 #ifdef FREECIV_JSON_CONNECTION
34291 field_addr.name = "style";
34292#endif /* FREECIV_JSON_CONNECTION */
34293 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
34294 }
34295 if (BV_ISSET(fields, 11)) {
34296 log_packet_detailed(" field 'music_style' has changed");
34297 #ifdef FREECIV_JSON_CONNECTION
34298 field_addr.name = "music_style";
34299#endif /* FREECIV_JSON_CONNECTION */
34300 DIO_PUT(sint8, &dout, &field_addr, real_packet->music_style);
34301 }
34302 if (BV_ISSET(fields, 12)) {
34303 log_packet_detailed(" field 'nation' has changed");
34304 #ifdef FREECIV_JSON_CONNECTION
34305 field_addr.name = "nation";
34306#endif /* FREECIV_JSON_CONNECTION */
34307 DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
34308 }
34309 if (BV_ISSET(fields, 13)) {
34310 log_packet_detailed(" field 'team' has changed");
34311 #ifdef FREECIV_JSON_CONNECTION
34312 field_addr.name = "team";
34313#endif /* FREECIV_JSON_CONNECTION */
34314 DIO_PUT(uint16, &dout, &field_addr, real_packet->team);
34315 }
34316 /* field 14 is folded into the header */
34317 /* field 15 is folded into the header */
34318 if (BV_ISSET(fields, 16)) {
34319 log_packet_detailed(" field 'nturns_idle' has changed");
34320 #ifdef FREECIV_JSON_CONNECTION
34321 field_addr.name = "nturns_idle";
34322#endif /* FREECIV_JSON_CONNECTION */
34323 DIO_PUT(sint16, &dout, &field_addr, real_packet->nturns_idle);
34324 }
34325 if (BV_ISSET(fields, 17)) {
34326 log_packet_detailed(" field 'turns_alive' has changed");
34327 #ifdef FREECIV_JSON_CONNECTION
34328 field_addr.name = "turns_alive";
34329#endif /* FREECIV_JSON_CONNECTION */
34330 DIO_PUT(sint16, &dout, &field_addr, real_packet->turns_alive);
34331 }
34332 /* field 18 is folded into the header */
34333 if (BV_ISSET(fields, 19)) {
34334 log_packet_detailed(" field 'gold' has changed");
34335 #ifdef FREECIV_JSON_CONNECTION
34336 field_addr.name = "gold";
34337#endif /* FREECIV_JSON_CONNECTION */
34338 DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
34339 }
34340 if (BV_ISSET(fields, 20)) {
34341 log_packet_detailed(" field 'tax' has changed");
34342 #ifdef FREECIV_JSON_CONNECTION
34343 field_addr.name = "tax";
34344#endif /* FREECIV_JSON_CONNECTION */
34345 DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
34346 }
34347 if (BV_ISSET(fields, 21)) {
34348 log_packet_detailed(" field 'science' has changed");
34349 #ifdef FREECIV_JSON_CONNECTION
34350 field_addr.name = "science";
34351#endif /* FREECIV_JSON_CONNECTION */
34352 DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
34353 }
34354 if (BV_ISSET(fields, 22)) {
34355 log_packet_detailed(" field 'luxury' has changed");
34356 #ifdef FREECIV_JSON_CONNECTION
34357 field_addr.name = "luxury";
34358#endif /* FREECIV_JSON_CONNECTION */
34359 DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
34360 }
34361 if (BV_ISSET(fields, 23)) {
34362 log_packet_detailed(" field 'infrapoints' has changed");
34363 #ifdef FREECIV_JSON_CONNECTION
34364 field_addr.name = "infrapoints";
34365#endif /* FREECIV_JSON_CONNECTION */
34366 DIO_PUT(uint32, &dout, &field_addr, real_packet->infrapoints);
34367 }
34368 if (BV_ISSET(fields, 24)) {
34369 log_packet_detailed(" field 'tech_upkeep' has changed");
34370 #ifdef FREECIV_JSON_CONNECTION
34371 field_addr.name = "tech_upkeep";
34372#endif /* FREECIV_JSON_CONNECTION */
34373 DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_upkeep);
34374 }
34375 if (BV_ISSET(fields, 25)) {
34376 log_packet_detailed(" field 'science_cost' has changed");
34377 #ifdef FREECIV_JSON_CONNECTION
34378 field_addr.name = "science_cost";
34379#endif /* FREECIV_JSON_CONNECTION */
34380 DIO_PUT(uint16, &dout, &field_addr, real_packet->science_cost);
34381 }
34382 /* field 26 is folded into the header */
34383 if (BV_ISSET(fields, 27)) {
34384 log_packet_detailed(" field 'revolution_finishes' has changed");
34385 #ifdef FREECIV_JSON_CONNECTION
34386 field_addr.name = "revolution_finishes";
34387#endif /* FREECIV_JSON_CONNECTION */
34388 DIO_PUT(sint16, &dout, &field_addr, real_packet->revolution_finishes);
34389 }
34390 if (BV_ISSET(fields, 28)) {
34391 log_packet_detailed(" field 'ai_skill_level' has changed");
34392 #ifdef FREECIV_JSON_CONNECTION
34393 field_addr.name = "ai_skill_level";
34394#endif /* FREECIV_JSON_CONNECTION */
34395 DIO_PUT(uint8, &dout, &field_addr, real_packet->ai_skill_level);
34396 }
34397 if (BV_ISSET(fields, 29)) {
34398 log_packet_detailed(" field 'barbarian_type' has changed");
34399 #ifdef FREECIV_JSON_CONNECTION
34400 field_addr.name = "barbarian_type";
34401#endif /* FREECIV_JSON_CONNECTION */
34402 DIO_PUT(uint8, &dout, &field_addr, real_packet->barbarian_type);
34403 }
34404 if (BV_ISSET(fields, 30)) {
34405 log_packet_detailed(" field 'gives_shared_vision' has changed");
34406 #ifdef FREECIV_JSON_CONNECTION
34407 field_addr.name = "gives_shared_vision";
34408#endif /* FREECIV_JSON_CONNECTION */
34409 DIO_BV_PUT(&dout, &field_addr, packet->gives_shared_vision);
34410 }
34411 if (BV_ISSET(fields, 31)) {
34412 log_packet_detailed(" field 'history' has changed");
34413 #ifdef FREECIV_JSON_CONNECTION
34414 field_addr.name = "history";
34415#endif /* FREECIV_JSON_CONNECTION */
34416 DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
34417 }
34418 if (BV_ISSET(fields, 32)) {
34419 log_packet_detailed(" field 'culture' has changed");
34420 #ifdef FREECIV_JSON_CONNECTION
34421 field_addr.name = "culture";
34422#endif /* FREECIV_JSON_CONNECTION */
34423 DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
34424 }
34425 if (BV_ISSET(fields, 33)) {
34426 log_packet_detailed(" field 'love' has changed");
34427 #ifdef FREECIV_JSON_CONNECTION
34428 field_addr.name = "love";
34429#endif /* FREECIV_JSON_CONNECTION */
34430
34431 {
34432 int i;
34433
34434#ifdef FREECIV_JSON_CONNECTION
34435 /* Create the array. */
34436 DIO_PUT(farray, &dout, &field_addr, MAX_NUM_PLAYER_SLOTS);
34437
34438 /* Enter the array. */
34439 field_addr.sub_location = plocation_elem_new(0);
34440#endif /* FREECIV_JSON_CONNECTION */
34441
34442 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
34443#ifdef FREECIV_JSON_CONNECTION
34444 /* Next array element. */
34445 field_addr.sub_location->number = i;
34446#endif /* FREECIV_JSON_CONNECTION */
34447 DIO_PUT(sint16, &dout, &field_addr, real_packet->love[i]);
34448 }
34449
34450#ifdef FREECIV_JSON_CONNECTION
34451 /* Exit array. */
34452 free(field_addr.sub_location);
34453 field_addr.sub_location = NULL;
34454#endif /* FREECIV_JSON_CONNECTION */
34455 }
34456 }
34457 /* field 34 is folded into the header */
34458 /* field 35 is folded into the header */
34459 if (BV_ISSET(fields, 36)) {
34460 log_packet_detailed(" field 'color_red' has changed");
34461 #ifdef FREECIV_JSON_CONNECTION
34462 field_addr.name = "color_red";
34463#endif /* FREECIV_JSON_CONNECTION */
34464 DIO_PUT(uint8, &dout, &field_addr, real_packet->color_red);
34465 }
34466 if (BV_ISSET(fields, 37)) {
34467 log_packet_detailed(" field 'color_green' has changed");
34468 #ifdef FREECIV_JSON_CONNECTION
34469 field_addr.name = "color_green";
34470#endif /* FREECIV_JSON_CONNECTION */
34471 DIO_PUT(uint8, &dout, &field_addr, real_packet->color_green);
34472 }
34473 if (BV_ISSET(fields, 38)) {
34474 log_packet_detailed(" field 'color_blue' has changed");
34475 #ifdef FREECIV_JSON_CONNECTION
34476 field_addr.name = "color_blue";
34477#endif /* FREECIV_JSON_CONNECTION */
34478 DIO_PUT(uint8, &dout, &field_addr, real_packet->color_blue);
34479 }
34480 if (BV_ISSET(fields, 39)) {
34481 log_packet_detailed(" field 'flags' has changed");
34482 #ifdef FREECIV_JSON_CONNECTION
34483 field_addr.name = "flags";
34484#endif /* FREECIV_JSON_CONNECTION */
34485 DIO_BV_PUT(&dout, &field_addr, packet->flags);
34486 }
34487 if (BV_ISSET(fields, 40)) {
34488 log_packet_detailed(" field 'wonders' has changed");
34489 #ifdef FREECIV_JSON_CONNECTION
34490 field_addr.name = "wonders";
34491#endif /* FREECIV_JSON_CONNECTION */
34492
34493 {
34494 int i;
34495
34496#ifdef FREECIV_JSON_CONNECTION
34497 int count = 0;
34498
34499 for (i = 0; i < B_LAST; i++) {
34500 if (old->wonders[i] != real_packet->wonders[i]) {
34501 count++;
34502 }
34503 }
34504 /* Create the array. */
34505 DIO_PUT(farray, &dout, &field_addr, count + 1);
34506
34507 /* Enter array. */
34508 field_addr.sub_location = plocation_elem_new(0);
34509
34510 count = 0;
34511#endif /* FREECIV_JSON_CONNECTION */
34512
34513 fc_assert(B_LAST < 255);
34514
34515 for (i = 0; i < B_LAST; i++) {
34516 if (old->wonders[i] != real_packet->wonders[i]) {
34517#ifdef FREECIV_JSON_CONNECTION
34518 /* Next diff array element. */
34519 field_addr.sub_location->number = count - 1;
34520
34521 /* Create the diff array element. */
34522 DIO_PUT(farray, &dout, &field_addr, 2);
34523
34524 /* Enter diff array element (start at the index address). */
34525 field_addr.sub_location->sub_location = plocation_elem_new(0);
34526#endif /* FREECIV_JSON_CONNECTION */
34527 DIO_PUT(uint8, &dout, &field_addr, i);
34528
34529#ifdef FREECIV_JSON_CONNECTION
34530 /* Content address. */
34531 field_addr.sub_location->sub_location->number = 1;
34532#endif /* FREECIV_JSON_CONNECTION */
34533 DIO_PUT(sint32, &dout, &field_addr, real_packet->wonders[i]);
34534
34535#ifdef FREECIV_JSON_CONNECTION
34536 /* Exit diff array element. */
34537 free(field_addr.sub_location->sub_location);
34538 field_addr.sub_location->sub_location = NULL;
34539#endif /* FREECIV_JSON_CONNECTION */
34540 }
34541 }
34542#ifdef FREECIV_JSON_CONNECTION
34543 field_addr.sub_location->number = count - 1;
34544
34545 /* Create the diff array element. */
34546 DIO_PUT(farray, &dout, &field_addr, B_LAST);
34547
34548 /* Enter diff array element. Point to index address. */
34549 field_addr.sub_location->sub_location = plocation_elem_new(0);
34550#endif /* FREECIV_JSON_CONNECTION */
34551 DIO_PUT(uint8, &dout, &field_addr, 255);
34552
34553#ifdef FREECIV_JSON_CONNECTION
34554 /* Exit diff array element. */
34555 free(field_addr.sub_location->sub_location);
34556 field_addr.sub_location->sub_location = NULL;
34557
34558 /* Exit array. */
34559 free(field_addr.sub_location);
34560 field_addr.sub_location = NULL;
34561#endif /* FREECIV_JSON_CONNECTION */
34562 }
34563 }
34564 if (BV_ISSET(fields, 41)) {
34565 log_packet_detailed(" field 'multip_count' has changed");
34566 #ifdef FREECIV_JSON_CONNECTION
34567 field_addr.name = "multip_count";
34568#endif /* FREECIV_JSON_CONNECTION */
34569 DIO_PUT(uint8, &dout, &field_addr, real_packet->multip_count);
34570 }
34571 if (BV_ISSET(fields, 42)) {
34572 log_packet_detailed(" field 'multiplier' has changed");
34573 #ifdef FREECIV_JSON_CONNECTION
34574 field_addr.name = "multiplier";
34575#endif /* FREECIV_JSON_CONNECTION */
34576
34577 {
34578 int i;
34579
34580#ifdef FREECIV_JSON_CONNECTION
34581 /* Create the array. */
34582 DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
34583
34584 /* Enter the array. */
34585 field_addr.sub_location = plocation_elem_new(0);
34586#endif /* FREECIV_JSON_CONNECTION */
34587
34588 for (i = 0; i < real_packet->multip_count; i++) {
34589#ifdef FREECIV_JSON_CONNECTION
34590 /* Next array element. */
34591 field_addr.sub_location->number = i;
34592#endif /* FREECIV_JSON_CONNECTION */
34593 DIO_PUT(sint32, &dout, &field_addr, real_packet->multiplier[i]);
34594 }
34595
34596#ifdef FREECIV_JSON_CONNECTION
34597 /* Exit array. */
34598 free(field_addr.sub_location);
34599 field_addr.sub_location = NULL;
34600#endif /* FREECIV_JSON_CONNECTION */
34601 }
34602 }
34603 if (BV_ISSET(fields, 43)) {
34604 log_packet_detailed(" field 'multiplier_target' has changed");
34605 #ifdef FREECIV_JSON_CONNECTION
34606 field_addr.name = "multiplier_target";
34607#endif /* FREECIV_JSON_CONNECTION */
34608
34609 {
34610 int i;
34611
34612#ifdef FREECIV_JSON_CONNECTION
34613 /* Create the array. */
34614 DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
34615
34616 /* Enter the array. */
34617 field_addr.sub_location = plocation_elem_new(0);
34618#endif /* FREECIV_JSON_CONNECTION */
34619
34620 for (i = 0; i < real_packet->multip_count; i++) {
34621#ifdef FREECIV_JSON_CONNECTION
34622 /* Next array element. */
34623 field_addr.sub_location->number = i;
34624#endif /* FREECIV_JSON_CONNECTION */
34625 DIO_PUT(sint32, &dout, &field_addr, real_packet->multiplier_target[i]);
34626 }
34627
34628#ifdef FREECIV_JSON_CONNECTION
34629 /* Exit array. */
34630 free(field_addr.sub_location);
34631 field_addr.sub_location = NULL;
34632#endif /* FREECIV_JSON_CONNECTION */
34633 }
34634 }
34635 if (BV_ISSET(fields, 44)) {
34636 log_packet_detailed(" field 'multiplier_changed' has changed");
34637 #ifdef FREECIV_JSON_CONNECTION
34638 field_addr.name = "multiplier_changed";
34639#endif /* FREECIV_JSON_CONNECTION */
34640
34641 {
34642 int i;
34643
34644#ifdef FREECIV_JSON_CONNECTION
34645 /* Create the array. */
34646 DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
34647
34648 /* Enter the array. */
34649 field_addr.sub_location = plocation_elem_new(0);
34650#endif /* FREECIV_JSON_CONNECTION */
34651
34652 for (i = 0; i < real_packet->multip_count; i++) {
34653#ifdef FREECIV_JSON_CONNECTION
34654 /* Next array element. */
34655 field_addr.sub_location->number = i;
34656#endif /* FREECIV_JSON_CONNECTION */
34657 DIO_PUT(sint16, &dout, &field_addr, real_packet->multiplier_changed[i]);
34658 }
34659
34660#ifdef FREECIV_JSON_CONNECTION
34661 /* Exit array. */
34662 free(field_addr.sub_location);
34663 field_addr.sub_location = NULL;
34664#endif /* FREECIV_JSON_CONNECTION */
34665 }
34666 }
34667
34668 *old = *real_packet;
34669#endif /* FREECIV_DELTA_PROTOCOL */
34670#ifndef FREECIV_DELTA_PROTOCOL
34671#ifdef FREECIV_JSON_CONNECTION
34672 field_addr.name = "playerno";
34673#endif /* FREECIV_JSON_CONNECTION */
34674 DIO_PUT(uint16, &dout, &field_addr, real_packet->playerno);
34675#ifdef FREECIV_JSON_CONNECTION
34676 field_addr.name = "name";
34677#endif /* FREECIV_JSON_CONNECTION */
34678 DIO_PUT(string, &dout, &field_addr, real_packet->name);
34679#ifdef FREECIV_JSON_CONNECTION
34680 field_addr.name = "username";
34681#endif /* FREECIV_JSON_CONNECTION */
34682 DIO_PUT(string, &dout, &field_addr, real_packet->username);
34683#ifdef FREECIV_JSON_CONNECTION
34684 field_addr.name = "unassigned_user";
34685#endif /* FREECIV_JSON_CONNECTION */
34686 DIO_PUT(bool8, &dout, &field_addr, real_packet->unassigned_user);
34687#ifdef FREECIV_JSON_CONNECTION
34688 field_addr.name = "score";
34689#endif /* FREECIV_JSON_CONNECTION */
34690 DIO_PUT(sint32, &dout, &field_addr, real_packet->score);
34691#ifdef FREECIV_JSON_CONNECTION
34692 field_addr.name = "is_male";
34693#endif /* FREECIV_JSON_CONNECTION */
34694 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_male);
34695#ifdef FREECIV_JSON_CONNECTION
34696 field_addr.name = "was_created";
34697#endif /* FREECIV_JSON_CONNECTION */
34698 DIO_PUT(bool8, &dout, &field_addr, real_packet->was_created);
34699#ifdef FREECIV_JSON_CONNECTION
34700 field_addr.name = "government";
34701#endif /* FREECIV_JSON_CONNECTION */
34702 DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
34703#ifdef FREECIV_JSON_CONNECTION
34704 field_addr.name = "target_government";
34705#endif /* FREECIV_JSON_CONNECTION */
34706 DIO_PUT(sint8, &dout, &field_addr, real_packet->target_government);
34707#ifdef FREECIV_JSON_CONNECTION
34708 field_addr.name = "real_embassy";
34709#endif /* FREECIV_JSON_CONNECTION */
34710
34711 {
34712 int i;
34713
34714#ifdef FREECIV_JSON_CONNECTION
34715 /* Create the array. */
34716 DIO_PUT(farray, &dout, &field_addr, MAX_NUM_PLAYER_SLOTS);
34717
34718 /* Enter the array. */
34719 field_addr.sub_location = plocation_elem_new(0);
34720#endif /* FREECIV_JSON_CONNECTION */
34721
34722 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
34723#ifdef FREECIV_JSON_CONNECTION
34724 /* Next array element. */
34725 field_addr.sub_location->number = i;
34726#endif /* FREECIV_JSON_CONNECTION */
34727 DIO_PUT(bool8, &dout, &field_addr, real_packet->real_embassy[i]);
34728 }
34729
34730#ifdef FREECIV_JSON_CONNECTION
34731 /* Exit array. */
34732 free(field_addr.sub_location);
34733 field_addr.sub_location = NULL;
34734#endif /* FREECIV_JSON_CONNECTION */
34735 }
34736#ifdef FREECIV_JSON_CONNECTION
34737 field_addr.name = "mood";
34738#endif /* FREECIV_JSON_CONNECTION */
34739 DIO_PUT(uint8, &dout, &field_addr, real_packet->mood);
34740#ifdef FREECIV_JSON_CONNECTION
34741 field_addr.name = "style";
34742#endif /* FREECIV_JSON_CONNECTION */
34743 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
34744#ifdef FREECIV_JSON_CONNECTION
34745 field_addr.name = "music_style";
34746#endif /* FREECIV_JSON_CONNECTION */
34747 DIO_PUT(sint8, &dout, &field_addr, real_packet->music_style);
34748#ifdef FREECIV_JSON_CONNECTION
34749 field_addr.name = "nation";
34750#endif /* FREECIV_JSON_CONNECTION */
34751 DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
34752#ifdef FREECIV_JSON_CONNECTION
34753 field_addr.name = "team";
34754#endif /* FREECIV_JSON_CONNECTION */
34755 DIO_PUT(uint16, &dout, &field_addr, real_packet->team);
34756#ifdef FREECIV_JSON_CONNECTION
34757 field_addr.name = "is_ready";
34758#endif /* FREECIV_JSON_CONNECTION */
34759 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_ready);
34760#ifdef FREECIV_JSON_CONNECTION
34761 field_addr.name = "phase_done";
34762#endif /* FREECIV_JSON_CONNECTION */
34763 DIO_PUT(bool8, &dout, &field_addr, real_packet->phase_done);
34764#ifdef FREECIV_JSON_CONNECTION
34765 field_addr.name = "nturns_idle";
34766#endif /* FREECIV_JSON_CONNECTION */
34767 DIO_PUT(sint16, &dout, &field_addr, real_packet->nturns_idle);
34768#ifdef FREECIV_JSON_CONNECTION
34769 field_addr.name = "turns_alive";
34770#endif /* FREECIV_JSON_CONNECTION */
34771 DIO_PUT(sint16, &dout, &field_addr, real_packet->turns_alive);
34772#ifdef FREECIV_JSON_CONNECTION
34773 field_addr.name = "is_alive";
34774#endif /* FREECIV_JSON_CONNECTION */
34775 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_alive);
34776#ifdef FREECIV_JSON_CONNECTION
34777 field_addr.name = "gold";
34778#endif /* FREECIV_JSON_CONNECTION */
34779 DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
34780#ifdef FREECIV_JSON_CONNECTION
34781 field_addr.name = "tax";
34782#endif /* FREECIV_JSON_CONNECTION */
34783 DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
34784#ifdef FREECIV_JSON_CONNECTION
34785 field_addr.name = "science";
34786#endif /* FREECIV_JSON_CONNECTION */
34787 DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
34788#ifdef FREECIV_JSON_CONNECTION
34789 field_addr.name = "luxury";
34790#endif /* FREECIV_JSON_CONNECTION */
34791 DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
34792#ifdef FREECIV_JSON_CONNECTION
34793 field_addr.name = "infrapoints";
34794#endif /* FREECIV_JSON_CONNECTION */
34795 DIO_PUT(uint32, &dout, &field_addr, real_packet->infrapoints);
34796#ifdef FREECIV_JSON_CONNECTION
34797 field_addr.name = "tech_upkeep";
34798#endif /* FREECIV_JSON_CONNECTION */
34799 DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_upkeep);
34800#ifdef FREECIV_JSON_CONNECTION
34801 field_addr.name = "science_cost";
34802#endif /* FREECIV_JSON_CONNECTION */
34803 DIO_PUT(uint16, &dout, &field_addr, real_packet->science_cost);
34804#ifdef FREECIV_JSON_CONNECTION
34805 field_addr.name = "is_connected";
34806#endif /* FREECIV_JSON_CONNECTION */
34807 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_connected);
34808#ifdef FREECIV_JSON_CONNECTION
34809 field_addr.name = "revolution_finishes";
34810#endif /* FREECIV_JSON_CONNECTION */
34811 DIO_PUT(sint16, &dout, &field_addr, real_packet->revolution_finishes);
34812#ifdef FREECIV_JSON_CONNECTION
34813 field_addr.name = "ai_skill_level";
34814#endif /* FREECIV_JSON_CONNECTION */
34815 DIO_PUT(uint8, &dout, &field_addr, real_packet->ai_skill_level);
34816#ifdef FREECIV_JSON_CONNECTION
34817 field_addr.name = "barbarian_type";
34818#endif /* FREECIV_JSON_CONNECTION */
34819 DIO_PUT(uint8, &dout, &field_addr, real_packet->barbarian_type);
34820#ifdef FREECIV_JSON_CONNECTION
34821 field_addr.name = "gives_shared_vision";
34822#endif /* FREECIV_JSON_CONNECTION */
34823 DIO_BV_PUT(&dout, &field_addr, packet->gives_shared_vision);
34824#ifdef FREECIV_JSON_CONNECTION
34825 field_addr.name = "history";
34826#endif /* FREECIV_JSON_CONNECTION */
34827 DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
34828#ifdef FREECIV_JSON_CONNECTION
34829 field_addr.name = "culture";
34830#endif /* FREECIV_JSON_CONNECTION */
34831 DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
34832#ifdef FREECIV_JSON_CONNECTION
34833 field_addr.name = "love";
34834#endif /* FREECIV_JSON_CONNECTION */
34835
34836 {
34837 int i;
34838
34839#ifdef FREECIV_JSON_CONNECTION
34840 /* Create the array. */
34841 DIO_PUT(farray, &dout, &field_addr, MAX_NUM_PLAYER_SLOTS);
34842
34843 /* Enter the array. */
34844 field_addr.sub_location = plocation_elem_new(0);
34845#endif /* FREECIV_JSON_CONNECTION */
34846
34847 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
34848#ifdef FREECIV_JSON_CONNECTION
34849 /* Next array element. */
34850 field_addr.sub_location->number = i;
34851#endif /* FREECIV_JSON_CONNECTION */
34852 DIO_PUT(sint16, &dout, &field_addr, real_packet->love[i]);
34853 }
34854
34855#ifdef FREECIV_JSON_CONNECTION
34856 /* Exit array. */
34857 free(field_addr.sub_location);
34858 field_addr.sub_location = NULL;
34859#endif /* FREECIV_JSON_CONNECTION */
34860 }
34861#ifdef FREECIV_JSON_CONNECTION
34862 field_addr.name = "color_valid";
34863#endif /* FREECIV_JSON_CONNECTION */
34864 DIO_PUT(bool8, &dout, &field_addr, real_packet->color_valid);
34865#ifdef FREECIV_JSON_CONNECTION
34866 field_addr.name = "color_changeable";
34867#endif /* FREECIV_JSON_CONNECTION */
34868 DIO_PUT(bool8, &dout, &field_addr, real_packet->color_changeable);
34869#ifdef FREECIV_JSON_CONNECTION
34870 field_addr.name = "color_red";
34871#endif /* FREECIV_JSON_CONNECTION */
34872 DIO_PUT(uint8, &dout, &field_addr, real_packet->color_red);
34873#ifdef FREECIV_JSON_CONNECTION
34874 field_addr.name = "color_green";
34875#endif /* FREECIV_JSON_CONNECTION */
34876 DIO_PUT(uint8, &dout, &field_addr, real_packet->color_green);
34877#ifdef FREECIV_JSON_CONNECTION
34878 field_addr.name = "color_blue";
34879#endif /* FREECIV_JSON_CONNECTION */
34880 DIO_PUT(uint8, &dout, &field_addr, real_packet->color_blue);
34881#ifdef FREECIV_JSON_CONNECTION
34882 field_addr.name = "flags";
34883#endif /* FREECIV_JSON_CONNECTION */
34884 DIO_BV_PUT(&dout, &field_addr, packet->flags);
34885#ifdef FREECIV_JSON_CONNECTION
34886 field_addr.name = "wonders";
34887#endif /* FREECIV_JSON_CONNECTION */
34888
34889 {
34890 int i;
34891
34892#ifdef FREECIV_JSON_CONNECTION
34893 /* Create the array. */
34894 DIO_PUT(farray, &dout, &field_addr, B_LAST);
34895
34896 /* Enter the array. */
34897 field_addr.sub_location = plocation_elem_new(0);
34898#endif /* FREECIV_JSON_CONNECTION */
34899
34900 for (i = 0; i < B_LAST; i++) {
34901#ifdef FREECIV_JSON_CONNECTION
34902 /* Next array element. */
34903 field_addr.sub_location->number = i;
34904#endif /* FREECIV_JSON_CONNECTION */
34905 DIO_PUT(sint32, &dout, &field_addr, real_packet->wonders[i]);
34906 }
34907
34908#ifdef FREECIV_JSON_CONNECTION
34909 /* Exit array. */
34910 free(field_addr.sub_location);
34911 field_addr.sub_location = NULL;
34912#endif /* FREECIV_JSON_CONNECTION */
34913 }
34914#ifdef FREECIV_JSON_CONNECTION
34915 field_addr.name = "multip_count";
34916#endif /* FREECIV_JSON_CONNECTION */
34917 DIO_PUT(uint8, &dout, &field_addr, real_packet->multip_count);
34918#ifdef FREECIV_JSON_CONNECTION
34919 field_addr.name = "multiplier";
34920#endif /* FREECIV_JSON_CONNECTION */
34921
34922 {
34923 int i;
34924
34925#ifdef FREECIV_JSON_CONNECTION
34926 /* Create the array. */
34927 DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
34928
34929 /* Enter the array. */
34930 field_addr.sub_location = plocation_elem_new(0);
34931#endif /* FREECIV_JSON_CONNECTION */
34932
34933 for (i = 0; i < real_packet->multip_count; i++) {
34934#ifdef FREECIV_JSON_CONNECTION
34935 /* Next array element. */
34936 field_addr.sub_location->number = i;
34937#endif /* FREECIV_JSON_CONNECTION */
34938 DIO_PUT(sint32, &dout, &field_addr, real_packet->multiplier[i]);
34939 }
34940
34941#ifdef FREECIV_JSON_CONNECTION
34942 /* Exit array. */
34943 free(field_addr.sub_location);
34944 field_addr.sub_location = NULL;
34945#endif /* FREECIV_JSON_CONNECTION */
34946 }
34947#ifdef FREECIV_JSON_CONNECTION
34948 field_addr.name = "multiplier_target";
34949#endif /* FREECIV_JSON_CONNECTION */
34950
34951 {
34952 int i;
34953
34954#ifdef FREECIV_JSON_CONNECTION
34955 /* Create the array. */
34956 DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
34957
34958 /* Enter the array. */
34959 field_addr.sub_location = plocation_elem_new(0);
34960#endif /* FREECIV_JSON_CONNECTION */
34961
34962 for (i = 0; i < real_packet->multip_count; i++) {
34963#ifdef FREECIV_JSON_CONNECTION
34964 /* Next array element. */
34965 field_addr.sub_location->number = i;
34966#endif /* FREECIV_JSON_CONNECTION */
34967 DIO_PUT(sint32, &dout, &field_addr, real_packet->multiplier_target[i]);
34968 }
34969
34970#ifdef FREECIV_JSON_CONNECTION
34971 /* Exit array. */
34972 free(field_addr.sub_location);
34973 field_addr.sub_location = NULL;
34974#endif /* FREECIV_JSON_CONNECTION */
34975 }
34976#ifdef FREECIV_JSON_CONNECTION
34977 field_addr.name = "multiplier_changed";
34978#endif /* FREECIV_JSON_CONNECTION */
34979
34980 {
34981 int i;
34982
34983#ifdef FREECIV_JSON_CONNECTION
34984 /* Create the array. */
34985 DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
34986
34987 /* Enter the array. */
34988 field_addr.sub_location = plocation_elem_new(0);
34989#endif /* FREECIV_JSON_CONNECTION */
34990
34991 for (i = 0; i < real_packet->multip_count; i++) {
34992#ifdef FREECIV_JSON_CONNECTION
34993 /* Next array element. */
34994 field_addr.sub_location->number = i;
34995#endif /* FREECIV_JSON_CONNECTION */
34996 DIO_PUT(sint16, &dout, &field_addr, real_packet->multiplier_changed[i]);
34997 }
34998
34999#ifdef FREECIV_JSON_CONNECTION
35000 /* Exit array. */
35001 free(field_addr.sub_location);
35002 field_addr.sub_location = NULL;
35003#endif /* FREECIV_JSON_CONNECTION */
35004 }
35005
35006#endif
35007 SEND_PACKET_END(PACKET_PLAYER_INFO);
35008}
35009
35010 int send_packet_player_info(struct connection *pc, const struct packet_player_info *packet)
35011{
35012 if (!pc->used) {
35013 log_error("WARNING: trying to send data to the closed connection %s",
35014 conn_description(pc));
35015 return -1;
35016 }
35017 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_INFO].packet != NULL, -1,
35018 "Handler for PACKET_PLAYER_INFO not installed");
35019 return pc->phs.handlers->send[PACKET_PLAYER_INFO].packet(pc, packet);
35020}
35021
35022#ifdef FREECIV_DELTA_PROTOCOL
35023#define hash_packet_player_phase_done_100 hash_const
35024
35025#define cmp_packet_player_phase_done_100 cmp_const
35026
35027 BV_DEFINE(packet_player_phase_done_100_fields, 1);
35028#endif /* FREECIV_DELTA_PROTOCOL */
35029
35030 static struct packet_player_phase_done *receive_packet_player_phase_done_100(struct connection *pc)
35031{
35032#ifdef FREECIV_DELTA_PROTOCOL
35033 packet_player_phase_done_100_fields fields;
35034 struct packet_player_phase_done *old;
35035 struct genhash **hash = pc->phs.received + PACKET_PLAYER_PHASE_DONE;
35036#endif /* FREECIV_DELTA_PROTOCOL */
35037 RECEIVE_PACKET_START(packet_player_phase_done, real_packet);
35038#ifdef FREECIV_JSON_CONNECTION
35039 struct plocation field_addr;
35040 {
35041 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35042 field_addr = *field_addr_tmp;
35043 FC_FREE(field_addr_tmp);
35044 }
35045#endif /* FREECIV_JSON_CONNECTION */
35046
35047#ifdef FREECIV_DELTA_PROTOCOL
35048#ifdef FREECIV_JSON_CONNECTION
35049 field_addr.name = "fields";
35050#endif /* FREECIV_JSON_CONNECTION */
35051 DIO_BV_GET(&din, &field_addr, fields);
35052
35053#else /* FREECIV_DELTA_PROTOCOL */
35054 #ifdef FREECIV_JSON_CONNECTION
35055 field_addr.name = "turn";
35056 #endif /* FREECIV_JSON_CONNECTION */
35057 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
35058 RECEIVE_PACKET_FIELD_ERROR(turn);
35059 }
35060
35061#endif
35062 log_packet_detailed("packet_player_phase_done_100: got info about ()");
35063
35064#ifdef FREECIV_DELTA_PROTOCOL
35065 if (NULL == *hash) {
35066 *hash = genhash_new_full(hash_packet_player_phase_done_100, cmp_packet_player_phase_done_100,
35067 NULL, NULL, NULL, free);
35068 }
35069
35070 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
35071 *real_packet = *old;
35072 } else {
35073 log_packet_detailed(" no old info");
35074 memset(real_packet, 0, sizeof(*real_packet));
35075 }
35076
35077 if (BV_ISSET(fields, 0)) {
35078 log_packet_detailed(" got field 'turn'");
35079 #ifdef FREECIV_JSON_CONNECTION
35080 field_addr.name = "turn";
35081 #endif /* FREECIV_JSON_CONNECTION */
35082 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
35083 RECEIVE_PACKET_FIELD_ERROR(turn);
35084 }
35085 }
35086
35087 if (NULL == old) {
35088 old = fc_malloc(sizeof(*old));
35089 *old = *real_packet;
35090 genhash_insert(*hash, old, old);
35091 } else {
35092 *old = *real_packet;
35093 }
35094
35095#endif /* FREECIV_DELTA_PROTOCOL */
35096 RECEIVE_PACKET_END(real_packet);
35097}
35098
35099 static int send_packet_player_phase_done_100(struct connection *pc, const struct packet_player_phase_done *packet)
35100{
35101 const struct packet_player_phase_done *real_packet = packet;
35102#ifdef FREECIV_DELTA_PROTOCOL
35103 packet_player_phase_done_100_fields fields;
35104 struct packet_player_phase_done *old;
35105 bool differ;
35106 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_PHASE_DONE;
35107#endif /* FREECIV_DELTA_PROTOCOL */
35108 SEND_PACKET_START(PACKET_PLAYER_PHASE_DONE);
35109#ifdef FREECIV_JSON_CONNECTION
35110 struct plocation field_addr;
35111 {
35112 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35113 field_addr = *field_addr_tmp;
35114 FC_FREE(field_addr_tmp);
35115 }
35116#endif /* FREECIV_JSON_CONNECTION */
35117
35118 log_packet_detailed("packet_player_phase_done_100: sending info about ()");
35119
35120#ifdef FREECIV_DELTA_PROTOCOL
35121 if (NULL == *hash) {
35122 *hash = genhash_new_full(hash_packet_player_phase_done_100, cmp_packet_player_phase_done_100,
35123 NULL, NULL, NULL, free);
35124 }
35125 BV_CLR_ALL(fields);
35126
35127 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
35128 old = fc_malloc(sizeof(*old));
35129 *old = *real_packet;
35130 genhash_insert(*hash, old, old);
35131 memset(old, 0, sizeof(*old));
35132 }
35133 differ = (old->turn != real_packet->turn);
35134 if (differ) {
35135 BV_SET(fields, 0);
35136 }
35137
35138
35139#ifdef FREECIV_JSON_CONNECTION
35140 field_addr.name = "fields";
35141#endif /* FREECIV_JSON_CONNECTION */
35142 DIO_BV_PUT(&dout, &field_addr, fields);
35143
35144 if (BV_ISSET(fields, 0)) {
35145 log_packet_detailed(" field 'turn' has changed");
35146 #ifdef FREECIV_JSON_CONNECTION
35147 field_addr.name = "turn";
35148#endif /* FREECIV_JSON_CONNECTION */
35149 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
35150 }
35151
35152 *old = *real_packet;
35153#endif /* FREECIV_DELTA_PROTOCOL */
35154#ifndef FREECIV_DELTA_PROTOCOL
35155#ifdef FREECIV_JSON_CONNECTION
35156 field_addr.name = "turn";
35157#endif /* FREECIV_JSON_CONNECTION */
35158 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
35159
35160#endif
35161 SEND_PACKET_END(PACKET_PLAYER_PHASE_DONE);
35162}
35163
35164 int send_packet_player_phase_done(struct connection *pc, const struct packet_player_phase_done *packet)
35165{
35166 if (!pc->used) {
35167 log_error("WARNING: trying to send data to the closed connection %s",
35168 conn_description(pc));
35169 return -1;
35170 }
35171 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_PHASE_DONE].packet != NULL, -1,
35172 "Handler for PACKET_PLAYER_PHASE_DONE not installed");
35173 return pc->phs.handlers->send[PACKET_PLAYER_PHASE_DONE].packet(pc, packet);
35174}
35175
35176 int dsend_packet_player_phase_done(struct connection *pc, int turn)
35177{
35178 struct packet_player_phase_done packet, *real_packet = &packet;
35179
35180 real_packet->turn = turn;
35181
35182 return send_packet_player_phase_done(pc, real_packet);
35183}
35184
35185#ifdef FREECIV_DELTA_PROTOCOL
35186#define hash_packet_player_rates_100 hash_const
35187
35188#define cmp_packet_player_rates_100 cmp_const
35189
35190 BV_DEFINE(packet_player_rates_100_fields, 3);
35191#endif /* FREECIV_DELTA_PROTOCOL */
35192
35193 static struct packet_player_rates *receive_packet_player_rates_100(struct connection *pc)
35194{
35195#ifdef FREECIV_DELTA_PROTOCOL
35196 packet_player_rates_100_fields fields;
35197 struct packet_player_rates *old;
35198 struct genhash **hash = pc->phs.received + PACKET_PLAYER_RATES;
35199#endif /* FREECIV_DELTA_PROTOCOL */
35200 RECEIVE_PACKET_START(packet_player_rates, real_packet);
35201#ifdef FREECIV_JSON_CONNECTION
35202 struct plocation field_addr;
35203 {
35204 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35205 field_addr = *field_addr_tmp;
35206 FC_FREE(field_addr_tmp);
35207 }
35208#endif /* FREECIV_JSON_CONNECTION */
35209
35210#ifdef FREECIV_DELTA_PROTOCOL
35211#ifdef FREECIV_JSON_CONNECTION
35212 field_addr.name = "fields";
35213#endif /* FREECIV_JSON_CONNECTION */
35214 DIO_BV_GET(&din, &field_addr, fields);
35215
35216#else /* FREECIV_DELTA_PROTOCOL */
35217 #ifdef FREECIV_JSON_CONNECTION
35218 field_addr.name = "tax";
35219 #endif /* FREECIV_JSON_CONNECTION */
35220 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
35221 RECEIVE_PACKET_FIELD_ERROR(tax);
35222 }
35223 #ifdef FREECIV_JSON_CONNECTION
35224 field_addr.name = "luxury";
35225 #endif /* FREECIV_JSON_CONNECTION */
35226 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
35227 RECEIVE_PACKET_FIELD_ERROR(luxury);
35228 }
35229 #ifdef FREECIV_JSON_CONNECTION
35230 field_addr.name = "science";
35231 #endif /* FREECIV_JSON_CONNECTION */
35232 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
35233 RECEIVE_PACKET_FIELD_ERROR(science);
35234 }
35235
35236#endif
35237 log_packet_detailed("packet_player_rates_100: got info about ()");
35238
35239#ifdef FREECIV_DELTA_PROTOCOL
35240 if (NULL == *hash) {
35241 *hash = genhash_new_full(hash_packet_player_rates_100, cmp_packet_player_rates_100,
35242 NULL, NULL, NULL, free);
35243 }
35244
35245 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
35246 *real_packet = *old;
35247 } else {
35248 log_packet_detailed(" no old info");
35249 memset(real_packet, 0, sizeof(*real_packet));
35250 }
35251
35252 if (BV_ISSET(fields, 0)) {
35253 log_packet_detailed(" got field 'tax'");
35254 #ifdef FREECIV_JSON_CONNECTION
35255 field_addr.name = "tax";
35256 #endif /* FREECIV_JSON_CONNECTION */
35257 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
35258 RECEIVE_PACKET_FIELD_ERROR(tax);
35259 }
35260 }
35261 if (BV_ISSET(fields, 1)) {
35262 log_packet_detailed(" got field 'luxury'");
35263 #ifdef FREECIV_JSON_CONNECTION
35264 field_addr.name = "luxury";
35265 #endif /* FREECIV_JSON_CONNECTION */
35266 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
35267 RECEIVE_PACKET_FIELD_ERROR(luxury);
35268 }
35269 }
35270 if (BV_ISSET(fields, 2)) {
35271 log_packet_detailed(" got field 'science'");
35272 #ifdef FREECIV_JSON_CONNECTION
35273 field_addr.name = "science";
35274 #endif /* FREECIV_JSON_CONNECTION */
35275 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
35276 RECEIVE_PACKET_FIELD_ERROR(science);
35277 }
35278 }
35279
35280 if (NULL == old) {
35281 old = fc_malloc(sizeof(*old));
35282 *old = *real_packet;
35283 genhash_insert(*hash, old, old);
35284 } else {
35285 *old = *real_packet;
35286 }
35287
35288#endif /* FREECIV_DELTA_PROTOCOL */
35289 RECEIVE_PACKET_END(real_packet);
35290}
35291
35292 static int send_packet_player_rates_100(struct connection *pc, const struct packet_player_rates *packet)
35293{
35294 const struct packet_player_rates *real_packet = packet;
35295#ifdef FREECIV_DELTA_PROTOCOL
35296 packet_player_rates_100_fields fields;
35297 struct packet_player_rates *old;
35298 bool differ;
35299 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_RATES;
35300#endif /* FREECIV_DELTA_PROTOCOL */
35301 SEND_PACKET_START(PACKET_PLAYER_RATES);
35302#ifdef FREECIV_JSON_CONNECTION
35303 struct plocation field_addr;
35304 {
35305 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35306 field_addr = *field_addr_tmp;
35307 FC_FREE(field_addr_tmp);
35308 }
35309#endif /* FREECIV_JSON_CONNECTION */
35310
35311 log_packet_detailed("packet_player_rates_100: sending info about ()");
35312
35313#ifdef FREECIV_DELTA_PROTOCOL
35314 if (NULL == *hash) {
35315 *hash = genhash_new_full(hash_packet_player_rates_100, cmp_packet_player_rates_100,
35316 NULL, NULL, NULL, free);
35317 }
35318 BV_CLR_ALL(fields);
35319
35320 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
35321 old = fc_malloc(sizeof(*old));
35322 *old = *real_packet;
35323 genhash_insert(*hash, old, old);
35324 memset(old, 0, sizeof(*old));
35325 }
35326 differ = (old->tax != real_packet->tax);
35327 if (differ) {
35328 BV_SET(fields, 0);
35329 }
35330
35331 differ = (old->luxury != real_packet->luxury);
35332 if (differ) {
35333 BV_SET(fields, 1);
35334 }
35335
35336 differ = (old->science != real_packet->science);
35337 if (differ) {
35338 BV_SET(fields, 2);
35339 }
35340
35341
35342#ifdef FREECIV_JSON_CONNECTION
35343 field_addr.name = "fields";
35344#endif /* FREECIV_JSON_CONNECTION */
35345 DIO_BV_PUT(&dout, &field_addr, fields);
35346
35347 if (BV_ISSET(fields, 0)) {
35348 log_packet_detailed(" field 'tax' has changed");
35349 #ifdef FREECIV_JSON_CONNECTION
35350 field_addr.name = "tax";
35351#endif /* FREECIV_JSON_CONNECTION */
35352 DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
35353 }
35354 if (BV_ISSET(fields, 1)) {
35355 log_packet_detailed(" field 'luxury' has changed");
35356 #ifdef FREECIV_JSON_CONNECTION
35357 field_addr.name = "luxury";
35358#endif /* FREECIV_JSON_CONNECTION */
35359 DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
35360 }
35361 if (BV_ISSET(fields, 2)) {
35362 log_packet_detailed(" field 'science' has changed");
35363 #ifdef FREECIV_JSON_CONNECTION
35364 field_addr.name = "science";
35365#endif /* FREECIV_JSON_CONNECTION */
35366 DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
35367 }
35368
35369 *old = *real_packet;
35370#endif /* FREECIV_DELTA_PROTOCOL */
35371#ifndef FREECIV_DELTA_PROTOCOL
35372#ifdef FREECIV_JSON_CONNECTION
35373 field_addr.name = "tax";
35374#endif /* FREECIV_JSON_CONNECTION */
35375 DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
35376#ifdef FREECIV_JSON_CONNECTION
35377 field_addr.name = "luxury";
35378#endif /* FREECIV_JSON_CONNECTION */
35379 DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
35380#ifdef FREECIV_JSON_CONNECTION
35381 field_addr.name = "science";
35382#endif /* FREECIV_JSON_CONNECTION */
35383 DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
35384
35385#endif
35386 SEND_PACKET_END(PACKET_PLAYER_RATES);
35387}
35388
35389 int send_packet_player_rates(struct connection *pc, const struct packet_player_rates *packet)
35390{
35391 if (!pc->used) {
35392 log_error("WARNING: trying to send data to the closed connection %s",
35393 conn_description(pc));
35394 return -1;
35395 }
35396 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_RATES].packet != NULL, -1,
35397 "Handler for PACKET_PLAYER_RATES not installed");
35398 return pc->phs.handlers->send[PACKET_PLAYER_RATES].packet(pc, packet);
35399}
35400
35401 int dsend_packet_player_rates(struct connection *pc, int tax, int luxury, int science)
35402{
35403 struct packet_player_rates packet, *real_packet = &packet;
35404
35405 real_packet->tax = tax;
35406 real_packet->luxury = luxury;
35407 real_packet->science = science;
35408
35409 return send_packet_player_rates(pc, real_packet);
35410}
35411
35412#ifdef FREECIV_DELTA_PROTOCOL
35413#define hash_packet_player_change_government_100 hash_const
35414
35415#define cmp_packet_player_change_government_100 cmp_const
35416
35417 BV_DEFINE(packet_player_change_government_100_fields, 1);
35418#endif /* FREECIV_DELTA_PROTOCOL */
35419
35420 static struct packet_player_change_government *receive_packet_player_change_government_100(struct connection *pc)
35421{
35422#ifdef FREECIV_DELTA_PROTOCOL
35423 packet_player_change_government_100_fields fields;
35424 struct packet_player_change_government *old;
35425 struct genhash **hash = pc->phs.received + PACKET_PLAYER_CHANGE_GOVERNMENT;
35426#endif /* FREECIV_DELTA_PROTOCOL */
35427 RECEIVE_PACKET_START(packet_player_change_government, real_packet);
35428#ifdef FREECIV_JSON_CONNECTION
35429 struct plocation field_addr;
35430 {
35431 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35432 field_addr = *field_addr_tmp;
35433 FC_FREE(field_addr_tmp);
35434 }
35435#endif /* FREECIV_JSON_CONNECTION */
35436
35437#ifdef FREECIV_DELTA_PROTOCOL
35438#ifdef FREECIV_JSON_CONNECTION
35439 field_addr.name = "fields";
35440#endif /* FREECIV_JSON_CONNECTION */
35441 DIO_BV_GET(&din, &field_addr, fields);
35442
35443#else /* FREECIV_DELTA_PROTOCOL */
35444 #ifdef FREECIV_JSON_CONNECTION
35445 field_addr.name = "government";
35446 #endif /* FREECIV_JSON_CONNECTION */
35447 {
35448 int readin;
35449
35450 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
35451 RECEIVE_PACKET_FIELD_ERROR(government);
35452 }
35453 real_packet->government = readin;
35454 }
35455
35456#endif
35457 log_packet_detailed("packet_player_change_government_100: got info about ()");
35458
35459#ifdef FREECIV_DELTA_PROTOCOL
35460 if (NULL == *hash) {
35461 *hash = genhash_new_full(hash_packet_player_change_government_100, cmp_packet_player_change_government_100,
35462 NULL, NULL, NULL, free);
35463 }
35464
35465 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
35466 *real_packet = *old;
35467 } else {
35468 log_packet_detailed(" no old info");
35469 memset(real_packet, 0, sizeof(*real_packet));
35470 }
35471
35472 if (BV_ISSET(fields, 0)) {
35473 log_packet_detailed(" got field 'government'");
35474 #ifdef FREECIV_JSON_CONNECTION
35475 field_addr.name = "government";
35476 #endif /* FREECIV_JSON_CONNECTION */
35477 {
35478 int readin;
35479
35480 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
35481 RECEIVE_PACKET_FIELD_ERROR(government);
35482 }
35483 real_packet->government = readin;
35484 }
35485 }
35486
35487 if (NULL == old) {
35488 old = fc_malloc(sizeof(*old));
35489 *old = *real_packet;
35490 genhash_insert(*hash, old, old);
35491 } else {
35492 *old = *real_packet;
35493 }
35494
35495#endif /* FREECIV_DELTA_PROTOCOL */
35496 RECEIVE_PACKET_END(real_packet);
35497}
35498
35499 static int send_packet_player_change_government_100(struct connection *pc, const struct packet_player_change_government *packet)
35500{
35501 const struct packet_player_change_government *real_packet = packet;
35502#ifdef FREECIV_DELTA_PROTOCOL
35503 packet_player_change_government_100_fields fields;
35504 struct packet_player_change_government *old;
35505 bool differ;
35506 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_CHANGE_GOVERNMENT;
35507#endif /* FREECIV_DELTA_PROTOCOL */
35508 SEND_PACKET_START(PACKET_PLAYER_CHANGE_GOVERNMENT);
35509#ifdef FREECIV_JSON_CONNECTION
35510 struct plocation field_addr;
35511 {
35512 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35513 field_addr = *field_addr_tmp;
35514 FC_FREE(field_addr_tmp);
35515 }
35516#endif /* FREECIV_JSON_CONNECTION */
35517
35518 log_packet_detailed("packet_player_change_government_100: sending info about ()");
35519
35520#ifdef FREECIV_DELTA_PROTOCOL
35521 if (NULL == *hash) {
35522 *hash = genhash_new_full(hash_packet_player_change_government_100, cmp_packet_player_change_government_100,
35523 NULL, NULL, NULL, free);
35524 }
35525 BV_CLR_ALL(fields);
35526
35527 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
35528 old = fc_malloc(sizeof(*old));
35529 *old = *real_packet;
35530 genhash_insert(*hash, old, old);
35531 memset(old, 0, sizeof(*old));
35532 }
35533 differ = (old->government != real_packet->government);
35534 if (differ) {
35535 BV_SET(fields, 0);
35536 }
35537
35538
35539#ifdef FREECIV_JSON_CONNECTION
35540 field_addr.name = "fields";
35541#endif /* FREECIV_JSON_CONNECTION */
35542 DIO_BV_PUT(&dout, &field_addr, fields);
35543
35544 if (BV_ISSET(fields, 0)) {
35545 log_packet_detailed(" field 'government' has changed");
35546 #ifdef FREECIV_JSON_CONNECTION
35547 field_addr.name = "government";
35548#endif /* FREECIV_JSON_CONNECTION */
35549 DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
35550 }
35551
35552 *old = *real_packet;
35553#endif /* FREECIV_DELTA_PROTOCOL */
35554#ifndef FREECIV_DELTA_PROTOCOL
35555#ifdef FREECIV_JSON_CONNECTION
35556 field_addr.name = "government";
35557#endif /* FREECIV_JSON_CONNECTION */
35558 DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
35559
35560#endif
35561 SEND_PACKET_END(PACKET_PLAYER_CHANGE_GOVERNMENT);
35562}
35563
35564 int send_packet_player_change_government(struct connection *pc, const struct packet_player_change_government *packet)
35565{
35566 if (!pc->used) {
35567 log_error("WARNING: trying to send data to the closed connection %s",
35568 conn_description(pc));
35569 return -1;
35570 }
35571 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_CHANGE_GOVERNMENT].packet != NULL, -1,
35572 "Handler for PACKET_PLAYER_CHANGE_GOVERNMENT not installed");
35573 return pc->phs.handlers->send[PACKET_PLAYER_CHANGE_GOVERNMENT].packet(pc, packet);
35574}
35575
35576 int dsend_packet_player_change_government(struct connection *pc, Government_type_id government)
35577{
35578 struct packet_player_change_government packet, *real_packet = &packet;
35579
35580 real_packet->government = government;
35581
35582 return send_packet_player_change_government(pc, real_packet);
35583}
35584
35585#ifdef FREECIV_DELTA_PROTOCOL
35586#define hash_packet_player_place_infra_100 hash_const
35587
35588#define cmp_packet_player_place_infra_100 cmp_const
35589
35590 BV_DEFINE(packet_player_place_infra_100_fields, 2);
35591#endif /* FREECIV_DELTA_PROTOCOL */
35592
35593 static struct packet_player_place_infra *receive_packet_player_place_infra_100(struct connection *pc)
35594{
35595#ifdef FREECIV_DELTA_PROTOCOL
35596 packet_player_place_infra_100_fields fields;
35597 struct packet_player_place_infra *old;
35598 struct genhash **hash = pc->phs.received + PACKET_PLAYER_PLACE_INFRA;
35599#endif /* FREECIV_DELTA_PROTOCOL */
35600 RECEIVE_PACKET_START(packet_player_place_infra, real_packet);
35601#ifdef FREECIV_JSON_CONNECTION
35602 struct plocation field_addr;
35603 {
35604 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35605 field_addr = *field_addr_tmp;
35606 FC_FREE(field_addr_tmp);
35607 }
35608#endif /* FREECIV_JSON_CONNECTION */
35609
35610#ifdef FREECIV_DELTA_PROTOCOL
35611#ifdef FREECIV_JSON_CONNECTION
35612 field_addr.name = "fields";
35613#endif /* FREECIV_JSON_CONNECTION */
35614 DIO_BV_GET(&din, &field_addr, fields);
35615
35616#else /* FREECIV_DELTA_PROTOCOL */
35617 #ifdef FREECIV_JSON_CONNECTION
35618 field_addr.name = "tile";
35619 #endif /* FREECIV_JSON_CONNECTION */
35620 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
35621 RECEIVE_PACKET_FIELD_ERROR(tile);
35622 }
35623 #ifdef FREECIV_JSON_CONNECTION
35624 field_addr.name = "extra";
35625 #endif /* FREECIV_JSON_CONNECTION */
35626 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->extra)) {
35627 RECEIVE_PACKET_FIELD_ERROR(extra);
35628 }
35629
35630#endif
35631 log_packet_detailed("packet_player_place_infra_100: got info about ()");
35632
35633#ifdef FREECIV_DELTA_PROTOCOL
35634 if (NULL == *hash) {
35635 *hash = genhash_new_full(hash_packet_player_place_infra_100, cmp_packet_player_place_infra_100,
35636 NULL, NULL, NULL, free);
35637 }
35638
35639 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
35640 *real_packet = *old;
35641 } else {
35642 log_packet_detailed(" no old info");
35643 memset(real_packet, 0, sizeof(*real_packet));
35644 }
35645
35646 if (BV_ISSET(fields, 0)) {
35647 log_packet_detailed(" got field 'tile'");
35648 #ifdef FREECIV_JSON_CONNECTION
35649 field_addr.name = "tile";
35650 #endif /* FREECIV_JSON_CONNECTION */
35651 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
35652 RECEIVE_PACKET_FIELD_ERROR(tile);
35653 }
35654 }
35655 if (BV_ISSET(fields, 1)) {
35656 log_packet_detailed(" got field 'extra'");
35657 #ifdef FREECIV_JSON_CONNECTION
35658 field_addr.name = "extra";
35659 #endif /* FREECIV_JSON_CONNECTION */
35660 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->extra)) {
35661 RECEIVE_PACKET_FIELD_ERROR(extra);
35662 }
35663 }
35664
35665 if (NULL == old) {
35666 old = fc_malloc(sizeof(*old));
35667 *old = *real_packet;
35668 genhash_insert(*hash, old, old);
35669 } else {
35670 *old = *real_packet;
35671 }
35672
35673#endif /* FREECIV_DELTA_PROTOCOL */
35674 RECEIVE_PACKET_END(real_packet);
35675}
35676
35677 static int send_packet_player_place_infra_100(struct connection *pc, const struct packet_player_place_infra *packet)
35678{
35679 const struct packet_player_place_infra *real_packet = packet;
35680#ifdef FREECIV_DELTA_PROTOCOL
35681 packet_player_place_infra_100_fields fields;
35682 struct packet_player_place_infra *old;
35683 bool differ;
35684 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_PLACE_INFRA;
35685#endif /* FREECIV_DELTA_PROTOCOL */
35686 SEND_PACKET_START(PACKET_PLAYER_PLACE_INFRA);
35687#ifdef FREECIV_JSON_CONNECTION
35688 struct plocation field_addr;
35689 {
35690 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35691 field_addr = *field_addr_tmp;
35692 FC_FREE(field_addr_tmp);
35693 }
35694#endif /* FREECIV_JSON_CONNECTION */
35695
35696 log_packet_detailed("packet_player_place_infra_100: sending info about ()");
35697
35698#ifdef FREECIV_DELTA_PROTOCOL
35699 if (NULL == *hash) {
35700 *hash = genhash_new_full(hash_packet_player_place_infra_100, cmp_packet_player_place_infra_100,
35701 NULL, NULL, NULL, free);
35702 }
35703 BV_CLR_ALL(fields);
35704
35705 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
35706 old = fc_malloc(sizeof(*old));
35707 *old = *real_packet;
35708 genhash_insert(*hash, old, old);
35709 memset(old, 0, sizeof(*old));
35710 }
35711 differ = (old->tile != real_packet->tile);
35712 if (differ) {
35713 BV_SET(fields, 0);
35714 }
35715
35716 differ = (old->extra != real_packet->extra);
35717 if (differ) {
35718 BV_SET(fields, 1);
35719 }
35720
35721
35722#ifdef FREECIV_JSON_CONNECTION
35723 field_addr.name = "fields";
35724#endif /* FREECIV_JSON_CONNECTION */
35725 DIO_BV_PUT(&dout, &field_addr, fields);
35726
35727 if (BV_ISSET(fields, 0)) {
35728 log_packet_detailed(" field 'tile' has changed");
35729 #ifdef FREECIV_JSON_CONNECTION
35730 field_addr.name = "tile";
35731#endif /* FREECIV_JSON_CONNECTION */
35732 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
35733 }
35734 if (BV_ISSET(fields, 1)) {
35735 log_packet_detailed(" field 'extra' has changed");
35736 #ifdef FREECIV_JSON_CONNECTION
35737 field_addr.name = "extra";
35738#endif /* FREECIV_JSON_CONNECTION */
35739 DIO_PUT(sint8, &dout, &field_addr, real_packet->extra);
35740 }
35741
35742 *old = *real_packet;
35743#endif /* FREECIV_DELTA_PROTOCOL */
35744#ifndef FREECIV_DELTA_PROTOCOL
35745#ifdef FREECIV_JSON_CONNECTION
35746 field_addr.name = "tile";
35747#endif /* FREECIV_JSON_CONNECTION */
35748 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
35749#ifdef FREECIV_JSON_CONNECTION
35750 field_addr.name = "extra";
35751#endif /* FREECIV_JSON_CONNECTION */
35752 DIO_PUT(sint8, &dout, &field_addr, real_packet->extra);
35753
35754#endif
35755 SEND_PACKET_END(PACKET_PLAYER_PLACE_INFRA);
35756}
35757
35758 int send_packet_player_place_infra(struct connection *pc, const struct packet_player_place_infra *packet)
35759{
35760 if (!pc->used) {
35761 log_error("WARNING: trying to send data to the closed connection %s",
35762 conn_description(pc));
35763 return -1;
35764 }
35765 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_PLACE_INFRA].packet != NULL, -1,
35766 "Handler for PACKET_PLAYER_PLACE_INFRA not installed");
35767 return pc->phs.handlers->send[PACKET_PLAYER_PLACE_INFRA].packet(pc, packet);
35768}
35769
35770 int dsend_packet_player_place_infra(struct connection *pc, int tile, int extra)
35771{
35772 struct packet_player_place_infra packet, *real_packet = &packet;
35773
35774 real_packet->tile = tile;
35775 real_packet->extra = extra;
35776
35777 return send_packet_player_place_infra(pc, real_packet);
35778}
35779
35780 static struct packet_player_attribute_block *receive_packet_player_attribute_block_100(struct connection *pc)
35781{
35782 RECEIVE_PACKET_START(packet_player_attribute_block, real_packet);
35783#if 1 /* To match endif */
35784 real_packet->__dummy = 0xff;
35785#endif
35786 log_packet_detailed("packet_player_attribute_block_100: got info about ()");
35787 RECEIVE_PACKET_END(real_packet);
35788}
35789
35790 static int send_packet_player_attribute_block_100(struct connection *pc)
35791{
35792 SEND_PACKET_START(PACKET_PLAYER_ATTRIBUTE_BLOCK);
35793
35794 log_packet_detailed("packet_player_attribute_block_100: sending info about ()");
35795 SEND_PACKET_END(PACKET_PLAYER_ATTRIBUTE_BLOCK);
35796}
35797
35798 int send_packet_player_attribute_block(struct connection *pc)
35799{
35800 if (!pc->used) {
35801 log_error("WARNING: trying to send data to the closed connection %s",
35802 conn_description(pc));
35803 return -1;
35804 }
35805 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_ATTRIBUTE_BLOCK].no_packet != NULL, -1,
35806 "Handler for PACKET_PLAYER_ATTRIBUTE_BLOCK not installed");
35807 return pc->phs.handlers->send[PACKET_PLAYER_ATTRIBUTE_BLOCK].no_packet(pc);
35808}
35809
35810#ifdef FREECIV_DELTA_PROTOCOL
35811static genhash_val_t hash_packet_player_attribute_chunk_100(const void *vkey)
35812{
35813 const struct packet_player_attribute_chunk *key = (const struct packet_player_attribute_chunk *) vkey;
35814
35815 return key->offset;
35816}
35817
35818static bool cmp_packet_player_attribute_chunk_100(const void *vkey1, const void *vkey2)
35819{
35820 const struct packet_player_attribute_chunk *key1 = (const struct packet_player_attribute_chunk *) vkey1;
35821 const struct packet_player_attribute_chunk *key2 = (const struct packet_player_attribute_chunk *) vkey2;
35822
35823 return key1->offset == key2->offset;
35824}
35825 BV_DEFINE(packet_player_attribute_chunk_100_fields, 3);
35826#endif /* FREECIV_DELTA_PROTOCOL */
35827
35828 static struct packet_player_attribute_chunk *receive_packet_player_attribute_chunk_100(struct connection *pc)
35829{
35830#ifdef FREECIV_DELTA_PROTOCOL
35831 packet_player_attribute_chunk_100_fields fields;
35832 struct packet_player_attribute_chunk *old;
35833 struct genhash **hash = pc->phs.received + PACKET_PLAYER_ATTRIBUTE_CHUNK;
35834#endif /* FREECIV_DELTA_PROTOCOL */
35835 RECEIVE_PACKET_START(packet_player_attribute_chunk, real_packet);
35836#ifdef FREECIV_JSON_CONNECTION
35837 struct plocation field_addr;
35838 {
35839 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35840 field_addr = *field_addr_tmp;
35841 FC_FREE(field_addr_tmp);
35842 }
35843#endif /* FREECIV_JSON_CONNECTION */
35844
35845#ifdef FREECIV_DELTA_PROTOCOL
35846#ifdef FREECIV_JSON_CONNECTION
35847 field_addr.name = "fields";
35848#endif /* FREECIV_JSON_CONNECTION */
35849 DIO_BV_GET(&din, &field_addr, fields);
35850 #ifdef FREECIV_JSON_CONNECTION
35851 field_addr.name = "offset";
35852 #endif /* FREECIV_JSON_CONNECTION */
35853 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->offset)) {
35854 RECEIVE_PACKET_FIELD_ERROR(offset);
35855 }
35856
35857#else /* FREECIV_DELTA_PROTOCOL */
35858 #ifdef FREECIV_JSON_CONNECTION
35859 field_addr.name = "offset";
35860 #endif /* FREECIV_JSON_CONNECTION */
35861 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->offset)) {
35862 RECEIVE_PACKET_FIELD_ERROR(offset);
35863 }
35864 #ifdef FREECIV_JSON_CONNECTION
35865 field_addr.name = "total_length";
35866 #endif /* FREECIV_JSON_CONNECTION */
35867 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->total_length)) {
35868 RECEIVE_PACKET_FIELD_ERROR(total_length);
35869 }
35870 #ifdef FREECIV_JSON_CONNECTION
35871 field_addr.name = "chunk_length";
35872 #endif /* FREECIV_JSON_CONNECTION */
35873 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->chunk_length)) {
35874 RECEIVE_PACKET_FIELD_ERROR(chunk_length);
35875 }
35876 #ifdef FREECIV_JSON_CONNECTION
35877 field_addr.name = "data";
35878 #endif /* FREECIV_JSON_CONNECTION */
35879
35880 if (real_packet->chunk_length > ATTRIBUTE_CHUNK_SIZE) {
35881 RECEIVE_PACKET_FIELD_ERROR(data, ": truncation array");
35882 }
35883 if (!DIO_GET(memory, &din, &field_addr, real_packet->data, real_packet->chunk_length)) {
35884 RECEIVE_PACKET_FIELD_ERROR(data);
35885 }
35886
35887#endif
35888 log_packet_detailed("packet_player_attribute_chunk_100: got info about (%d)",
35889 real_packet->offset);
35890
35891#ifdef FREECIV_DELTA_PROTOCOL
35892 if (NULL == *hash) {
35893 *hash = genhash_new_full(hash_packet_player_attribute_chunk_100, cmp_packet_player_attribute_chunk_100,
35894 NULL, NULL, NULL, free);
35895 }
35896
35897 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
35898 *real_packet = *old;
35899 } else {
35900 int offset = real_packet->offset;
35901
35902 log_packet_detailed(" no old info");
35903 memset(real_packet, 0, sizeof(*real_packet));
35904
35905 real_packet->offset = offset;
35906 }
35907
35908 if (BV_ISSET(fields, 0)) {
35909 log_packet_detailed(" got field 'total_length'");
35910 #ifdef FREECIV_JSON_CONNECTION
35911 field_addr.name = "total_length";
35912 #endif /* FREECIV_JSON_CONNECTION */
35913 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->total_length)) {
35914 RECEIVE_PACKET_FIELD_ERROR(total_length);
35915 }
35916 }
35917 if (BV_ISSET(fields, 1)) {
35918 log_packet_detailed(" got field 'chunk_length'");
35919 #ifdef FREECIV_JSON_CONNECTION
35920 field_addr.name = "chunk_length";
35921 #endif /* FREECIV_JSON_CONNECTION */
35922 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->chunk_length)) {
35923 RECEIVE_PACKET_FIELD_ERROR(chunk_length);
35924 }
35925 }
35926 if (BV_ISSET(fields, 2)) {
35927 log_packet_detailed(" got field 'data'");
35928 #ifdef FREECIV_JSON_CONNECTION
35929 field_addr.name = "data";
35930 #endif /* FREECIV_JSON_CONNECTION */
35931
35932 if (real_packet->chunk_length > ATTRIBUTE_CHUNK_SIZE) {
35933 RECEIVE_PACKET_FIELD_ERROR(data, ": truncation array");
35934 }
35935 if (!DIO_GET(memory, &din, &field_addr, real_packet->data, real_packet->chunk_length)) {
35936 RECEIVE_PACKET_FIELD_ERROR(data);
35937 }
35938 }
35939
35940 if (NULL == old) {
35941 old = fc_malloc(sizeof(*old));
35942 *old = *real_packet;
35943 genhash_insert(*hash, old, old);
35944 } else {
35945 *old = *real_packet;
35946 }
35947
35948#endif /* FREECIV_DELTA_PROTOCOL */
35949 RECEIVE_PACKET_END(real_packet);
35950}
35951
35952 static int send_packet_player_attribute_chunk_100(struct connection *pc, const struct packet_player_attribute_chunk *packet)
35953{
35954 const struct packet_player_attribute_chunk *real_packet = packet;
35955#ifdef FREECIV_DELTA_PROTOCOL
35956 packet_player_attribute_chunk_100_fields fields;
35957 struct packet_player_attribute_chunk *old;
35958 bool differ;
35959 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_ATTRIBUTE_CHUNK;
35960#endif /* FREECIV_DELTA_PROTOCOL */
35961 SEND_PACKET_START(PACKET_PLAYER_ATTRIBUTE_CHUNK);
35962#ifdef FREECIV_JSON_CONNECTION
35963 struct plocation field_addr;
35964 {
35965 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35966 field_addr = *field_addr_tmp;
35967 FC_FREE(field_addr_tmp);
35968 }
35969#endif /* FREECIV_JSON_CONNECTION */
35970
35971 log_packet_detailed("packet_player_attribute_chunk_100: sending info about (%d)",
35972 real_packet->offset);
35973
35974 {
35975 struct packet_player_attribute_chunk *tmp = fc_malloc(sizeof(*tmp));
35976
35977 *tmp = *packet;
35978 pre_send_packet_player_attribute_chunk(pc, tmp);
35979 real_packet = tmp;
35980 }
35981
35982#ifdef FREECIV_DELTA_PROTOCOL
35983 if (NULL == *hash) {
35984 *hash = genhash_new_full(hash_packet_player_attribute_chunk_100, cmp_packet_player_attribute_chunk_100,
35985 NULL, NULL, NULL, free);
35986 }
35987 BV_CLR_ALL(fields);
35988
35989 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
35990 old = fc_malloc(sizeof(*old));
35991 *old = *real_packet;
35992 genhash_insert(*hash, old, old);
35993 memset(old, 0, sizeof(*old));
35994 }
35995 differ = (old->total_length != real_packet->total_length);
35996 if (differ) {
35997 BV_SET(fields, 0);
35998 }
35999
36000 differ = (old->chunk_length != real_packet->chunk_length);
36001 if (differ) {
36002 BV_SET(fields, 1);
36003 }
36004
36005 differ = (memcmp(old->data, real_packet->data, ATTRIBUTE_CHUNK_SIZE) != 0);
36006 if (differ) {
36007 BV_SET(fields, 2);
36008 }
36009
36010
36011#ifdef FREECIV_JSON_CONNECTION
36012 field_addr.name = "fields";
36013#endif /* FREECIV_JSON_CONNECTION */
36014 DIO_BV_PUT(&dout, &field_addr, fields);
36015#ifdef FREECIV_JSON_CONNECTION
36016 field_addr.name = "offset";
36017#endif /* FREECIV_JSON_CONNECTION */
36018 DIO_PUT(uint32, &dout, &field_addr, real_packet->offset);
36019
36020 if (BV_ISSET(fields, 0)) {
36021 log_packet_detailed(" field 'total_length' has changed");
36022 #ifdef FREECIV_JSON_CONNECTION
36023 field_addr.name = "total_length";
36024#endif /* FREECIV_JSON_CONNECTION */
36025 DIO_PUT(uint32, &dout, &field_addr, real_packet->total_length);
36026 }
36027 if (BV_ISSET(fields, 1)) {
36028 log_packet_detailed(" field 'chunk_length' has changed");
36029 #ifdef FREECIV_JSON_CONNECTION
36030 field_addr.name = "chunk_length";
36031#endif /* FREECIV_JSON_CONNECTION */
36032 DIO_PUT(uint16, &dout, &field_addr, real_packet->chunk_length);
36033 }
36034 if (BV_ISSET(fields, 2)) {
36035 log_packet_detailed(" field 'data' has changed");
36036 #ifdef FREECIV_JSON_CONNECTION
36037 field_addr.name = "data";
36038#endif /* FREECIV_JSON_CONNECTION */
36039 DIO_PUT(memory, &dout, &field_addr, &real_packet->data, real_packet->chunk_length);
36040 }
36041
36042 *old = *real_packet;
36043#endif /* FREECIV_DELTA_PROTOCOL */
36044#ifndef FREECIV_DELTA_PROTOCOL
36045#ifdef FREECIV_JSON_CONNECTION
36046 field_addr.name = "offset";
36047#endif /* FREECIV_JSON_CONNECTION */
36048 DIO_PUT(uint32, &dout, &field_addr, real_packet->offset);
36049#ifdef FREECIV_JSON_CONNECTION
36050 field_addr.name = "total_length";
36051#endif /* FREECIV_JSON_CONNECTION */
36052 DIO_PUT(uint32, &dout, &field_addr, real_packet->total_length);
36053#ifdef FREECIV_JSON_CONNECTION
36054 field_addr.name = "chunk_length";
36055#endif /* FREECIV_JSON_CONNECTION */
36056 DIO_PUT(uint16, &dout, &field_addr, real_packet->chunk_length);
36057#ifdef FREECIV_JSON_CONNECTION
36058 field_addr.name = "data";
36059#endif /* FREECIV_JSON_CONNECTION */
36060 DIO_PUT(memory, &dout, &field_addr, &real_packet->data, real_packet->chunk_length);
36061
36062#endif
36063
36064 if (real_packet != packet) {
36065 free((void *) real_packet);
36066 }
36067 SEND_PACKET_END(PACKET_PLAYER_ATTRIBUTE_CHUNK);
36068}
36069
36070 int send_packet_player_attribute_chunk(struct connection *pc, const struct packet_player_attribute_chunk *packet)
36071{
36072 if (!pc->used) {
36073 log_error("WARNING: trying to send data to the closed connection %s",
36074 conn_description(pc));
36075 return -1;
36076 }
36077 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_ATTRIBUTE_CHUNK].packet != NULL, -1,
36078 "Handler for PACKET_PLAYER_ATTRIBUTE_CHUNK not installed");
36079 return pc->phs.handlers->send[PACKET_PLAYER_ATTRIBUTE_CHUNK].packet(pc, packet);
36080}
36081
36082#ifdef FREECIV_DELTA_PROTOCOL
36083static genhash_val_t hash_packet_player_diplstate_100(const void *vkey)
36084{
36085 const struct packet_player_diplstate *key = (const struct packet_player_diplstate *) vkey;
36086
36087 return key->diplstate_id;
36088}
36089
36090static bool cmp_packet_player_diplstate_100(const void *vkey1, const void *vkey2)
36091{
36092 const struct packet_player_diplstate *key1 = (const struct packet_player_diplstate *) vkey1;
36093 const struct packet_player_diplstate *key2 = (const struct packet_player_diplstate *) vkey2;
36094
36095 return key1->diplstate_id == key2->diplstate_id;
36096}
36097 BV_DEFINE(packet_player_diplstate_100_fields, 6);
36098#endif /* FREECIV_DELTA_PROTOCOL */
36099
36100 static struct packet_player_diplstate *receive_packet_player_diplstate_100(struct connection *pc)
36101{
36102#ifdef FREECIV_DELTA_PROTOCOL
36103 packet_player_diplstate_100_fields fields;
36104 struct packet_player_diplstate *old;
36105 struct genhash **hash = pc->phs.received + PACKET_PLAYER_DIPLSTATE;
36106#endif /* FREECIV_DELTA_PROTOCOL */
36107 RECEIVE_PACKET_START(packet_player_diplstate, real_packet);
36108#ifdef FREECIV_JSON_CONNECTION
36109 struct plocation field_addr;
36110 {
36111 struct plocation *field_addr_tmp = plocation_field_new(NULL);
36112 field_addr = *field_addr_tmp;
36113 FC_FREE(field_addr_tmp);
36114 }
36115#endif /* FREECIV_JSON_CONNECTION */
36116
36117#ifdef FREECIV_DELTA_PROTOCOL
36118#ifdef FREECIV_JSON_CONNECTION
36119 field_addr.name = "fields";
36120#endif /* FREECIV_JSON_CONNECTION */
36121 DIO_BV_GET(&din, &field_addr, fields);
36122 #ifdef FREECIV_JSON_CONNECTION
36123 field_addr.name = "diplstate_id";
36124 #endif /* FREECIV_JSON_CONNECTION */
36125 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->diplstate_id)) {
36126 RECEIVE_PACKET_FIELD_ERROR(diplstate_id);
36127 }
36128
36129#else /* FREECIV_DELTA_PROTOCOL */
36130 #ifdef FREECIV_JSON_CONNECTION
36131 field_addr.name = "diplstate_id";
36132 #endif /* FREECIV_JSON_CONNECTION */
36133 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->diplstate_id)) {
36134 RECEIVE_PACKET_FIELD_ERROR(diplstate_id);
36135 }
36136 #ifdef FREECIV_JSON_CONNECTION
36137 field_addr.name = "plr1";
36138 #endif /* FREECIV_JSON_CONNECTION */
36139 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->plr1)) {
36140 RECEIVE_PACKET_FIELD_ERROR(plr1);
36141 }
36142 #ifdef FREECIV_JSON_CONNECTION
36143 field_addr.name = "plr2";
36144 #endif /* FREECIV_JSON_CONNECTION */
36145 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->plr2)) {
36146 RECEIVE_PACKET_FIELD_ERROR(plr2);
36147 }
36148 #ifdef FREECIV_JSON_CONNECTION
36149 field_addr.name = "type";
36150 #endif /* FREECIV_JSON_CONNECTION */
36151 {
36152 int readin;
36153
36154 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
36155 RECEIVE_PACKET_FIELD_ERROR(type);
36156 }
36157 real_packet->type = readin;
36158 }
36159 #ifdef FREECIV_JSON_CONNECTION
36160 field_addr.name = "turns_left";
36161 #endif /* FREECIV_JSON_CONNECTION */
36162 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->turns_left)) {
36163 RECEIVE_PACKET_FIELD_ERROR(turns_left);
36164 }
36165 #ifdef FREECIV_JSON_CONNECTION
36166 field_addr.name = "has_reason_to_cancel";
36167 #endif /* FREECIV_JSON_CONNECTION */
36168 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->has_reason_to_cancel)) {
36169 RECEIVE_PACKET_FIELD_ERROR(has_reason_to_cancel);
36170 }
36171 #ifdef FREECIV_JSON_CONNECTION
36172 field_addr.name = "contact_turns_left";
36173 #endif /* FREECIV_JSON_CONNECTION */
36174 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->contact_turns_left)) {
36175 RECEIVE_PACKET_FIELD_ERROR(contact_turns_left);
36176 }
36177
36178#endif
36179 log_packet_detailed("packet_player_diplstate_100: got info about (%d)",
36180 real_packet->diplstate_id);
36181
36182#ifdef FREECIV_DELTA_PROTOCOL
36183 if (NULL == *hash) {
36184 *hash = genhash_new_full(hash_packet_player_diplstate_100, cmp_packet_player_diplstate_100,
36185 NULL, NULL, NULL, free);
36186 }
36187
36188 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
36189 *real_packet = *old;
36190 } else {
36191 int diplstate_id = real_packet->diplstate_id;
36192
36193 log_packet_detailed(" no old info");
36194 memset(real_packet, 0, sizeof(*real_packet));
36195
36196 real_packet->diplstate_id = diplstate_id;
36197 }
36198
36199 if (BV_ISSET(fields, 0)) {
36200 log_packet_detailed(" got field 'plr1'");
36201 #ifdef FREECIV_JSON_CONNECTION
36202 field_addr.name = "plr1";
36203 #endif /* FREECIV_JSON_CONNECTION */
36204 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->plr1)) {
36205 RECEIVE_PACKET_FIELD_ERROR(plr1);
36206 }
36207 }
36208 if (BV_ISSET(fields, 1)) {
36209 log_packet_detailed(" got field 'plr2'");
36210 #ifdef FREECIV_JSON_CONNECTION
36211 field_addr.name = "plr2";
36212 #endif /* FREECIV_JSON_CONNECTION */
36213 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->plr2)) {
36214 RECEIVE_PACKET_FIELD_ERROR(plr2);
36215 }
36216 }
36217 if (BV_ISSET(fields, 2)) {
36218 log_packet_detailed(" got field 'type'");
36219 #ifdef FREECIV_JSON_CONNECTION
36220 field_addr.name = "type";
36221 #endif /* FREECIV_JSON_CONNECTION */
36222 {
36223 int readin;
36224
36225 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
36226 RECEIVE_PACKET_FIELD_ERROR(type);
36227 }
36228 real_packet->type = readin;
36229 }
36230 }
36231 if (BV_ISSET(fields, 3)) {
36232 log_packet_detailed(" got field 'turns_left'");
36233 #ifdef FREECIV_JSON_CONNECTION
36234 field_addr.name = "turns_left";
36235 #endif /* FREECIV_JSON_CONNECTION */
36236 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->turns_left)) {
36237 RECEIVE_PACKET_FIELD_ERROR(turns_left);
36238 }
36239 }
36240 if (BV_ISSET(fields, 4)) {
36241 log_packet_detailed(" got field 'has_reason_to_cancel'");
36242 #ifdef FREECIV_JSON_CONNECTION
36243 field_addr.name = "has_reason_to_cancel";
36244 #endif /* FREECIV_JSON_CONNECTION */
36245 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->has_reason_to_cancel)) {
36246 RECEIVE_PACKET_FIELD_ERROR(has_reason_to_cancel);
36247 }
36248 }
36249 if (BV_ISSET(fields, 5)) {
36250 log_packet_detailed(" got field 'contact_turns_left'");
36251 #ifdef FREECIV_JSON_CONNECTION
36252 field_addr.name = "contact_turns_left";
36253 #endif /* FREECIV_JSON_CONNECTION */
36254 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->contact_turns_left)) {
36255 RECEIVE_PACKET_FIELD_ERROR(contact_turns_left);
36256 }
36257 }
36258
36259 if (NULL == old) {
36260 old = fc_malloc(sizeof(*old));
36261 *old = *real_packet;
36262 genhash_insert(*hash, old, old);
36263 } else {
36264 *old = *real_packet;
36265 }
36266
36267#endif /* FREECIV_DELTA_PROTOCOL */
36268 RECEIVE_PACKET_END(real_packet);
36269}
36270
36271 static int send_packet_player_diplstate_100(struct connection *pc, const struct packet_player_diplstate *packet)
36272{
36273 const struct packet_player_diplstate *real_packet = packet;
36274#ifdef FREECIV_DELTA_PROTOCOL
36275 packet_player_diplstate_100_fields fields;
36276 struct packet_player_diplstate *old;
36277 bool differ;
36278 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_DIPLSTATE;
36279#endif /* FREECIV_DELTA_PROTOCOL */
36280 SEND_PACKET_START(PACKET_PLAYER_DIPLSTATE);
36281#ifdef FREECIV_JSON_CONNECTION
36282 struct plocation field_addr;
36283 {
36284 struct plocation *field_addr_tmp = plocation_field_new(NULL);
36285 field_addr = *field_addr_tmp;
36286 FC_FREE(field_addr_tmp);
36287 }
36288#endif /* FREECIV_JSON_CONNECTION */
36289
36290 log_packet_detailed("packet_player_diplstate_100: sending info about (%d)",
36291 real_packet->diplstate_id);
36292
36293#ifdef FREECIV_DELTA_PROTOCOL
36294 if (NULL == *hash) {
36295 *hash = genhash_new_full(hash_packet_player_diplstate_100, cmp_packet_player_diplstate_100,
36296 NULL, NULL, NULL, free);
36297 }
36298 BV_CLR_ALL(fields);
36299
36300 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
36301 old = fc_malloc(sizeof(*old));
36302 *old = *real_packet;
36303 genhash_insert(*hash, old, old);
36304 memset(old, 0, sizeof(*old));
36305 }
36306 differ = (old->plr1 != real_packet->plr1);
36307 if (differ) {
36308 BV_SET(fields, 0);
36309 }
36310
36311 differ = (old->plr2 != real_packet->plr2);
36312 if (differ) {
36313 BV_SET(fields, 1);
36314 }
36315
36316 differ = (old->type != real_packet->type);
36317 if (differ) {
36318 BV_SET(fields, 2);
36319 }
36320
36321 differ = (old->turns_left != real_packet->turns_left);
36322 if (differ) {
36323 BV_SET(fields, 3);
36324 }
36325
36326 differ = (old->has_reason_to_cancel != real_packet->has_reason_to_cancel);
36327 if (differ) {
36328 BV_SET(fields, 4);
36329 }
36330
36331 differ = (old->contact_turns_left != real_packet->contact_turns_left);
36332 if (differ) {
36333 BV_SET(fields, 5);
36334 }
36335
36336
36337#ifdef FREECIV_JSON_CONNECTION
36338 field_addr.name = "fields";
36339#endif /* FREECIV_JSON_CONNECTION */
36340 DIO_BV_PUT(&dout, &field_addr, fields);
36341#ifdef FREECIV_JSON_CONNECTION
36342 field_addr.name = "diplstate_id";
36343#endif /* FREECIV_JSON_CONNECTION */
36344 DIO_PUT(uint32, &dout, &field_addr, real_packet->diplstate_id);
36345
36346 if (BV_ISSET(fields, 0)) {
36347 log_packet_detailed(" field 'plr1' has changed");
36348 #ifdef FREECIV_JSON_CONNECTION
36349 field_addr.name = "plr1";
36350#endif /* FREECIV_JSON_CONNECTION */
36351 DIO_PUT(uint16, &dout, &field_addr, real_packet->plr1);
36352 }
36353 if (BV_ISSET(fields, 1)) {
36354 log_packet_detailed(" field 'plr2' has changed");
36355 #ifdef FREECIV_JSON_CONNECTION
36356 field_addr.name = "plr2";
36357#endif /* FREECIV_JSON_CONNECTION */
36358 DIO_PUT(uint16, &dout, &field_addr, real_packet->plr2);
36359 }
36360 if (BV_ISSET(fields, 2)) {
36361 log_packet_detailed(" field 'type' has changed");
36362 #ifdef FREECIV_JSON_CONNECTION
36363 field_addr.name = "type";
36364#endif /* FREECIV_JSON_CONNECTION */
36365 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
36366 }
36367 if (BV_ISSET(fields, 3)) {
36368 log_packet_detailed(" field 'turns_left' has changed");
36369 #ifdef FREECIV_JSON_CONNECTION
36370 field_addr.name = "turns_left";
36371#endif /* FREECIV_JSON_CONNECTION */
36372 DIO_PUT(uint16, &dout, &field_addr, real_packet->turns_left);
36373 }
36374 if (BV_ISSET(fields, 4)) {
36375 log_packet_detailed(" field 'has_reason_to_cancel' has changed");
36376 #ifdef FREECIV_JSON_CONNECTION
36377 field_addr.name = "has_reason_to_cancel";
36378#endif /* FREECIV_JSON_CONNECTION */
36379 DIO_PUT(uint8, &dout, &field_addr, real_packet->has_reason_to_cancel);
36380 }
36381 if (BV_ISSET(fields, 5)) {
36382 log_packet_detailed(" field 'contact_turns_left' has changed");
36383 #ifdef FREECIV_JSON_CONNECTION
36384 field_addr.name = "contact_turns_left";
36385#endif /* FREECIV_JSON_CONNECTION */
36386 DIO_PUT(uint16, &dout, &field_addr, real_packet->contact_turns_left);
36387 }
36388
36389 *old = *real_packet;
36390#endif /* FREECIV_DELTA_PROTOCOL */
36391#ifndef FREECIV_DELTA_PROTOCOL
36392#ifdef FREECIV_JSON_CONNECTION
36393 field_addr.name = "diplstate_id";
36394#endif /* FREECIV_JSON_CONNECTION */
36395 DIO_PUT(uint32, &dout, &field_addr, real_packet->diplstate_id);
36396#ifdef FREECIV_JSON_CONNECTION
36397 field_addr.name = "plr1";
36398#endif /* FREECIV_JSON_CONNECTION */
36399 DIO_PUT(uint16, &dout, &field_addr, real_packet->plr1);
36400#ifdef FREECIV_JSON_CONNECTION
36401 field_addr.name = "plr2";
36402#endif /* FREECIV_JSON_CONNECTION */
36403 DIO_PUT(uint16, &dout, &field_addr, real_packet->plr2);
36404#ifdef FREECIV_JSON_CONNECTION
36405 field_addr.name = "type";
36406#endif /* FREECIV_JSON_CONNECTION */
36407 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
36408#ifdef FREECIV_JSON_CONNECTION
36409 field_addr.name = "turns_left";
36410#endif /* FREECIV_JSON_CONNECTION */
36411 DIO_PUT(uint16, &dout, &field_addr, real_packet->turns_left);
36412#ifdef FREECIV_JSON_CONNECTION
36413 field_addr.name = "has_reason_to_cancel";
36414#endif /* FREECIV_JSON_CONNECTION */
36415 DIO_PUT(uint8, &dout, &field_addr, real_packet->has_reason_to_cancel);
36416#ifdef FREECIV_JSON_CONNECTION
36417 field_addr.name = "contact_turns_left";
36418#endif /* FREECIV_JSON_CONNECTION */
36419 DIO_PUT(uint16, &dout, &field_addr, real_packet->contact_turns_left);
36420
36421#endif
36422 SEND_PACKET_END(PACKET_PLAYER_DIPLSTATE);
36423}
36424
36425 int send_packet_player_diplstate(struct connection *pc, const struct packet_player_diplstate *packet)
36426{
36427 if (!pc->used) {
36428 log_error("WARNING: trying to send data to the closed connection %s",
36429 conn_description(pc));
36430 return -1;
36431 }
36432 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_DIPLSTATE].packet != NULL, -1,
36433 "Handler for PACKET_PLAYER_DIPLSTATE not installed");
36434 return pc->phs.handlers->send[PACKET_PLAYER_DIPLSTATE].packet(pc, packet);
36435}
36436
36437#ifdef FREECIV_DELTA_PROTOCOL
36438#define hash_packet_player_multiplier_100 hash_const
36439
36440#define cmp_packet_player_multiplier_100 cmp_const
36441
36442 BV_DEFINE(packet_player_multiplier_100_fields, 2);
36443#endif /* FREECIV_DELTA_PROTOCOL */
36444
36445 static struct packet_player_multiplier *receive_packet_player_multiplier_100(struct connection *pc)
36446{
36447#ifdef FREECIV_DELTA_PROTOCOL
36448 packet_player_multiplier_100_fields fields;
36449 struct packet_player_multiplier *old;
36450 struct genhash **hash = pc->phs.received + PACKET_PLAYER_MULTIPLIER;
36451#endif /* FREECIV_DELTA_PROTOCOL */
36452 RECEIVE_PACKET_START(packet_player_multiplier, real_packet);
36453#ifdef FREECIV_JSON_CONNECTION
36454 struct plocation field_addr;
36455 {
36456 struct plocation *field_addr_tmp = plocation_field_new(NULL);
36457 field_addr = *field_addr_tmp;
36458 FC_FREE(field_addr_tmp);
36459 }
36460#endif /* FREECIV_JSON_CONNECTION */
36461
36462#ifdef FREECIV_DELTA_PROTOCOL
36463#ifdef FREECIV_JSON_CONNECTION
36464 field_addr.name = "fields";
36465#endif /* FREECIV_JSON_CONNECTION */
36466 DIO_BV_GET(&din, &field_addr, fields);
36467
36468#else /* FREECIV_DELTA_PROTOCOL */
36469 #ifdef FREECIV_JSON_CONNECTION
36470 field_addr.name = "count";
36471 #endif /* FREECIV_JSON_CONNECTION */
36472 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->count)) {
36473 RECEIVE_PACKET_FIELD_ERROR(count);
36474 }
36475 #ifdef FREECIV_JSON_CONNECTION
36476 field_addr.name = "multipliers";
36477 #endif /* FREECIV_JSON_CONNECTION */
36478
36479 {
36480 int i;
36481
36482 #ifdef FREECIV_JSON_CONNECTION
36483 /* Enter array. */
36484 field_addr.sub_location = plocation_elem_new(0);
36485 #endif /* FREECIV_JSON_CONNECTION */
36486
36487 if (real_packet->count > MAX_NUM_MULTIPLIERS) {
36488 RECEIVE_PACKET_FIELD_ERROR(multipliers, ": truncation array");
36489 }
36490 for (i = 0; i < real_packet->count; i++) {
36491 #ifdef FREECIV_JSON_CONNECTION
36492 field_addr.sub_location->number = i;
36493 #endif /* FREECIV_JSON_CONNECTION */
36494 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multipliers[i])) {
36495 RECEIVE_PACKET_FIELD_ERROR(multipliers);
36496 }
36497 }
36498
36499 #ifdef FREECIV_JSON_CONNECTION
36500 /* Exit array. */
36501 free(field_addr.sub_location);
36502 field_addr.sub_location = NULL;
36503 #endif /* FREECIV_JSON_CONNECTION */
36504 }
36505
36506#endif
36507 log_packet_detailed("packet_player_multiplier_100: got info about ()");
36508
36509#ifdef FREECIV_DELTA_PROTOCOL
36510 if (NULL == *hash) {
36511 *hash = genhash_new_full(hash_packet_player_multiplier_100, cmp_packet_player_multiplier_100,
36512 NULL, NULL, NULL, free);
36513 }
36514
36515 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
36516 *real_packet = *old;
36517 } else {
36518 log_packet_detailed(" no old info");
36519 memset(real_packet, 0, sizeof(*real_packet));
36520 }
36521
36522 if (BV_ISSET(fields, 0)) {
36523 log_packet_detailed(" got field 'count'");
36524 #ifdef FREECIV_JSON_CONNECTION
36525 field_addr.name = "count";
36526 #endif /* FREECIV_JSON_CONNECTION */
36527 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->count)) {
36528 RECEIVE_PACKET_FIELD_ERROR(count);
36529 }
36530 }
36531 if (BV_ISSET(fields, 1)) {
36532 log_packet_detailed(" got field 'multipliers'");
36533 #ifdef FREECIV_JSON_CONNECTION
36534 field_addr.name = "multipliers";
36535 #endif /* FREECIV_JSON_CONNECTION */
36536
36537 {
36538 int i;
36539
36540 #ifdef FREECIV_JSON_CONNECTION
36541 /* Enter array. */
36542 field_addr.sub_location = plocation_elem_new(0);
36543 #endif /* FREECIV_JSON_CONNECTION */
36544
36545 if (real_packet->count > MAX_NUM_MULTIPLIERS) {
36546 RECEIVE_PACKET_FIELD_ERROR(multipliers, ": truncation array");
36547 }
36548 for (i = 0; i < real_packet->count; i++) {
36549 #ifdef FREECIV_JSON_CONNECTION
36550 field_addr.sub_location->number = i;
36551 #endif /* FREECIV_JSON_CONNECTION */
36552 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multipliers[i])) {
36553 RECEIVE_PACKET_FIELD_ERROR(multipliers);
36554 }
36555 }
36556
36557 #ifdef FREECIV_JSON_CONNECTION
36558 /* Exit array. */
36559 free(field_addr.sub_location);
36560 field_addr.sub_location = NULL;
36561 #endif /* FREECIV_JSON_CONNECTION */
36562 }
36563 }
36564
36565 if (NULL == old) {
36566 old = fc_malloc(sizeof(*old));
36567 *old = *real_packet;
36568 genhash_insert(*hash, old, old);
36569 } else {
36570 *old = *real_packet;
36571 }
36572
36573#endif /* FREECIV_DELTA_PROTOCOL */
36574 RECEIVE_PACKET_END(real_packet);
36575}
36576
36577 static int send_packet_player_multiplier_100(struct connection *pc, const struct packet_player_multiplier *packet)
36578{
36579 const struct packet_player_multiplier *real_packet = packet;
36580#ifdef FREECIV_DELTA_PROTOCOL
36581 packet_player_multiplier_100_fields fields;
36582 struct packet_player_multiplier *old;
36583 bool differ;
36584 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_MULTIPLIER;
36585#endif /* FREECIV_DELTA_PROTOCOL */
36586 SEND_PACKET_START(PACKET_PLAYER_MULTIPLIER);
36587#ifdef FREECIV_JSON_CONNECTION
36588 struct plocation field_addr;
36589 {
36590 struct plocation *field_addr_tmp = plocation_field_new(NULL);
36591 field_addr = *field_addr_tmp;
36592 FC_FREE(field_addr_tmp);
36593 }
36594#endif /* FREECIV_JSON_CONNECTION */
36595
36596 log_packet_detailed("packet_player_multiplier_100: sending info about ()");
36597
36598#ifdef FREECIV_DELTA_PROTOCOL
36599 if (NULL == *hash) {
36600 *hash = genhash_new_full(hash_packet_player_multiplier_100, cmp_packet_player_multiplier_100,
36601 NULL, NULL, NULL, free);
36602 }
36603 BV_CLR_ALL(fields);
36604
36605 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
36606 old = fc_malloc(sizeof(*old));
36607 *old = *real_packet;
36608 genhash_insert(*hash, old, old);
36609 memset(old, 0, sizeof(*old));
36610 }
36611 differ = (old->count != real_packet->count);
36612 if (differ) {
36613 BV_SET(fields, 0);
36614 }
36615
36616
36617 {
36618 differ = (old->count != real_packet->count);
36619 if (!differ) {
36620 int i;
36621
36622 for (i = 0; i < real_packet->count; i++) {
36623 if (old->multipliers[i] != real_packet->multipliers[i]) {
36624 differ = TRUE;
36625 break;
36626 }
36627 }
36628 }
36629 }
36630 if (differ) {
36631 BV_SET(fields, 1);
36632 }
36633
36634
36635#ifdef FREECIV_JSON_CONNECTION
36636 field_addr.name = "fields";
36637#endif /* FREECIV_JSON_CONNECTION */
36638 DIO_BV_PUT(&dout, &field_addr, fields);
36639
36640 if (BV_ISSET(fields, 0)) {
36641 log_packet_detailed(" field 'count' has changed");
36642 #ifdef FREECIV_JSON_CONNECTION
36643 field_addr.name = "count";
36644#endif /* FREECIV_JSON_CONNECTION */
36645 DIO_PUT(uint16, &dout, &field_addr, real_packet->count);
36646 }
36647 if (BV_ISSET(fields, 1)) {
36648 log_packet_detailed(" field 'multipliers' has changed");
36649 #ifdef FREECIV_JSON_CONNECTION
36650 field_addr.name = "multipliers";
36651#endif /* FREECIV_JSON_CONNECTION */
36652
36653 {
36654 int i;
36655
36656#ifdef FREECIV_JSON_CONNECTION
36657 /* Create the array. */
36658 DIO_PUT(farray, &dout, &field_addr, real_packet->count);
36659
36660 /* Enter the array. */
36661 field_addr.sub_location = plocation_elem_new(0);
36662#endif /* FREECIV_JSON_CONNECTION */
36663
36664 for (i = 0; i < real_packet->count; i++) {
36665#ifdef FREECIV_JSON_CONNECTION
36666 /* Next array element. */
36667 field_addr.sub_location->number = i;
36668#endif /* FREECIV_JSON_CONNECTION */
36669 DIO_PUT(sint32, &dout, &field_addr, real_packet->multipliers[i]);
36670 }
36671
36672#ifdef FREECIV_JSON_CONNECTION
36673 /* Exit array. */
36674 free(field_addr.sub_location);
36675 field_addr.sub_location = NULL;
36676#endif /* FREECIV_JSON_CONNECTION */
36677 }
36678 }
36679
36680 *old = *real_packet;
36681#endif /* FREECIV_DELTA_PROTOCOL */
36682#ifndef FREECIV_DELTA_PROTOCOL
36683#ifdef FREECIV_JSON_CONNECTION
36684 field_addr.name = "count";
36685#endif /* FREECIV_JSON_CONNECTION */
36686 DIO_PUT(uint16, &dout, &field_addr, real_packet->count);
36687#ifdef FREECIV_JSON_CONNECTION
36688 field_addr.name = "multipliers";
36689#endif /* FREECIV_JSON_CONNECTION */
36690
36691 {
36692 int i;
36693
36694#ifdef FREECIV_JSON_CONNECTION
36695 /* Create the array. */
36696 DIO_PUT(farray, &dout, &field_addr, real_packet->count);
36697
36698 /* Enter the array. */
36699 field_addr.sub_location = plocation_elem_new(0);
36700#endif /* FREECIV_JSON_CONNECTION */
36701
36702 for (i = 0; i < real_packet->count; i++) {
36703#ifdef FREECIV_JSON_CONNECTION
36704 /* Next array element. */
36705 field_addr.sub_location->number = i;
36706#endif /* FREECIV_JSON_CONNECTION */
36707 DIO_PUT(sint32, &dout, &field_addr, real_packet->multipliers[i]);
36708 }
36709
36710#ifdef FREECIV_JSON_CONNECTION
36711 /* Exit array. */
36712 free(field_addr.sub_location);
36713 field_addr.sub_location = NULL;
36714#endif /* FREECIV_JSON_CONNECTION */
36715 }
36716
36717#endif
36718 SEND_PACKET_END(PACKET_PLAYER_MULTIPLIER);
36719}
36720
36721 int send_packet_player_multiplier(struct connection *pc, const struct packet_player_multiplier *packet)
36722{
36723 if (!pc->used) {
36724 log_error("WARNING: trying to send data to the closed connection %s",
36725 conn_description(pc));
36726 return -1;
36727 }
36728 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_MULTIPLIER].packet != NULL, -1,
36729 "Handler for PACKET_PLAYER_MULTIPLIER not installed");
36730 return pc->phs.handlers->send[PACKET_PLAYER_MULTIPLIER].packet(pc, packet);
36731}
36732
36733#ifdef FREECIV_DELTA_PROTOCOL
36734static genhash_val_t hash_packet_research_info_100(const void *vkey)
36735{
36736 const struct packet_research_info *key = (const struct packet_research_info *) vkey;
36737
36738 return key->id;
36739}
36740
36741static bool cmp_packet_research_info_100(const void *vkey1, const void *vkey2)
36742{
36743 const struct packet_research_info *key1 = (const struct packet_research_info *) vkey1;
36744 const struct packet_research_info *key2 = (const struct packet_research_info *) vkey2;
36745
36746 return key1->id == key2->id;
36747}
36748 BV_DEFINE(packet_research_info_100_fields, 8);
36749#endif /* FREECIV_DELTA_PROTOCOL */
36750
36751 static struct packet_research_info *receive_packet_research_info_100(struct connection *pc)
36752{
36753#ifdef FREECIV_DELTA_PROTOCOL
36754 packet_research_info_100_fields fields;
36755 struct packet_research_info *old;
36756 struct genhash **hash = pc->phs.received + PACKET_RESEARCH_INFO;
36757#endif /* FREECIV_DELTA_PROTOCOL */
36758 RECEIVE_PACKET_START(packet_research_info, real_packet);
36759#ifdef FREECIV_JSON_CONNECTION
36760 struct plocation field_addr;
36761 {
36762 struct plocation *field_addr_tmp = plocation_field_new(NULL);
36763 field_addr = *field_addr_tmp;
36764 FC_FREE(field_addr_tmp);
36765 }
36766#endif /* FREECIV_JSON_CONNECTION */
36767
36768#ifdef FREECIV_DELTA_PROTOCOL
36769#ifdef FREECIV_JSON_CONNECTION
36770 field_addr.name = "fields";
36771#endif /* FREECIV_JSON_CONNECTION */
36772 DIO_BV_GET(&din, &field_addr, fields);
36773 #ifdef FREECIV_JSON_CONNECTION
36774 field_addr.name = "id";
36775 #endif /* FREECIV_JSON_CONNECTION */
36776 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
36777 RECEIVE_PACKET_FIELD_ERROR(id);
36778 }
36779
36780#else /* FREECIV_DELTA_PROTOCOL */
36781 #ifdef FREECIV_JSON_CONNECTION
36782 field_addr.name = "id";
36783 #endif /* FREECIV_JSON_CONNECTION */
36784 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
36785 RECEIVE_PACKET_FIELD_ERROR(id);
36786 }
36787 #ifdef FREECIV_JSON_CONNECTION
36788 field_addr.name = "techs_researched";
36789 #endif /* FREECIV_JSON_CONNECTION */
36790 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->techs_researched)) {
36791 RECEIVE_PACKET_FIELD_ERROR(techs_researched);
36792 }
36793 #ifdef FREECIV_JSON_CONNECTION
36794 field_addr.name = "future_tech";
36795 #endif /* FREECIV_JSON_CONNECTION */
36796 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->future_tech)) {
36797 RECEIVE_PACKET_FIELD_ERROR(future_tech);
36798 }
36799 #ifdef FREECIV_JSON_CONNECTION
36800 field_addr.name = "researching";
36801 #endif /* FREECIV_JSON_CONNECTION */
36802 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->researching)) {
36803 RECEIVE_PACKET_FIELD_ERROR(researching);
36804 }
36805 #ifdef FREECIV_JSON_CONNECTION
36806 field_addr.name = "researching_cost";
36807 #endif /* FREECIV_JSON_CONNECTION */
36808 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->researching_cost)) {
36809 RECEIVE_PACKET_FIELD_ERROR(researching_cost);
36810 }
36811 #ifdef FREECIV_JSON_CONNECTION
36812 field_addr.name = "bulbs_researched";
36813 #endif /* FREECIV_JSON_CONNECTION */
36814 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->bulbs_researched)) {
36815 RECEIVE_PACKET_FIELD_ERROR(bulbs_researched);
36816 }
36817 #ifdef FREECIV_JSON_CONNECTION
36818 field_addr.name = "tech_goal";
36819 #endif /* FREECIV_JSON_CONNECTION */
36820 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tech_goal)) {
36821 RECEIVE_PACKET_FIELD_ERROR(tech_goal);
36822 }
36823 #ifdef FREECIV_JSON_CONNECTION
36824 field_addr.name = "total_bulbs_prod";
36825 #endif /* FREECIV_JSON_CONNECTION */
36826 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->total_bulbs_prod)) {
36827 RECEIVE_PACKET_FIELD_ERROR(total_bulbs_prod);
36828 }
36829 #ifdef FREECIV_JSON_CONNECTION
36830 field_addr.name = "inventions";
36831 #endif /* FREECIV_JSON_CONNECTION */
36832 if (!DIO_GET(string, &din, &field_addr, real_packet->inventions, sizeof(real_packet->inventions))) {
36833 RECEIVE_PACKET_FIELD_ERROR(inventions);
36834 }
36835
36836#endif
36837 log_packet_detailed("packet_research_info_100: got info about (%d)",
36838 real_packet->id);
36839
36840#ifdef FREECIV_DELTA_PROTOCOL
36841 if (NULL == *hash) {
36842 *hash = genhash_new_full(hash_packet_research_info_100, cmp_packet_research_info_100,
36843 NULL, NULL, NULL, free);
36844 }
36845
36846 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
36847 *real_packet = *old;
36848 } else {
36849 int id = real_packet->id;
36850
36851 log_packet_detailed(" no old info");
36852 memset(real_packet, 0, sizeof(*real_packet));
36853
36854 real_packet->id = id;
36855 }
36856
36857 if (BV_ISSET(fields, 0)) {
36858 log_packet_detailed(" got field 'techs_researched'");
36859 #ifdef FREECIV_JSON_CONNECTION
36860 field_addr.name = "techs_researched";
36861 #endif /* FREECIV_JSON_CONNECTION */
36862 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->techs_researched)) {
36863 RECEIVE_PACKET_FIELD_ERROR(techs_researched);
36864 }
36865 }
36866 if (BV_ISSET(fields, 1)) {
36867 log_packet_detailed(" got field 'future_tech'");
36868 #ifdef FREECIV_JSON_CONNECTION
36869 field_addr.name = "future_tech";
36870 #endif /* FREECIV_JSON_CONNECTION */
36871 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->future_tech)) {
36872 RECEIVE_PACKET_FIELD_ERROR(future_tech);
36873 }
36874 }
36875 if (BV_ISSET(fields, 2)) {
36876 log_packet_detailed(" got field 'researching'");
36877 #ifdef FREECIV_JSON_CONNECTION
36878 field_addr.name = "researching";
36879 #endif /* FREECIV_JSON_CONNECTION */
36880 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->researching)) {
36881 RECEIVE_PACKET_FIELD_ERROR(researching);
36882 }
36883 }
36884 if (BV_ISSET(fields, 3)) {
36885 log_packet_detailed(" got field 'researching_cost'");
36886 #ifdef FREECIV_JSON_CONNECTION
36887 field_addr.name = "researching_cost";
36888 #endif /* FREECIV_JSON_CONNECTION */
36889 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->researching_cost)) {
36890 RECEIVE_PACKET_FIELD_ERROR(researching_cost);
36891 }
36892 }
36893 if (BV_ISSET(fields, 4)) {
36894 log_packet_detailed(" got field 'bulbs_researched'");
36895 #ifdef FREECIV_JSON_CONNECTION
36896 field_addr.name = "bulbs_researched";
36897 #endif /* FREECIV_JSON_CONNECTION */
36898 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->bulbs_researched)) {
36899 RECEIVE_PACKET_FIELD_ERROR(bulbs_researched);
36900 }
36901 }
36902 if (BV_ISSET(fields, 5)) {
36903 log_packet_detailed(" got field 'tech_goal'");
36904 #ifdef FREECIV_JSON_CONNECTION
36905 field_addr.name = "tech_goal";
36906 #endif /* FREECIV_JSON_CONNECTION */
36907 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tech_goal)) {
36908 RECEIVE_PACKET_FIELD_ERROR(tech_goal);
36909 }
36910 }
36911 if (BV_ISSET(fields, 6)) {
36912 log_packet_detailed(" got field 'total_bulbs_prod'");
36913 #ifdef FREECIV_JSON_CONNECTION
36914 field_addr.name = "total_bulbs_prod";
36915 #endif /* FREECIV_JSON_CONNECTION */
36916 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->total_bulbs_prod)) {
36917 RECEIVE_PACKET_FIELD_ERROR(total_bulbs_prod);
36918 }
36919 }
36920 if (BV_ISSET(fields, 7)) {
36921 log_packet_detailed(" got field 'inventions'");
36922 #ifdef FREECIV_JSON_CONNECTION
36923 field_addr.name = "inventions";
36924 #endif /* FREECIV_JSON_CONNECTION */
36925 if (!DIO_GET(string, &din, &field_addr, real_packet->inventions, sizeof(real_packet->inventions))) {
36926 RECEIVE_PACKET_FIELD_ERROR(inventions);
36927 }
36928 }
36929
36930 if (NULL == old) {
36931 old = fc_malloc(sizeof(*old));
36932 *old = *real_packet;
36933 genhash_insert(*hash, old, old);
36934 } else {
36935 *old = *real_packet;
36936 }
36937
36938#endif /* FREECIV_DELTA_PROTOCOL */
36939 RECEIVE_PACKET_END(real_packet);
36940}
36941
36942 static int send_packet_research_info_100(struct connection *pc, const struct packet_research_info *packet)
36943{
36944 const struct packet_research_info *real_packet = packet;
36945#ifdef FREECIV_DELTA_PROTOCOL
36946 packet_research_info_100_fields fields;
36947 struct packet_research_info *old;
36948 bool differ;
36949 struct genhash **hash = pc->phs.sent + PACKET_RESEARCH_INFO;
36950 int different = 0;
36951#endif /* FREECIV_DELTA_PROTOCOL */
36952 SEND_PACKET_START(PACKET_RESEARCH_INFO);
36953#ifdef FREECIV_JSON_CONNECTION
36954 struct plocation field_addr;
36955 {
36956 struct plocation *field_addr_tmp = plocation_field_new(NULL);
36957 field_addr = *field_addr_tmp;
36958 FC_FREE(field_addr_tmp);
36959 }
36960#endif /* FREECIV_JSON_CONNECTION */
36961
36962 log_packet_detailed("packet_research_info_100: sending info about (%d)",
36963 real_packet->id);
36964
36965#ifdef FREECIV_DELTA_PROTOCOL
36966 if (NULL == *hash) {
36967 *hash = genhash_new_full(hash_packet_research_info_100, cmp_packet_research_info_100,
36968 NULL, NULL, NULL, free);
36969 }
36970 BV_CLR_ALL(fields);
36971
36972 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
36973 old = fc_malloc(sizeof(*old));
36974 *old = *real_packet;
36975 genhash_insert(*hash, old, old);
36976 memset(old, 0, sizeof(*old));
36977 different = 1; /* Force to send. */
36978 }
36979 differ = (old->techs_researched != real_packet->techs_researched);
36980 if (differ) {
36981 different++;
36982 BV_SET(fields, 0);
36983 }
36984
36985 differ = (old->future_tech != real_packet->future_tech);
36986 if (differ) {
36987 different++;
36988 BV_SET(fields, 1);
36989 }
36990
36991 differ = (old->researching != real_packet->researching);
36992 if (differ) {
36993 different++;
36994 BV_SET(fields, 2);
36995 }
36996
36997 differ = (old->researching_cost != real_packet->researching_cost);
36998 if (differ) {
36999 different++;
37000 BV_SET(fields, 3);
37001 }
37002
37003 differ = (old->bulbs_researched != real_packet->bulbs_researched);
37004 if (differ) {
37005 different++;
37006 BV_SET(fields, 4);
37007 }
37008
37009 differ = (old->tech_goal != real_packet->tech_goal);
37010 if (differ) {
37011 different++;
37012 BV_SET(fields, 5);
37013 }
37014
37015 differ = (old->total_bulbs_prod != real_packet->total_bulbs_prod);
37016 if (differ) {
37017 different++;
37018 BV_SET(fields, 6);
37019 }
37020
37021 differ = (strcmp(old->inventions, real_packet->inventions) != 0);
37022 if (differ) {
37023 different++;
37024 BV_SET(fields, 7);
37025 }
37026
37027
37028 if (different == 0) {
37029 log_packet_detailed(" no change -> discard");
37030 return 0;
37031 }
37032
37033#ifdef FREECIV_JSON_CONNECTION
37034 field_addr.name = "fields";
37035#endif /* FREECIV_JSON_CONNECTION */
37036 DIO_BV_PUT(&dout, &field_addr, fields);
37037#ifdef FREECIV_JSON_CONNECTION
37038 field_addr.name = "id";
37039#endif /* FREECIV_JSON_CONNECTION */
37040 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
37041
37042 if (BV_ISSET(fields, 0)) {
37043 log_packet_detailed(" field 'techs_researched' has changed");
37044 #ifdef FREECIV_JSON_CONNECTION
37045 field_addr.name = "techs_researched";
37046#endif /* FREECIV_JSON_CONNECTION */
37047 DIO_PUT(uint32, &dout, &field_addr, real_packet->techs_researched);
37048 }
37049 if (BV_ISSET(fields, 1)) {
37050 log_packet_detailed(" field 'future_tech' has changed");
37051 #ifdef FREECIV_JSON_CONNECTION
37052 field_addr.name = "future_tech";
37053#endif /* FREECIV_JSON_CONNECTION */
37054 DIO_PUT(uint16, &dout, &field_addr, real_packet->future_tech);
37055 }
37056 if (BV_ISSET(fields, 2)) {
37057 log_packet_detailed(" field 'researching' has changed");
37058 #ifdef FREECIV_JSON_CONNECTION
37059 field_addr.name = "researching";
37060#endif /* FREECIV_JSON_CONNECTION */
37061 DIO_PUT(uint8, &dout, &field_addr, real_packet->researching);
37062 }
37063 if (BV_ISSET(fields, 3)) {
37064 log_packet_detailed(" field 'researching_cost' has changed");
37065 #ifdef FREECIV_JSON_CONNECTION
37066 field_addr.name = "researching_cost";
37067#endif /* FREECIV_JSON_CONNECTION */
37068 DIO_PUT(uint32, &dout, &field_addr, real_packet->researching_cost);
37069 }
37070 if (BV_ISSET(fields, 4)) {
37071 log_packet_detailed(" field 'bulbs_researched' has changed");
37072 #ifdef FREECIV_JSON_CONNECTION
37073 field_addr.name = "bulbs_researched";
37074#endif /* FREECIV_JSON_CONNECTION */
37075 DIO_PUT(uint32, &dout, &field_addr, real_packet->bulbs_researched);
37076 }
37077 if (BV_ISSET(fields, 5)) {
37078 log_packet_detailed(" field 'tech_goal' has changed");
37079 #ifdef FREECIV_JSON_CONNECTION
37080 field_addr.name = "tech_goal";
37081#endif /* FREECIV_JSON_CONNECTION */
37082 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_goal);
37083 }
37084 if (BV_ISSET(fields, 6)) {
37085 log_packet_detailed(" field 'total_bulbs_prod' has changed");
37086 #ifdef FREECIV_JSON_CONNECTION
37087 field_addr.name = "total_bulbs_prod";
37088#endif /* FREECIV_JSON_CONNECTION */
37089 DIO_PUT(sint32, &dout, &field_addr, real_packet->total_bulbs_prod);
37090 }
37091 if (BV_ISSET(fields, 7)) {
37092 log_packet_detailed(" field 'inventions' has changed");
37093 #ifdef FREECIV_JSON_CONNECTION
37094 field_addr.name = "inventions";
37095#endif /* FREECIV_JSON_CONNECTION */
37096 DIO_PUT(string, &dout, &field_addr, real_packet->inventions);
37097 }
37098
37099 *old = *real_packet;
37100#endif /* FREECIV_DELTA_PROTOCOL */
37101#ifndef FREECIV_DELTA_PROTOCOL
37102#ifdef FREECIV_JSON_CONNECTION
37103 field_addr.name = "id";
37104#endif /* FREECIV_JSON_CONNECTION */
37105 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
37106#ifdef FREECIV_JSON_CONNECTION
37107 field_addr.name = "techs_researched";
37108#endif /* FREECIV_JSON_CONNECTION */
37109 DIO_PUT(uint32, &dout, &field_addr, real_packet->techs_researched);
37110#ifdef FREECIV_JSON_CONNECTION
37111 field_addr.name = "future_tech";
37112#endif /* FREECIV_JSON_CONNECTION */
37113 DIO_PUT(uint16, &dout, &field_addr, real_packet->future_tech);
37114#ifdef FREECIV_JSON_CONNECTION
37115 field_addr.name = "researching";
37116#endif /* FREECIV_JSON_CONNECTION */
37117 DIO_PUT(uint8, &dout, &field_addr, real_packet->researching);
37118#ifdef FREECIV_JSON_CONNECTION
37119 field_addr.name = "researching_cost";
37120#endif /* FREECIV_JSON_CONNECTION */
37121 DIO_PUT(uint32, &dout, &field_addr, real_packet->researching_cost);
37122#ifdef FREECIV_JSON_CONNECTION
37123 field_addr.name = "bulbs_researched";
37124#endif /* FREECIV_JSON_CONNECTION */
37125 DIO_PUT(uint32, &dout, &field_addr, real_packet->bulbs_researched);
37126#ifdef FREECIV_JSON_CONNECTION
37127 field_addr.name = "tech_goal";
37128#endif /* FREECIV_JSON_CONNECTION */
37129 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_goal);
37130#ifdef FREECIV_JSON_CONNECTION
37131 field_addr.name = "total_bulbs_prod";
37132#endif /* FREECIV_JSON_CONNECTION */
37133 DIO_PUT(sint32, &dout, &field_addr, real_packet->total_bulbs_prod);
37134#ifdef FREECIV_JSON_CONNECTION
37135 field_addr.name = "inventions";
37136#endif /* FREECIV_JSON_CONNECTION */
37137 DIO_PUT(string, &dout, &field_addr, real_packet->inventions);
37138
37139#endif
37140 SEND_PACKET_END(PACKET_RESEARCH_INFO);
37141}
37142
37143 int send_packet_research_info(struct connection *pc, const struct packet_research_info *packet)
37144{
37145 if (!pc->used) {
37146 log_error("WARNING: trying to send data to the closed connection %s",
37147 conn_description(pc));
37148 return -1;
37149 }
37150 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RESEARCH_INFO].packet != NULL, -1,
37151 "Handler for PACKET_RESEARCH_INFO not installed");
37152 return pc->phs.handlers->send[PACKET_RESEARCH_INFO].packet(pc, packet);
37153}
37154
37155 void lsend_packet_research_info(struct conn_list *dest, const struct packet_research_info *packet)
37156{
37157 conn_list_iterate(dest, pconn) {
37158 send_packet_research_info(pconn, packet);
37159 } conn_list_iterate_end;
37160}
37161
37162#ifdef FREECIV_DELTA_PROTOCOL
37163#define hash_packet_unknown_research_100 hash_const
37164
37165#define cmp_packet_unknown_research_100 cmp_const
37166
37167 BV_DEFINE(packet_unknown_research_100_fields, 1);
37168#endif /* FREECIV_DELTA_PROTOCOL */
37169
37170 static struct packet_unknown_research *receive_packet_unknown_research_100(struct connection *pc)
37171{
37172#ifdef FREECIV_DELTA_PROTOCOL
37173 packet_unknown_research_100_fields fields;
37174 struct packet_unknown_research *old;
37175 struct genhash **hash = pc->phs.received + PACKET_UNKNOWN_RESEARCH;
37176#endif /* FREECIV_DELTA_PROTOCOL */
37177 RECEIVE_PACKET_START(packet_unknown_research, real_packet);
37178#ifdef FREECIV_JSON_CONNECTION
37179 struct plocation field_addr;
37180 {
37181 struct plocation *field_addr_tmp = plocation_field_new(NULL);
37182 field_addr = *field_addr_tmp;
37183 FC_FREE(field_addr_tmp);
37184 }
37185#endif /* FREECIV_JSON_CONNECTION */
37186
37187#ifdef FREECIV_DELTA_PROTOCOL
37188#ifdef FREECIV_JSON_CONNECTION
37189 field_addr.name = "fields";
37190#endif /* FREECIV_JSON_CONNECTION */
37191 DIO_BV_GET(&din, &field_addr, fields);
37192
37193#else /* FREECIV_DELTA_PROTOCOL */
37194 #ifdef FREECIV_JSON_CONNECTION
37195 field_addr.name = "id";
37196 #endif /* FREECIV_JSON_CONNECTION */
37197 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
37198 RECEIVE_PACKET_FIELD_ERROR(id);
37199 }
37200
37201#endif
37202 log_packet_detailed("packet_unknown_research_100: got info about ()");
37203
37204#ifdef FREECIV_DELTA_PROTOCOL
37205 if (NULL == *hash) {
37206 *hash = genhash_new_full(hash_packet_unknown_research_100, cmp_packet_unknown_research_100,
37207 NULL, NULL, NULL, free);
37208 }
37209
37210 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
37211 *real_packet = *old;
37212 } else {
37213 log_packet_detailed(" no old info");
37214 memset(real_packet, 0, sizeof(*real_packet));
37215 }
37216
37217 if (BV_ISSET(fields, 0)) {
37218 log_packet_detailed(" got field 'id'");
37219 #ifdef FREECIV_JSON_CONNECTION
37220 field_addr.name = "id";
37221 #endif /* FREECIV_JSON_CONNECTION */
37222 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
37223 RECEIVE_PACKET_FIELD_ERROR(id);
37224 }
37225 }
37226
37227 if (NULL == old) {
37228 old = fc_malloc(sizeof(*old));
37229 *old = *real_packet;
37230 genhash_insert(*hash, old, old);
37231 } else {
37232 *old = *real_packet;
37233 }
37234
37235 hash = pc->phs.received + PACKET_RESEARCH_INFO;
37236 if (NULL != *hash) {
37237 genhash_remove(*hash, real_packet);
37238 }
37239
37240#endif /* FREECIV_DELTA_PROTOCOL */
37241 RECEIVE_PACKET_END(real_packet);
37242}
37243
37244 static int send_packet_unknown_research_100(struct connection *pc, const struct packet_unknown_research *packet)
37245{
37246 const struct packet_unknown_research *real_packet = packet;
37247#ifdef FREECIV_DELTA_PROTOCOL
37248 packet_unknown_research_100_fields fields;
37249 struct packet_unknown_research *old;
37250 bool differ;
37251 struct genhash **hash = pc->phs.sent + PACKET_UNKNOWN_RESEARCH;
37252 int different = 0;
37253#endif /* FREECIV_DELTA_PROTOCOL */
37254 SEND_PACKET_START(PACKET_UNKNOWN_RESEARCH);
37255#ifdef FREECIV_JSON_CONNECTION
37256 struct plocation field_addr;
37257 {
37258 struct plocation *field_addr_tmp = plocation_field_new(NULL);
37259 field_addr = *field_addr_tmp;
37260 FC_FREE(field_addr_tmp);
37261 }
37262#endif /* FREECIV_JSON_CONNECTION */
37263
37264 log_packet_detailed("packet_unknown_research_100: sending info about ()");
37265
37266#ifdef FREECIV_DELTA_PROTOCOL
37267 if (NULL == *hash) {
37268 *hash = genhash_new_full(hash_packet_unknown_research_100, cmp_packet_unknown_research_100,
37269 NULL, NULL, NULL, free);
37270 }
37271 BV_CLR_ALL(fields);
37272
37273 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
37274 old = fc_malloc(sizeof(*old));
37275 *old = *real_packet;
37276 genhash_insert(*hash, old, old);
37277 memset(old, 0, sizeof(*old));
37278 different = 1; /* Force to send. */
37279 }
37280 differ = (old->id != real_packet->id);
37281 if (differ) {
37282 different++;
37283 BV_SET(fields, 0);
37284 }
37285
37286
37287 if (different == 0) {
37288 log_packet_detailed(" no change -> discard");
37289 return 0;
37290 }
37291
37292#ifdef FREECIV_JSON_CONNECTION
37293 field_addr.name = "fields";
37294#endif /* FREECIV_JSON_CONNECTION */
37295 DIO_BV_PUT(&dout, &field_addr, fields);
37296
37297 if (BV_ISSET(fields, 0)) {
37298 log_packet_detailed(" field 'id' has changed");
37299 #ifdef FREECIV_JSON_CONNECTION
37300 field_addr.name = "id";
37301#endif /* FREECIV_JSON_CONNECTION */
37302 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
37303 }
37304
37305 *old = *real_packet;
37306
37307 hash = pc->phs.sent + PACKET_RESEARCH_INFO;
37308 if (NULL != *hash) {
37309 genhash_remove(*hash, real_packet);
37310 }
37311#endif /* FREECIV_DELTA_PROTOCOL */
37312#ifndef FREECIV_DELTA_PROTOCOL
37313#ifdef FREECIV_JSON_CONNECTION
37314 field_addr.name = "id";
37315#endif /* FREECIV_JSON_CONNECTION */
37316 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
37317
37318#endif
37319 SEND_PACKET_END(PACKET_UNKNOWN_RESEARCH);
37320}
37321
37322 int send_packet_unknown_research(struct connection *pc, const struct packet_unknown_research *packet)
37323{
37324 if (!pc->used) {
37325 log_error("WARNING: trying to send data to the closed connection %s",
37326 conn_description(pc));
37327 return -1;
37328 }
37329 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNKNOWN_RESEARCH].packet != NULL, -1,
37330 "Handler for PACKET_UNKNOWN_RESEARCH not installed");
37331 return pc->phs.handlers->send[PACKET_UNKNOWN_RESEARCH].packet(pc, packet);
37332}
37333
37334#ifdef FREECIV_DELTA_PROTOCOL
37335#define hash_packet_player_research_100 hash_const
37336
37337#define cmp_packet_player_research_100 cmp_const
37338
37339 BV_DEFINE(packet_player_research_100_fields, 1);
37340#endif /* FREECIV_DELTA_PROTOCOL */
37341
37342 static struct packet_player_research *receive_packet_player_research_100(struct connection *pc)
37343{
37344#ifdef FREECIV_DELTA_PROTOCOL
37345 packet_player_research_100_fields fields;
37346 struct packet_player_research *old;
37347 struct genhash **hash = pc->phs.received + PACKET_PLAYER_RESEARCH;
37348#endif /* FREECIV_DELTA_PROTOCOL */
37349 RECEIVE_PACKET_START(packet_player_research, real_packet);
37350#ifdef FREECIV_JSON_CONNECTION
37351 struct plocation field_addr;
37352 {
37353 struct plocation *field_addr_tmp = plocation_field_new(NULL);
37354 field_addr = *field_addr_tmp;
37355 FC_FREE(field_addr_tmp);
37356 }
37357#endif /* FREECIV_JSON_CONNECTION */
37358
37359#ifdef FREECIV_DELTA_PROTOCOL
37360#ifdef FREECIV_JSON_CONNECTION
37361 field_addr.name = "fields";
37362#endif /* FREECIV_JSON_CONNECTION */
37363 DIO_BV_GET(&din, &field_addr, fields);
37364
37365#else /* FREECIV_DELTA_PROTOCOL */
37366 #ifdef FREECIV_JSON_CONNECTION
37367 field_addr.name = "tech";
37368 #endif /* FREECIV_JSON_CONNECTION */
37369 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tech)) {
37370 RECEIVE_PACKET_FIELD_ERROR(tech);
37371 }
37372
37373#endif
37374 log_packet_detailed("packet_player_research_100: got info about ()");
37375
37376#ifdef FREECIV_DELTA_PROTOCOL
37377 if (NULL == *hash) {
37378 *hash = genhash_new_full(hash_packet_player_research_100, cmp_packet_player_research_100,
37379 NULL, NULL, NULL, free);
37380 }
37381
37382 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
37383 *real_packet = *old;
37384 } else {
37385 log_packet_detailed(" no old info");
37386 memset(real_packet, 0, sizeof(*real_packet));
37387 }
37388
37389 if (BV_ISSET(fields, 0)) {
37390 log_packet_detailed(" got field 'tech'");
37391 #ifdef FREECIV_JSON_CONNECTION
37392 field_addr.name = "tech";
37393 #endif /* FREECIV_JSON_CONNECTION */
37394 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tech)) {
37395 RECEIVE_PACKET_FIELD_ERROR(tech);
37396 }
37397 }
37398
37399 if (NULL == old) {
37400 old = fc_malloc(sizeof(*old));
37401 *old = *real_packet;
37402 genhash_insert(*hash, old, old);
37403 } else {
37404 *old = *real_packet;
37405 }
37406
37407#endif /* FREECIV_DELTA_PROTOCOL */
37408 RECEIVE_PACKET_END(real_packet);
37409}
37410
37411 static int send_packet_player_research_100(struct connection *pc, const struct packet_player_research *packet)
37412{
37413 const struct packet_player_research *real_packet = packet;
37414#ifdef FREECIV_DELTA_PROTOCOL
37415 packet_player_research_100_fields fields;
37416 struct packet_player_research *old;
37417 bool differ;
37418 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_RESEARCH;
37419#endif /* FREECIV_DELTA_PROTOCOL */
37420 SEND_PACKET_START(PACKET_PLAYER_RESEARCH);
37421#ifdef FREECIV_JSON_CONNECTION
37422 struct plocation field_addr;
37423 {
37424 struct plocation *field_addr_tmp = plocation_field_new(NULL);
37425 field_addr = *field_addr_tmp;
37426 FC_FREE(field_addr_tmp);
37427 }
37428#endif /* FREECIV_JSON_CONNECTION */
37429
37430 log_packet_detailed("packet_player_research_100: sending info about ()");
37431
37432#ifdef FREECIV_DELTA_PROTOCOL
37433 if (NULL == *hash) {
37434 *hash = genhash_new_full(hash_packet_player_research_100, cmp_packet_player_research_100,
37435 NULL, NULL, NULL, free);
37436 }
37437 BV_CLR_ALL(fields);
37438
37439 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
37440 old = fc_malloc(sizeof(*old));
37441 *old = *real_packet;
37442 genhash_insert(*hash, old, old);
37443 memset(old, 0, sizeof(*old));
37444 }
37445 differ = (old->tech != real_packet->tech);
37446 if (differ) {
37447 BV_SET(fields, 0);
37448 }
37449
37450
37451#ifdef FREECIV_JSON_CONNECTION
37452 field_addr.name = "fields";
37453#endif /* FREECIV_JSON_CONNECTION */
37454 DIO_BV_PUT(&dout, &field_addr, fields);
37455
37456 if (BV_ISSET(fields, 0)) {
37457 log_packet_detailed(" field 'tech' has changed");
37458 #ifdef FREECIV_JSON_CONNECTION
37459 field_addr.name = "tech";
37460#endif /* FREECIV_JSON_CONNECTION */
37461 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech);
37462 }
37463
37464 *old = *real_packet;
37465#endif /* FREECIV_DELTA_PROTOCOL */
37466#ifndef FREECIV_DELTA_PROTOCOL
37467#ifdef FREECIV_JSON_CONNECTION
37468 field_addr.name = "tech";
37469#endif /* FREECIV_JSON_CONNECTION */
37470 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech);
37471
37472#endif
37473 SEND_PACKET_END(PACKET_PLAYER_RESEARCH);
37474}
37475
37476 int send_packet_player_research(struct connection *pc, const struct packet_player_research *packet)
37477{
37478 if (!pc->used) {
37479 log_error("WARNING: trying to send data to the closed connection %s",
37480 conn_description(pc));
37481 return -1;
37482 }
37483 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_RESEARCH].packet != NULL, -1,
37484 "Handler for PACKET_PLAYER_RESEARCH not installed");
37485 return pc->phs.handlers->send[PACKET_PLAYER_RESEARCH].packet(pc, packet);
37486}
37487
37488 int dsend_packet_player_research(struct connection *pc, int tech)
37489{
37490 struct packet_player_research packet, *real_packet = &packet;
37491
37492 real_packet->tech = tech;
37493
37494 return send_packet_player_research(pc, real_packet);
37495}
37496
37497#ifdef FREECIV_DELTA_PROTOCOL
37498#define hash_packet_player_tech_goal_100 hash_const
37499
37500#define cmp_packet_player_tech_goal_100 cmp_const
37501
37502 BV_DEFINE(packet_player_tech_goal_100_fields, 1);
37503#endif /* FREECIV_DELTA_PROTOCOL */
37504
37505 static struct packet_player_tech_goal *receive_packet_player_tech_goal_100(struct connection *pc)
37506{
37507#ifdef FREECIV_DELTA_PROTOCOL
37508 packet_player_tech_goal_100_fields fields;
37509 struct packet_player_tech_goal *old;
37510 struct genhash **hash = pc->phs.received + PACKET_PLAYER_TECH_GOAL;
37511#endif /* FREECIV_DELTA_PROTOCOL */
37512 RECEIVE_PACKET_START(packet_player_tech_goal, real_packet);
37513#ifdef FREECIV_JSON_CONNECTION
37514 struct plocation field_addr;
37515 {
37516 struct plocation *field_addr_tmp = plocation_field_new(NULL);
37517 field_addr = *field_addr_tmp;
37518 FC_FREE(field_addr_tmp);
37519 }
37520#endif /* FREECIV_JSON_CONNECTION */
37521
37522#ifdef FREECIV_DELTA_PROTOCOL
37523#ifdef FREECIV_JSON_CONNECTION
37524 field_addr.name = "fields";
37525#endif /* FREECIV_JSON_CONNECTION */
37526 DIO_BV_GET(&din, &field_addr, fields);
37527
37528#else /* FREECIV_DELTA_PROTOCOL */
37529 #ifdef FREECIV_JSON_CONNECTION
37530 field_addr.name = "tech";
37531 #endif /* FREECIV_JSON_CONNECTION */
37532 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tech)) {
37533 RECEIVE_PACKET_FIELD_ERROR(tech);
37534 }
37535
37536#endif
37537 log_packet_detailed("packet_player_tech_goal_100: got info about ()");
37538
37539#ifdef FREECIV_DELTA_PROTOCOL
37540 if (NULL == *hash) {
37541 *hash = genhash_new_full(hash_packet_player_tech_goal_100, cmp_packet_player_tech_goal_100,
37542 NULL, NULL, NULL, free);
37543 }
37544
37545 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
37546 *real_packet = *old;
37547 } else {
37548 log_packet_detailed(" no old info");
37549 memset(real_packet, 0, sizeof(*real_packet));
37550 }
37551
37552 if (BV_ISSET(fields, 0)) {
37553 log_packet_detailed(" got field 'tech'");
37554 #ifdef FREECIV_JSON_CONNECTION
37555 field_addr.name = "tech";
37556 #endif /* FREECIV_JSON_CONNECTION */
37557 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tech)) {
37558 RECEIVE_PACKET_FIELD_ERROR(tech);
37559 }
37560 }
37561
37562 if (NULL == old) {
37563 old = fc_malloc(sizeof(*old));
37564 *old = *real_packet;
37565 genhash_insert(*hash, old, old);
37566 } else {
37567 *old = *real_packet;
37568 }
37569
37570#endif /* FREECIV_DELTA_PROTOCOL */
37571 RECEIVE_PACKET_END(real_packet);
37572}
37573
37574 static int send_packet_player_tech_goal_100(struct connection *pc, const struct packet_player_tech_goal *packet)
37575{
37576 const struct packet_player_tech_goal *real_packet = packet;
37577#ifdef FREECIV_DELTA_PROTOCOL
37578 packet_player_tech_goal_100_fields fields;
37579 struct packet_player_tech_goal *old;
37580 bool differ;
37581 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_TECH_GOAL;
37582#endif /* FREECIV_DELTA_PROTOCOL */
37583 SEND_PACKET_START(PACKET_PLAYER_TECH_GOAL);
37584#ifdef FREECIV_JSON_CONNECTION
37585 struct plocation field_addr;
37586 {
37587 struct plocation *field_addr_tmp = plocation_field_new(NULL);
37588 field_addr = *field_addr_tmp;
37589 FC_FREE(field_addr_tmp);
37590 }
37591#endif /* FREECIV_JSON_CONNECTION */
37592
37593 log_packet_detailed("packet_player_tech_goal_100: sending info about ()");
37594
37595#ifdef FREECIV_DELTA_PROTOCOL
37596 if (NULL == *hash) {
37597 *hash = genhash_new_full(hash_packet_player_tech_goal_100, cmp_packet_player_tech_goal_100,
37598 NULL, NULL, NULL, free);
37599 }
37600 BV_CLR_ALL(fields);
37601
37602 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
37603 old = fc_malloc(sizeof(*old));
37604 *old = *real_packet;
37605 genhash_insert(*hash, old, old);
37606 memset(old, 0, sizeof(*old));
37607 }
37608 differ = (old->tech != real_packet->tech);
37609 if (differ) {
37610 BV_SET(fields, 0);
37611 }
37612
37613
37614#ifdef FREECIV_JSON_CONNECTION
37615 field_addr.name = "fields";
37616#endif /* FREECIV_JSON_CONNECTION */
37617 DIO_BV_PUT(&dout, &field_addr, fields);
37618
37619 if (BV_ISSET(fields, 0)) {
37620 log_packet_detailed(" field 'tech' has changed");
37621 #ifdef FREECIV_JSON_CONNECTION
37622 field_addr.name = "tech";
37623#endif /* FREECIV_JSON_CONNECTION */
37624 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech);
37625 }
37626
37627 *old = *real_packet;
37628#endif /* FREECIV_DELTA_PROTOCOL */
37629#ifndef FREECIV_DELTA_PROTOCOL
37630#ifdef FREECIV_JSON_CONNECTION
37631 field_addr.name = "tech";
37632#endif /* FREECIV_JSON_CONNECTION */
37633 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech);
37634
37635#endif
37636 SEND_PACKET_END(PACKET_PLAYER_TECH_GOAL);
37637}
37638
37639 int send_packet_player_tech_goal(struct connection *pc, const struct packet_player_tech_goal *packet)
37640{
37641 if (!pc->used) {
37642 log_error("WARNING: trying to send data to the closed connection %s",
37643 conn_description(pc));
37644 return -1;
37645 }
37646 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_TECH_GOAL].packet != NULL, -1,
37647 "Handler for PACKET_PLAYER_TECH_GOAL not installed");
37648 return pc->phs.handlers->send[PACKET_PLAYER_TECH_GOAL].packet(pc, packet);
37649}
37650
37651 int dsend_packet_player_tech_goal(struct connection *pc, int tech)
37652{
37653 struct packet_player_tech_goal packet, *real_packet = &packet;
37654
37655 real_packet->tech = tech;
37656
37657 return send_packet_player_tech_goal(pc, real_packet);
37658}
37659
37660#ifdef FREECIV_DELTA_PROTOCOL
37661#define hash_packet_unit_remove_100 hash_const
37662
37663#define cmp_packet_unit_remove_100 cmp_const
37664
37665 BV_DEFINE(packet_unit_remove_100_fields, 1);
37666#endif /* FREECIV_DELTA_PROTOCOL */
37667
37668 static struct packet_unit_remove *receive_packet_unit_remove_100(struct connection *pc)
37669{
37670#ifdef FREECIV_DELTA_PROTOCOL
37671 packet_unit_remove_100_fields fields;
37672 struct packet_unit_remove *old;
37673 struct genhash **hash = pc->phs.received + PACKET_UNIT_REMOVE;
37674#endif /* FREECIV_DELTA_PROTOCOL */
37675 RECEIVE_PACKET_START(packet_unit_remove, real_packet);
37676#ifdef FREECIV_JSON_CONNECTION
37677 struct plocation field_addr;
37678 {
37679 struct plocation *field_addr_tmp = plocation_field_new(NULL);
37680 field_addr = *field_addr_tmp;
37681 FC_FREE(field_addr_tmp);
37682 }
37683#endif /* FREECIV_JSON_CONNECTION */
37684
37685#ifdef FREECIV_DELTA_PROTOCOL
37686#ifdef FREECIV_JSON_CONNECTION
37687 field_addr.name = "fields";
37688#endif /* FREECIV_JSON_CONNECTION */
37689 DIO_BV_GET(&din, &field_addr, fields);
37690
37691#else /* FREECIV_DELTA_PROTOCOL */
37692 #ifdef FREECIV_JSON_CONNECTION
37693 field_addr.name = "unit_id32";
37694 #endif /* FREECIV_JSON_CONNECTION */
37695 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
37696 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
37697 }
37698
37699#endif
37700 log_packet_detailed("packet_unit_remove_100: got info about ()");
37701
37702#ifdef FREECIV_DELTA_PROTOCOL
37703 if (NULL == *hash) {
37704 *hash = genhash_new_full(hash_packet_unit_remove_100, cmp_packet_unit_remove_100,
37705 NULL, NULL, NULL, free);
37706 }
37707
37708 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
37709 *real_packet = *old;
37710 } else {
37711 log_packet_detailed(" no old info");
37712 memset(real_packet, 0, sizeof(*real_packet));
37713 }
37714
37715 if (BV_ISSET(fields, 0)) {
37716 log_packet_detailed(" got field 'unit_id32'");
37717 #ifdef FREECIV_JSON_CONNECTION
37718 field_addr.name = "unit_id32";
37719 #endif /* FREECIV_JSON_CONNECTION */
37720 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
37721 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
37722 }
37723 }
37724
37725 if (NULL == old) {
37726 old = fc_malloc(sizeof(*old));
37727 *old = *real_packet;
37728 genhash_insert(*hash, old, old);
37729 } else {
37730 *old = *real_packet;
37731 }
37732
37733 hash = pc->phs.received + PACKET_UNIT_INFO;
37734 if (NULL != *hash) {
37735 genhash_remove(*hash, real_packet);
37736 }
37737
37738 hash = pc->phs.received + PACKET_UNIT_SHORT_INFO;
37739 if (NULL != *hash) {
37740 genhash_remove(*hash, real_packet);
37741 }
37742
37743#endif /* FREECIV_DELTA_PROTOCOL */
37744 RECEIVE_PACKET_END(real_packet);
37745}
37746
37747 static int send_packet_unit_remove_100(struct connection *pc, const struct packet_unit_remove *packet)
37748{
37749 const struct packet_unit_remove *real_packet = packet;
37750#ifdef FREECIV_DELTA_PROTOCOL
37751 packet_unit_remove_100_fields fields;
37752 struct packet_unit_remove *old;
37753 bool differ;
37754 struct genhash **hash = pc->phs.sent + PACKET_UNIT_REMOVE;
37755#endif /* FREECIV_DELTA_PROTOCOL */
37756 SEND_PACKET_START(PACKET_UNIT_REMOVE);
37757#ifdef FREECIV_JSON_CONNECTION
37758 struct plocation field_addr;
37759 {
37760 struct plocation *field_addr_tmp = plocation_field_new(NULL);
37761 field_addr = *field_addr_tmp;
37762 FC_FREE(field_addr_tmp);
37763 }
37764#endif /* FREECIV_JSON_CONNECTION */
37765
37766 log_packet_detailed("packet_unit_remove_100: sending info about ()");
37767
37768#ifdef FREECIV_DELTA_PROTOCOL
37769 if (NULL == *hash) {
37770 *hash = genhash_new_full(hash_packet_unit_remove_100, cmp_packet_unit_remove_100,
37771 NULL, NULL, NULL, free);
37772 }
37773 BV_CLR_ALL(fields);
37774
37775 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
37776 old = fc_malloc(sizeof(*old));
37777 *old = *real_packet;
37778 genhash_insert(*hash, old, old);
37779 memset(old, 0, sizeof(*old));
37780 }
37781 differ = (old->unit_id32 != real_packet->unit_id32);
37782 if (differ) {
37783 BV_SET(fields, 0);
37784 }
37785
37786
37787#ifdef FREECIV_JSON_CONNECTION
37788 field_addr.name = "fields";
37789#endif /* FREECIV_JSON_CONNECTION */
37790 DIO_BV_PUT(&dout, &field_addr, fields);
37791
37792 if (BV_ISSET(fields, 0)) {
37793 log_packet_detailed(" field 'unit_id32' has changed");
37794 #ifdef FREECIV_JSON_CONNECTION
37795 field_addr.name = "unit_id32";
37796#endif /* FREECIV_JSON_CONNECTION */
37797 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
37798 }
37799
37800 *old = *real_packet;
37801
37802 hash = pc->phs.sent + PACKET_UNIT_INFO;
37803 if (NULL != *hash) {
37804 genhash_remove(*hash, real_packet);
37805 }
37806
37807 hash = pc->phs.sent + PACKET_UNIT_SHORT_INFO;
37808 if (NULL != *hash) {
37809 genhash_remove(*hash, real_packet);
37810 }
37811#endif /* FREECIV_DELTA_PROTOCOL */
37812#ifndef FREECIV_DELTA_PROTOCOL
37813#ifdef FREECIV_JSON_CONNECTION
37814 field_addr.name = "unit_id32";
37815#endif /* FREECIV_JSON_CONNECTION */
37816 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
37817
37818#endif
37819 SEND_PACKET_END(PACKET_UNIT_REMOVE);
37820}
37821
37822#ifdef FREECIV_DELTA_PROTOCOL
37823#define hash_packet_unit_remove_101 hash_const
37824
37825#define cmp_packet_unit_remove_101 cmp_const
37826
37827 BV_DEFINE(packet_unit_remove_101_fields, 1);
37828#endif /* FREECIV_DELTA_PROTOCOL */
37829
37830 static struct packet_unit_remove *receive_packet_unit_remove_101(struct connection *pc)
37831{
37832#ifdef FREECIV_DELTA_PROTOCOL
37833 packet_unit_remove_101_fields fields;
37834 struct packet_unit_remove *old;
37835 struct genhash **hash = pc->phs.received + PACKET_UNIT_REMOVE;
37836#endif /* FREECIV_DELTA_PROTOCOL */
37837 RECEIVE_PACKET_START(packet_unit_remove, real_packet);
37838#ifdef FREECIV_JSON_CONNECTION
37839 struct plocation field_addr;
37840 {
37841 struct plocation *field_addr_tmp = plocation_field_new(NULL);
37842 field_addr = *field_addr_tmp;
37843 FC_FREE(field_addr_tmp);
37844 }
37845#endif /* FREECIV_JSON_CONNECTION */
37846
37847#ifdef FREECIV_DELTA_PROTOCOL
37848#ifdef FREECIV_JSON_CONNECTION
37849 field_addr.name = "fields";
37850#endif /* FREECIV_JSON_CONNECTION */
37851 DIO_BV_GET(&din, &field_addr, fields);
37852
37853#else /* FREECIV_DELTA_PROTOCOL */
37854 #ifdef FREECIV_JSON_CONNECTION
37855 field_addr.name = "unit_id16";
37856 #endif /* FREECIV_JSON_CONNECTION */
37857 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
37858 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
37859 }
37860
37861#endif
37862 log_packet_detailed("packet_unit_remove_101: got info about ()");
37863
37864#ifdef FREECIV_DELTA_PROTOCOL
37865 if (NULL == *hash) {
37866 *hash = genhash_new_full(hash_packet_unit_remove_101, cmp_packet_unit_remove_101,
37867 NULL, NULL, NULL, free);
37868 }
37869
37870 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
37871 *real_packet = *old;
37872 } else {
37873 log_packet_detailed(" no old info");
37874 memset(real_packet, 0, sizeof(*real_packet));
37875 }
37876
37877 if (BV_ISSET(fields, 0)) {
37878 log_packet_detailed(" got field 'unit_id16'");
37879 #ifdef FREECIV_JSON_CONNECTION
37880 field_addr.name = "unit_id16";
37881 #endif /* FREECIV_JSON_CONNECTION */
37882 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
37883 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
37884 }
37885 }
37886
37887 if (NULL == old) {
37888 old = fc_malloc(sizeof(*old));
37889 *old = *real_packet;
37890 genhash_insert(*hash, old, old);
37891 } else {
37892 *old = *real_packet;
37893 }
37894
37895 hash = pc->phs.received + PACKET_UNIT_INFO;
37896 if (NULL != *hash) {
37897 genhash_remove(*hash, real_packet);
37898 }
37899
37900 hash = pc->phs.received + PACKET_UNIT_SHORT_INFO;
37901 if (NULL != *hash) {
37902 genhash_remove(*hash, real_packet);
37903 }
37904
37905#endif /* FREECIV_DELTA_PROTOCOL */
37906 RECEIVE_PACKET_END(real_packet);
37907}
37908
37909 static int send_packet_unit_remove_101(struct connection *pc, const struct packet_unit_remove *packet)
37910{
37911 const struct packet_unit_remove *real_packet = packet;
37912#ifdef FREECIV_DELTA_PROTOCOL
37913 packet_unit_remove_101_fields fields;
37914 struct packet_unit_remove *old;
37915 bool differ;
37916 struct genhash **hash = pc->phs.sent + PACKET_UNIT_REMOVE;
37917#endif /* FREECIV_DELTA_PROTOCOL */
37918 SEND_PACKET_START(PACKET_UNIT_REMOVE);
37919#ifdef FREECIV_JSON_CONNECTION
37920 struct plocation field_addr;
37921 {
37922 struct plocation *field_addr_tmp = plocation_field_new(NULL);
37923 field_addr = *field_addr_tmp;
37924 FC_FREE(field_addr_tmp);
37925 }
37926#endif /* FREECIV_JSON_CONNECTION */
37927
37928 log_packet_detailed("packet_unit_remove_101: sending info about ()");
37929
37930#ifdef FREECIV_DELTA_PROTOCOL
37931 if (NULL == *hash) {
37932 *hash = genhash_new_full(hash_packet_unit_remove_101, cmp_packet_unit_remove_101,
37933 NULL, NULL, NULL, free);
37934 }
37935 BV_CLR_ALL(fields);
37936
37937 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
37938 old = fc_malloc(sizeof(*old));
37939 *old = *real_packet;
37940 genhash_insert(*hash, old, old);
37941 memset(old, 0, sizeof(*old));
37942 }
37943 differ = (old->unit_id16 != real_packet->unit_id16);
37944 if (differ) {
37945 BV_SET(fields, 0);
37946 }
37947
37948
37949#ifdef FREECIV_JSON_CONNECTION
37950 field_addr.name = "fields";
37951#endif /* FREECIV_JSON_CONNECTION */
37952 DIO_BV_PUT(&dout, &field_addr, fields);
37953
37954 if (BV_ISSET(fields, 0)) {
37955 log_packet_detailed(" field 'unit_id16' has changed");
37956 #ifdef FREECIV_JSON_CONNECTION
37957 field_addr.name = "unit_id16";
37958#endif /* FREECIV_JSON_CONNECTION */
37959 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
37960 }
37961
37962 *old = *real_packet;
37963
37964 hash = pc->phs.sent + PACKET_UNIT_INFO;
37965 if (NULL != *hash) {
37966 genhash_remove(*hash, real_packet);
37967 }
37968
37969 hash = pc->phs.sent + PACKET_UNIT_SHORT_INFO;
37970 if (NULL != *hash) {
37971 genhash_remove(*hash, real_packet);
37972 }
37973#endif /* FREECIV_DELTA_PROTOCOL */
37974#ifndef FREECIV_DELTA_PROTOCOL
37975#ifdef FREECIV_JSON_CONNECTION
37976 field_addr.name = "unit_id16";
37977#endif /* FREECIV_JSON_CONNECTION */
37978 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
37979
37980#endif
37981 SEND_PACKET_END(PACKET_UNIT_REMOVE);
37982}
37983
37984 int send_packet_unit_remove(struct connection *pc, const struct packet_unit_remove *packet)
37985{
37986 if (!pc->used) {
37987 log_error("WARNING: trying to send data to the closed connection %s",
37988 conn_description(pc));
37989 return -1;
37990 }
37991 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_REMOVE].packet != NULL, -1,
37992 "Handler for PACKET_UNIT_REMOVE not installed");
37993 return pc->phs.handlers->send[PACKET_UNIT_REMOVE].packet(pc, packet);
37994}
37995
37996 void lsend_packet_unit_remove(struct conn_list *dest, const struct packet_unit_remove *packet)
37997{
37998 conn_list_iterate(dest, pconn) {
37999 send_packet_unit_remove(pconn, packet);
38000 } conn_list_iterate_end;
38001}
38002
38003 int dsend_packet_unit_remove(struct connection *pc, int unit_id16, int unit_id32)
38004{
38005 struct packet_unit_remove packet, *real_packet = &packet;
38006
38007 real_packet->unit_id16 = unit_id16;
38008 real_packet->unit_id32 = unit_id32;
38009
38010 return send_packet_unit_remove(pc, real_packet);
38011}
38012
38013 void dlsend_packet_unit_remove(struct conn_list *dest, int unit_id16, int unit_id32)
38014{
38015 struct packet_unit_remove packet, *real_packet = &packet;
38016
38017 real_packet->unit_id16 = unit_id16;
38018 real_packet->unit_id32 = unit_id32;
38019
38020 lsend_packet_unit_remove(dest, real_packet);
38021}
38022
38023#ifdef FREECIV_DELTA_PROTOCOL
38024#define hash_packet_unit_info_100 hash_const
38025
38026#define cmp_packet_unit_info_100 cmp_const
38027
38028 BV_DEFINE(packet_unit_info_100_fields, 36);
38029#endif /* FREECIV_DELTA_PROTOCOL */
38030
38031 static struct packet_unit_info *receive_packet_unit_info_100(struct connection *pc)
38032{
38033#ifdef FREECIV_DELTA_PROTOCOL
38034 packet_unit_info_100_fields fields;
38035 struct packet_unit_info *old;
38036 struct genhash **hash = pc->phs.received + PACKET_UNIT_INFO;
38037#endif /* FREECIV_DELTA_PROTOCOL */
38038 RECEIVE_PACKET_START(packet_unit_info, real_packet);
38039#ifdef FREECIV_JSON_CONNECTION
38040 struct plocation field_addr;
38041 {
38042 struct plocation *field_addr_tmp = plocation_field_new(NULL);
38043 field_addr = *field_addr_tmp;
38044 FC_FREE(field_addr_tmp);
38045 }
38046#endif /* FREECIV_JSON_CONNECTION */
38047
38048#ifdef FREECIV_DELTA_PROTOCOL
38049#ifdef FREECIV_JSON_CONNECTION
38050 field_addr.name = "fields";
38051#endif /* FREECIV_JSON_CONNECTION */
38052 DIO_BV_GET(&din, &field_addr, fields);
38053
38054#else /* FREECIV_DELTA_PROTOCOL */
38055 #ifdef FREECIV_JSON_CONNECTION
38056 field_addr.name = "id32";
38057 #endif /* FREECIV_JSON_CONNECTION */
38058 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
38059 RECEIVE_PACKET_FIELD_ERROR(id32);
38060 }
38061 #ifdef FREECIV_JSON_CONNECTION
38062 field_addr.name = "owner";
38063 #endif /* FREECIV_JSON_CONNECTION */
38064 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
38065 RECEIVE_PACKET_FIELD_ERROR(owner);
38066 }
38067 #ifdef FREECIV_JSON_CONNECTION
38068 field_addr.name = "nationality";
38069 #endif /* FREECIV_JSON_CONNECTION */
38070 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nationality)) {
38071 RECEIVE_PACKET_FIELD_ERROR(nationality);
38072 }
38073 #ifdef FREECIV_JSON_CONNECTION
38074 field_addr.name = "tile";
38075 #endif /* FREECIV_JSON_CONNECTION */
38076 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
38077 RECEIVE_PACKET_FIELD_ERROR(tile);
38078 }
38079 #ifdef FREECIV_JSON_CONNECTION
38080 field_addr.name = "facing";
38081 #endif /* FREECIV_JSON_CONNECTION */
38082 {
38083 int readin;
38084
38085 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
38086 RECEIVE_PACKET_FIELD_ERROR(facing);
38087 }
38088 real_packet->facing = readin;
38089 }
38090 #ifdef FREECIV_JSON_CONNECTION
38091 field_addr.name = "homecity32";
38092 #endif /* FREECIV_JSON_CONNECTION */
38093 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->homecity32)) {
38094 RECEIVE_PACKET_FIELD_ERROR(homecity32);
38095 }
38096 #ifdef FREECIV_JSON_CONNECTION
38097 field_addr.name = "upkeep";
38098 #endif /* FREECIV_JSON_CONNECTION */
38099
38100 {
38101 int i;
38102
38103 #ifdef FREECIV_JSON_CONNECTION
38104 /* Enter array. */
38105 field_addr.sub_location = plocation_elem_new(0);
38106 #endif /* FREECIV_JSON_CONNECTION */
38107
38108 for (i = 0; i < O_LAST; i++) {
38109 #ifdef FREECIV_JSON_CONNECTION
38110 field_addr.sub_location->number = i;
38111 #endif /* FREECIV_JSON_CONNECTION */
38112 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep[i])) {
38113 RECEIVE_PACKET_FIELD_ERROR(upkeep);
38114 }
38115 }
38116
38117 #ifdef FREECIV_JSON_CONNECTION
38118 /* Exit array. */
38119 free(field_addr.sub_location);
38120 field_addr.sub_location = NULL;
38121 #endif /* FREECIV_JSON_CONNECTION */
38122 }
38123 #ifdef FREECIV_JSON_CONNECTION
38124 field_addr.name = "veteran";
38125 #endif /* FREECIV_JSON_CONNECTION */
38126 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
38127 RECEIVE_PACKET_FIELD_ERROR(veteran);
38128 }
38129 #ifdef FREECIV_JSON_CONNECTION
38130 field_addr.name = "ssa_controller";
38131 #endif /* FREECIV_JSON_CONNECTION */
38132 {
38133 int readin;
38134
38135 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38136 RECEIVE_PACKET_FIELD_ERROR(ssa_controller);
38137 }
38138 real_packet->ssa_controller = readin;
38139 }
38140 #ifdef FREECIV_JSON_CONNECTION
38141 field_addr.name = "paradropped";
38142 #endif /* FREECIV_JSON_CONNECTION */
38143 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->paradropped)) {
38144 RECEIVE_PACKET_FIELD_ERROR(paradropped);
38145 }
38146 #ifdef FREECIV_JSON_CONNECTION
38147 field_addr.name = "occupied";
38148 #endif /* FREECIV_JSON_CONNECTION */
38149 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->occupied)) {
38150 RECEIVE_PACKET_FIELD_ERROR(occupied);
38151 }
38152 #ifdef FREECIV_JSON_CONNECTION
38153 field_addr.name = "transported";
38154 #endif /* FREECIV_JSON_CONNECTION */
38155 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->transported)) {
38156 RECEIVE_PACKET_FIELD_ERROR(transported);
38157 }
38158 #ifdef FREECIV_JSON_CONNECTION
38159 field_addr.name = "done_moving";
38160 #endif /* FREECIV_JSON_CONNECTION */
38161 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->done_moving)) {
38162 RECEIVE_PACKET_FIELD_ERROR(done_moving);
38163 }
38164 #ifdef FREECIV_JSON_CONNECTION
38165 field_addr.name = "stay";
38166 #endif /* FREECIV_JSON_CONNECTION */
38167 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->stay)) {
38168 RECEIVE_PACKET_FIELD_ERROR(stay);
38169 }
38170 #ifdef FREECIV_JSON_CONNECTION
38171 field_addr.name = "type";
38172 #endif /* FREECIV_JSON_CONNECTION */
38173 {
38174 int readin;
38175
38176 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38177 RECEIVE_PACKET_FIELD_ERROR(type);
38178 }
38179 real_packet->type = readin;
38180 }
38181 #ifdef FREECIV_JSON_CONNECTION
38182 field_addr.name = "transported_by32";
38183 #endif /* FREECIV_JSON_CONNECTION */
38184 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by32)) {
38185 RECEIVE_PACKET_FIELD_ERROR(transported_by32);
38186 }
38187 #ifdef FREECIV_JSON_CONNECTION
38188 field_addr.name = "carrying";
38189 #endif /* FREECIV_JSON_CONNECTION */
38190 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->carrying)) {
38191 RECEIVE_PACKET_FIELD_ERROR(carrying);
38192 }
38193 #ifdef FREECIV_JSON_CONNECTION
38194 field_addr.name = "movesleft";
38195 #endif /* FREECIV_JSON_CONNECTION */
38196 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->movesleft)) {
38197 RECEIVE_PACKET_FIELD_ERROR(movesleft);
38198 }
38199 #ifdef FREECIV_JSON_CONNECTION
38200 field_addr.name = "hp";
38201 #endif /* FREECIV_JSON_CONNECTION */
38202 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
38203 RECEIVE_PACKET_FIELD_ERROR(hp);
38204 }
38205 #ifdef FREECIV_JSON_CONNECTION
38206 field_addr.name = "fuel";
38207 #endif /* FREECIV_JSON_CONNECTION */
38208 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
38209 RECEIVE_PACKET_FIELD_ERROR(fuel);
38210 }
38211 #ifdef FREECIV_JSON_CONNECTION
38212 field_addr.name = "activity_count";
38213 #endif /* FREECIV_JSON_CONNECTION */
38214 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
38215 RECEIVE_PACKET_FIELD_ERROR(activity_count);
38216 }
38217 #ifdef FREECIV_JSON_CONNECTION
38218 field_addr.name = "changed_from_count";
38219 #endif /* FREECIV_JSON_CONNECTION */
38220 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->changed_from_count)) {
38221 RECEIVE_PACKET_FIELD_ERROR(changed_from_count);
38222 }
38223 #ifdef FREECIV_JSON_CONNECTION
38224 field_addr.name = "goto_tile";
38225 #endif /* FREECIV_JSON_CONNECTION */
38226 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->goto_tile)) {
38227 RECEIVE_PACKET_FIELD_ERROR(goto_tile);
38228 }
38229 #ifdef FREECIV_JSON_CONNECTION
38230 field_addr.name = "activity";
38231 #endif /* FREECIV_JSON_CONNECTION */
38232 {
38233 int readin;
38234
38235 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38236 RECEIVE_PACKET_FIELD_ERROR(activity);
38237 }
38238 real_packet->activity = readin;
38239 }
38240 #ifdef FREECIV_JSON_CONNECTION
38241 field_addr.name = "activity_tgt";
38242 #endif /* FREECIV_JSON_CONNECTION */
38243 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
38244 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
38245 }
38246 #ifdef FREECIV_JSON_CONNECTION
38247 field_addr.name = "changed_from";
38248 #endif /* FREECIV_JSON_CONNECTION */
38249 {
38250 int readin;
38251
38252 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38253 RECEIVE_PACKET_FIELD_ERROR(changed_from);
38254 }
38255 real_packet->changed_from = readin;
38256 }
38257 #ifdef FREECIV_JSON_CONNECTION
38258 field_addr.name = "changed_from_tgt";
38259 #endif /* FREECIV_JSON_CONNECTION */
38260 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->changed_from_tgt)) {
38261 RECEIVE_PACKET_FIELD_ERROR(changed_from_tgt);
38262 }
38263 #ifdef FREECIV_JSON_CONNECTION
38264 field_addr.name = "battlegroup";
38265 #endif /* FREECIV_JSON_CONNECTION */
38266 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->battlegroup)) {
38267 RECEIVE_PACKET_FIELD_ERROR(battlegroup);
38268 }
38269 #ifdef FREECIV_JSON_CONNECTION
38270 field_addr.name = "has_orders";
38271 #endif /* FREECIV_JSON_CONNECTION */
38272 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->has_orders)) {
38273 RECEIVE_PACKET_FIELD_ERROR(has_orders);
38274 }
38275 #ifdef FREECIV_JSON_CONNECTION
38276 field_addr.name = "orders_length";
38277 #endif /* FREECIV_JSON_CONNECTION */
38278 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_length)) {
38279 RECEIVE_PACKET_FIELD_ERROR(orders_length);
38280 }
38281 #ifdef FREECIV_JSON_CONNECTION
38282 field_addr.name = "orders_index";
38283 #endif /* FREECIV_JSON_CONNECTION */
38284 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_index)) {
38285 RECEIVE_PACKET_FIELD_ERROR(orders_index);
38286 }
38287 #ifdef FREECIV_JSON_CONNECTION
38288 field_addr.name = "orders_repeat";
38289 #endif /* FREECIV_JSON_CONNECTION */
38290 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->orders_repeat)) {
38291 RECEIVE_PACKET_FIELD_ERROR(orders_repeat);
38292 }
38293 #ifdef FREECIV_JSON_CONNECTION
38294 field_addr.name = "orders_vigilant";
38295 #endif /* FREECIV_JSON_CONNECTION */
38296 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->orders_vigilant)) {
38297 RECEIVE_PACKET_FIELD_ERROR(orders_vigilant);
38298 }
38299 #ifdef FREECIV_JSON_CONNECTION
38300 field_addr.name = "orders";
38301 #endif /* FREECIV_JSON_CONNECTION */
38302
38303 {
38304 int i;
38305
38306 #ifdef FREECIV_JSON_CONNECTION
38307 /* Enter array. */
38308 field_addr.sub_location = plocation_elem_new(0);
38309 #endif /* FREECIV_JSON_CONNECTION */
38310
38311 if (real_packet->orders_length > MAX_LEN_ROUTE) {
38312 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
38313 }
38314 for (i = 0; i < real_packet->orders_length; i++) {
38315 #ifdef FREECIV_JSON_CONNECTION
38316 field_addr.sub_location->number = i;
38317 #endif /* FREECIV_JSON_CONNECTION */
38318 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
38319 RECEIVE_PACKET_FIELD_ERROR(orders);
38320 }
38321 }
38322
38323 #ifdef FREECIV_JSON_CONNECTION
38324 /* Exit array. */
38325 free(field_addr.sub_location);
38326 field_addr.sub_location = NULL;
38327 #endif /* FREECIV_JSON_CONNECTION */
38328 }
38329 #ifdef FREECIV_JSON_CONNECTION
38330 field_addr.name = "action_decision_want";
38331 #endif /* FREECIV_JSON_CONNECTION */
38332 {
38333 int readin;
38334
38335 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38336 RECEIVE_PACKET_FIELD_ERROR(action_decision_want);
38337 }
38338 real_packet->action_decision_want = readin;
38339 }
38340 #ifdef FREECIV_JSON_CONNECTION
38341 field_addr.name = "action_decision_tile";
38342 #endif /* FREECIV_JSON_CONNECTION */
38343 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->action_decision_tile)) {
38344 RECEIVE_PACKET_FIELD_ERROR(action_decision_tile);
38345 }
38346
38347#endif
38348 log_packet_detailed("packet_unit_info_100: got info about ()");
38349
38350#ifdef FREECIV_DELTA_PROTOCOL
38351 if (NULL == *hash) {
38352 *hash = genhash_new_full(hash_packet_unit_info_100, cmp_packet_unit_info_100,
38353 NULL, NULL, NULL, free);
38354 }
38355
38356 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
38357 *real_packet = *old;
38358 } else {
38359 log_packet_detailed(" no old info");
38360 memset(real_packet, 0, sizeof(*real_packet));
38361 }
38362
38363 if (BV_ISSET(fields, 0)) {
38364 log_packet_detailed(" got field 'id32'");
38365 #ifdef FREECIV_JSON_CONNECTION
38366 field_addr.name = "id32";
38367 #endif /* FREECIV_JSON_CONNECTION */
38368 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
38369 RECEIVE_PACKET_FIELD_ERROR(id32);
38370 }
38371 }
38372 if (BV_ISSET(fields, 1)) {
38373 log_packet_detailed(" got field 'owner'");
38374 #ifdef FREECIV_JSON_CONNECTION
38375 field_addr.name = "owner";
38376 #endif /* FREECIV_JSON_CONNECTION */
38377 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
38378 RECEIVE_PACKET_FIELD_ERROR(owner);
38379 }
38380 }
38381 if (BV_ISSET(fields, 2)) {
38382 log_packet_detailed(" got field 'nationality'");
38383 #ifdef FREECIV_JSON_CONNECTION
38384 field_addr.name = "nationality";
38385 #endif /* FREECIV_JSON_CONNECTION */
38386 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nationality)) {
38387 RECEIVE_PACKET_FIELD_ERROR(nationality);
38388 }
38389 }
38390 if (BV_ISSET(fields, 3)) {
38391 log_packet_detailed(" got field 'tile'");
38392 #ifdef FREECIV_JSON_CONNECTION
38393 field_addr.name = "tile";
38394 #endif /* FREECIV_JSON_CONNECTION */
38395 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
38396 RECEIVE_PACKET_FIELD_ERROR(tile);
38397 }
38398 }
38399 if (BV_ISSET(fields, 4)) {
38400 log_packet_detailed(" got field 'facing'");
38401 #ifdef FREECIV_JSON_CONNECTION
38402 field_addr.name = "facing";
38403 #endif /* FREECIV_JSON_CONNECTION */
38404 {
38405 int readin;
38406
38407 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
38408 RECEIVE_PACKET_FIELD_ERROR(facing);
38409 }
38410 real_packet->facing = readin;
38411 }
38412 }
38413 if (BV_ISSET(fields, 5)) {
38414 log_packet_detailed(" got field 'homecity32'");
38415 #ifdef FREECIV_JSON_CONNECTION
38416 field_addr.name = "homecity32";
38417 #endif /* FREECIV_JSON_CONNECTION */
38418 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->homecity32)) {
38419 RECEIVE_PACKET_FIELD_ERROR(homecity32);
38420 }
38421 }
38422 if (BV_ISSET(fields, 6)) {
38423 log_packet_detailed(" got field 'upkeep'");
38424 #ifdef FREECIV_JSON_CONNECTION
38425 field_addr.name = "upkeep";
38426 #endif /* FREECIV_JSON_CONNECTION */
38427
38428 {
38429 int i;
38430
38431 #ifdef FREECIV_JSON_CONNECTION
38432 /* Enter array. */
38433 field_addr.sub_location = plocation_elem_new(0);
38434 #endif /* FREECIV_JSON_CONNECTION */
38435
38436 for (i = 0; i < O_LAST; i++) {
38437 #ifdef FREECIV_JSON_CONNECTION
38438 field_addr.sub_location->number = i;
38439 #endif /* FREECIV_JSON_CONNECTION */
38440 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep[i])) {
38441 RECEIVE_PACKET_FIELD_ERROR(upkeep);
38442 }
38443 }
38444
38445 #ifdef FREECIV_JSON_CONNECTION
38446 /* Exit array. */
38447 free(field_addr.sub_location);
38448 field_addr.sub_location = NULL;
38449 #endif /* FREECIV_JSON_CONNECTION */
38450 }
38451 }
38452 if (BV_ISSET(fields, 7)) {
38453 log_packet_detailed(" got field 'veteran'");
38454 #ifdef FREECIV_JSON_CONNECTION
38455 field_addr.name = "veteran";
38456 #endif /* FREECIV_JSON_CONNECTION */
38457 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
38458 RECEIVE_PACKET_FIELD_ERROR(veteran);
38459 }
38460 }
38461 if (BV_ISSET(fields, 8)) {
38462 log_packet_detailed(" got field 'ssa_controller'");
38463 #ifdef FREECIV_JSON_CONNECTION
38464 field_addr.name = "ssa_controller";
38465 #endif /* FREECIV_JSON_CONNECTION */
38466 {
38467 int readin;
38468
38469 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38470 RECEIVE_PACKET_FIELD_ERROR(ssa_controller);
38471 }
38472 real_packet->ssa_controller = readin;
38473 }
38474 }
38475 real_packet->paradropped = BV_ISSET(fields, 9);
38476 real_packet->occupied = BV_ISSET(fields, 10);
38477 real_packet->transported = BV_ISSET(fields, 11);
38478 real_packet->done_moving = BV_ISSET(fields, 12);
38479 real_packet->stay = BV_ISSET(fields, 13);
38480 if (BV_ISSET(fields, 14)) {
38481 log_packet_detailed(" got field 'type'");
38482 #ifdef FREECIV_JSON_CONNECTION
38483 field_addr.name = "type";
38484 #endif /* FREECIV_JSON_CONNECTION */
38485 {
38486 int readin;
38487
38488 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38489 RECEIVE_PACKET_FIELD_ERROR(type);
38490 }
38491 real_packet->type = readin;
38492 }
38493 }
38494 if (BV_ISSET(fields, 15)) {
38495 log_packet_detailed(" got field 'transported_by32'");
38496 #ifdef FREECIV_JSON_CONNECTION
38497 field_addr.name = "transported_by32";
38498 #endif /* FREECIV_JSON_CONNECTION */
38499 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by32)) {
38500 RECEIVE_PACKET_FIELD_ERROR(transported_by32);
38501 }
38502 }
38503 if (BV_ISSET(fields, 16)) {
38504 log_packet_detailed(" got field 'carrying'");
38505 #ifdef FREECIV_JSON_CONNECTION
38506 field_addr.name = "carrying";
38507 #endif /* FREECIV_JSON_CONNECTION */
38508 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->carrying)) {
38509 RECEIVE_PACKET_FIELD_ERROR(carrying);
38510 }
38511 }
38512 if (BV_ISSET(fields, 17)) {
38513 log_packet_detailed(" got field 'movesleft'");
38514 #ifdef FREECIV_JSON_CONNECTION
38515 field_addr.name = "movesleft";
38516 #endif /* FREECIV_JSON_CONNECTION */
38517 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->movesleft)) {
38518 RECEIVE_PACKET_FIELD_ERROR(movesleft);
38519 }
38520 }
38521 if (BV_ISSET(fields, 18)) {
38522 log_packet_detailed(" got field 'hp'");
38523 #ifdef FREECIV_JSON_CONNECTION
38524 field_addr.name = "hp";
38525 #endif /* FREECIV_JSON_CONNECTION */
38526 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
38527 RECEIVE_PACKET_FIELD_ERROR(hp);
38528 }
38529 }
38530 if (BV_ISSET(fields, 19)) {
38531 log_packet_detailed(" got field 'fuel'");
38532 #ifdef FREECIV_JSON_CONNECTION
38533 field_addr.name = "fuel";
38534 #endif /* FREECIV_JSON_CONNECTION */
38535 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
38536 RECEIVE_PACKET_FIELD_ERROR(fuel);
38537 }
38538 }
38539 if (BV_ISSET(fields, 20)) {
38540 log_packet_detailed(" got field 'activity_count'");
38541 #ifdef FREECIV_JSON_CONNECTION
38542 field_addr.name = "activity_count";
38543 #endif /* FREECIV_JSON_CONNECTION */
38544 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
38545 RECEIVE_PACKET_FIELD_ERROR(activity_count);
38546 }
38547 }
38548 if (BV_ISSET(fields, 21)) {
38549 log_packet_detailed(" got field 'changed_from_count'");
38550 #ifdef FREECIV_JSON_CONNECTION
38551 field_addr.name = "changed_from_count";
38552 #endif /* FREECIV_JSON_CONNECTION */
38553 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->changed_from_count)) {
38554 RECEIVE_PACKET_FIELD_ERROR(changed_from_count);
38555 }
38556 }
38557 if (BV_ISSET(fields, 22)) {
38558 log_packet_detailed(" got field 'goto_tile'");
38559 #ifdef FREECIV_JSON_CONNECTION
38560 field_addr.name = "goto_tile";
38561 #endif /* FREECIV_JSON_CONNECTION */
38562 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->goto_tile)) {
38563 RECEIVE_PACKET_FIELD_ERROR(goto_tile);
38564 }
38565 }
38566 if (BV_ISSET(fields, 23)) {
38567 log_packet_detailed(" got field 'activity'");
38568 #ifdef FREECIV_JSON_CONNECTION
38569 field_addr.name = "activity";
38570 #endif /* FREECIV_JSON_CONNECTION */
38571 {
38572 int readin;
38573
38574 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38575 RECEIVE_PACKET_FIELD_ERROR(activity);
38576 }
38577 real_packet->activity = readin;
38578 }
38579 }
38580 if (BV_ISSET(fields, 24)) {
38581 log_packet_detailed(" got field 'activity_tgt'");
38582 #ifdef FREECIV_JSON_CONNECTION
38583 field_addr.name = "activity_tgt";
38584 #endif /* FREECIV_JSON_CONNECTION */
38585 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
38586 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
38587 }
38588 }
38589 if (BV_ISSET(fields, 25)) {
38590 log_packet_detailed(" got field 'changed_from'");
38591 #ifdef FREECIV_JSON_CONNECTION
38592 field_addr.name = "changed_from";
38593 #endif /* FREECIV_JSON_CONNECTION */
38594 {
38595 int readin;
38596
38597 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38598 RECEIVE_PACKET_FIELD_ERROR(changed_from);
38599 }
38600 real_packet->changed_from = readin;
38601 }
38602 }
38603 if (BV_ISSET(fields, 26)) {
38604 log_packet_detailed(" got field 'changed_from_tgt'");
38605 #ifdef FREECIV_JSON_CONNECTION
38606 field_addr.name = "changed_from_tgt";
38607 #endif /* FREECIV_JSON_CONNECTION */
38608 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->changed_from_tgt)) {
38609 RECEIVE_PACKET_FIELD_ERROR(changed_from_tgt);
38610 }
38611 }
38612 if (BV_ISSET(fields, 27)) {
38613 log_packet_detailed(" got field 'battlegroup'");
38614 #ifdef FREECIV_JSON_CONNECTION
38615 field_addr.name = "battlegroup";
38616 #endif /* FREECIV_JSON_CONNECTION */
38617 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->battlegroup)) {
38618 RECEIVE_PACKET_FIELD_ERROR(battlegroup);
38619 }
38620 }
38621 real_packet->has_orders = BV_ISSET(fields, 28);
38622 if (BV_ISSET(fields, 29)) {
38623 log_packet_detailed(" got field 'orders_length'");
38624 #ifdef FREECIV_JSON_CONNECTION
38625 field_addr.name = "orders_length";
38626 #endif /* FREECIV_JSON_CONNECTION */
38627 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_length)) {
38628 RECEIVE_PACKET_FIELD_ERROR(orders_length);
38629 }
38630 }
38631 if (BV_ISSET(fields, 30)) {
38632 log_packet_detailed(" got field 'orders_index'");
38633 #ifdef FREECIV_JSON_CONNECTION
38634 field_addr.name = "orders_index";
38635 #endif /* FREECIV_JSON_CONNECTION */
38636 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_index)) {
38637 RECEIVE_PACKET_FIELD_ERROR(orders_index);
38638 }
38639 }
38640 real_packet->orders_repeat = BV_ISSET(fields, 31);
38641 real_packet->orders_vigilant = BV_ISSET(fields, 32);
38642 if (BV_ISSET(fields, 33)) {
38643 log_packet_detailed(" got field 'orders'");
38644 #ifdef FREECIV_JSON_CONNECTION
38645 field_addr.name = "orders";
38646 #endif /* FREECIV_JSON_CONNECTION */
38647
38648 {
38649 int i;
38650
38651 #ifdef FREECIV_JSON_CONNECTION
38652 /* Enter array. */
38653 field_addr.sub_location = plocation_elem_new(0);
38654 #endif /* FREECIV_JSON_CONNECTION */
38655
38656 if (real_packet->orders_length > MAX_LEN_ROUTE) {
38657 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
38658 }
38659 for (i = 0; i < real_packet->orders_length; i++) {
38660 #ifdef FREECIV_JSON_CONNECTION
38661 field_addr.sub_location->number = i;
38662 #endif /* FREECIV_JSON_CONNECTION */
38663 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
38664 RECEIVE_PACKET_FIELD_ERROR(orders);
38665 }
38666 }
38667
38668 #ifdef FREECIV_JSON_CONNECTION
38669 /* Exit array. */
38670 free(field_addr.sub_location);
38671 field_addr.sub_location = NULL;
38672 #endif /* FREECIV_JSON_CONNECTION */
38673 }
38674 }
38675 if (BV_ISSET(fields, 34)) {
38676 log_packet_detailed(" got field 'action_decision_want'");
38677 #ifdef FREECIV_JSON_CONNECTION
38678 field_addr.name = "action_decision_want";
38679 #endif /* FREECIV_JSON_CONNECTION */
38680 {
38681 int readin;
38682
38683 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38684 RECEIVE_PACKET_FIELD_ERROR(action_decision_want);
38685 }
38686 real_packet->action_decision_want = readin;
38687 }
38688 }
38689 if (BV_ISSET(fields, 35)) {
38690 log_packet_detailed(" got field 'action_decision_tile'");
38691 #ifdef FREECIV_JSON_CONNECTION
38692 field_addr.name = "action_decision_tile";
38693 #endif /* FREECIV_JSON_CONNECTION */
38694 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->action_decision_tile)) {
38695 RECEIVE_PACKET_FIELD_ERROR(action_decision_tile);
38696 }
38697 }
38698
38699 if (NULL == old) {
38700 old = fc_malloc(sizeof(*old));
38701 *old = *real_packet;
38702 genhash_insert(*hash, old, old);
38703 } else {
38704 *old = *real_packet;
38705 }
38706
38707 hash = pc->phs.received + PACKET_UNIT_SHORT_INFO;
38708 if (NULL != *hash) {
38709 genhash_remove(*hash, real_packet);
38710 }
38711
38712#endif /* FREECIV_DELTA_PROTOCOL */
38713 RECEIVE_PACKET_END(real_packet);
38714}
38715
38716 static int send_packet_unit_info_100(struct connection *pc, const struct packet_unit_info *packet)
38717{
38718 const struct packet_unit_info *real_packet = packet;
38719#ifdef FREECIV_DELTA_PROTOCOL
38720 packet_unit_info_100_fields fields;
38721 struct packet_unit_info *old;
38722 bool differ;
38723 struct genhash **hash = pc->phs.sent + PACKET_UNIT_INFO;
38724 int different = 0;
38725#endif /* FREECIV_DELTA_PROTOCOL */
38726 SEND_PACKET_START(PACKET_UNIT_INFO);
38727#ifdef FREECIV_JSON_CONNECTION
38728 struct plocation field_addr;
38729 {
38730 struct plocation *field_addr_tmp = plocation_field_new(NULL);
38731 field_addr = *field_addr_tmp;
38732 FC_FREE(field_addr_tmp);
38733 }
38734#endif /* FREECIV_JSON_CONNECTION */
38735
38736 log_packet_detailed("packet_unit_info_100: sending info about ()");
38737
38738#ifdef FREECIV_DELTA_PROTOCOL
38739 if (NULL == *hash) {
38740 *hash = genhash_new_full(hash_packet_unit_info_100, cmp_packet_unit_info_100,
38741 NULL, NULL, NULL, free);
38742 }
38743 BV_CLR_ALL(fields);
38744
38745 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
38746 old = fc_malloc(sizeof(*old));
38747 *old = *real_packet;
38748 genhash_insert(*hash, old, old);
38749 memset(old, 0, sizeof(*old));
38750 different = 1; /* Force to send. */
38751 }
38752 differ = (old->id32 != real_packet->id32);
38753 if (differ) {
38754 different++;
38755 BV_SET(fields, 0);
38756 }
38757
38758 differ = (old->owner != real_packet->owner);
38759 if (differ) {
38760 different++;
38761 BV_SET(fields, 1);
38762 }
38763
38764 differ = (old->nationality != real_packet->nationality);
38765 if (differ) {
38766 different++;
38767 BV_SET(fields, 2);
38768 }
38769
38770 differ = (old->tile != real_packet->tile);
38771 if (differ) {
38772 different++;
38773 BV_SET(fields, 3);
38774 }
38775
38776 differ = (old->facing != real_packet->facing);
38777 if (differ) {
38778 different++;
38779 BV_SET(fields, 4);
38780 }
38781
38782 differ = (old->homecity32 != real_packet->homecity32);
38783 if (differ) {
38784 different++;
38785 BV_SET(fields, 5);
38786 }
38787
38788
38789 {
38790 differ = FALSE;
38791 {
38792 int i;
38793
38794 for (i = 0; i < O_LAST; i++) {
38795 if (old->upkeep[i] != real_packet->upkeep[i]) {
38796 differ = TRUE;
38797 break;
38798 }
38799 }
38800 }
38801 }
38802 if (differ) {
38803 different++;
38804 BV_SET(fields, 6);
38805 }
38806
38807 differ = (old->veteran != real_packet->veteran);
38808 if (differ) {
38809 different++;
38810 BV_SET(fields, 7);
38811 }
38812
38813 differ = (old->ssa_controller != real_packet->ssa_controller);
38814 if (differ) {
38815 different++;
38816 BV_SET(fields, 8);
38817 }
38818
38819 differ = (old->paradropped != real_packet->paradropped);
38820 if (differ) {
38821 different++;
38822 }
38823 if (packet->paradropped) {
38824 BV_SET(fields, 9);
38825 }
38826
38827 differ = (old->occupied != real_packet->occupied);
38828 if (differ) {
38829 different++;
38830 }
38831 if (packet->occupied) {
38832 BV_SET(fields, 10);
38833 }
38834
38835 differ = (old->transported != real_packet->transported);
38836 if (differ) {
38837 different++;
38838 }
38839 if (packet->transported) {
38840 BV_SET(fields, 11);
38841 }
38842
38843 differ = (old->done_moving != real_packet->done_moving);
38844 if (differ) {
38845 different++;
38846 }
38847 if (packet->done_moving) {
38848 BV_SET(fields, 12);
38849 }
38850
38851 differ = (old->stay != real_packet->stay);
38852 if (differ) {
38853 different++;
38854 }
38855 if (packet->stay) {
38856 BV_SET(fields, 13);
38857 }
38858
38859 differ = (old->type != real_packet->type);
38860 if (differ) {
38861 different++;
38862 BV_SET(fields, 14);
38863 }
38864
38865 differ = (old->transported_by32 != real_packet->transported_by32);
38866 if (differ) {
38867 different++;
38868 BV_SET(fields, 15);
38869 }
38870
38871 differ = (old->carrying != real_packet->carrying);
38872 if (differ) {
38873 different++;
38874 BV_SET(fields, 16);
38875 }
38876
38877 differ = (old->movesleft != real_packet->movesleft);
38878 if (differ) {
38879 different++;
38880 BV_SET(fields, 17);
38881 }
38882
38883 differ = (old->hp != real_packet->hp);
38884 if (differ) {
38885 different++;
38886 BV_SET(fields, 18);
38887 }
38888
38889 differ = (old->fuel != real_packet->fuel);
38890 if (differ) {
38891 different++;
38892 BV_SET(fields, 19);
38893 }
38894
38895 differ = (old->activity_count != real_packet->activity_count);
38896 if (differ) {
38897 different++;
38898 BV_SET(fields, 20);
38899 }
38900
38901 differ = (old->changed_from_count != real_packet->changed_from_count);
38902 if (differ) {
38903 different++;
38904 BV_SET(fields, 21);
38905 }
38906
38907 differ = (old->goto_tile != real_packet->goto_tile);
38908 if (differ) {
38909 different++;
38910 BV_SET(fields, 22);
38911 }
38912
38913 differ = (old->activity != real_packet->activity);
38914 if (differ) {
38915 different++;
38916 BV_SET(fields, 23);
38917 }
38918
38919 differ = (old->activity_tgt != real_packet->activity_tgt);
38920 if (differ) {
38921 different++;
38922 BV_SET(fields, 24);
38923 }
38924
38925 differ = (old->changed_from != real_packet->changed_from);
38926 if (differ) {
38927 different++;
38928 BV_SET(fields, 25);
38929 }
38930
38931 differ = (old->changed_from_tgt != real_packet->changed_from_tgt);
38932 if (differ) {
38933 different++;
38934 BV_SET(fields, 26);
38935 }
38936
38937 differ = (old->battlegroup != real_packet->battlegroup);
38938 if (differ) {
38939 different++;
38940 BV_SET(fields, 27);
38941 }
38942
38943 differ = (old->has_orders != real_packet->has_orders);
38944 if (differ) {
38945 different++;
38946 }
38947 if (packet->has_orders) {
38948 BV_SET(fields, 28);
38949 }
38950
38951 differ = (old->orders_length != real_packet->orders_length);
38952 if (differ) {
38953 different++;
38954 BV_SET(fields, 29);
38955 }
38956
38957 differ = (old->orders_index != real_packet->orders_index);
38958 if (differ) {
38959 different++;
38960 BV_SET(fields, 30);
38961 }
38962
38963 differ = (old->orders_repeat != real_packet->orders_repeat);
38964 if (differ) {
38965 different++;
38966 }
38967 if (packet->orders_repeat) {
38968 BV_SET(fields, 31);
38969 }
38970
38971 differ = (old->orders_vigilant != real_packet->orders_vigilant);
38972 if (differ) {
38973 different++;
38974 }
38975 if (packet->orders_vigilant) {
38976 BV_SET(fields, 32);
38977 }
38978
38979
38980 {
38981 differ = (old->orders_length != real_packet->orders_length);
38982 if (!differ) {
38983 int i;
38984
38985 for (i = 0; i < real_packet->orders_length; i++) {
38986 if (!are_unit_orders_equal(&old->orders[i], &real_packet->orders[i])) {
38987 differ = TRUE;
38988 break;
38989 }
38990 }
38991 }
38992 }
38993 if (differ) {
38994 different++;
38995 BV_SET(fields, 33);
38996 }
38997
38998 differ = (old->action_decision_want != real_packet->action_decision_want);
38999 if (differ) {
39000 different++;
39001 BV_SET(fields, 34);
39002 }
39003
39004 differ = (old->action_decision_tile != real_packet->action_decision_tile);
39005 if (differ) {
39006 different++;
39007 BV_SET(fields, 35);
39008 }
39009
39010
39011 if (different == 0) {
39012 log_packet_detailed(" no change -> discard");
39013 return 0;
39014 }
39015
39016#ifdef FREECIV_JSON_CONNECTION
39017 field_addr.name = "fields";
39018#endif /* FREECIV_JSON_CONNECTION */
39019 DIO_BV_PUT(&dout, &field_addr, fields);
39020
39021 if (BV_ISSET(fields, 0)) {
39022 log_packet_detailed(" field 'id32' has changed");
39023 #ifdef FREECIV_JSON_CONNECTION
39024 field_addr.name = "id32";
39025#endif /* FREECIV_JSON_CONNECTION */
39026 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
39027 }
39028 if (BV_ISSET(fields, 1)) {
39029 log_packet_detailed(" field 'owner' has changed");
39030 #ifdef FREECIV_JSON_CONNECTION
39031 field_addr.name = "owner";
39032#endif /* FREECIV_JSON_CONNECTION */
39033 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
39034 }
39035 if (BV_ISSET(fields, 2)) {
39036 log_packet_detailed(" field 'nationality' has changed");
39037 #ifdef FREECIV_JSON_CONNECTION
39038 field_addr.name = "nationality";
39039#endif /* FREECIV_JSON_CONNECTION */
39040 DIO_PUT(uint16, &dout, &field_addr, real_packet->nationality);
39041 }
39042 if (BV_ISSET(fields, 3)) {
39043 log_packet_detailed(" field 'tile' has changed");
39044 #ifdef FREECIV_JSON_CONNECTION
39045 field_addr.name = "tile";
39046#endif /* FREECIV_JSON_CONNECTION */
39047 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
39048 }
39049 if (BV_ISSET(fields, 4)) {
39050 log_packet_detailed(" field 'facing' has changed");
39051 #ifdef FREECIV_JSON_CONNECTION
39052 field_addr.name = "facing";
39053#endif /* FREECIV_JSON_CONNECTION */
39054 DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
39055 }
39056 if (BV_ISSET(fields, 5)) {
39057 log_packet_detailed(" field 'homecity32' has changed");
39058 #ifdef FREECIV_JSON_CONNECTION
39059 field_addr.name = "homecity32";
39060#endif /* FREECIV_JSON_CONNECTION */
39061 DIO_PUT(uint32, &dout, &field_addr, real_packet->homecity32);
39062 }
39063 if (BV_ISSET(fields, 6)) {
39064 log_packet_detailed(" field 'upkeep' has changed");
39065 #ifdef FREECIV_JSON_CONNECTION
39066 field_addr.name = "upkeep";
39067#endif /* FREECIV_JSON_CONNECTION */
39068
39069 {
39070 int i;
39071
39072#ifdef FREECIV_JSON_CONNECTION
39073 /* Create the array. */
39074 DIO_PUT(farray, &dout, &field_addr, O_LAST);
39075
39076 /* Enter the array. */
39077 field_addr.sub_location = plocation_elem_new(0);
39078#endif /* FREECIV_JSON_CONNECTION */
39079
39080 for (i = 0; i < O_LAST; i++) {
39081#ifdef FREECIV_JSON_CONNECTION
39082 /* Next array element. */
39083 field_addr.sub_location->number = i;
39084#endif /* FREECIV_JSON_CONNECTION */
39085 DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep[i]);
39086 }
39087
39088#ifdef FREECIV_JSON_CONNECTION
39089 /* Exit array. */
39090 free(field_addr.sub_location);
39091 field_addr.sub_location = NULL;
39092#endif /* FREECIV_JSON_CONNECTION */
39093 }
39094 }
39095 if (BV_ISSET(fields, 7)) {
39096 log_packet_detailed(" field 'veteran' has changed");
39097 #ifdef FREECIV_JSON_CONNECTION
39098 field_addr.name = "veteran";
39099#endif /* FREECIV_JSON_CONNECTION */
39100 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
39101 }
39102 if (BV_ISSET(fields, 8)) {
39103 log_packet_detailed(" field 'ssa_controller' has changed");
39104 #ifdef FREECIV_JSON_CONNECTION
39105 field_addr.name = "ssa_controller";
39106#endif /* FREECIV_JSON_CONNECTION */
39107 DIO_PUT(uint8, &dout, &field_addr, real_packet->ssa_controller);
39108 }
39109 /* field 9 is folded into the header */
39110 /* field 10 is folded into the header */
39111 /* field 11 is folded into the header */
39112 /* field 12 is folded into the header */
39113 /* field 13 is folded into the header */
39114 if (BV_ISSET(fields, 14)) {
39115 log_packet_detailed(" field 'type' has changed");
39116 #ifdef FREECIV_JSON_CONNECTION
39117 field_addr.name = "type";
39118#endif /* FREECIV_JSON_CONNECTION */
39119 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
39120 }
39121 if (BV_ISSET(fields, 15)) {
39122 log_packet_detailed(" field 'transported_by32' has changed");
39123 #ifdef FREECIV_JSON_CONNECTION
39124 field_addr.name = "transported_by32";
39125#endif /* FREECIV_JSON_CONNECTION */
39126 DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by32);
39127 }
39128 if (BV_ISSET(fields, 16)) {
39129 log_packet_detailed(" field 'carrying' has changed");
39130 #ifdef FREECIV_JSON_CONNECTION
39131 field_addr.name = "carrying";
39132#endif /* FREECIV_JSON_CONNECTION */
39133 DIO_PUT(sint8, &dout, &field_addr, real_packet->carrying);
39134 }
39135 if (BV_ISSET(fields, 17)) {
39136 log_packet_detailed(" field 'movesleft' has changed");
39137 #ifdef FREECIV_JSON_CONNECTION
39138 field_addr.name = "movesleft";
39139#endif /* FREECIV_JSON_CONNECTION */
39140 DIO_PUT(uint32, &dout, &field_addr, real_packet->movesleft);
39141 }
39142 if (BV_ISSET(fields, 18)) {
39143 log_packet_detailed(" field 'hp' has changed");
39144 #ifdef FREECIV_JSON_CONNECTION
39145 field_addr.name = "hp";
39146#endif /* FREECIV_JSON_CONNECTION */
39147 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
39148 }
39149 if (BV_ISSET(fields, 19)) {
39150 log_packet_detailed(" field 'fuel' has changed");
39151 #ifdef FREECIV_JSON_CONNECTION
39152 field_addr.name = "fuel";
39153#endif /* FREECIV_JSON_CONNECTION */
39154 DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
39155 }
39156 if (BV_ISSET(fields, 20)) {
39157 log_packet_detailed(" field 'activity_count' has changed");
39158 #ifdef FREECIV_JSON_CONNECTION
39159 field_addr.name = "activity_count";
39160#endif /* FREECIV_JSON_CONNECTION */
39161 DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
39162 }
39163 if (BV_ISSET(fields, 21)) {
39164 log_packet_detailed(" field 'changed_from_count' has changed");
39165 #ifdef FREECIV_JSON_CONNECTION
39166 field_addr.name = "changed_from_count";
39167#endif /* FREECIV_JSON_CONNECTION */
39168 DIO_PUT(uint16, &dout, &field_addr, real_packet->changed_from_count);
39169 }
39170 if (BV_ISSET(fields, 22)) {
39171 log_packet_detailed(" field 'goto_tile' has changed");
39172 #ifdef FREECIV_JSON_CONNECTION
39173 field_addr.name = "goto_tile";
39174#endif /* FREECIV_JSON_CONNECTION */
39175 DIO_PUT(sint32, &dout, &field_addr, real_packet->goto_tile);
39176 }
39177 if (BV_ISSET(fields, 23)) {
39178 log_packet_detailed(" field 'activity' has changed");
39179 #ifdef FREECIV_JSON_CONNECTION
39180 field_addr.name = "activity";
39181#endif /* FREECIV_JSON_CONNECTION */
39182 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
39183 }
39184 if (BV_ISSET(fields, 24)) {
39185 log_packet_detailed(" field 'activity_tgt' has changed");
39186 #ifdef FREECIV_JSON_CONNECTION
39187 field_addr.name = "activity_tgt";
39188#endif /* FREECIV_JSON_CONNECTION */
39189 DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
39190 }
39191 if (BV_ISSET(fields, 25)) {
39192 log_packet_detailed(" field 'changed_from' has changed");
39193 #ifdef FREECIV_JSON_CONNECTION
39194 field_addr.name = "changed_from";
39195#endif /* FREECIV_JSON_CONNECTION */
39196 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from);
39197 }
39198 if (BV_ISSET(fields, 26)) {
39199 log_packet_detailed(" field 'changed_from_tgt' has changed");
39200 #ifdef FREECIV_JSON_CONNECTION
39201 field_addr.name = "changed_from_tgt";
39202#endif /* FREECIV_JSON_CONNECTION */
39203 DIO_PUT(sint8, &dout, &field_addr, real_packet->changed_from_tgt);
39204 }
39205 if (BV_ISSET(fields, 27)) {
39206 log_packet_detailed(" field 'battlegroup' has changed");
39207 #ifdef FREECIV_JSON_CONNECTION
39208 field_addr.name = "battlegroup";
39209#endif /* FREECIV_JSON_CONNECTION */
39210 DIO_PUT(sint8, &dout, &field_addr, real_packet->battlegroup);
39211 }
39212 /* field 28 is folded into the header */
39213 if (BV_ISSET(fields, 29)) {
39214 log_packet_detailed(" field 'orders_length' has changed");
39215 #ifdef FREECIV_JSON_CONNECTION
39216 field_addr.name = "orders_length";
39217#endif /* FREECIV_JSON_CONNECTION */
39218 DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_length);
39219 }
39220 if (BV_ISSET(fields, 30)) {
39221 log_packet_detailed(" field 'orders_index' has changed");
39222 #ifdef FREECIV_JSON_CONNECTION
39223 field_addr.name = "orders_index";
39224#endif /* FREECIV_JSON_CONNECTION */
39225 DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_index);
39226 }
39227 /* field 31 is folded into the header */
39228 /* field 32 is folded into the header */
39229 if (BV_ISSET(fields, 33)) {
39230 log_packet_detailed(" field 'orders' has changed");
39231 #ifdef FREECIV_JSON_CONNECTION
39232 field_addr.name = "orders";
39233#endif /* FREECIV_JSON_CONNECTION */
39234
39235 {
39236 int i;
39237
39238#ifdef FREECIV_JSON_CONNECTION
39239 /* Create the array. */
39240 DIO_PUT(farray, &dout, &field_addr, real_packet->orders_length);
39241
39242 /* Enter the array. */
39243 field_addr.sub_location = plocation_elem_new(0);
39244#endif /* FREECIV_JSON_CONNECTION */
39245
39246 for (i = 0; i < real_packet->orders_length; i++) {
39247#ifdef FREECIV_JSON_CONNECTION
39248 /* Next array element. */
39249 field_addr.sub_location->number = i;
39250#endif /* FREECIV_JSON_CONNECTION */
39251 DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
39252 }
39253
39254#ifdef FREECIV_JSON_CONNECTION
39255 /* Exit array. */
39256 free(field_addr.sub_location);
39257 field_addr.sub_location = NULL;
39258#endif /* FREECIV_JSON_CONNECTION */
39259 }
39260 }
39261 if (BV_ISSET(fields, 34)) {
39262 log_packet_detailed(" field 'action_decision_want' has changed");
39263 #ifdef FREECIV_JSON_CONNECTION
39264 field_addr.name = "action_decision_want";
39265#endif /* FREECIV_JSON_CONNECTION */
39266 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_decision_want);
39267 }
39268 if (BV_ISSET(fields, 35)) {
39269 log_packet_detailed(" field 'action_decision_tile' has changed");
39270 #ifdef FREECIV_JSON_CONNECTION
39271 field_addr.name = "action_decision_tile";
39272#endif /* FREECIV_JSON_CONNECTION */
39273 DIO_PUT(sint32, &dout, &field_addr, real_packet->action_decision_tile);
39274 }
39275
39276 *old = *real_packet;
39277
39278 hash = pc->phs.sent + PACKET_UNIT_SHORT_INFO;
39279 if (NULL != *hash) {
39280 genhash_remove(*hash, real_packet);
39281 }
39282#endif /* FREECIV_DELTA_PROTOCOL */
39283#ifndef FREECIV_DELTA_PROTOCOL
39284#ifdef FREECIV_JSON_CONNECTION
39285 field_addr.name = "id32";
39286#endif /* FREECIV_JSON_CONNECTION */
39287 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
39288#ifdef FREECIV_JSON_CONNECTION
39289 field_addr.name = "owner";
39290#endif /* FREECIV_JSON_CONNECTION */
39291 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
39292#ifdef FREECIV_JSON_CONNECTION
39293 field_addr.name = "nationality";
39294#endif /* FREECIV_JSON_CONNECTION */
39295 DIO_PUT(uint16, &dout, &field_addr, real_packet->nationality);
39296#ifdef FREECIV_JSON_CONNECTION
39297 field_addr.name = "tile";
39298#endif /* FREECIV_JSON_CONNECTION */
39299 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
39300#ifdef FREECIV_JSON_CONNECTION
39301 field_addr.name = "facing";
39302#endif /* FREECIV_JSON_CONNECTION */
39303 DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
39304#ifdef FREECIV_JSON_CONNECTION
39305 field_addr.name = "homecity32";
39306#endif /* FREECIV_JSON_CONNECTION */
39307 DIO_PUT(uint32, &dout, &field_addr, real_packet->homecity32);
39308#ifdef FREECIV_JSON_CONNECTION
39309 field_addr.name = "upkeep";
39310#endif /* FREECIV_JSON_CONNECTION */
39311
39312 {
39313 int i;
39314
39315#ifdef FREECIV_JSON_CONNECTION
39316 /* Create the array. */
39317 DIO_PUT(farray, &dout, &field_addr, O_LAST);
39318
39319 /* Enter the array. */
39320 field_addr.sub_location = plocation_elem_new(0);
39321#endif /* FREECIV_JSON_CONNECTION */
39322
39323 for (i = 0; i < O_LAST; i++) {
39324#ifdef FREECIV_JSON_CONNECTION
39325 /* Next array element. */
39326 field_addr.sub_location->number = i;
39327#endif /* FREECIV_JSON_CONNECTION */
39328 DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep[i]);
39329 }
39330
39331#ifdef FREECIV_JSON_CONNECTION
39332 /* Exit array. */
39333 free(field_addr.sub_location);
39334 field_addr.sub_location = NULL;
39335#endif /* FREECIV_JSON_CONNECTION */
39336 }
39337#ifdef FREECIV_JSON_CONNECTION
39338 field_addr.name = "veteran";
39339#endif /* FREECIV_JSON_CONNECTION */
39340 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
39341#ifdef FREECIV_JSON_CONNECTION
39342 field_addr.name = "ssa_controller";
39343#endif /* FREECIV_JSON_CONNECTION */
39344 DIO_PUT(uint8, &dout, &field_addr, real_packet->ssa_controller);
39345#ifdef FREECIV_JSON_CONNECTION
39346 field_addr.name = "paradropped";
39347#endif /* FREECIV_JSON_CONNECTION */
39348 DIO_PUT(bool8, &dout, &field_addr, real_packet->paradropped);
39349#ifdef FREECIV_JSON_CONNECTION
39350 field_addr.name = "occupied";
39351#endif /* FREECIV_JSON_CONNECTION */
39352 DIO_PUT(bool8, &dout, &field_addr, real_packet->occupied);
39353#ifdef FREECIV_JSON_CONNECTION
39354 field_addr.name = "transported";
39355#endif /* FREECIV_JSON_CONNECTION */
39356 DIO_PUT(bool8, &dout, &field_addr, real_packet->transported);
39357#ifdef FREECIV_JSON_CONNECTION
39358 field_addr.name = "done_moving";
39359#endif /* FREECIV_JSON_CONNECTION */
39360 DIO_PUT(bool8, &dout, &field_addr, real_packet->done_moving);
39361#ifdef FREECIV_JSON_CONNECTION
39362 field_addr.name = "stay";
39363#endif /* FREECIV_JSON_CONNECTION */
39364 DIO_PUT(bool8, &dout, &field_addr, real_packet->stay);
39365#ifdef FREECIV_JSON_CONNECTION
39366 field_addr.name = "type";
39367#endif /* FREECIV_JSON_CONNECTION */
39368 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
39369#ifdef FREECIV_JSON_CONNECTION
39370 field_addr.name = "transported_by32";
39371#endif /* FREECIV_JSON_CONNECTION */
39372 DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by32);
39373#ifdef FREECIV_JSON_CONNECTION
39374 field_addr.name = "carrying";
39375#endif /* FREECIV_JSON_CONNECTION */
39376 DIO_PUT(sint8, &dout, &field_addr, real_packet->carrying);
39377#ifdef FREECIV_JSON_CONNECTION
39378 field_addr.name = "movesleft";
39379#endif /* FREECIV_JSON_CONNECTION */
39380 DIO_PUT(uint32, &dout, &field_addr, real_packet->movesleft);
39381#ifdef FREECIV_JSON_CONNECTION
39382 field_addr.name = "hp";
39383#endif /* FREECIV_JSON_CONNECTION */
39384 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
39385#ifdef FREECIV_JSON_CONNECTION
39386 field_addr.name = "fuel";
39387#endif /* FREECIV_JSON_CONNECTION */
39388 DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
39389#ifdef FREECIV_JSON_CONNECTION
39390 field_addr.name = "activity_count";
39391#endif /* FREECIV_JSON_CONNECTION */
39392 DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
39393#ifdef FREECIV_JSON_CONNECTION
39394 field_addr.name = "changed_from_count";
39395#endif /* FREECIV_JSON_CONNECTION */
39396 DIO_PUT(uint16, &dout, &field_addr, real_packet->changed_from_count);
39397#ifdef FREECIV_JSON_CONNECTION
39398 field_addr.name = "goto_tile";
39399#endif /* FREECIV_JSON_CONNECTION */
39400 DIO_PUT(sint32, &dout, &field_addr, real_packet->goto_tile);
39401#ifdef FREECIV_JSON_CONNECTION
39402 field_addr.name = "activity";
39403#endif /* FREECIV_JSON_CONNECTION */
39404 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
39405#ifdef FREECIV_JSON_CONNECTION
39406 field_addr.name = "activity_tgt";
39407#endif /* FREECIV_JSON_CONNECTION */
39408 DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
39409#ifdef FREECIV_JSON_CONNECTION
39410 field_addr.name = "changed_from";
39411#endif /* FREECIV_JSON_CONNECTION */
39412 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from);
39413#ifdef FREECIV_JSON_CONNECTION
39414 field_addr.name = "changed_from_tgt";
39415#endif /* FREECIV_JSON_CONNECTION */
39416 DIO_PUT(sint8, &dout, &field_addr, real_packet->changed_from_tgt);
39417#ifdef FREECIV_JSON_CONNECTION
39418 field_addr.name = "battlegroup";
39419#endif /* FREECIV_JSON_CONNECTION */
39420 DIO_PUT(sint8, &dout, &field_addr, real_packet->battlegroup);
39421#ifdef FREECIV_JSON_CONNECTION
39422 field_addr.name = "has_orders";
39423#endif /* FREECIV_JSON_CONNECTION */
39424 DIO_PUT(bool8, &dout, &field_addr, real_packet->has_orders);
39425#ifdef FREECIV_JSON_CONNECTION
39426 field_addr.name = "orders_length";
39427#endif /* FREECIV_JSON_CONNECTION */
39428 DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_length);
39429#ifdef FREECIV_JSON_CONNECTION
39430 field_addr.name = "orders_index";
39431#endif /* FREECIV_JSON_CONNECTION */
39432 DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_index);
39433#ifdef FREECIV_JSON_CONNECTION
39434 field_addr.name = "orders_repeat";
39435#endif /* FREECIV_JSON_CONNECTION */
39436 DIO_PUT(bool8, &dout, &field_addr, real_packet->orders_repeat);
39437#ifdef FREECIV_JSON_CONNECTION
39438 field_addr.name = "orders_vigilant";
39439#endif /* FREECIV_JSON_CONNECTION */
39440 DIO_PUT(bool8, &dout, &field_addr, real_packet->orders_vigilant);
39441#ifdef FREECIV_JSON_CONNECTION
39442 field_addr.name = "orders";
39443#endif /* FREECIV_JSON_CONNECTION */
39444
39445 {
39446 int i;
39447
39448#ifdef FREECIV_JSON_CONNECTION
39449 /* Create the array. */
39450 DIO_PUT(farray, &dout, &field_addr, real_packet->orders_length);
39451
39452 /* Enter the array. */
39453 field_addr.sub_location = plocation_elem_new(0);
39454#endif /* FREECIV_JSON_CONNECTION */
39455
39456 for (i = 0; i < real_packet->orders_length; i++) {
39457#ifdef FREECIV_JSON_CONNECTION
39458 /* Next array element. */
39459 field_addr.sub_location->number = i;
39460#endif /* FREECIV_JSON_CONNECTION */
39461 DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
39462 }
39463
39464#ifdef FREECIV_JSON_CONNECTION
39465 /* Exit array. */
39466 free(field_addr.sub_location);
39467 field_addr.sub_location = NULL;
39468#endif /* FREECIV_JSON_CONNECTION */
39469 }
39470#ifdef FREECIV_JSON_CONNECTION
39471 field_addr.name = "action_decision_want";
39472#endif /* FREECIV_JSON_CONNECTION */
39473 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_decision_want);
39474#ifdef FREECIV_JSON_CONNECTION
39475 field_addr.name = "action_decision_tile";
39476#endif /* FREECIV_JSON_CONNECTION */
39477 DIO_PUT(sint32, &dout, &field_addr, real_packet->action_decision_tile);
39478
39479#endif
39480 SEND_PACKET_END(PACKET_UNIT_INFO);
39481}
39482
39483#ifdef FREECIV_DELTA_PROTOCOL
39484static genhash_val_t hash_packet_unit_info_101(const void *vkey)
39485{
39486 const struct packet_unit_info *key = (const struct packet_unit_info *) vkey;
39487
39488 return key->id16;
39489}
39490
39491static bool cmp_packet_unit_info_101(const void *vkey1, const void *vkey2)
39492{
39493 const struct packet_unit_info *key1 = (const struct packet_unit_info *) vkey1;
39494 const struct packet_unit_info *key2 = (const struct packet_unit_info *) vkey2;
39495
39496 return key1->id16 == key2->id16;
39497}
39498 BV_DEFINE(packet_unit_info_101_fields, 35);
39499#endif /* FREECIV_DELTA_PROTOCOL */
39500
39501 static struct packet_unit_info *receive_packet_unit_info_101(struct connection *pc)
39502{
39503#ifdef FREECIV_DELTA_PROTOCOL
39504 packet_unit_info_101_fields fields;
39505 struct packet_unit_info *old;
39506 struct genhash **hash = pc->phs.received + PACKET_UNIT_INFO;
39507#endif /* FREECIV_DELTA_PROTOCOL */
39508 RECEIVE_PACKET_START(packet_unit_info, real_packet);
39509#ifdef FREECIV_JSON_CONNECTION
39510 struct plocation field_addr;
39511 {
39512 struct plocation *field_addr_tmp = plocation_field_new(NULL);
39513 field_addr = *field_addr_tmp;
39514 FC_FREE(field_addr_tmp);
39515 }
39516#endif /* FREECIV_JSON_CONNECTION */
39517
39518#ifdef FREECIV_DELTA_PROTOCOL
39519#ifdef FREECIV_JSON_CONNECTION
39520 field_addr.name = "fields";
39521#endif /* FREECIV_JSON_CONNECTION */
39522 DIO_BV_GET(&din, &field_addr, fields);
39523 #ifdef FREECIV_JSON_CONNECTION
39524 field_addr.name = "id16";
39525 #endif /* FREECIV_JSON_CONNECTION */
39526 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
39527 RECEIVE_PACKET_FIELD_ERROR(id16);
39528 }
39529
39530#else /* FREECIV_DELTA_PROTOCOL */
39531 #ifdef FREECIV_JSON_CONNECTION
39532 field_addr.name = "id16";
39533 #endif /* FREECIV_JSON_CONNECTION */
39534 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
39535 RECEIVE_PACKET_FIELD_ERROR(id16);
39536 }
39537 #ifdef FREECIV_JSON_CONNECTION
39538 field_addr.name = "owner";
39539 #endif /* FREECIV_JSON_CONNECTION */
39540 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
39541 RECEIVE_PACKET_FIELD_ERROR(owner);
39542 }
39543 #ifdef FREECIV_JSON_CONNECTION
39544 field_addr.name = "nationality";
39545 #endif /* FREECIV_JSON_CONNECTION */
39546 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nationality)) {
39547 RECEIVE_PACKET_FIELD_ERROR(nationality);
39548 }
39549 #ifdef FREECIV_JSON_CONNECTION
39550 field_addr.name = "tile";
39551 #endif /* FREECIV_JSON_CONNECTION */
39552 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
39553 RECEIVE_PACKET_FIELD_ERROR(tile);
39554 }
39555 #ifdef FREECIV_JSON_CONNECTION
39556 field_addr.name = "facing";
39557 #endif /* FREECIV_JSON_CONNECTION */
39558 {
39559 int readin;
39560
39561 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
39562 RECEIVE_PACKET_FIELD_ERROR(facing);
39563 }
39564 real_packet->facing = readin;
39565 }
39566 #ifdef FREECIV_JSON_CONNECTION
39567 field_addr.name = "homecity16";
39568 #endif /* FREECIV_JSON_CONNECTION */
39569 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->homecity16)) {
39570 RECEIVE_PACKET_FIELD_ERROR(homecity16);
39571 }
39572 #ifdef FREECIV_JSON_CONNECTION
39573 field_addr.name = "upkeep";
39574 #endif /* FREECIV_JSON_CONNECTION */
39575
39576 {
39577 int i;
39578
39579 #ifdef FREECIV_JSON_CONNECTION
39580 /* Enter array. */
39581 field_addr.sub_location = plocation_elem_new(0);
39582 #endif /* FREECIV_JSON_CONNECTION */
39583
39584 for (i = 0; i < O_LAST; i++) {
39585 #ifdef FREECIV_JSON_CONNECTION
39586 field_addr.sub_location->number = i;
39587 #endif /* FREECIV_JSON_CONNECTION */
39588 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep[i])) {
39589 RECEIVE_PACKET_FIELD_ERROR(upkeep);
39590 }
39591 }
39592
39593 #ifdef FREECIV_JSON_CONNECTION
39594 /* Exit array. */
39595 free(field_addr.sub_location);
39596 field_addr.sub_location = NULL;
39597 #endif /* FREECIV_JSON_CONNECTION */
39598 }
39599 #ifdef FREECIV_JSON_CONNECTION
39600 field_addr.name = "veteran";
39601 #endif /* FREECIV_JSON_CONNECTION */
39602 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
39603 RECEIVE_PACKET_FIELD_ERROR(veteran);
39604 }
39605 #ifdef FREECIV_JSON_CONNECTION
39606 field_addr.name = "ssa_controller";
39607 #endif /* FREECIV_JSON_CONNECTION */
39608 {
39609 int readin;
39610
39611 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
39612 RECEIVE_PACKET_FIELD_ERROR(ssa_controller);
39613 }
39614 real_packet->ssa_controller = readin;
39615 }
39616 #ifdef FREECIV_JSON_CONNECTION
39617 field_addr.name = "paradropped";
39618 #endif /* FREECIV_JSON_CONNECTION */
39619 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->paradropped)) {
39620 RECEIVE_PACKET_FIELD_ERROR(paradropped);
39621 }
39622 #ifdef FREECIV_JSON_CONNECTION
39623 field_addr.name = "occupied";
39624 #endif /* FREECIV_JSON_CONNECTION */
39625 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->occupied)) {
39626 RECEIVE_PACKET_FIELD_ERROR(occupied);
39627 }
39628 #ifdef FREECIV_JSON_CONNECTION
39629 field_addr.name = "transported";
39630 #endif /* FREECIV_JSON_CONNECTION */
39631 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->transported)) {
39632 RECEIVE_PACKET_FIELD_ERROR(transported);
39633 }
39634 #ifdef FREECIV_JSON_CONNECTION
39635 field_addr.name = "done_moving";
39636 #endif /* FREECIV_JSON_CONNECTION */
39637 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->done_moving)) {
39638 RECEIVE_PACKET_FIELD_ERROR(done_moving);
39639 }
39640 #ifdef FREECIV_JSON_CONNECTION
39641 field_addr.name = "stay";
39642 #endif /* FREECIV_JSON_CONNECTION */
39643 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->stay)) {
39644 RECEIVE_PACKET_FIELD_ERROR(stay);
39645 }
39646 #ifdef FREECIV_JSON_CONNECTION
39647 field_addr.name = "type";
39648 #endif /* FREECIV_JSON_CONNECTION */
39649 {
39650 int readin;
39651
39652 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
39653 RECEIVE_PACKET_FIELD_ERROR(type);
39654 }
39655 real_packet->type = readin;
39656 }
39657 #ifdef FREECIV_JSON_CONNECTION
39658 field_addr.name = "transported_by16";
39659 #endif /* FREECIV_JSON_CONNECTION */
39660 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->transported_by16)) {
39661 RECEIVE_PACKET_FIELD_ERROR(transported_by16);
39662 }
39663 #ifdef FREECIV_JSON_CONNECTION
39664 field_addr.name = "carrying";
39665 #endif /* FREECIV_JSON_CONNECTION */
39666 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->carrying)) {
39667 RECEIVE_PACKET_FIELD_ERROR(carrying);
39668 }
39669 #ifdef FREECIV_JSON_CONNECTION
39670 field_addr.name = "movesleft";
39671 #endif /* FREECIV_JSON_CONNECTION */
39672 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->movesleft)) {
39673 RECEIVE_PACKET_FIELD_ERROR(movesleft);
39674 }
39675 #ifdef FREECIV_JSON_CONNECTION
39676 field_addr.name = "hp";
39677 #endif /* FREECIV_JSON_CONNECTION */
39678 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
39679 RECEIVE_PACKET_FIELD_ERROR(hp);
39680 }
39681 #ifdef FREECIV_JSON_CONNECTION
39682 field_addr.name = "fuel";
39683 #endif /* FREECIV_JSON_CONNECTION */
39684 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
39685 RECEIVE_PACKET_FIELD_ERROR(fuel);
39686 }
39687 #ifdef FREECIV_JSON_CONNECTION
39688 field_addr.name = "activity_count";
39689 #endif /* FREECIV_JSON_CONNECTION */
39690 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
39691 RECEIVE_PACKET_FIELD_ERROR(activity_count);
39692 }
39693 #ifdef FREECIV_JSON_CONNECTION
39694 field_addr.name = "changed_from_count";
39695 #endif /* FREECIV_JSON_CONNECTION */
39696 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->changed_from_count)) {
39697 RECEIVE_PACKET_FIELD_ERROR(changed_from_count);
39698 }
39699 #ifdef FREECIV_JSON_CONNECTION
39700 field_addr.name = "goto_tile";
39701 #endif /* FREECIV_JSON_CONNECTION */
39702 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->goto_tile)) {
39703 RECEIVE_PACKET_FIELD_ERROR(goto_tile);
39704 }
39705 #ifdef FREECIV_JSON_CONNECTION
39706 field_addr.name = "activity";
39707 #endif /* FREECIV_JSON_CONNECTION */
39708 {
39709 int readin;
39710
39711 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
39712 RECEIVE_PACKET_FIELD_ERROR(activity);
39713 }
39714 real_packet->activity = readin;
39715 }
39716 #ifdef FREECIV_JSON_CONNECTION
39717 field_addr.name = "activity_tgt";
39718 #endif /* FREECIV_JSON_CONNECTION */
39719 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
39720 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
39721 }
39722 #ifdef FREECIV_JSON_CONNECTION
39723 field_addr.name = "changed_from";
39724 #endif /* FREECIV_JSON_CONNECTION */
39725 {
39726 int readin;
39727
39728 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
39729 RECEIVE_PACKET_FIELD_ERROR(changed_from);
39730 }
39731 real_packet->changed_from = readin;
39732 }
39733 #ifdef FREECIV_JSON_CONNECTION
39734 field_addr.name = "changed_from_tgt";
39735 #endif /* FREECIV_JSON_CONNECTION */
39736 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->changed_from_tgt)) {
39737 RECEIVE_PACKET_FIELD_ERROR(changed_from_tgt);
39738 }
39739 #ifdef FREECIV_JSON_CONNECTION
39740 field_addr.name = "battlegroup";
39741 #endif /* FREECIV_JSON_CONNECTION */
39742 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->battlegroup)) {
39743 RECEIVE_PACKET_FIELD_ERROR(battlegroup);
39744 }
39745 #ifdef FREECIV_JSON_CONNECTION
39746 field_addr.name = "has_orders";
39747 #endif /* FREECIV_JSON_CONNECTION */
39748 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->has_orders)) {
39749 RECEIVE_PACKET_FIELD_ERROR(has_orders);
39750 }
39751 #ifdef FREECIV_JSON_CONNECTION
39752 field_addr.name = "orders_length";
39753 #endif /* FREECIV_JSON_CONNECTION */
39754 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_length)) {
39755 RECEIVE_PACKET_FIELD_ERROR(orders_length);
39756 }
39757 #ifdef FREECIV_JSON_CONNECTION
39758 field_addr.name = "orders_index";
39759 #endif /* FREECIV_JSON_CONNECTION */
39760 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_index)) {
39761 RECEIVE_PACKET_FIELD_ERROR(orders_index);
39762 }
39763 #ifdef FREECIV_JSON_CONNECTION
39764 field_addr.name = "orders_repeat";
39765 #endif /* FREECIV_JSON_CONNECTION */
39766 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->orders_repeat)) {
39767 RECEIVE_PACKET_FIELD_ERROR(orders_repeat);
39768 }
39769 #ifdef FREECIV_JSON_CONNECTION
39770 field_addr.name = "orders_vigilant";
39771 #endif /* FREECIV_JSON_CONNECTION */
39772 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->orders_vigilant)) {
39773 RECEIVE_PACKET_FIELD_ERROR(orders_vigilant);
39774 }
39775 #ifdef FREECIV_JSON_CONNECTION
39776 field_addr.name = "orders";
39777 #endif /* FREECIV_JSON_CONNECTION */
39778
39779 {
39780 int i;
39781
39782 #ifdef FREECIV_JSON_CONNECTION
39783 /* Enter array. */
39784 field_addr.sub_location = plocation_elem_new(0);
39785 #endif /* FREECIV_JSON_CONNECTION */
39786
39787 if (real_packet->orders_length > MAX_LEN_ROUTE) {
39788 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
39789 }
39790 for (i = 0; i < real_packet->orders_length; i++) {
39791 #ifdef FREECIV_JSON_CONNECTION
39792 field_addr.sub_location->number = i;
39793 #endif /* FREECIV_JSON_CONNECTION */
39794 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
39795 RECEIVE_PACKET_FIELD_ERROR(orders);
39796 }
39797 }
39798
39799 #ifdef FREECIV_JSON_CONNECTION
39800 /* Exit array. */
39801 free(field_addr.sub_location);
39802 field_addr.sub_location = NULL;
39803 #endif /* FREECIV_JSON_CONNECTION */
39804 }
39805 #ifdef FREECIV_JSON_CONNECTION
39806 field_addr.name = "action_decision_want";
39807 #endif /* FREECIV_JSON_CONNECTION */
39808 {
39809 int readin;
39810
39811 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
39812 RECEIVE_PACKET_FIELD_ERROR(action_decision_want);
39813 }
39814 real_packet->action_decision_want = readin;
39815 }
39816 #ifdef FREECIV_JSON_CONNECTION
39817 field_addr.name = "action_decision_tile";
39818 #endif /* FREECIV_JSON_CONNECTION */
39819 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->action_decision_tile)) {
39820 RECEIVE_PACKET_FIELD_ERROR(action_decision_tile);
39821 }
39822
39823#endif
39824 log_packet_detailed("packet_unit_info_101: got info about (%d)",
39825 real_packet->id16);
39826
39827#ifdef FREECIV_DELTA_PROTOCOL
39828 if (NULL == *hash) {
39829 *hash = genhash_new_full(hash_packet_unit_info_101, cmp_packet_unit_info_101,
39830 NULL, NULL, NULL, free);
39831 }
39832
39833 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
39834 *real_packet = *old;
39835 } else {
39836 int id16 = real_packet->id16;
39837
39838 log_packet_detailed(" no old info");
39839 memset(real_packet, 0, sizeof(*real_packet));
39840
39841 real_packet->id16 = id16;
39842 }
39843
39844 if (BV_ISSET(fields, 0)) {
39845 log_packet_detailed(" got field 'owner'");
39846 #ifdef FREECIV_JSON_CONNECTION
39847 field_addr.name = "owner";
39848 #endif /* FREECIV_JSON_CONNECTION */
39849 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
39850 RECEIVE_PACKET_FIELD_ERROR(owner);
39851 }
39852 }
39853 if (BV_ISSET(fields, 1)) {
39854 log_packet_detailed(" got field 'nationality'");
39855 #ifdef FREECIV_JSON_CONNECTION
39856 field_addr.name = "nationality";
39857 #endif /* FREECIV_JSON_CONNECTION */
39858 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nationality)) {
39859 RECEIVE_PACKET_FIELD_ERROR(nationality);
39860 }
39861 }
39862 if (BV_ISSET(fields, 2)) {
39863 log_packet_detailed(" got field 'tile'");
39864 #ifdef FREECIV_JSON_CONNECTION
39865 field_addr.name = "tile";
39866 #endif /* FREECIV_JSON_CONNECTION */
39867 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
39868 RECEIVE_PACKET_FIELD_ERROR(tile);
39869 }
39870 }
39871 if (BV_ISSET(fields, 3)) {
39872 log_packet_detailed(" got field 'facing'");
39873 #ifdef FREECIV_JSON_CONNECTION
39874 field_addr.name = "facing";
39875 #endif /* FREECIV_JSON_CONNECTION */
39876 {
39877 int readin;
39878
39879 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
39880 RECEIVE_PACKET_FIELD_ERROR(facing);
39881 }
39882 real_packet->facing = readin;
39883 }
39884 }
39885 if (BV_ISSET(fields, 4)) {
39886 log_packet_detailed(" got field 'homecity16'");
39887 #ifdef FREECIV_JSON_CONNECTION
39888 field_addr.name = "homecity16";
39889 #endif /* FREECIV_JSON_CONNECTION */
39890 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->homecity16)) {
39891 RECEIVE_PACKET_FIELD_ERROR(homecity16);
39892 }
39893 }
39894 if (BV_ISSET(fields, 5)) {
39895 log_packet_detailed(" got field 'upkeep'");
39896 #ifdef FREECIV_JSON_CONNECTION
39897 field_addr.name = "upkeep";
39898 #endif /* FREECIV_JSON_CONNECTION */
39899
39900 {
39901 int i;
39902
39903 #ifdef FREECIV_JSON_CONNECTION
39904 /* Enter array. */
39905 field_addr.sub_location = plocation_elem_new(0);
39906 #endif /* FREECIV_JSON_CONNECTION */
39907
39908 for (i = 0; i < O_LAST; i++) {
39909 #ifdef FREECIV_JSON_CONNECTION
39910 field_addr.sub_location->number = i;
39911 #endif /* FREECIV_JSON_CONNECTION */
39912 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep[i])) {
39913 RECEIVE_PACKET_FIELD_ERROR(upkeep);
39914 }
39915 }
39916
39917 #ifdef FREECIV_JSON_CONNECTION
39918 /* Exit array. */
39919 free(field_addr.sub_location);
39920 field_addr.sub_location = NULL;
39921 #endif /* FREECIV_JSON_CONNECTION */
39922 }
39923 }
39924 if (BV_ISSET(fields, 6)) {
39925 log_packet_detailed(" got field 'veteran'");
39926 #ifdef FREECIV_JSON_CONNECTION
39927 field_addr.name = "veteran";
39928 #endif /* FREECIV_JSON_CONNECTION */
39929 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
39930 RECEIVE_PACKET_FIELD_ERROR(veteran);
39931 }
39932 }
39933 if (BV_ISSET(fields, 7)) {
39934 log_packet_detailed(" got field 'ssa_controller'");
39935 #ifdef FREECIV_JSON_CONNECTION
39936 field_addr.name = "ssa_controller";
39937 #endif /* FREECIV_JSON_CONNECTION */
39938 {
39939 int readin;
39940
39941 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
39942 RECEIVE_PACKET_FIELD_ERROR(ssa_controller);
39943 }
39944 real_packet->ssa_controller = readin;
39945 }
39946 }
39947 real_packet->paradropped = BV_ISSET(fields, 8);
39948 real_packet->occupied = BV_ISSET(fields, 9);
39949 real_packet->transported = BV_ISSET(fields, 10);
39950 real_packet->done_moving = BV_ISSET(fields, 11);
39951 real_packet->stay = BV_ISSET(fields, 12);
39952 if (BV_ISSET(fields, 13)) {
39953 log_packet_detailed(" got field 'type'");
39954 #ifdef FREECIV_JSON_CONNECTION
39955 field_addr.name = "type";
39956 #endif /* FREECIV_JSON_CONNECTION */
39957 {
39958 int readin;
39959
39960 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
39961 RECEIVE_PACKET_FIELD_ERROR(type);
39962 }
39963 real_packet->type = readin;
39964 }
39965 }
39966 if (BV_ISSET(fields, 14)) {
39967 log_packet_detailed(" got field 'transported_by16'");
39968 #ifdef FREECIV_JSON_CONNECTION
39969 field_addr.name = "transported_by16";
39970 #endif /* FREECIV_JSON_CONNECTION */
39971 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->transported_by16)) {
39972 RECEIVE_PACKET_FIELD_ERROR(transported_by16);
39973 }
39974 }
39975 if (BV_ISSET(fields, 15)) {
39976 log_packet_detailed(" got field 'carrying'");
39977 #ifdef FREECIV_JSON_CONNECTION
39978 field_addr.name = "carrying";
39979 #endif /* FREECIV_JSON_CONNECTION */
39980 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->carrying)) {
39981 RECEIVE_PACKET_FIELD_ERROR(carrying);
39982 }
39983 }
39984 if (BV_ISSET(fields, 16)) {
39985 log_packet_detailed(" got field 'movesleft'");
39986 #ifdef FREECIV_JSON_CONNECTION
39987 field_addr.name = "movesleft";
39988 #endif /* FREECIV_JSON_CONNECTION */
39989 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->movesleft)) {
39990 RECEIVE_PACKET_FIELD_ERROR(movesleft);
39991 }
39992 }
39993 if (BV_ISSET(fields, 17)) {
39994 log_packet_detailed(" got field 'hp'");
39995 #ifdef FREECIV_JSON_CONNECTION
39996 field_addr.name = "hp";
39997 #endif /* FREECIV_JSON_CONNECTION */
39998 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
39999 RECEIVE_PACKET_FIELD_ERROR(hp);
40000 }
40001 }
40002 if (BV_ISSET(fields, 18)) {
40003 log_packet_detailed(" got field 'fuel'");
40004 #ifdef FREECIV_JSON_CONNECTION
40005 field_addr.name = "fuel";
40006 #endif /* FREECIV_JSON_CONNECTION */
40007 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
40008 RECEIVE_PACKET_FIELD_ERROR(fuel);
40009 }
40010 }
40011 if (BV_ISSET(fields, 19)) {
40012 log_packet_detailed(" got field 'activity_count'");
40013 #ifdef FREECIV_JSON_CONNECTION
40014 field_addr.name = "activity_count";
40015 #endif /* FREECIV_JSON_CONNECTION */
40016 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
40017 RECEIVE_PACKET_FIELD_ERROR(activity_count);
40018 }
40019 }
40020 if (BV_ISSET(fields, 20)) {
40021 log_packet_detailed(" got field 'changed_from_count'");
40022 #ifdef FREECIV_JSON_CONNECTION
40023 field_addr.name = "changed_from_count";
40024 #endif /* FREECIV_JSON_CONNECTION */
40025 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->changed_from_count)) {
40026 RECEIVE_PACKET_FIELD_ERROR(changed_from_count);
40027 }
40028 }
40029 if (BV_ISSET(fields, 21)) {
40030 log_packet_detailed(" got field 'goto_tile'");
40031 #ifdef FREECIV_JSON_CONNECTION
40032 field_addr.name = "goto_tile";
40033 #endif /* FREECIV_JSON_CONNECTION */
40034 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->goto_tile)) {
40035 RECEIVE_PACKET_FIELD_ERROR(goto_tile);
40036 }
40037 }
40038 if (BV_ISSET(fields, 22)) {
40039 log_packet_detailed(" got field 'activity'");
40040 #ifdef FREECIV_JSON_CONNECTION
40041 field_addr.name = "activity";
40042 #endif /* FREECIV_JSON_CONNECTION */
40043 {
40044 int readin;
40045
40046 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
40047 RECEIVE_PACKET_FIELD_ERROR(activity);
40048 }
40049 real_packet->activity = readin;
40050 }
40051 }
40052 if (BV_ISSET(fields, 23)) {
40053 log_packet_detailed(" got field 'activity_tgt'");
40054 #ifdef FREECIV_JSON_CONNECTION
40055 field_addr.name = "activity_tgt";
40056 #endif /* FREECIV_JSON_CONNECTION */
40057 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
40058 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
40059 }
40060 }
40061 if (BV_ISSET(fields, 24)) {
40062 log_packet_detailed(" got field 'changed_from'");
40063 #ifdef FREECIV_JSON_CONNECTION
40064 field_addr.name = "changed_from";
40065 #endif /* FREECIV_JSON_CONNECTION */
40066 {
40067 int readin;
40068
40069 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
40070 RECEIVE_PACKET_FIELD_ERROR(changed_from);
40071 }
40072 real_packet->changed_from = readin;
40073 }
40074 }
40075 if (BV_ISSET(fields, 25)) {
40076 log_packet_detailed(" got field 'changed_from_tgt'");
40077 #ifdef FREECIV_JSON_CONNECTION
40078 field_addr.name = "changed_from_tgt";
40079 #endif /* FREECIV_JSON_CONNECTION */
40080 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->changed_from_tgt)) {
40081 RECEIVE_PACKET_FIELD_ERROR(changed_from_tgt);
40082 }
40083 }
40084 if (BV_ISSET(fields, 26)) {
40085 log_packet_detailed(" got field 'battlegroup'");
40086 #ifdef FREECIV_JSON_CONNECTION
40087 field_addr.name = "battlegroup";
40088 #endif /* FREECIV_JSON_CONNECTION */
40089 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->battlegroup)) {
40090 RECEIVE_PACKET_FIELD_ERROR(battlegroup);
40091 }
40092 }
40093 real_packet->has_orders = BV_ISSET(fields, 27);
40094 if (BV_ISSET(fields, 28)) {
40095 log_packet_detailed(" got field 'orders_length'");
40096 #ifdef FREECIV_JSON_CONNECTION
40097 field_addr.name = "orders_length";
40098 #endif /* FREECIV_JSON_CONNECTION */
40099 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_length)) {
40100 RECEIVE_PACKET_FIELD_ERROR(orders_length);
40101 }
40102 }
40103 if (BV_ISSET(fields, 29)) {
40104 log_packet_detailed(" got field 'orders_index'");
40105 #ifdef FREECIV_JSON_CONNECTION
40106 field_addr.name = "orders_index";
40107 #endif /* FREECIV_JSON_CONNECTION */
40108 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_index)) {
40109 RECEIVE_PACKET_FIELD_ERROR(orders_index);
40110 }
40111 }
40112 real_packet->orders_repeat = BV_ISSET(fields, 30);
40113 real_packet->orders_vigilant = BV_ISSET(fields, 31);
40114 if (BV_ISSET(fields, 32)) {
40115 log_packet_detailed(" got field 'orders'");
40116 #ifdef FREECIV_JSON_CONNECTION
40117 field_addr.name = "orders";
40118 #endif /* FREECIV_JSON_CONNECTION */
40119
40120 {
40121 int i;
40122
40123 #ifdef FREECIV_JSON_CONNECTION
40124 /* Enter array. */
40125 field_addr.sub_location = plocation_elem_new(0);
40126 #endif /* FREECIV_JSON_CONNECTION */
40127
40128 if (real_packet->orders_length > MAX_LEN_ROUTE) {
40129 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
40130 }
40131 for (i = 0; i < real_packet->orders_length; i++) {
40132 #ifdef FREECIV_JSON_CONNECTION
40133 field_addr.sub_location->number = i;
40134 #endif /* FREECIV_JSON_CONNECTION */
40135 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
40136 RECEIVE_PACKET_FIELD_ERROR(orders);
40137 }
40138 }
40139
40140 #ifdef FREECIV_JSON_CONNECTION
40141 /* Exit array. */
40142 free(field_addr.sub_location);
40143 field_addr.sub_location = NULL;
40144 #endif /* FREECIV_JSON_CONNECTION */
40145 }
40146 }
40147 if (BV_ISSET(fields, 33)) {
40148 log_packet_detailed(" got field 'action_decision_want'");
40149 #ifdef FREECIV_JSON_CONNECTION
40150 field_addr.name = "action_decision_want";
40151 #endif /* FREECIV_JSON_CONNECTION */
40152 {
40153 int readin;
40154
40155 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
40156 RECEIVE_PACKET_FIELD_ERROR(action_decision_want);
40157 }
40158 real_packet->action_decision_want = readin;
40159 }
40160 }
40161 if (BV_ISSET(fields, 34)) {
40162 log_packet_detailed(" got field 'action_decision_tile'");
40163 #ifdef FREECIV_JSON_CONNECTION
40164 field_addr.name = "action_decision_tile";
40165 #endif /* FREECIV_JSON_CONNECTION */
40166 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->action_decision_tile)) {
40167 RECEIVE_PACKET_FIELD_ERROR(action_decision_tile);
40168 }
40169 }
40170
40171 if (NULL == old) {
40172 old = fc_malloc(sizeof(*old));
40173 *old = *real_packet;
40174 genhash_insert(*hash, old, old);
40175 } else {
40176 *old = *real_packet;
40177 }
40178
40179 hash = pc->phs.received + PACKET_UNIT_SHORT_INFO;
40180 if (NULL != *hash) {
40181 genhash_remove(*hash, real_packet);
40182 }
40183
40184#endif /* FREECIV_DELTA_PROTOCOL */
40185 RECEIVE_PACKET_END(real_packet);
40186}
40187
40188 static int send_packet_unit_info_101(struct connection *pc, const struct packet_unit_info *packet)
40189{
40190 const struct packet_unit_info *real_packet = packet;
40191#ifdef FREECIV_DELTA_PROTOCOL
40192 packet_unit_info_101_fields fields;
40193 struct packet_unit_info *old;
40194 bool differ;
40195 struct genhash **hash = pc->phs.sent + PACKET_UNIT_INFO;
40196 int different = 0;
40197#endif /* FREECIV_DELTA_PROTOCOL */
40198 SEND_PACKET_START(PACKET_UNIT_INFO);
40199#ifdef FREECIV_JSON_CONNECTION
40200 struct plocation field_addr;
40201 {
40202 struct plocation *field_addr_tmp = plocation_field_new(NULL);
40203 field_addr = *field_addr_tmp;
40204 FC_FREE(field_addr_tmp);
40205 }
40206#endif /* FREECIV_JSON_CONNECTION */
40207
40208 log_packet_detailed("packet_unit_info_101: sending info about (%d)",
40209 real_packet->id16);
40210
40211#ifdef FREECIV_DELTA_PROTOCOL
40212 if (NULL == *hash) {
40213 *hash = genhash_new_full(hash_packet_unit_info_101, cmp_packet_unit_info_101,
40214 NULL, NULL, NULL, free);
40215 }
40216 BV_CLR_ALL(fields);
40217
40218 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
40219 old = fc_malloc(sizeof(*old));
40220 *old = *real_packet;
40221 genhash_insert(*hash, old, old);
40222 memset(old, 0, sizeof(*old));
40223 different = 1; /* Force to send. */
40224 }
40225 differ = (old->owner != real_packet->owner);
40226 if (differ) {
40227 different++;
40228 BV_SET(fields, 0);
40229 }
40230
40231 differ = (old->nationality != real_packet->nationality);
40232 if (differ) {
40233 different++;
40234 BV_SET(fields, 1);
40235 }
40236
40237 differ = (old->tile != real_packet->tile);
40238 if (differ) {
40239 different++;
40240 BV_SET(fields, 2);
40241 }
40242
40243 differ = (old->facing != real_packet->facing);
40244 if (differ) {
40245 different++;
40246 BV_SET(fields, 3);
40247 }
40248
40249 differ = (old->homecity16 != real_packet->homecity16);
40250 if (differ) {
40251 different++;
40252 BV_SET(fields, 4);
40253 }
40254
40255
40256 {
40257 differ = FALSE;
40258 {
40259 int i;
40260
40261 for (i = 0; i < O_LAST; i++) {
40262 if (old->upkeep[i] != real_packet->upkeep[i]) {
40263 differ = TRUE;
40264 break;
40265 }
40266 }
40267 }
40268 }
40269 if (differ) {
40270 different++;
40271 BV_SET(fields, 5);
40272 }
40273
40274 differ = (old->veteran != real_packet->veteran);
40275 if (differ) {
40276 different++;
40277 BV_SET(fields, 6);
40278 }
40279
40280 differ = (old->ssa_controller != real_packet->ssa_controller);
40281 if (differ) {
40282 different++;
40283 BV_SET(fields, 7);
40284 }
40285
40286 differ = (old->paradropped != real_packet->paradropped);
40287 if (differ) {
40288 different++;
40289 }
40290 if (packet->paradropped) {
40291 BV_SET(fields, 8);
40292 }
40293
40294 differ = (old->occupied != real_packet->occupied);
40295 if (differ) {
40296 different++;
40297 }
40298 if (packet->occupied) {
40299 BV_SET(fields, 9);
40300 }
40301
40302 differ = (old->transported != real_packet->transported);
40303 if (differ) {
40304 different++;
40305 }
40306 if (packet->transported) {
40307 BV_SET(fields, 10);
40308 }
40309
40310 differ = (old->done_moving != real_packet->done_moving);
40311 if (differ) {
40312 different++;
40313 }
40314 if (packet->done_moving) {
40315 BV_SET(fields, 11);
40316 }
40317
40318 differ = (old->stay != real_packet->stay);
40319 if (differ) {
40320 different++;
40321 }
40322 if (packet->stay) {
40323 BV_SET(fields, 12);
40324 }
40325
40326 differ = (old->type != real_packet->type);
40327 if (differ) {
40328 different++;
40329 BV_SET(fields, 13);
40330 }
40331
40332 differ = (old->transported_by16 != real_packet->transported_by16);
40333 if (differ) {
40334 different++;
40335 BV_SET(fields, 14);
40336 }
40337
40338 differ = (old->carrying != real_packet->carrying);
40339 if (differ) {
40340 different++;
40341 BV_SET(fields, 15);
40342 }
40343
40344 differ = (old->movesleft != real_packet->movesleft);
40345 if (differ) {
40346 different++;
40347 BV_SET(fields, 16);
40348 }
40349
40350 differ = (old->hp != real_packet->hp);
40351 if (differ) {
40352 different++;
40353 BV_SET(fields, 17);
40354 }
40355
40356 differ = (old->fuel != real_packet->fuel);
40357 if (differ) {
40358 different++;
40359 BV_SET(fields, 18);
40360 }
40361
40362 differ = (old->activity_count != real_packet->activity_count);
40363 if (differ) {
40364 different++;
40365 BV_SET(fields, 19);
40366 }
40367
40368 differ = (old->changed_from_count != real_packet->changed_from_count);
40369 if (differ) {
40370 different++;
40371 BV_SET(fields, 20);
40372 }
40373
40374 differ = (old->goto_tile != real_packet->goto_tile);
40375 if (differ) {
40376 different++;
40377 BV_SET(fields, 21);
40378 }
40379
40380 differ = (old->activity != real_packet->activity);
40381 if (differ) {
40382 different++;
40383 BV_SET(fields, 22);
40384 }
40385
40386 differ = (old->activity_tgt != real_packet->activity_tgt);
40387 if (differ) {
40388 different++;
40389 BV_SET(fields, 23);
40390 }
40391
40392 differ = (old->changed_from != real_packet->changed_from);
40393 if (differ) {
40394 different++;
40395 BV_SET(fields, 24);
40396 }
40397
40398 differ = (old->changed_from_tgt != real_packet->changed_from_tgt);
40399 if (differ) {
40400 different++;
40401 BV_SET(fields, 25);
40402 }
40403
40404 differ = (old->battlegroup != real_packet->battlegroup);
40405 if (differ) {
40406 different++;
40407 BV_SET(fields, 26);
40408 }
40409
40410 differ = (old->has_orders != real_packet->has_orders);
40411 if (differ) {
40412 different++;
40413 }
40414 if (packet->has_orders) {
40415 BV_SET(fields, 27);
40416 }
40417
40418 differ = (old->orders_length != real_packet->orders_length);
40419 if (differ) {
40420 different++;
40421 BV_SET(fields, 28);
40422 }
40423
40424 differ = (old->orders_index != real_packet->orders_index);
40425 if (differ) {
40426 different++;
40427 BV_SET(fields, 29);
40428 }
40429
40430 differ = (old->orders_repeat != real_packet->orders_repeat);
40431 if (differ) {
40432 different++;
40433 }
40434 if (packet->orders_repeat) {
40435 BV_SET(fields, 30);
40436 }
40437
40438 differ = (old->orders_vigilant != real_packet->orders_vigilant);
40439 if (differ) {
40440 different++;
40441 }
40442 if (packet->orders_vigilant) {
40443 BV_SET(fields, 31);
40444 }
40445
40446
40447 {
40448 differ = (old->orders_length != real_packet->orders_length);
40449 if (!differ) {
40450 int i;
40451
40452 for (i = 0; i < real_packet->orders_length; i++) {
40453 if (!are_unit_orders_equal(&old->orders[i], &real_packet->orders[i])) {
40454 differ = TRUE;
40455 break;
40456 }
40457 }
40458 }
40459 }
40460 if (differ) {
40461 different++;
40462 BV_SET(fields, 32);
40463 }
40464
40465 differ = (old->action_decision_want != real_packet->action_decision_want);
40466 if (differ) {
40467 different++;
40468 BV_SET(fields, 33);
40469 }
40470
40471 differ = (old->action_decision_tile != real_packet->action_decision_tile);
40472 if (differ) {
40473 different++;
40474 BV_SET(fields, 34);
40475 }
40476
40477
40478 if (different == 0) {
40479 log_packet_detailed(" no change -> discard");
40480 return 0;
40481 }
40482
40483#ifdef FREECIV_JSON_CONNECTION
40484 field_addr.name = "fields";
40485#endif /* FREECIV_JSON_CONNECTION */
40486 DIO_BV_PUT(&dout, &field_addr, fields);
40487#ifdef FREECIV_JSON_CONNECTION
40488 field_addr.name = "id16";
40489#endif /* FREECIV_JSON_CONNECTION */
40490 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
40491
40492 if (BV_ISSET(fields, 0)) {
40493 log_packet_detailed(" field 'owner' has changed");
40494 #ifdef FREECIV_JSON_CONNECTION
40495 field_addr.name = "owner";
40496#endif /* FREECIV_JSON_CONNECTION */
40497 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
40498 }
40499 if (BV_ISSET(fields, 1)) {
40500 log_packet_detailed(" field 'nationality' has changed");
40501 #ifdef FREECIV_JSON_CONNECTION
40502 field_addr.name = "nationality";
40503#endif /* FREECIV_JSON_CONNECTION */
40504 DIO_PUT(uint16, &dout, &field_addr, real_packet->nationality);
40505 }
40506 if (BV_ISSET(fields, 2)) {
40507 log_packet_detailed(" field 'tile' has changed");
40508 #ifdef FREECIV_JSON_CONNECTION
40509 field_addr.name = "tile";
40510#endif /* FREECIV_JSON_CONNECTION */
40511 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
40512 }
40513 if (BV_ISSET(fields, 3)) {
40514 log_packet_detailed(" field 'facing' has changed");
40515 #ifdef FREECIV_JSON_CONNECTION
40516 field_addr.name = "facing";
40517#endif /* FREECIV_JSON_CONNECTION */
40518 DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
40519 }
40520 if (BV_ISSET(fields, 4)) {
40521 log_packet_detailed(" field 'homecity16' has changed");
40522 #ifdef FREECIV_JSON_CONNECTION
40523 field_addr.name = "homecity16";
40524#endif /* FREECIV_JSON_CONNECTION */
40525 DIO_PUT(uint16, &dout, &field_addr, real_packet->homecity16);
40526 }
40527 if (BV_ISSET(fields, 5)) {
40528 log_packet_detailed(" field 'upkeep' has changed");
40529 #ifdef FREECIV_JSON_CONNECTION
40530 field_addr.name = "upkeep";
40531#endif /* FREECIV_JSON_CONNECTION */
40532
40533 {
40534 int i;
40535
40536#ifdef FREECIV_JSON_CONNECTION
40537 /* Create the array. */
40538 DIO_PUT(farray, &dout, &field_addr, O_LAST);
40539
40540 /* Enter the array. */
40541 field_addr.sub_location = plocation_elem_new(0);
40542#endif /* FREECIV_JSON_CONNECTION */
40543
40544 for (i = 0; i < O_LAST; i++) {
40545#ifdef FREECIV_JSON_CONNECTION
40546 /* Next array element. */
40547 field_addr.sub_location->number = i;
40548#endif /* FREECIV_JSON_CONNECTION */
40549 DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep[i]);
40550 }
40551
40552#ifdef FREECIV_JSON_CONNECTION
40553 /* Exit array. */
40554 free(field_addr.sub_location);
40555 field_addr.sub_location = NULL;
40556#endif /* FREECIV_JSON_CONNECTION */
40557 }
40558 }
40559 if (BV_ISSET(fields, 6)) {
40560 log_packet_detailed(" field 'veteran' has changed");
40561 #ifdef FREECIV_JSON_CONNECTION
40562 field_addr.name = "veteran";
40563#endif /* FREECIV_JSON_CONNECTION */
40564 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
40565 }
40566 if (BV_ISSET(fields, 7)) {
40567 log_packet_detailed(" field 'ssa_controller' has changed");
40568 #ifdef FREECIV_JSON_CONNECTION
40569 field_addr.name = "ssa_controller";
40570#endif /* FREECIV_JSON_CONNECTION */
40571 DIO_PUT(uint8, &dout, &field_addr, real_packet->ssa_controller);
40572 }
40573 /* field 8 is folded into the header */
40574 /* field 9 is folded into the header */
40575 /* field 10 is folded into the header */
40576 /* field 11 is folded into the header */
40577 /* field 12 is folded into the header */
40578 if (BV_ISSET(fields, 13)) {
40579 log_packet_detailed(" field 'type' has changed");
40580 #ifdef FREECIV_JSON_CONNECTION
40581 field_addr.name = "type";
40582#endif /* FREECIV_JSON_CONNECTION */
40583 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
40584 }
40585 if (BV_ISSET(fields, 14)) {
40586 log_packet_detailed(" field 'transported_by16' has changed");
40587 #ifdef FREECIV_JSON_CONNECTION
40588 field_addr.name = "transported_by16";
40589#endif /* FREECIV_JSON_CONNECTION */
40590 DIO_PUT(uint16, &dout, &field_addr, real_packet->transported_by16);
40591 }
40592 if (BV_ISSET(fields, 15)) {
40593 log_packet_detailed(" field 'carrying' has changed");
40594 #ifdef FREECIV_JSON_CONNECTION
40595 field_addr.name = "carrying";
40596#endif /* FREECIV_JSON_CONNECTION */
40597 DIO_PUT(sint8, &dout, &field_addr, real_packet->carrying);
40598 }
40599 if (BV_ISSET(fields, 16)) {
40600 log_packet_detailed(" field 'movesleft' has changed");
40601 #ifdef FREECIV_JSON_CONNECTION
40602 field_addr.name = "movesleft";
40603#endif /* FREECIV_JSON_CONNECTION */
40604 DIO_PUT(uint32, &dout, &field_addr, real_packet->movesleft);
40605 }
40606 if (BV_ISSET(fields, 17)) {
40607 log_packet_detailed(" field 'hp' has changed");
40608 #ifdef FREECIV_JSON_CONNECTION
40609 field_addr.name = "hp";
40610#endif /* FREECIV_JSON_CONNECTION */
40611 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
40612 }
40613 if (BV_ISSET(fields, 18)) {
40614 log_packet_detailed(" field 'fuel' has changed");
40615 #ifdef FREECIV_JSON_CONNECTION
40616 field_addr.name = "fuel";
40617#endif /* FREECIV_JSON_CONNECTION */
40618 DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
40619 }
40620 if (BV_ISSET(fields, 19)) {
40621 log_packet_detailed(" field 'activity_count' has changed");
40622 #ifdef FREECIV_JSON_CONNECTION
40623 field_addr.name = "activity_count";
40624#endif /* FREECIV_JSON_CONNECTION */
40625 DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
40626 }
40627 if (BV_ISSET(fields, 20)) {
40628 log_packet_detailed(" field 'changed_from_count' has changed");
40629 #ifdef FREECIV_JSON_CONNECTION
40630 field_addr.name = "changed_from_count";
40631#endif /* FREECIV_JSON_CONNECTION */
40632 DIO_PUT(uint16, &dout, &field_addr, real_packet->changed_from_count);
40633 }
40634 if (BV_ISSET(fields, 21)) {
40635 log_packet_detailed(" field 'goto_tile' has changed");
40636 #ifdef FREECIV_JSON_CONNECTION
40637 field_addr.name = "goto_tile";
40638#endif /* FREECIV_JSON_CONNECTION */
40639 DIO_PUT(sint32, &dout, &field_addr, real_packet->goto_tile);
40640 }
40641 if (BV_ISSET(fields, 22)) {
40642 log_packet_detailed(" field 'activity' has changed");
40643 #ifdef FREECIV_JSON_CONNECTION
40644 field_addr.name = "activity";
40645#endif /* FREECIV_JSON_CONNECTION */
40646 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
40647 }
40648 if (BV_ISSET(fields, 23)) {
40649 log_packet_detailed(" field 'activity_tgt' has changed");
40650 #ifdef FREECIV_JSON_CONNECTION
40651 field_addr.name = "activity_tgt";
40652#endif /* FREECIV_JSON_CONNECTION */
40653 DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
40654 }
40655 if (BV_ISSET(fields, 24)) {
40656 log_packet_detailed(" field 'changed_from' has changed");
40657 #ifdef FREECIV_JSON_CONNECTION
40658 field_addr.name = "changed_from";
40659#endif /* FREECIV_JSON_CONNECTION */
40660 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from);
40661 }
40662 if (BV_ISSET(fields, 25)) {
40663 log_packet_detailed(" field 'changed_from_tgt' has changed");
40664 #ifdef FREECIV_JSON_CONNECTION
40665 field_addr.name = "changed_from_tgt";
40666#endif /* FREECIV_JSON_CONNECTION */
40667 DIO_PUT(sint8, &dout, &field_addr, real_packet->changed_from_tgt);
40668 }
40669 if (BV_ISSET(fields, 26)) {
40670 log_packet_detailed(" field 'battlegroup' has changed");
40671 #ifdef FREECIV_JSON_CONNECTION
40672 field_addr.name = "battlegroup";
40673#endif /* FREECIV_JSON_CONNECTION */
40674 DIO_PUT(sint8, &dout, &field_addr, real_packet->battlegroup);
40675 }
40676 /* field 27 is folded into the header */
40677 if (BV_ISSET(fields, 28)) {
40678 log_packet_detailed(" field 'orders_length' has changed");
40679 #ifdef FREECIV_JSON_CONNECTION
40680 field_addr.name = "orders_length";
40681#endif /* FREECIV_JSON_CONNECTION */
40682 DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_length);
40683 }
40684 if (BV_ISSET(fields, 29)) {
40685 log_packet_detailed(" field 'orders_index' has changed");
40686 #ifdef FREECIV_JSON_CONNECTION
40687 field_addr.name = "orders_index";
40688#endif /* FREECIV_JSON_CONNECTION */
40689 DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_index);
40690 }
40691 /* field 30 is folded into the header */
40692 /* field 31 is folded into the header */
40693 if (BV_ISSET(fields, 32)) {
40694 log_packet_detailed(" field 'orders' has changed");
40695 #ifdef FREECIV_JSON_CONNECTION
40696 field_addr.name = "orders";
40697#endif /* FREECIV_JSON_CONNECTION */
40698
40699 {
40700 int i;
40701
40702#ifdef FREECIV_JSON_CONNECTION
40703 /* Create the array. */
40704 DIO_PUT(farray, &dout, &field_addr, real_packet->orders_length);
40705
40706 /* Enter the array. */
40707 field_addr.sub_location = plocation_elem_new(0);
40708#endif /* FREECIV_JSON_CONNECTION */
40709
40710 for (i = 0; i < real_packet->orders_length; i++) {
40711#ifdef FREECIV_JSON_CONNECTION
40712 /* Next array element. */
40713 field_addr.sub_location->number = i;
40714#endif /* FREECIV_JSON_CONNECTION */
40715 DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
40716 }
40717
40718#ifdef FREECIV_JSON_CONNECTION
40719 /* Exit array. */
40720 free(field_addr.sub_location);
40721 field_addr.sub_location = NULL;
40722#endif /* FREECIV_JSON_CONNECTION */
40723 }
40724 }
40725 if (BV_ISSET(fields, 33)) {
40726 log_packet_detailed(" field 'action_decision_want' has changed");
40727 #ifdef FREECIV_JSON_CONNECTION
40728 field_addr.name = "action_decision_want";
40729#endif /* FREECIV_JSON_CONNECTION */
40730 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_decision_want);
40731 }
40732 if (BV_ISSET(fields, 34)) {
40733 log_packet_detailed(" field 'action_decision_tile' has changed");
40734 #ifdef FREECIV_JSON_CONNECTION
40735 field_addr.name = "action_decision_tile";
40736#endif /* FREECIV_JSON_CONNECTION */
40737 DIO_PUT(sint32, &dout, &field_addr, real_packet->action_decision_tile);
40738 }
40739
40740 *old = *real_packet;
40741
40742 hash = pc->phs.sent + PACKET_UNIT_SHORT_INFO;
40743 if (NULL != *hash) {
40744 genhash_remove(*hash, real_packet);
40745 }
40746#endif /* FREECIV_DELTA_PROTOCOL */
40747#ifndef FREECIV_DELTA_PROTOCOL
40748#ifdef FREECIV_JSON_CONNECTION
40749 field_addr.name = "id16";
40750#endif /* FREECIV_JSON_CONNECTION */
40751 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
40752#ifdef FREECIV_JSON_CONNECTION
40753 field_addr.name = "owner";
40754#endif /* FREECIV_JSON_CONNECTION */
40755 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
40756#ifdef FREECIV_JSON_CONNECTION
40757 field_addr.name = "nationality";
40758#endif /* FREECIV_JSON_CONNECTION */
40759 DIO_PUT(uint16, &dout, &field_addr, real_packet->nationality);
40760#ifdef FREECIV_JSON_CONNECTION
40761 field_addr.name = "tile";
40762#endif /* FREECIV_JSON_CONNECTION */
40763 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
40764#ifdef FREECIV_JSON_CONNECTION
40765 field_addr.name = "facing";
40766#endif /* FREECIV_JSON_CONNECTION */
40767 DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
40768#ifdef FREECIV_JSON_CONNECTION
40769 field_addr.name = "homecity16";
40770#endif /* FREECIV_JSON_CONNECTION */
40771 DIO_PUT(uint16, &dout, &field_addr, real_packet->homecity16);
40772#ifdef FREECIV_JSON_CONNECTION
40773 field_addr.name = "upkeep";
40774#endif /* FREECIV_JSON_CONNECTION */
40775
40776 {
40777 int i;
40778
40779#ifdef FREECIV_JSON_CONNECTION
40780 /* Create the array. */
40781 DIO_PUT(farray, &dout, &field_addr, O_LAST);
40782
40783 /* Enter the array. */
40784 field_addr.sub_location = plocation_elem_new(0);
40785#endif /* FREECIV_JSON_CONNECTION */
40786
40787 for (i = 0; i < O_LAST; i++) {
40788#ifdef FREECIV_JSON_CONNECTION
40789 /* Next array element. */
40790 field_addr.sub_location->number = i;
40791#endif /* FREECIV_JSON_CONNECTION */
40792 DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep[i]);
40793 }
40794
40795#ifdef FREECIV_JSON_CONNECTION
40796 /* Exit array. */
40797 free(field_addr.sub_location);
40798 field_addr.sub_location = NULL;
40799#endif /* FREECIV_JSON_CONNECTION */
40800 }
40801#ifdef FREECIV_JSON_CONNECTION
40802 field_addr.name = "veteran";
40803#endif /* FREECIV_JSON_CONNECTION */
40804 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
40805#ifdef FREECIV_JSON_CONNECTION
40806 field_addr.name = "ssa_controller";
40807#endif /* FREECIV_JSON_CONNECTION */
40808 DIO_PUT(uint8, &dout, &field_addr, real_packet->ssa_controller);
40809#ifdef FREECIV_JSON_CONNECTION
40810 field_addr.name = "paradropped";
40811#endif /* FREECIV_JSON_CONNECTION */
40812 DIO_PUT(bool8, &dout, &field_addr, real_packet->paradropped);
40813#ifdef FREECIV_JSON_CONNECTION
40814 field_addr.name = "occupied";
40815#endif /* FREECIV_JSON_CONNECTION */
40816 DIO_PUT(bool8, &dout, &field_addr, real_packet->occupied);
40817#ifdef FREECIV_JSON_CONNECTION
40818 field_addr.name = "transported";
40819#endif /* FREECIV_JSON_CONNECTION */
40820 DIO_PUT(bool8, &dout, &field_addr, real_packet->transported);
40821#ifdef FREECIV_JSON_CONNECTION
40822 field_addr.name = "done_moving";
40823#endif /* FREECIV_JSON_CONNECTION */
40824 DIO_PUT(bool8, &dout, &field_addr, real_packet->done_moving);
40825#ifdef FREECIV_JSON_CONNECTION
40826 field_addr.name = "stay";
40827#endif /* FREECIV_JSON_CONNECTION */
40828 DIO_PUT(bool8, &dout, &field_addr, real_packet->stay);
40829#ifdef FREECIV_JSON_CONNECTION
40830 field_addr.name = "type";
40831#endif /* FREECIV_JSON_CONNECTION */
40832 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
40833#ifdef FREECIV_JSON_CONNECTION
40834 field_addr.name = "transported_by16";
40835#endif /* FREECIV_JSON_CONNECTION */
40836 DIO_PUT(uint16, &dout, &field_addr, real_packet->transported_by16);
40837#ifdef FREECIV_JSON_CONNECTION
40838 field_addr.name = "carrying";
40839#endif /* FREECIV_JSON_CONNECTION */
40840 DIO_PUT(sint8, &dout, &field_addr, real_packet->carrying);
40841#ifdef FREECIV_JSON_CONNECTION
40842 field_addr.name = "movesleft";
40843#endif /* FREECIV_JSON_CONNECTION */
40844 DIO_PUT(uint32, &dout, &field_addr, real_packet->movesleft);
40845#ifdef FREECIV_JSON_CONNECTION
40846 field_addr.name = "hp";
40847#endif /* FREECIV_JSON_CONNECTION */
40848 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
40849#ifdef FREECIV_JSON_CONNECTION
40850 field_addr.name = "fuel";
40851#endif /* FREECIV_JSON_CONNECTION */
40852 DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
40853#ifdef FREECIV_JSON_CONNECTION
40854 field_addr.name = "activity_count";
40855#endif /* FREECIV_JSON_CONNECTION */
40856 DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
40857#ifdef FREECIV_JSON_CONNECTION
40858 field_addr.name = "changed_from_count";
40859#endif /* FREECIV_JSON_CONNECTION */
40860 DIO_PUT(uint16, &dout, &field_addr, real_packet->changed_from_count);
40861#ifdef FREECIV_JSON_CONNECTION
40862 field_addr.name = "goto_tile";
40863#endif /* FREECIV_JSON_CONNECTION */
40864 DIO_PUT(sint32, &dout, &field_addr, real_packet->goto_tile);
40865#ifdef FREECIV_JSON_CONNECTION
40866 field_addr.name = "activity";
40867#endif /* FREECIV_JSON_CONNECTION */
40868 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
40869#ifdef FREECIV_JSON_CONNECTION
40870 field_addr.name = "activity_tgt";
40871#endif /* FREECIV_JSON_CONNECTION */
40872 DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
40873#ifdef FREECIV_JSON_CONNECTION
40874 field_addr.name = "changed_from";
40875#endif /* FREECIV_JSON_CONNECTION */
40876 DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from);
40877#ifdef FREECIV_JSON_CONNECTION
40878 field_addr.name = "changed_from_tgt";
40879#endif /* FREECIV_JSON_CONNECTION */
40880 DIO_PUT(sint8, &dout, &field_addr, real_packet->changed_from_tgt);
40881#ifdef FREECIV_JSON_CONNECTION
40882 field_addr.name = "battlegroup";
40883#endif /* FREECIV_JSON_CONNECTION */
40884 DIO_PUT(sint8, &dout, &field_addr, real_packet->battlegroup);
40885#ifdef FREECIV_JSON_CONNECTION
40886 field_addr.name = "has_orders";
40887#endif /* FREECIV_JSON_CONNECTION */
40888 DIO_PUT(bool8, &dout, &field_addr, real_packet->has_orders);
40889#ifdef FREECIV_JSON_CONNECTION
40890 field_addr.name = "orders_length";
40891#endif /* FREECIV_JSON_CONNECTION */
40892 DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_length);
40893#ifdef FREECIV_JSON_CONNECTION
40894 field_addr.name = "orders_index";
40895#endif /* FREECIV_JSON_CONNECTION */
40896 DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_index);
40897#ifdef FREECIV_JSON_CONNECTION
40898 field_addr.name = "orders_repeat";
40899#endif /* FREECIV_JSON_CONNECTION */
40900 DIO_PUT(bool8, &dout, &field_addr, real_packet->orders_repeat);
40901#ifdef FREECIV_JSON_CONNECTION
40902 field_addr.name = "orders_vigilant";
40903#endif /* FREECIV_JSON_CONNECTION */
40904 DIO_PUT(bool8, &dout, &field_addr, real_packet->orders_vigilant);
40905#ifdef FREECIV_JSON_CONNECTION
40906 field_addr.name = "orders";
40907#endif /* FREECIV_JSON_CONNECTION */
40908
40909 {
40910 int i;
40911
40912#ifdef FREECIV_JSON_CONNECTION
40913 /* Create the array. */
40914 DIO_PUT(farray, &dout, &field_addr, real_packet->orders_length);
40915
40916 /* Enter the array. */
40917 field_addr.sub_location = plocation_elem_new(0);
40918#endif /* FREECIV_JSON_CONNECTION */
40919
40920 for (i = 0; i < real_packet->orders_length; i++) {
40921#ifdef FREECIV_JSON_CONNECTION
40922 /* Next array element. */
40923 field_addr.sub_location->number = i;
40924#endif /* FREECIV_JSON_CONNECTION */
40925 DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
40926 }
40927
40928#ifdef FREECIV_JSON_CONNECTION
40929 /* Exit array. */
40930 free(field_addr.sub_location);
40931 field_addr.sub_location = NULL;
40932#endif /* FREECIV_JSON_CONNECTION */
40933 }
40934#ifdef FREECIV_JSON_CONNECTION
40935 field_addr.name = "action_decision_want";
40936#endif /* FREECIV_JSON_CONNECTION */
40937 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_decision_want);
40938#ifdef FREECIV_JSON_CONNECTION
40939 field_addr.name = "action_decision_tile";
40940#endif /* FREECIV_JSON_CONNECTION */
40941 DIO_PUT(sint32, &dout, &field_addr, real_packet->action_decision_tile);
40942
40943#endif
40944 SEND_PACKET_END(PACKET_UNIT_INFO);
40945}
40946
40947 int send_packet_unit_info(struct connection *pc, const struct packet_unit_info *packet)
40948{
40949 if (!pc->used) {
40950 log_error("WARNING: trying to send data to the closed connection %s",
40951 conn_description(pc));
40952 return -1;
40953 }
40954 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_INFO].packet != NULL, -1,
40955 "Handler for PACKET_UNIT_INFO not installed");
40956 return pc->phs.handlers->send[PACKET_UNIT_INFO].packet(pc, packet);
40957}
40958
40959 void lsend_packet_unit_info(struct conn_list *dest, const struct packet_unit_info *packet)
40960{
40961 conn_list_iterate(dest, pconn) {
40962 send_packet_unit_info(pconn, packet);
40963 } conn_list_iterate_end;
40964}
40965
40966#ifdef FREECIV_DELTA_PROTOCOL
40967#define hash_packet_unit_short_info_100 hash_const
40968
40969#define cmp_packet_unit_short_info_100 cmp_const
40970
40971 BV_DEFINE(packet_unit_short_info_100_fields, 14);
40972#endif /* FREECIV_DELTA_PROTOCOL */
40973
40974 static struct packet_unit_short_info *receive_packet_unit_short_info_100(struct connection *pc)
40975{
40976#ifdef FREECIV_DELTA_PROTOCOL
40977 packet_unit_short_info_100_fields fields;
40978 struct packet_unit_short_info *old;
40979 struct genhash **hash = pc->phs.received + PACKET_UNIT_SHORT_INFO;
40980#endif /* FREECIV_DELTA_PROTOCOL */
40981 RECEIVE_PACKET_START(packet_unit_short_info, real_packet);
40982#ifdef FREECIV_JSON_CONNECTION
40983 struct plocation field_addr;
40984 {
40985 struct plocation *field_addr_tmp = plocation_field_new(NULL);
40986 field_addr = *field_addr_tmp;
40987 FC_FREE(field_addr_tmp);
40988 }
40989#endif /* FREECIV_JSON_CONNECTION */
40990
40991#ifdef FREECIV_DELTA_PROTOCOL
40992#ifdef FREECIV_JSON_CONNECTION
40993 field_addr.name = "fields";
40994#endif /* FREECIV_JSON_CONNECTION */
40995 DIO_BV_GET(&din, &field_addr, fields);
40996
40997#else /* FREECIV_DELTA_PROTOCOL */
40998 #ifdef FREECIV_JSON_CONNECTION
40999 field_addr.name = "id32";
41000 #endif /* FREECIV_JSON_CONNECTION */
41001 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
41002 RECEIVE_PACKET_FIELD_ERROR(id32);
41003 }
41004 #ifdef FREECIV_JSON_CONNECTION
41005 field_addr.name = "owner";
41006 #endif /* FREECIV_JSON_CONNECTION */
41007 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
41008 RECEIVE_PACKET_FIELD_ERROR(owner);
41009 }
41010 #ifdef FREECIV_JSON_CONNECTION
41011 field_addr.name = "tile";
41012 #endif /* FREECIV_JSON_CONNECTION */
41013 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
41014 RECEIVE_PACKET_FIELD_ERROR(tile);
41015 }
41016 #ifdef FREECIV_JSON_CONNECTION
41017 field_addr.name = "facing";
41018 #endif /* FREECIV_JSON_CONNECTION */
41019 {
41020 int readin;
41021
41022 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
41023 RECEIVE_PACKET_FIELD_ERROR(facing);
41024 }
41025 real_packet->facing = readin;
41026 }
41027 #ifdef FREECIV_JSON_CONNECTION
41028 field_addr.name = "type";
41029 #endif /* FREECIV_JSON_CONNECTION */
41030 {
41031 int readin;
41032
41033 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
41034 RECEIVE_PACKET_FIELD_ERROR(type);
41035 }
41036 real_packet->type = readin;
41037 }
41038 #ifdef FREECIV_JSON_CONNECTION
41039 field_addr.name = "veteran";
41040 #endif /* FREECIV_JSON_CONNECTION */
41041 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
41042 RECEIVE_PACKET_FIELD_ERROR(veteran);
41043 }
41044 #ifdef FREECIV_JSON_CONNECTION
41045 field_addr.name = "occupied";
41046 #endif /* FREECIV_JSON_CONNECTION */
41047 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->occupied)) {
41048 RECEIVE_PACKET_FIELD_ERROR(occupied);
41049 }
41050 #ifdef FREECIV_JSON_CONNECTION
41051 field_addr.name = "transported";
41052 #endif /* FREECIV_JSON_CONNECTION */
41053 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->transported)) {
41054 RECEIVE_PACKET_FIELD_ERROR(transported);
41055 }
41056 #ifdef FREECIV_JSON_CONNECTION
41057 field_addr.name = "hp";
41058 #endif /* FREECIV_JSON_CONNECTION */
41059 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
41060 RECEIVE_PACKET_FIELD_ERROR(hp);
41061 }
41062 #ifdef FREECIV_JSON_CONNECTION
41063 field_addr.name = "activity";
41064 #endif /* FREECIV_JSON_CONNECTION */
41065 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->activity)) {
41066 RECEIVE_PACKET_FIELD_ERROR(activity);
41067 }
41068 #ifdef FREECIV_JSON_CONNECTION
41069 field_addr.name = "activity_tgt";
41070 #endif /* FREECIV_JSON_CONNECTION */
41071 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
41072 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
41073 }
41074 #ifdef FREECIV_JSON_CONNECTION
41075 field_addr.name = "transported_by32";
41076 #endif /* FREECIV_JSON_CONNECTION */
41077 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by32)) {
41078 RECEIVE_PACKET_FIELD_ERROR(transported_by32);
41079 }
41080 #ifdef FREECIV_JSON_CONNECTION
41081 field_addr.name = "packet_use";
41082 #endif /* FREECIV_JSON_CONNECTION */
41083 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->packet_use)) {
41084 RECEIVE_PACKET_FIELD_ERROR(packet_use);
41085 }
41086 #ifdef FREECIV_JSON_CONNECTION
41087 field_addr.name = "info_city_id32";
41088 #endif /* FREECIV_JSON_CONNECTION */
41089 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->info_city_id32)) {
41090 RECEIVE_PACKET_FIELD_ERROR(info_city_id32);
41091 }
41092
41093#endif
41094 log_packet_detailed("packet_unit_short_info_100: got info about ()");
41095
41096#ifdef FREECIV_DELTA_PROTOCOL
41097 if (NULL == *hash) {
41098 *hash = genhash_new_full(hash_packet_unit_short_info_100, cmp_packet_unit_short_info_100,
41099 NULL, NULL, NULL, free);
41100 }
41101
41102 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
41103 *real_packet = *old;
41104 } else {
41105 log_packet_detailed(" no old info");
41106 memset(real_packet, 0, sizeof(*real_packet));
41107 }
41108
41109 if (BV_ISSET(fields, 0)) {
41110 log_packet_detailed(" got field 'id32'");
41111 #ifdef FREECIV_JSON_CONNECTION
41112 field_addr.name = "id32";
41113 #endif /* FREECIV_JSON_CONNECTION */
41114 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
41115 RECEIVE_PACKET_FIELD_ERROR(id32);
41116 }
41117 }
41118 if (BV_ISSET(fields, 1)) {
41119 log_packet_detailed(" got field 'owner'");
41120 #ifdef FREECIV_JSON_CONNECTION
41121 field_addr.name = "owner";
41122 #endif /* FREECIV_JSON_CONNECTION */
41123 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
41124 RECEIVE_PACKET_FIELD_ERROR(owner);
41125 }
41126 }
41127 if (BV_ISSET(fields, 2)) {
41128 log_packet_detailed(" got field 'tile'");
41129 #ifdef FREECIV_JSON_CONNECTION
41130 field_addr.name = "tile";
41131 #endif /* FREECIV_JSON_CONNECTION */
41132 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
41133 RECEIVE_PACKET_FIELD_ERROR(tile);
41134 }
41135 }
41136 if (BV_ISSET(fields, 3)) {
41137 log_packet_detailed(" got field 'facing'");
41138 #ifdef FREECIV_JSON_CONNECTION
41139 field_addr.name = "facing";
41140 #endif /* FREECIV_JSON_CONNECTION */
41141 {
41142 int readin;
41143
41144 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
41145 RECEIVE_PACKET_FIELD_ERROR(facing);
41146 }
41147 real_packet->facing = readin;
41148 }
41149 }
41150 if (BV_ISSET(fields, 4)) {
41151 log_packet_detailed(" got field 'type'");
41152 #ifdef FREECIV_JSON_CONNECTION
41153 field_addr.name = "type";
41154 #endif /* FREECIV_JSON_CONNECTION */
41155 {
41156 int readin;
41157
41158 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
41159 RECEIVE_PACKET_FIELD_ERROR(type);
41160 }
41161 real_packet->type = readin;
41162 }
41163 }
41164 if (BV_ISSET(fields, 5)) {
41165 log_packet_detailed(" got field 'veteran'");
41166 #ifdef FREECIV_JSON_CONNECTION
41167 field_addr.name = "veteran";
41168 #endif /* FREECIV_JSON_CONNECTION */
41169 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
41170 RECEIVE_PACKET_FIELD_ERROR(veteran);
41171 }
41172 }
41173 real_packet->occupied = BV_ISSET(fields, 6);
41174 real_packet->transported = BV_ISSET(fields, 7);
41175 if (BV_ISSET(fields, 8)) {
41176 log_packet_detailed(" got field 'hp'");
41177 #ifdef FREECIV_JSON_CONNECTION
41178 field_addr.name = "hp";
41179 #endif /* FREECIV_JSON_CONNECTION */
41180 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
41181 RECEIVE_PACKET_FIELD_ERROR(hp);
41182 }
41183 }
41184 if (BV_ISSET(fields, 9)) {
41185 log_packet_detailed(" got field 'activity'");
41186 #ifdef FREECIV_JSON_CONNECTION
41187 field_addr.name = "activity";
41188 #endif /* FREECIV_JSON_CONNECTION */
41189 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->activity)) {
41190 RECEIVE_PACKET_FIELD_ERROR(activity);
41191 }
41192 }
41193 if (BV_ISSET(fields, 10)) {
41194 log_packet_detailed(" got field 'activity_tgt'");
41195 #ifdef FREECIV_JSON_CONNECTION
41196 field_addr.name = "activity_tgt";
41197 #endif /* FREECIV_JSON_CONNECTION */
41198 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
41199 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
41200 }
41201 }
41202 if (BV_ISSET(fields, 11)) {
41203 log_packet_detailed(" got field 'transported_by32'");
41204 #ifdef FREECIV_JSON_CONNECTION
41205 field_addr.name = "transported_by32";
41206 #endif /* FREECIV_JSON_CONNECTION */
41207 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by32)) {
41208 RECEIVE_PACKET_FIELD_ERROR(transported_by32);
41209 }
41210 }
41211 if (BV_ISSET(fields, 12)) {
41212 log_packet_detailed(" got field 'packet_use'");
41213 #ifdef FREECIV_JSON_CONNECTION
41214 field_addr.name = "packet_use";
41215 #endif /* FREECIV_JSON_CONNECTION */
41216 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->packet_use)) {
41217 RECEIVE_PACKET_FIELD_ERROR(packet_use);
41218 }
41219 }
41220 if (BV_ISSET(fields, 13)) {
41221 log_packet_detailed(" got field 'info_city_id32'");
41222 #ifdef FREECIV_JSON_CONNECTION
41223 field_addr.name = "info_city_id32";
41224 #endif /* FREECIV_JSON_CONNECTION */
41225 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->info_city_id32)) {
41226 RECEIVE_PACKET_FIELD_ERROR(info_city_id32);
41227 }
41228 }
41229
41230 if (NULL == old) {
41231 old = fc_malloc(sizeof(*old));
41232 *old = *real_packet;
41233 genhash_insert(*hash, old, old);
41234 } else {
41235 *old = *real_packet;
41236 }
41237
41238 hash = pc->phs.received + PACKET_UNIT_INFO;
41239 if (NULL != *hash) {
41240 genhash_remove(*hash, real_packet);
41241 }
41242
41243#endif /* FREECIV_DELTA_PROTOCOL */
41244 RECEIVE_PACKET_END(real_packet);
41245}
41246
41247 static int send_packet_unit_short_info_100(struct connection *pc, const struct packet_unit_short_info *packet, bool force_to_send)
41248{
41249 const struct packet_unit_short_info *real_packet = packet;
41250#ifdef FREECIV_DELTA_PROTOCOL
41251 packet_unit_short_info_100_fields fields;
41252 struct packet_unit_short_info *old;
41253 bool differ;
41254 struct genhash **hash = pc->phs.sent + PACKET_UNIT_SHORT_INFO;
41255 int different = force_to_send;
41256#endif /* FREECIV_DELTA_PROTOCOL */
41257 SEND_PACKET_START(PACKET_UNIT_SHORT_INFO);
41258#ifdef FREECIV_JSON_CONNECTION
41259 struct plocation field_addr;
41260 {
41261 struct plocation *field_addr_tmp = plocation_field_new(NULL);
41262 field_addr = *field_addr_tmp;
41263 FC_FREE(field_addr_tmp);
41264 }
41265#endif /* FREECIV_JSON_CONNECTION */
41266
41267 log_packet_detailed("packet_unit_short_info_100: sending info about ()");
41268
41269#ifdef FREECIV_DELTA_PROTOCOL
41270 if (NULL == *hash) {
41271 *hash = genhash_new_full(hash_packet_unit_short_info_100, cmp_packet_unit_short_info_100,
41272 NULL, NULL, NULL, free);
41273 }
41274 BV_CLR_ALL(fields);
41275
41276 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
41277 old = fc_malloc(sizeof(*old));
41278 *old = *real_packet;
41279 genhash_insert(*hash, old, old);
41280 memset(old, 0, sizeof(*old));
41281 different = 1; /* Force to send. */
41282 }
41283 differ = (old->id32 != real_packet->id32);
41284 if (differ) {
41285 different++;
41286 BV_SET(fields, 0);
41287 }
41288
41289 differ = (old->owner != real_packet->owner);
41290 if (differ) {
41291 different++;
41292 BV_SET(fields, 1);
41293 }
41294
41295 differ = (old->tile != real_packet->tile);
41296 if (differ) {
41297 different++;
41298 BV_SET(fields, 2);
41299 }
41300
41301 differ = (old->facing != real_packet->facing);
41302 if (differ) {
41303 different++;
41304 BV_SET(fields, 3);
41305 }
41306
41307 differ = (old->type != real_packet->type);
41308 if (differ) {
41309 different++;
41310 BV_SET(fields, 4);
41311 }
41312
41313 differ = (old->veteran != real_packet->veteran);
41314 if (differ) {
41315 different++;
41316 BV_SET(fields, 5);
41317 }
41318
41319 differ = (old->occupied != real_packet->occupied);
41320 if (differ) {
41321 different++;
41322 }
41323 if (packet->occupied) {
41324 BV_SET(fields, 6);
41325 }
41326
41327 differ = (old->transported != real_packet->transported);
41328 if (differ) {
41329 different++;
41330 }
41331 if (packet->transported) {
41332 BV_SET(fields, 7);
41333 }
41334
41335 differ = (old->hp != real_packet->hp);
41336 if (differ) {
41337 different++;
41338 BV_SET(fields, 8);
41339 }
41340
41341 differ = (old->activity != real_packet->activity);
41342 if (differ) {
41343 different++;
41344 BV_SET(fields, 9);
41345 }
41346
41347 differ = (old->activity_tgt != real_packet->activity_tgt);
41348 if (differ) {
41349 different++;
41350 BV_SET(fields, 10);
41351 }
41352
41353 differ = (old->transported_by32 != real_packet->transported_by32);
41354 if (differ) {
41355 different++;
41356 BV_SET(fields, 11);
41357 }
41358
41359 differ = (old->packet_use != real_packet->packet_use);
41360 if (differ) {
41361 different++;
41362 BV_SET(fields, 12);
41363 }
41364
41365 differ = (old->info_city_id32 != real_packet->info_city_id32);
41366 if (differ) {
41367 different++;
41368 BV_SET(fields, 13);
41369 }
41370
41371
41372 if (different == 0) {
41373 log_packet_detailed(" no change -> discard");
41374 return 0;
41375 }
41376
41377#ifdef FREECIV_JSON_CONNECTION
41378 field_addr.name = "fields";
41379#endif /* FREECIV_JSON_CONNECTION */
41380 DIO_BV_PUT(&dout, &field_addr, fields);
41381
41382 if (BV_ISSET(fields, 0)) {
41383 log_packet_detailed(" field 'id32' has changed");
41384 #ifdef FREECIV_JSON_CONNECTION
41385 field_addr.name = "id32";
41386#endif /* FREECIV_JSON_CONNECTION */
41387 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
41388 }
41389 if (BV_ISSET(fields, 1)) {
41390 log_packet_detailed(" field 'owner' has changed");
41391 #ifdef FREECIV_JSON_CONNECTION
41392 field_addr.name = "owner";
41393#endif /* FREECIV_JSON_CONNECTION */
41394 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
41395 }
41396 if (BV_ISSET(fields, 2)) {
41397 log_packet_detailed(" field 'tile' has changed");
41398 #ifdef FREECIV_JSON_CONNECTION
41399 field_addr.name = "tile";
41400#endif /* FREECIV_JSON_CONNECTION */
41401 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
41402 }
41403 if (BV_ISSET(fields, 3)) {
41404 log_packet_detailed(" field 'facing' has changed");
41405 #ifdef FREECIV_JSON_CONNECTION
41406 field_addr.name = "facing";
41407#endif /* FREECIV_JSON_CONNECTION */
41408 DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
41409 }
41410 if (BV_ISSET(fields, 4)) {
41411 log_packet_detailed(" field 'type' has changed");
41412 #ifdef FREECIV_JSON_CONNECTION
41413 field_addr.name = "type";
41414#endif /* FREECIV_JSON_CONNECTION */
41415 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
41416 }
41417 if (BV_ISSET(fields, 5)) {
41418 log_packet_detailed(" field 'veteran' has changed");
41419 #ifdef FREECIV_JSON_CONNECTION
41420 field_addr.name = "veteran";
41421#endif /* FREECIV_JSON_CONNECTION */
41422 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
41423 }
41424 /* field 6 is folded into the header */
41425 /* field 7 is folded into the header */
41426 if (BV_ISSET(fields, 8)) {
41427 log_packet_detailed(" field 'hp' has changed");
41428 #ifdef FREECIV_JSON_CONNECTION
41429 field_addr.name = "hp";
41430#endif /* FREECIV_JSON_CONNECTION */
41431 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
41432 }
41433 if (BV_ISSET(fields, 9)) {
41434 log_packet_detailed(" field 'activity' has changed");
41435 #ifdef FREECIV_JSON_CONNECTION
41436 field_addr.name = "activity";
41437#endif /* FREECIV_JSON_CONNECTION */
41438 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
41439 }
41440 if (BV_ISSET(fields, 10)) {
41441 log_packet_detailed(" field 'activity_tgt' has changed");
41442 #ifdef FREECIV_JSON_CONNECTION
41443 field_addr.name = "activity_tgt";
41444#endif /* FREECIV_JSON_CONNECTION */
41445 DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
41446 }
41447 if (BV_ISSET(fields, 11)) {
41448 log_packet_detailed(" field 'transported_by32' has changed");
41449 #ifdef FREECIV_JSON_CONNECTION
41450 field_addr.name = "transported_by32";
41451#endif /* FREECIV_JSON_CONNECTION */
41452 DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by32);
41453 }
41454 if (BV_ISSET(fields, 12)) {
41455 log_packet_detailed(" field 'packet_use' has changed");
41456 #ifdef FREECIV_JSON_CONNECTION
41457 field_addr.name = "packet_use";
41458#endif /* FREECIV_JSON_CONNECTION */
41459 DIO_PUT(uint8, &dout, &field_addr, real_packet->packet_use);
41460 }
41461 if (BV_ISSET(fields, 13)) {
41462 log_packet_detailed(" field 'info_city_id32' has changed");
41463 #ifdef FREECIV_JSON_CONNECTION
41464 field_addr.name = "info_city_id32";
41465#endif /* FREECIV_JSON_CONNECTION */
41466 DIO_PUT(uint32, &dout, &field_addr, real_packet->info_city_id32);
41467 }
41468
41469 *old = *real_packet;
41470
41471 hash = pc->phs.sent + PACKET_UNIT_INFO;
41472 if (NULL != *hash) {
41473 genhash_remove(*hash, real_packet);
41474 }
41475#endif /* FREECIV_DELTA_PROTOCOL */
41476#ifndef FREECIV_DELTA_PROTOCOL
41477#ifdef FREECIV_JSON_CONNECTION
41478 field_addr.name = "id32";
41479#endif /* FREECIV_JSON_CONNECTION */
41480 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
41481#ifdef FREECIV_JSON_CONNECTION
41482 field_addr.name = "owner";
41483#endif /* FREECIV_JSON_CONNECTION */
41484 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
41485#ifdef FREECIV_JSON_CONNECTION
41486 field_addr.name = "tile";
41487#endif /* FREECIV_JSON_CONNECTION */
41488 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
41489#ifdef FREECIV_JSON_CONNECTION
41490 field_addr.name = "facing";
41491#endif /* FREECIV_JSON_CONNECTION */
41492 DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
41493#ifdef FREECIV_JSON_CONNECTION
41494 field_addr.name = "type";
41495#endif /* FREECIV_JSON_CONNECTION */
41496 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
41497#ifdef FREECIV_JSON_CONNECTION
41498 field_addr.name = "veteran";
41499#endif /* FREECIV_JSON_CONNECTION */
41500 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
41501#ifdef FREECIV_JSON_CONNECTION
41502 field_addr.name = "occupied";
41503#endif /* FREECIV_JSON_CONNECTION */
41504 DIO_PUT(bool8, &dout, &field_addr, real_packet->occupied);
41505#ifdef FREECIV_JSON_CONNECTION
41506 field_addr.name = "transported";
41507#endif /* FREECIV_JSON_CONNECTION */
41508 DIO_PUT(bool8, &dout, &field_addr, real_packet->transported);
41509#ifdef FREECIV_JSON_CONNECTION
41510 field_addr.name = "hp";
41511#endif /* FREECIV_JSON_CONNECTION */
41512 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
41513#ifdef FREECIV_JSON_CONNECTION
41514 field_addr.name = "activity";
41515#endif /* FREECIV_JSON_CONNECTION */
41516 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
41517#ifdef FREECIV_JSON_CONNECTION
41518 field_addr.name = "activity_tgt";
41519#endif /* FREECIV_JSON_CONNECTION */
41520 DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
41521#ifdef FREECIV_JSON_CONNECTION
41522 field_addr.name = "transported_by32";
41523#endif /* FREECIV_JSON_CONNECTION */
41524 DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by32);
41525#ifdef FREECIV_JSON_CONNECTION
41526 field_addr.name = "packet_use";
41527#endif /* FREECIV_JSON_CONNECTION */
41528 DIO_PUT(uint8, &dout, &field_addr, real_packet->packet_use);
41529#ifdef FREECIV_JSON_CONNECTION
41530 field_addr.name = "info_city_id32";
41531#endif /* FREECIV_JSON_CONNECTION */
41532 DIO_PUT(uint32, &dout, &field_addr, real_packet->info_city_id32);
41533
41534#endif
41535 SEND_PACKET_END(PACKET_UNIT_SHORT_INFO);
41536}
41537
41538#ifdef FREECIV_DELTA_PROTOCOL
41539static genhash_val_t hash_packet_unit_short_info_101(const void *vkey)
41540{
41541 const struct packet_unit_short_info *key = (const struct packet_unit_short_info *) vkey;
41542
41543 return key->id16;
41544}
41545
41546static bool cmp_packet_unit_short_info_101(const void *vkey1, const void *vkey2)
41547{
41548 const struct packet_unit_short_info *key1 = (const struct packet_unit_short_info *) vkey1;
41549 const struct packet_unit_short_info *key2 = (const struct packet_unit_short_info *) vkey2;
41550
41551 return key1->id16 == key2->id16;
41552}
41553 BV_DEFINE(packet_unit_short_info_101_fields, 13);
41554#endif /* FREECIV_DELTA_PROTOCOL */
41555
41556 static struct packet_unit_short_info *receive_packet_unit_short_info_101(struct connection *pc)
41557{
41558#ifdef FREECIV_DELTA_PROTOCOL
41559 packet_unit_short_info_101_fields fields;
41560 struct packet_unit_short_info *old;
41561 struct genhash **hash = pc->phs.received + PACKET_UNIT_SHORT_INFO;
41562#endif /* FREECIV_DELTA_PROTOCOL */
41563 RECEIVE_PACKET_START(packet_unit_short_info, real_packet);
41564#ifdef FREECIV_JSON_CONNECTION
41565 struct plocation field_addr;
41566 {
41567 struct plocation *field_addr_tmp = plocation_field_new(NULL);
41568 field_addr = *field_addr_tmp;
41569 FC_FREE(field_addr_tmp);
41570 }
41571#endif /* FREECIV_JSON_CONNECTION */
41572
41573#ifdef FREECIV_DELTA_PROTOCOL
41574#ifdef FREECIV_JSON_CONNECTION
41575 field_addr.name = "fields";
41576#endif /* FREECIV_JSON_CONNECTION */
41577 DIO_BV_GET(&din, &field_addr, fields);
41578 #ifdef FREECIV_JSON_CONNECTION
41579 field_addr.name = "id16";
41580 #endif /* FREECIV_JSON_CONNECTION */
41581 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
41582 RECEIVE_PACKET_FIELD_ERROR(id16);
41583 }
41584
41585#else /* FREECIV_DELTA_PROTOCOL */
41586 #ifdef FREECIV_JSON_CONNECTION
41587 field_addr.name = "id16";
41588 #endif /* FREECIV_JSON_CONNECTION */
41589 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
41590 RECEIVE_PACKET_FIELD_ERROR(id16);
41591 }
41592 #ifdef FREECIV_JSON_CONNECTION
41593 field_addr.name = "owner";
41594 #endif /* FREECIV_JSON_CONNECTION */
41595 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
41596 RECEIVE_PACKET_FIELD_ERROR(owner);
41597 }
41598 #ifdef FREECIV_JSON_CONNECTION
41599 field_addr.name = "tile";
41600 #endif /* FREECIV_JSON_CONNECTION */
41601 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
41602 RECEIVE_PACKET_FIELD_ERROR(tile);
41603 }
41604 #ifdef FREECIV_JSON_CONNECTION
41605 field_addr.name = "facing";
41606 #endif /* FREECIV_JSON_CONNECTION */
41607 {
41608 int readin;
41609
41610 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
41611 RECEIVE_PACKET_FIELD_ERROR(facing);
41612 }
41613 real_packet->facing = readin;
41614 }
41615 #ifdef FREECIV_JSON_CONNECTION
41616 field_addr.name = "type";
41617 #endif /* FREECIV_JSON_CONNECTION */
41618 {
41619 int readin;
41620
41621 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
41622 RECEIVE_PACKET_FIELD_ERROR(type);
41623 }
41624 real_packet->type = readin;
41625 }
41626 #ifdef FREECIV_JSON_CONNECTION
41627 field_addr.name = "veteran";
41628 #endif /* FREECIV_JSON_CONNECTION */
41629 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
41630 RECEIVE_PACKET_FIELD_ERROR(veteran);
41631 }
41632 #ifdef FREECIV_JSON_CONNECTION
41633 field_addr.name = "occupied";
41634 #endif /* FREECIV_JSON_CONNECTION */
41635 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->occupied)) {
41636 RECEIVE_PACKET_FIELD_ERROR(occupied);
41637 }
41638 #ifdef FREECIV_JSON_CONNECTION
41639 field_addr.name = "transported";
41640 #endif /* FREECIV_JSON_CONNECTION */
41641 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->transported)) {
41642 RECEIVE_PACKET_FIELD_ERROR(transported);
41643 }
41644 #ifdef FREECIV_JSON_CONNECTION
41645 field_addr.name = "hp";
41646 #endif /* FREECIV_JSON_CONNECTION */
41647 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
41648 RECEIVE_PACKET_FIELD_ERROR(hp);
41649 }
41650 #ifdef FREECIV_JSON_CONNECTION
41651 field_addr.name = "activity";
41652 #endif /* FREECIV_JSON_CONNECTION */
41653 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->activity)) {
41654 RECEIVE_PACKET_FIELD_ERROR(activity);
41655 }
41656 #ifdef FREECIV_JSON_CONNECTION
41657 field_addr.name = "activity_tgt";
41658 #endif /* FREECIV_JSON_CONNECTION */
41659 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
41660 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
41661 }
41662 #ifdef FREECIV_JSON_CONNECTION
41663 field_addr.name = "transported_by16";
41664 #endif /* FREECIV_JSON_CONNECTION */
41665 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->transported_by16)) {
41666 RECEIVE_PACKET_FIELD_ERROR(transported_by16);
41667 }
41668 #ifdef FREECIV_JSON_CONNECTION
41669 field_addr.name = "packet_use";
41670 #endif /* FREECIV_JSON_CONNECTION */
41671 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->packet_use)) {
41672 RECEIVE_PACKET_FIELD_ERROR(packet_use);
41673 }
41674 #ifdef FREECIV_JSON_CONNECTION
41675 field_addr.name = "info_city_id16";
41676 #endif /* FREECIV_JSON_CONNECTION */
41677 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->info_city_id16)) {
41678 RECEIVE_PACKET_FIELD_ERROR(info_city_id16);
41679 }
41680
41681#endif
41682 log_packet_detailed("packet_unit_short_info_101: got info about (%d)",
41683 real_packet->id16);
41684
41685#ifdef FREECIV_DELTA_PROTOCOL
41686 if (NULL == *hash) {
41687 *hash = genhash_new_full(hash_packet_unit_short_info_101, cmp_packet_unit_short_info_101,
41688 NULL, NULL, NULL, free);
41689 }
41690
41691 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
41692 *real_packet = *old;
41693 } else {
41694 int id16 = real_packet->id16;
41695
41696 log_packet_detailed(" no old info");
41697 memset(real_packet, 0, sizeof(*real_packet));
41698
41699 real_packet->id16 = id16;
41700 }
41701
41702 if (BV_ISSET(fields, 0)) {
41703 log_packet_detailed(" got field 'owner'");
41704 #ifdef FREECIV_JSON_CONNECTION
41705 field_addr.name = "owner";
41706 #endif /* FREECIV_JSON_CONNECTION */
41707 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
41708 RECEIVE_PACKET_FIELD_ERROR(owner);
41709 }
41710 }
41711 if (BV_ISSET(fields, 1)) {
41712 log_packet_detailed(" got field 'tile'");
41713 #ifdef FREECIV_JSON_CONNECTION
41714 field_addr.name = "tile";
41715 #endif /* FREECIV_JSON_CONNECTION */
41716 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
41717 RECEIVE_PACKET_FIELD_ERROR(tile);
41718 }
41719 }
41720 if (BV_ISSET(fields, 2)) {
41721 log_packet_detailed(" got field 'facing'");
41722 #ifdef FREECIV_JSON_CONNECTION
41723 field_addr.name = "facing";
41724 #endif /* FREECIV_JSON_CONNECTION */
41725 {
41726 int readin;
41727
41728 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
41729 RECEIVE_PACKET_FIELD_ERROR(facing);
41730 }
41731 real_packet->facing = readin;
41732 }
41733 }
41734 if (BV_ISSET(fields, 3)) {
41735 log_packet_detailed(" got field 'type'");
41736 #ifdef FREECIV_JSON_CONNECTION
41737 field_addr.name = "type";
41738 #endif /* FREECIV_JSON_CONNECTION */
41739 {
41740 int readin;
41741
41742 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
41743 RECEIVE_PACKET_FIELD_ERROR(type);
41744 }
41745 real_packet->type = readin;
41746 }
41747 }
41748 if (BV_ISSET(fields, 4)) {
41749 log_packet_detailed(" got field 'veteran'");
41750 #ifdef FREECIV_JSON_CONNECTION
41751 field_addr.name = "veteran";
41752 #endif /* FREECIV_JSON_CONNECTION */
41753 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
41754 RECEIVE_PACKET_FIELD_ERROR(veteran);
41755 }
41756 }
41757 real_packet->occupied = BV_ISSET(fields, 5);
41758 real_packet->transported = BV_ISSET(fields, 6);
41759 if (BV_ISSET(fields, 7)) {
41760 log_packet_detailed(" got field 'hp'");
41761 #ifdef FREECIV_JSON_CONNECTION
41762 field_addr.name = "hp";
41763 #endif /* FREECIV_JSON_CONNECTION */
41764 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
41765 RECEIVE_PACKET_FIELD_ERROR(hp);
41766 }
41767 }
41768 if (BV_ISSET(fields, 8)) {
41769 log_packet_detailed(" got field 'activity'");
41770 #ifdef FREECIV_JSON_CONNECTION
41771 field_addr.name = "activity";
41772 #endif /* FREECIV_JSON_CONNECTION */
41773 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->activity)) {
41774 RECEIVE_PACKET_FIELD_ERROR(activity);
41775 }
41776 }
41777 if (BV_ISSET(fields, 9)) {
41778 log_packet_detailed(" got field 'activity_tgt'");
41779 #ifdef FREECIV_JSON_CONNECTION
41780 field_addr.name = "activity_tgt";
41781 #endif /* FREECIV_JSON_CONNECTION */
41782 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
41783 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
41784 }
41785 }
41786 if (BV_ISSET(fields, 10)) {
41787 log_packet_detailed(" got field 'transported_by16'");
41788 #ifdef FREECIV_JSON_CONNECTION
41789 field_addr.name = "transported_by16";
41790 #endif /* FREECIV_JSON_CONNECTION */
41791 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->transported_by16)) {
41792 RECEIVE_PACKET_FIELD_ERROR(transported_by16);
41793 }
41794 }
41795 if (BV_ISSET(fields, 11)) {
41796 log_packet_detailed(" got field 'packet_use'");
41797 #ifdef FREECIV_JSON_CONNECTION
41798 field_addr.name = "packet_use";
41799 #endif /* FREECIV_JSON_CONNECTION */
41800 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->packet_use)) {
41801 RECEIVE_PACKET_FIELD_ERROR(packet_use);
41802 }
41803 }
41804 if (BV_ISSET(fields, 12)) {
41805 log_packet_detailed(" got field 'info_city_id16'");
41806 #ifdef FREECIV_JSON_CONNECTION
41807 field_addr.name = "info_city_id16";
41808 #endif /* FREECIV_JSON_CONNECTION */
41809 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->info_city_id16)) {
41810 RECEIVE_PACKET_FIELD_ERROR(info_city_id16);
41811 }
41812 }
41813
41814 if (NULL == old) {
41815 old = fc_malloc(sizeof(*old));
41816 *old = *real_packet;
41817 genhash_insert(*hash, old, old);
41818 } else {
41819 *old = *real_packet;
41820 }
41821
41822 hash = pc->phs.received + PACKET_UNIT_INFO;
41823 if (NULL != *hash) {
41824 genhash_remove(*hash, real_packet);
41825 }
41826
41827#endif /* FREECIV_DELTA_PROTOCOL */
41828 RECEIVE_PACKET_END(real_packet);
41829}
41830
41831 static int send_packet_unit_short_info_101(struct connection *pc, const struct packet_unit_short_info *packet, bool force_to_send)
41832{
41833 const struct packet_unit_short_info *real_packet = packet;
41834#ifdef FREECIV_DELTA_PROTOCOL
41835 packet_unit_short_info_101_fields fields;
41836 struct packet_unit_short_info *old;
41837 bool differ;
41838 struct genhash **hash = pc->phs.sent + PACKET_UNIT_SHORT_INFO;
41839 int different = force_to_send;
41840#endif /* FREECIV_DELTA_PROTOCOL */
41841 SEND_PACKET_START(PACKET_UNIT_SHORT_INFO);
41842#ifdef FREECIV_JSON_CONNECTION
41843 struct plocation field_addr;
41844 {
41845 struct plocation *field_addr_tmp = plocation_field_new(NULL);
41846 field_addr = *field_addr_tmp;
41847 FC_FREE(field_addr_tmp);
41848 }
41849#endif /* FREECIV_JSON_CONNECTION */
41850
41851 log_packet_detailed("packet_unit_short_info_101: sending info about (%d)",
41852 real_packet->id16);
41853
41854#ifdef FREECIV_DELTA_PROTOCOL
41855 if (NULL == *hash) {
41856 *hash = genhash_new_full(hash_packet_unit_short_info_101, cmp_packet_unit_short_info_101,
41857 NULL, NULL, NULL, free);
41858 }
41859 BV_CLR_ALL(fields);
41860
41861 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
41862 old = fc_malloc(sizeof(*old));
41863 *old = *real_packet;
41864 genhash_insert(*hash, old, old);
41865 memset(old, 0, sizeof(*old));
41866 different = 1; /* Force to send. */
41867 }
41868 differ = (old->owner != real_packet->owner);
41869 if (differ) {
41870 different++;
41871 BV_SET(fields, 0);
41872 }
41873
41874 differ = (old->tile != real_packet->tile);
41875 if (differ) {
41876 different++;
41877 BV_SET(fields, 1);
41878 }
41879
41880 differ = (old->facing != real_packet->facing);
41881 if (differ) {
41882 different++;
41883 BV_SET(fields, 2);
41884 }
41885
41886 differ = (old->type != real_packet->type);
41887 if (differ) {
41888 different++;
41889 BV_SET(fields, 3);
41890 }
41891
41892 differ = (old->veteran != real_packet->veteran);
41893 if (differ) {
41894 different++;
41895 BV_SET(fields, 4);
41896 }
41897
41898 differ = (old->occupied != real_packet->occupied);
41899 if (differ) {
41900 different++;
41901 }
41902 if (packet->occupied) {
41903 BV_SET(fields, 5);
41904 }
41905
41906 differ = (old->transported != real_packet->transported);
41907 if (differ) {
41908 different++;
41909 }
41910 if (packet->transported) {
41911 BV_SET(fields, 6);
41912 }
41913
41914 differ = (old->hp != real_packet->hp);
41915 if (differ) {
41916 different++;
41917 BV_SET(fields, 7);
41918 }
41919
41920 differ = (old->activity != real_packet->activity);
41921 if (differ) {
41922 different++;
41923 BV_SET(fields, 8);
41924 }
41925
41926 differ = (old->activity_tgt != real_packet->activity_tgt);
41927 if (differ) {
41928 different++;
41929 BV_SET(fields, 9);
41930 }
41931
41932 differ = (old->transported_by16 != real_packet->transported_by16);
41933 if (differ) {
41934 different++;
41935 BV_SET(fields, 10);
41936 }
41937
41938 differ = (old->packet_use != real_packet->packet_use);
41939 if (differ) {
41940 different++;
41941 BV_SET(fields, 11);
41942 }
41943
41944 differ = (old->info_city_id16 != real_packet->info_city_id16);
41945 if (differ) {
41946 different++;
41947 BV_SET(fields, 12);
41948 }
41949
41950
41951 if (different == 0) {
41952 log_packet_detailed(" no change -> discard");
41953 return 0;
41954 }
41955
41956#ifdef FREECIV_JSON_CONNECTION
41957 field_addr.name = "fields";
41958#endif /* FREECIV_JSON_CONNECTION */
41959 DIO_BV_PUT(&dout, &field_addr, fields);
41960#ifdef FREECIV_JSON_CONNECTION
41961 field_addr.name = "id16";
41962#endif /* FREECIV_JSON_CONNECTION */
41963 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
41964
41965 if (BV_ISSET(fields, 0)) {
41966 log_packet_detailed(" field 'owner' has changed");
41967 #ifdef FREECIV_JSON_CONNECTION
41968 field_addr.name = "owner";
41969#endif /* FREECIV_JSON_CONNECTION */
41970 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
41971 }
41972 if (BV_ISSET(fields, 1)) {
41973 log_packet_detailed(" field 'tile' has changed");
41974 #ifdef FREECIV_JSON_CONNECTION
41975 field_addr.name = "tile";
41976#endif /* FREECIV_JSON_CONNECTION */
41977 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
41978 }
41979 if (BV_ISSET(fields, 2)) {
41980 log_packet_detailed(" field 'facing' has changed");
41981 #ifdef FREECIV_JSON_CONNECTION
41982 field_addr.name = "facing";
41983#endif /* FREECIV_JSON_CONNECTION */
41984 DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
41985 }
41986 if (BV_ISSET(fields, 3)) {
41987 log_packet_detailed(" field 'type' has changed");
41988 #ifdef FREECIV_JSON_CONNECTION
41989 field_addr.name = "type";
41990#endif /* FREECIV_JSON_CONNECTION */
41991 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
41992 }
41993 if (BV_ISSET(fields, 4)) {
41994 log_packet_detailed(" field 'veteran' has changed");
41995 #ifdef FREECIV_JSON_CONNECTION
41996 field_addr.name = "veteran";
41997#endif /* FREECIV_JSON_CONNECTION */
41998 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
41999 }
42000 /* field 5 is folded into the header */
42001 /* field 6 is folded into the header */
42002 if (BV_ISSET(fields, 7)) {
42003 log_packet_detailed(" field 'hp' has changed");
42004 #ifdef FREECIV_JSON_CONNECTION
42005 field_addr.name = "hp";
42006#endif /* FREECIV_JSON_CONNECTION */
42007 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
42008 }
42009 if (BV_ISSET(fields, 8)) {
42010 log_packet_detailed(" field 'activity' has changed");
42011 #ifdef FREECIV_JSON_CONNECTION
42012 field_addr.name = "activity";
42013#endif /* FREECIV_JSON_CONNECTION */
42014 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
42015 }
42016 if (BV_ISSET(fields, 9)) {
42017 log_packet_detailed(" field 'activity_tgt' has changed");
42018 #ifdef FREECIV_JSON_CONNECTION
42019 field_addr.name = "activity_tgt";
42020#endif /* FREECIV_JSON_CONNECTION */
42021 DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
42022 }
42023 if (BV_ISSET(fields, 10)) {
42024 log_packet_detailed(" field 'transported_by16' has changed");
42025 #ifdef FREECIV_JSON_CONNECTION
42026 field_addr.name = "transported_by16";
42027#endif /* FREECIV_JSON_CONNECTION */
42028 DIO_PUT(uint16, &dout, &field_addr, real_packet->transported_by16);
42029 }
42030 if (BV_ISSET(fields, 11)) {
42031 log_packet_detailed(" field 'packet_use' has changed");
42032 #ifdef FREECIV_JSON_CONNECTION
42033 field_addr.name = "packet_use";
42034#endif /* FREECIV_JSON_CONNECTION */
42035 DIO_PUT(uint8, &dout, &field_addr, real_packet->packet_use);
42036 }
42037 if (BV_ISSET(fields, 12)) {
42038 log_packet_detailed(" field 'info_city_id16' has changed");
42039 #ifdef FREECIV_JSON_CONNECTION
42040 field_addr.name = "info_city_id16";
42041#endif /* FREECIV_JSON_CONNECTION */
42042 DIO_PUT(uint16, &dout, &field_addr, real_packet->info_city_id16);
42043 }
42044
42045 *old = *real_packet;
42046
42047 hash = pc->phs.sent + PACKET_UNIT_INFO;
42048 if (NULL != *hash) {
42049 genhash_remove(*hash, real_packet);
42050 }
42051#endif /* FREECIV_DELTA_PROTOCOL */
42052#ifndef FREECIV_DELTA_PROTOCOL
42053#ifdef FREECIV_JSON_CONNECTION
42054 field_addr.name = "id16";
42055#endif /* FREECIV_JSON_CONNECTION */
42056 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
42057#ifdef FREECIV_JSON_CONNECTION
42058 field_addr.name = "owner";
42059#endif /* FREECIV_JSON_CONNECTION */
42060 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
42061#ifdef FREECIV_JSON_CONNECTION
42062 field_addr.name = "tile";
42063#endif /* FREECIV_JSON_CONNECTION */
42064 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
42065#ifdef FREECIV_JSON_CONNECTION
42066 field_addr.name = "facing";
42067#endif /* FREECIV_JSON_CONNECTION */
42068 DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
42069#ifdef FREECIV_JSON_CONNECTION
42070 field_addr.name = "type";
42071#endif /* FREECIV_JSON_CONNECTION */
42072 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
42073#ifdef FREECIV_JSON_CONNECTION
42074 field_addr.name = "veteran";
42075#endif /* FREECIV_JSON_CONNECTION */
42076 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
42077#ifdef FREECIV_JSON_CONNECTION
42078 field_addr.name = "occupied";
42079#endif /* FREECIV_JSON_CONNECTION */
42080 DIO_PUT(bool8, &dout, &field_addr, real_packet->occupied);
42081#ifdef FREECIV_JSON_CONNECTION
42082 field_addr.name = "transported";
42083#endif /* FREECIV_JSON_CONNECTION */
42084 DIO_PUT(bool8, &dout, &field_addr, real_packet->transported);
42085#ifdef FREECIV_JSON_CONNECTION
42086 field_addr.name = "hp";
42087#endif /* FREECIV_JSON_CONNECTION */
42088 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
42089#ifdef FREECIV_JSON_CONNECTION
42090 field_addr.name = "activity";
42091#endif /* FREECIV_JSON_CONNECTION */
42092 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
42093#ifdef FREECIV_JSON_CONNECTION
42094 field_addr.name = "activity_tgt";
42095#endif /* FREECIV_JSON_CONNECTION */
42096 DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
42097#ifdef FREECIV_JSON_CONNECTION
42098 field_addr.name = "transported_by16";
42099#endif /* FREECIV_JSON_CONNECTION */
42100 DIO_PUT(uint16, &dout, &field_addr, real_packet->transported_by16);
42101#ifdef FREECIV_JSON_CONNECTION
42102 field_addr.name = "packet_use";
42103#endif /* FREECIV_JSON_CONNECTION */
42104 DIO_PUT(uint8, &dout, &field_addr, real_packet->packet_use);
42105#ifdef FREECIV_JSON_CONNECTION
42106 field_addr.name = "info_city_id16";
42107#endif /* FREECIV_JSON_CONNECTION */
42108 DIO_PUT(uint16, &dout, &field_addr, real_packet->info_city_id16);
42109
42110#endif
42111 SEND_PACKET_END(PACKET_UNIT_SHORT_INFO);
42112}
42113
42114 int send_packet_unit_short_info(struct connection *pc, const struct packet_unit_short_info *packet, bool force_to_send)
42115{
42116 if (!pc->used) {
42117 log_error("WARNING: trying to send data to the closed connection %s",
42118 conn_description(pc));
42119 return -1;
42120 }
42121 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_SHORT_INFO].force_to_send != NULL, -1,
42122 "Handler for PACKET_UNIT_SHORT_INFO not installed");
42123 return pc->phs.handlers->send[PACKET_UNIT_SHORT_INFO].force_to_send(pc, packet, force_to_send);
42124}
42125
42126 void lsend_packet_unit_short_info(struct conn_list *dest, const struct packet_unit_short_info *packet, bool force_to_send)
42127{
42128 conn_list_iterate(dest, pconn) {
42129 send_packet_unit_short_info(pconn, packet, force_to_send);
42130 } conn_list_iterate_end;
42131}
42132
42133#ifdef FREECIV_DELTA_PROTOCOL
42134#define hash_packet_unit_combat_info_100 hash_const
42135
42136#define cmp_packet_unit_combat_info_100 cmp_const
42137
42138 BV_DEFINE(packet_unit_combat_info_100_fields, 6);
42139#endif /* FREECIV_DELTA_PROTOCOL */
42140
42141 static struct packet_unit_combat_info *receive_packet_unit_combat_info_100(struct connection *pc)
42142{
42143#ifdef FREECIV_DELTA_PROTOCOL
42144 packet_unit_combat_info_100_fields fields;
42145 struct packet_unit_combat_info *old;
42146 struct genhash **hash = pc->phs.received + PACKET_UNIT_COMBAT_INFO;
42147#endif /* FREECIV_DELTA_PROTOCOL */
42148 RECEIVE_PACKET_START(packet_unit_combat_info, real_packet);
42149#ifdef FREECIV_JSON_CONNECTION
42150 struct plocation field_addr;
42151 {
42152 struct plocation *field_addr_tmp = plocation_field_new(NULL);
42153 field_addr = *field_addr_tmp;
42154 FC_FREE(field_addr_tmp);
42155 }
42156#endif /* FREECIV_JSON_CONNECTION */
42157
42158#ifdef FREECIV_DELTA_PROTOCOL
42159#ifdef FREECIV_JSON_CONNECTION
42160 field_addr.name = "fields";
42161#endif /* FREECIV_JSON_CONNECTION */
42162 DIO_BV_GET(&din, &field_addr, fields);
42163
42164#else /* FREECIV_DELTA_PROTOCOL */
42165 #ifdef FREECIV_JSON_CONNECTION
42166 field_addr.name = "attacker_unit_id32";
42167 #endif /* FREECIV_JSON_CONNECTION */
42168 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->attacker_unit_id32)) {
42169 RECEIVE_PACKET_FIELD_ERROR(attacker_unit_id32);
42170 }
42171 #ifdef FREECIV_JSON_CONNECTION
42172 field_addr.name = "defender_unit_id32";
42173 #endif /* FREECIV_JSON_CONNECTION */
42174 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->defender_unit_id32)) {
42175 RECEIVE_PACKET_FIELD_ERROR(defender_unit_id32);
42176 }
42177 #ifdef FREECIV_JSON_CONNECTION
42178 field_addr.name = "attacker_hp";
42179 #endif /* FREECIV_JSON_CONNECTION */
42180 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->attacker_hp)) {
42181 RECEIVE_PACKET_FIELD_ERROR(attacker_hp);
42182 }
42183 #ifdef FREECIV_JSON_CONNECTION
42184 field_addr.name = "defender_hp";
42185 #endif /* FREECIV_JSON_CONNECTION */
42186 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defender_hp)) {
42187 RECEIVE_PACKET_FIELD_ERROR(defender_hp);
42188 }
42189 #ifdef FREECIV_JSON_CONNECTION
42190 field_addr.name = "make_att_veteran";
42191 #endif /* FREECIV_JSON_CONNECTION */
42192 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->make_att_veteran)) {
42193 RECEIVE_PACKET_FIELD_ERROR(make_att_veteran);
42194 }
42195 #ifdef FREECIV_JSON_CONNECTION
42196 field_addr.name = "make_def_veteran";
42197 #endif /* FREECIV_JSON_CONNECTION */
42198 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->make_def_veteran)) {
42199 RECEIVE_PACKET_FIELD_ERROR(make_def_veteran);
42200 }
42201
42202#endif
42203 log_packet_detailed("packet_unit_combat_info_100: got info about ()");
42204
42205#ifdef FREECIV_DELTA_PROTOCOL
42206 if (NULL == *hash) {
42207 *hash = genhash_new_full(hash_packet_unit_combat_info_100, cmp_packet_unit_combat_info_100,
42208 NULL, NULL, NULL, free);
42209 }
42210
42211 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
42212 *real_packet = *old;
42213 } else {
42214 log_packet_detailed(" no old info");
42215 memset(real_packet, 0, sizeof(*real_packet));
42216 }
42217
42218 if (BV_ISSET(fields, 0)) {
42219 log_packet_detailed(" got field 'attacker_unit_id32'");
42220 #ifdef FREECIV_JSON_CONNECTION
42221 field_addr.name = "attacker_unit_id32";
42222 #endif /* FREECIV_JSON_CONNECTION */
42223 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->attacker_unit_id32)) {
42224 RECEIVE_PACKET_FIELD_ERROR(attacker_unit_id32);
42225 }
42226 }
42227 if (BV_ISSET(fields, 1)) {
42228 log_packet_detailed(" got field 'defender_unit_id32'");
42229 #ifdef FREECIV_JSON_CONNECTION
42230 field_addr.name = "defender_unit_id32";
42231 #endif /* FREECIV_JSON_CONNECTION */
42232 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->defender_unit_id32)) {
42233 RECEIVE_PACKET_FIELD_ERROR(defender_unit_id32);
42234 }
42235 }
42236 if (BV_ISSET(fields, 2)) {
42237 log_packet_detailed(" got field 'attacker_hp'");
42238 #ifdef FREECIV_JSON_CONNECTION
42239 field_addr.name = "attacker_hp";
42240 #endif /* FREECIV_JSON_CONNECTION */
42241 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->attacker_hp)) {
42242 RECEIVE_PACKET_FIELD_ERROR(attacker_hp);
42243 }
42244 }
42245 if (BV_ISSET(fields, 3)) {
42246 log_packet_detailed(" got field 'defender_hp'");
42247 #ifdef FREECIV_JSON_CONNECTION
42248 field_addr.name = "defender_hp";
42249 #endif /* FREECIV_JSON_CONNECTION */
42250 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defender_hp)) {
42251 RECEIVE_PACKET_FIELD_ERROR(defender_hp);
42252 }
42253 }
42254 real_packet->make_att_veteran = BV_ISSET(fields, 4);
42255 real_packet->make_def_veteran = BV_ISSET(fields, 5);
42256
42257 if (NULL == old) {
42258 old = fc_malloc(sizeof(*old));
42259 *old = *real_packet;
42260 genhash_insert(*hash, old, old);
42261 } else {
42262 *old = *real_packet;
42263 }
42264
42265#endif /* FREECIV_DELTA_PROTOCOL */
42266 RECEIVE_PACKET_END(real_packet);
42267}
42268
42269 static int send_packet_unit_combat_info_100(struct connection *pc, const struct packet_unit_combat_info *packet)
42270{
42271 const struct packet_unit_combat_info *real_packet = packet;
42272#ifdef FREECIV_DELTA_PROTOCOL
42273 packet_unit_combat_info_100_fields fields;
42274 struct packet_unit_combat_info *old;
42275 bool differ;
42276 struct genhash **hash = pc->phs.sent + PACKET_UNIT_COMBAT_INFO;
42277#endif /* FREECIV_DELTA_PROTOCOL */
42278 SEND_PACKET_START(PACKET_UNIT_COMBAT_INFO);
42279#ifdef FREECIV_JSON_CONNECTION
42280 struct plocation field_addr;
42281 {
42282 struct plocation *field_addr_tmp = plocation_field_new(NULL);
42283 field_addr = *field_addr_tmp;
42284 FC_FREE(field_addr_tmp);
42285 }
42286#endif /* FREECIV_JSON_CONNECTION */
42287
42288 log_packet_detailed("packet_unit_combat_info_100: sending info about ()");
42289
42290#ifdef FREECIV_DELTA_PROTOCOL
42291 if (NULL == *hash) {
42292 *hash = genhash_new_full(hash_packet_unit_combat_info_100, cmp_packet_unit_combat_info_100,
42293 NULL, NULL, NULL, free);
42294 }
42295 BV_CLR_ALL(fields);
42296
42297 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
42298 old = fc_malloc(sizeof(*old));
42299 *old = *real_packet;
42300 genhash_insert(*hash, old, old);
42301 memset(old, 0, sizeof(*old));
42302 }
42303 differ = (old->attacker_unit_id32 != real_packet->attacker_unit_id32);
42304 if (differ) {
42305 BV_SET(fields, 0);
42306 }
42307
42308 differ = (old->defender_unit_id32 != real_packet->defender_unit_id32);
42309 if (differ) {
42310 BV_SET(fields, 1);
42311 }
42312
42313 differ = (old->attacker_hp != real_packet->attacker_hp);
42314 if (differ) {
42315 BV_SET(fields, 2);
42316 }
42317
42318 differ = (old->defender_hp != real_packet->defender_hp);
42319 if (differ) {
42320 BV_SET(fields, 3);
42321 }
42322
42323 if (packet->make_att_veteran) {
42324 BV_SET(fields, 4);
42325 }
42326
42327 if (packet->make_def_veteran) {
42328 BV_SET(fields, 5);
42329 }
42330
42331
42332#ifdef FREECIV_JSON_CONNECTION
42333 field_addr.name = "fields";
42334#endif /* FREECIV_JSON_CONNECTION */
42335 DIO_BV_PUT(&dout, &field_addr, fields);
42336
42337 if (BV_ISSET(fields, 0)) {
42338 log_packet_detailed(" field 'attacker_unit_id32' has changed");
42339 #ifdef FREECIV_JSON_CONNECTION
42340 field_addr.name = "attacker_unit_id32";
42341#endif /* FREECIV_JSON_CONNECTION */
42342 DIO_PUT(uint32, &dout, &field_addr, real_packet->attacker_unit_id32);
42343 }
42344 if (BV_ISSET(fields, 1)) {
42345 log_packet_detailed(" field 'defender_unit_id32' has changed");
42346 #ifdef FREECIV_JSON_CONNECTION
42347 field_addr.name = "defender_unit_id32";
42348#endif /* FREECIV_JSON_CONNECTION */
42349 DIO_PUT(uint32, &dout, &field_addr, real_packet->defender_unit_id32);
42350 }
42351 if (BV_ISSET(fields, 2)) {
42352 log_packet_detailed(" field 'attacker_hp' has changed");
42353 #ifdef FREECIV_JSON_CONNECTION
42354 field_addr.name = "attacker_hp";
42355#endif /* FREECIV_JSON_CONNECTION */
42356 DIO_PUT(uint8, &dout, &field_addr, real_packet->attacker_hp);
42357 }
42358 if (BV_ISSET(fields, 3)) {
42359 log_packet_detailed(" field 'defender_hp' has changed");
42360 #ifdef FREECIV_JSON_CONNECTION
42361 field_addr.name = "defender_hp";
42362#endif /* FREECIV_JSON_CONNECTION */
42363 DIO_PUT(uint8, &dout, &field_addr, real_packet->defender_hp);
42364 }
42365 /* field 4 is folded into the header */
42366 /* field 5 is folded into the header */
42367
42368 *old = *real_packet;
42369#endif /* FREECIV_DELTA_PROTOCOL */
42370#ifndef FREECIV_DELTA_PROTOCOL
42371#ifdef FREECIV_JSON_CONNECTION
42372 field_addr.name = "attacker_unit_id32";
42373#endif /* FREECIV_JSON_CONNECTION */
42374 DIO_PUT(uint32, &dout, &field_addr, real_packet->attacker_unit_id32);
42375#ifdef FREECIV_JSON_CONNECTION
42376 field_addr.name = "defender_unit_id32";
42377#endif /* FREECIV_JSON_CONNECTION */
42378 DIO_PUT(uint32, &dout, &field_addr, real_packet->defender_unit_id32);
42379#ifdef FREECIV_JSON_CONNECTION
42380 field_addr.name = "attacker_hp";
42381#endif /* FREECIV_JSON_CONNECTION */
42382 DIO_PUT(uint8, &dout, &field_addr, real_packet->attacker_hp);
42383#ifdef FREECIV_JSON_CONNECTION
42384 field_addr.name = "defender_hp";
42385#endif /* FREECIV_JSON_CONNECTION */
42386 DIO_PUT(uint8, &dout, &field_addr, real_packet->defender_hp);
42387#ifdef FREECIV_JSON_CONNECTION
42388 field_addr.name = "make_att_veteran";
42389#endif /* FREECIV_JSON_CONNECTION */
42390 DIO_PUT(bool8, &dout, &field_addr, real_packet->make_att_veteran);
42391#ifdef FREECIV_JSON_CONNECTION
42392 field_addr.name = "make_def_veteran";
42393#endif /* FREECIV_JSON_CONNECTION */
42394 DIO_PUT(bool8, &dout, &field_addr, real_packet->make_def_veteran);
42395
42396#endif
42397 SEND_PACKET_END(PACKET_UNIT_COMBAT_INFO);
42398}
42399
42400#ifdef FREECIV_DELTA_PROTOCOL
42401#define hash_packet_unit_combat_info_101 hash_const
42402
42403#define cmp_packet_unit_combat_info_101 cmp_const
42404
42405 BV_DEFINE(packet_unit_combat_info_101_fields, 6);
42406#endif /* FREECIV_DELTA_PROTOCOL */
42407
42408 static struct packet_unit_combat_info *receive_packet_unit_combat_info_101(struct connection *pc)
42409{
42410#ifdef FREECIV_DELTA_PROTOCOL
42411 packet_unit_combat_info_101_fields fields;
42412 struct packet_unit_combat_info *old;
42413 struct genhash **hash = pc->phs.received + PACKET_UNIT_COMBAT_INFO;
42414#endif /* FREECIV_DELTA_PROTOCOL */
42415 RECEIVE_PACKET_START(packet_unit_combat_info, real_packet);
42416#ifdef FREECIV_JSON_CONNECTION
42417 struct plocation field_addr;
42418 {
42419 struct plocation *field_addr_tmp = plocation_field_new(NULL);
42420 field_addr = *field_addr_tmp;
42421 FC_FREE(field_addr_tmp);
42422 }
42423#endif /* FREECIV_JSON_CONNECTION */
42424
42425#ifdef FREECIV_DELTA_PROTOCOL
42426#ifdef FREECIV_JSON_CONNECTION
42427 field_addr.name = "fields";
42428#endif /* FREECIV_JSON_CONNECTION */
42429 DIO_BV_GET(&din, &field_addr, fields);
42430
42431#else /* FREECIV_DELTA_PROTOCOL */
42432 #ifdef FREECIV_JSON_CONNECTION
42433 field_addr.name = "attacker_unit_id16";
42434 #endif /* FREECIV_JSON_CONNECTION */
42435 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->attacker_unit_id16)) {
42436 RECEIVE_PACKET_FIELD_ERROR(attacker_unit_id16);
42437 }
42438 #ifdef FREECIV_JSON_CONNECTION
42439 field_addr.name = "defender_unit_id16";
42440 #endif /* FREECIV_JSON_CONNECTION */
42441 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->defender_unit_id16)) {
42442 RECEIVE_PACKET_FIELD_ERROR(defender_unit_id16);
42443 }
42444 #ifdef FREECIV_JSON_CONNECTION
42445 field_addr.name = "attacker_hp";
42446 #endif /* FREECIV_JSON_CONNECTION */
42447 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->attacker_hp)) {
42448 RECEIVE_PACKET_FIELD_ERROR(attacker_hp);
42449 }
42450 #ifdef FREECIV_JSON_CONNECTION
42451 field_addr.name = "defender_hp";
42452 #endif /* FREECIV_JSON_CONNECTION */
42453 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defender_hp)) {
42454 RECEIVE_PACKET_FIELD_ERROR(defender_hp);
42455 }
42456 #ifdef FREECIV_JSON_CONNECTION
42457 field_addr.name = "make_att_veteran";
42458 #endif /* FREECIV_JSON_CONNECTION */
42459 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->make_att_veteran)) {
42460 RECEIVE_PACKET_FIELD_ERROR(make_att_veteran);
42461 }
42462 #ifdef FREECIV_JSON_CONNECTION
42463 field_addr.name = "make_def_veteran";
42464 #endif /* FREECIV_JSON_CONNECTION */
42465 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->make_def_veteran)) {
42466 RECEIVE_PACKET_FIELD_ERROR(make_def_veteran);
42467 }
42468
42469#endif
42470 log_packet_detailed("packet_unit_combat_info_101: got info about ()");
42471
42472#ifdef FREECIV_DELTA_PROTOCOL
42473 if (NULL == *hash) {
42474 *hash = genhash_new_full(hash_packet_unit_combat_info_101, cmp_packet_unit_combat_info_101,
42475 NULL, NULL, NULL, free);
42476 }
42477
42478 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
42479 *real_packet = *old;
42480 } else {
42481 log_packet_detailed(" no old info");
42482 memset(real_packet, 0, sizeof(*real_packet));
42483 }
42484
42485 if (BV_ISSET(fields, 0)) {
42486 log_packet_detailed(" got field 'attacker_unit_id16'");
42487 #ifdef FREECIV_JSON_CONNECTION
42488 field_addr.name = "attacker_unit_id16";
42489 #endif /* FREECIV_JSON_CONNECTION */
42490 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->attacker_unit_id16)) {
42491 RECEIVE_PACKET_FIELD_ERROR(attacker_unit_id16);
42492 }
42493 }
42494 if (BV_ISSET(fields, 1)) {
42495 log_packet_detailed(" got field 'defender_unit_id16'");
42496 #ifdef FREECIV_JSON_CONNECTION
42497 field_addr.name = "defender_unit_id16";
42498 #endif /* FREECIV_JSON_CONNECTION */
42499 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->defender_unit_id16)) {
42500 RECEIVE_PACKET_FIELD_ERROR(defender_unit_id16);
42501 }
42502 }
42503 if (BV_ISSET(fields, 2)) {
42504 log_packet_detailed(" got field 'attacker_hp'");
42505 #ifdef FREECIV_JSON_CONNECTION
42506 field_addr.name = "attacker_hp";
42507 #endif /* FREECIV_JSON_CONNECTION */
42508 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->attacker_hp)) {
42509 RECEIVE_PACKET_FIELD_ERROR(attacker_hp);
42510 }
42511 }
42512 if (BV_ISSET(fields, 3)) {
42513 log_packet_detailed(" got field 'defender_hp'");
42514 #ifdef FREECIV_JSON_CONNECTION
42515 field_addr.name = "defender_hp";
42516 #endif /* FREECIV_JSON_CONNECTION */
42517 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defender_hp)) {
42518 RECEIVE_PACKET_FIELD_ERROR(defender_hp);
42519 }
42520 }
42521 real_packet->make_att_veteran = BV_ISSET(fields, 4);
42522 real_packet->make_def_veteran = BV_ISSET(fields, 5);
42523
42524 if (NULL == old) {
42525 old = fc_malloc(sizeof(*old));
42526 *old = *real_packet;
42527 genhash_insert(*hash, old, old);
42528 } else {
42529 *old = *real_packet;
42530 }
42531
42532#endif /* FREECIV_DELTA_PROTOCOL */
42533 RECEIVE_PACKET_END(real_packet);
42534}
42535
42536 static int send_packet_unit_combat_info_101(struct connection *pc, const struct packet_unit_combat_info *packet)
42537{
42538 const struct packet_unit_combat_info *real_packet = packet;
42539#ifdef FREECIV_DELTA_PROTOCOL
42540 packet_unit_combat_info_101_fields fields;
42541 struct packet_unit_combat_info *old;
42542 bool differ;
42543 struct genhash **hash = pc->phs.sent + PACKET_UNIT_COMBAT_INFO;
42544#endif /* FREECIV_DELTA_PROTOCOL */
42545 SEND_PACKET_START(PACKET_UNIT_COMBAT_INFO);
42546#ifdef FREECIV_JSON_CONNECTION
42547 struct plocation field_addr;
42548 {
42549 struct plocation *field_addr_tmp = plocation_field_new(NULL);
42550 field_addr = *field_addr_tmp;
42551 FC_FREE(field_addr_tmp);
42552 }
42553#endif /* FREECIV_JSON_CONNECTION */
42554
42555 log_packet_detailed("packet_unit_combat_info_101: sending info about ()");
42556
42557#ifdef FREECIV_DELTA_PROTOCOL
42558 if (NULL == *hash) {
42559 *hash = genhash_new_full(hash_packet_unit_combat_info_101, cmp_packet_unit_combat_info_101,
42560 NULL, NULL, NULL, free);
42561 }
42562 BV_CLR_ALL(fields);
42563
42564 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
42565 old = fc_malloc(sizeof(*old));
42566 *old = *real_packet;
42567 genhash_insert(*hash, old, old);
42568 memset(old, 0, sizeof(*old));
42569 }
42570 differ = (old->attacker_unit_id16 != real_packet->attacker_unit_id16);
42571 if (differ) {
42572 BV_SET(fields, 0);
42573 }
42574
42575 differ = (old->defender_unit_id16 != real_packet->defender_unit_id16);
42576 if (differ) {
42577 BV_SET(fields, 1);
42578 }
42579
42580 differ = (old->attacker_hp != real_packet->attacker_hp);
42581 if (differ) {
42582 BV_SET(fields, 2);
42583 }
42584
42585 differ = (old->defender_hp != real_packet->defender_hp);
42586 if (differ) {
42587 BV_SET(fields, 3);
42588 }
42589
42590 if (packet->make_att_veteran) {
42591 BV_SET(fields, 4);
42592 }
42593
42594 if (packet->make_def_veteran) {
42595 BV_SET(fields, 5);
42596 }
42597
42598
42599#ifdef FREECIV_JSON_CONNECTION
42600 field_addr.name = "fields";
42601#endif /* FREECIV_JSON_CONNECTION */
42602 DIO_BV_PUT(&dout, &field_addr, fields);
42603
42604 if (BV_ISSET(fields, 0)) {
42605 log_packet_detailed(" field 'attacker_unit_id16' has changed");
42606 #ifdef FREECIV_JSON_CONNECTION
42607 field_addr.name = "attacker_unit_id16";
42608#endif /* FREECIV_JSON_CONNECTION */
42609 DIO_PUT(uint16, &dout, &field_addr, real_packet->attacker_unit_id16);
42610 }
42611 if (BV_ISSET(fields, 1)) {
42612 log_packet_detailed(" field 'defender_unit_id16' has changed");
42613 #ifdef FREECIV_JSON_CONNECTION
42614 field_addr.name = "defender_unit_id16";
42615#endif /* FREECIV_JSON_CONNECTION */
42616 DIO_PUT(uint16, &dout, &field_addr, real_packet->defender_unit_id16);
42617 }
42618 if (BV_ISSET(fields, 2)) {
42619 log_packet_detailed(" field 'attacker_hp' has changed");
42620 #ifdef FREECIV_JSON_CONNECTION
42621 field_addr.name = "attacker_hp";
42622#endif /* FREECIV_JSON_CONNECTION */
42623 DIO_PUT(uint8, &dout, &field_addr, real_packet->attacker_hp);
42624 }
42625 if (BV_ISSET(fields, 3)) {
42626 log_packet_detailed(" field 'defender_hp' has changed");
42627 #ifdef FREECIV_JSON_CONNECTION
42628 field_addr.name = "defender_hp";
42629#endif /* FREECIV_JSON_CONNECTION */
42630 DIO_PUT(uint8, &dout, &field_addr, real_packet->defender_hp);
42631 }
42632 /* field 4 is folded into the header */
42633 /* field 5 is folded into the header */
42634
42635 *old = *real_packet;
42636#endif /* FREECIV_DELTA_PROTOCOL */
42637#ifndef FREECIV_DELTA_PROTOCOL
42638#ifdef FREECIV_JSON_CONNECTION
42639 field_addr.name = "attacker_unit_id16";
42640#endif /* FREECIV_JSON_CONNECTION */
42641 DIO_PUT(uint16, &dout, &field_addr, real_packet->attacker_unit_id16);
42642#ifdef FREECIV_JSON_CONNECTION
42643 field_addr.name = "defender_unit_id16";
42644#endif /* FREECIV_JSON_CONNECTION */
42645 DIO_PUT(uint16, &dout, &field_addr, real_packet->defender_unit_id16);
42646#ifdef FREECIV_JSON_CONNECTION
42647 field_addr.name = "attacker_hp";
42648#endif /* FREECIV_JSON_CONNECTION */
42649 DIO_PUT(uint8, &dout, &field_addr, real_packet->attacker_hp);
42650#ifdef FREECIV_JSON_CONNECTION
42651 field_addr.name = "defender_hp";
42652#endif /* FREECIV_JSON_CONNECTION */
42653 DIO_PUT(uint8, &dout, &field_addr, real_packet->defender_hp);
42654#ifdef FREECIV_JSON_CONNECTION
42655 field_addr.name = "make_att_veteran";
42656#endif /* FREECIV_JSON_CONNECTION */
42657 DIO_PUT(bool8, &dout, &field_addr, real_packet->make_att_veteran);
42658#ifdef FREECIV_JSON_CONNECTION
42659 field_addr.name = "make_def_veteran";
42660#endif /* FREECIV_JSON_CONNECTION */
42661 DIO_PUT(bool8, &dout, &field_addr, real_packet->make_def_veteran);
42662
42663#endif
42664 SEND_PACKET_END(PACKET_UNIT_COMBAT_INFO);
42665}
42666
42667 int send_packet_unit_combat_info(struct connection *pc, const struct packet_unit_combat_info *packet)
42668{
42669 if (!pc->used) {
42670 log_error("WARNING: trying to send data to the closed connection %s",
42671 conn_description(pc));
42672 return -1;
42673 }
42674 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_COMBAT_INFO].packet != NULL, -1,
42675 "Handler for PACKET_UNIT_COMBAT_INFO not installed");
42676 return pc->phs.handlers->send[PACKET_UNIT_COMBAT_INFO].packet(pc, packet);
42677}
42678
42679 void lsend_packet_unit_combat_info(struct conn_list *dest, const struct packet_unit_combat_info *packet)
42680{
42681 conn_list_iterate(dest, pconn) {
42682 send_packet_unit_combat_info(pconn, packet);
42683 } conn_list_iterate_end;
42684}
42685
42686#ifdef FREECIV_DELTA_PROTOCOL
42687#define hash_packet_unit_sscs_set_100 hash_const
42688
42689#define cmp_packet_unit_sscs_set_100 cmp_const
42690
42691 BV_DEFINE(packet_unit_sscs_set_100_fields, 3);
42692#endif /* FREECIV_DELTA_PROTOCOL */
42693
42694 static struct packet_unit_sscs_set *receive_packet_unit_sscs_set_100(struct connection *pc)
42695{
42696#ifdef FREECIV_DELTA_PROTOCOL
42697 packet_unit_sscs_set_100_fields fields;
42698 struct packet_unit_sscs_set *old;
42699 struct genhash **hash = pc->phs.received + PACKET_UNIT_SSCS_SET;
42700#endif /* FREECIV_DELTA_PROTOCOL */
42701 RECEIVE_PACKET_START(packet_unit_sscs_set, real_packet);
42702#ifdef FREECIV_JSON_CONNECTION
42703 struct plocation field_addr;
42704 {
42705 struct plocation *field_addr_tmp = plocation_field_new(NULL);
42706 field_addr = *field_addr_tmp;
42707 FC_FREE(field_addr_tmp);
42708 }
42709#endif /* FREECIV_JSON_CONNECTION */
42710
42711#ifdef FREECIV_DELTA_PROTOCOL
42712#ifdef FREECIV_JSON_CONNECTION
42713 field_addr.name = "fields";
42714#endif /* FREECIV_JSON_CONNECTION */
42715 DIO_BV_GET(&din, &field_addr, fields);
42716
42717#else /* FREECIV_DELTA_PROTOCOL */
42718 #ifdef FREECIV_JSON_CONNECTION
42719 field_addr.name = "unit_id32";
42720 #endif /* FREECIV_JSON_CONNECTION */
42721 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
42722 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
42723 }
42724 #ifdef FREECIV_JSON_CONNECTION
42725 field_addr.name = "type";
42726 #endif /* FREECIV_JSON_CONNECTION */
42727 {
42728 int readin;
42729
42730 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
42731 RECEIVE_PACKET_FIELD_ERROR(type);
42732 }
42733 real_packet->type = readin;
42734 }
42735 #ifdef FREECIV_JSON_CONNECTION
42736 field_addr.name = "value";
42737 #endif /* FREECIV_JSON_CONNECTION */
42738 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->value)) {
42739 RECEIVE_PACKET_FIELD_ERROR(value);
42740 }
42741
42742#endif
42743 log_packet_detailed("packet_unit_sscs_set_100: got info about ()");
42744
42745#ifdef FREECIV_DELTA_PROTOCOL
42746 if (NULL == *hash) {
42747 *hash = genhash_new_full(hash_packet_unit_sscs_set_100, cmp_packet_unit_sscs_set_100,
42748 NULL, NULL, NULL, free);
42749 }
42750
42751 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
42752 *real_packet = *old;
42753 } else {
42754 log_packet_detailed(" no old info");
42755 memset(real_packet, 0, sizeof(*real_packet));
42756 }
42757
42758 if (BV_ISSET(fields, 0)) {
42759 log_packet_detailed(" got field 'unit_id32'");
42760 #ifdef FREECIV_JSON_CONNECTION
42761 field_addr.name = "unit_id32";
42762 #endif /* FREECIV_JSON_CONNECTION */
42763 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
42764 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
42765 }
42766 }
42767 if (BV_ISSET(fields, 1)) {
42768 log_packet_detailed(" got field 'type'");
42769 #ifdef FREECIV_JSON_CONNECTION
42770 field_addr.name = "type";
42771 #endif /* FREECIV_JSON_CONNECTION */
42772 {
42773 int readin;
42774
42775 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
42776 RECEIVE_PACKET_FIELD_ERROR(type);
42777 }
42778 real_packet->type = readin;
42779 }
42780 }
42781 if (BV_ISSET(fields, 2)) {
42782 log_packet_detailed(" got field 'value'");
42783 #ifdef FREECIV_JSON_CONNECTION
42784 field_addr.name = "value";
42785 #endif /* FREECIV_JSON_CONNECTION */
42786 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->value)) {
42787 RECEIVE_PACKET_FIELD_ERROR(value);
42788 }
42789 }
42790
42791 if (NULL == old) {
42792 old = fc_malloc(sizeof(*old));
42793 *old = *real_packet;
42794 genhash_insert(*hash, old, old);
42795 } else {
42796 *old = *real_packet;
42797 }
42798
42799#endif /* FREECIV_DELTA_PROTOCOL */
42800 RECEIVE_PACKET_END(real_packet);
42801}
42802
42803 static int send_packet_unit_sscs_set_100(struct connection *pc, const struct packet_unit_sscs_set *packet)
42804{
42805 const struct packet_unit_sscs_set *real_packet = packet;
42806#ifdef FREECIV_DELTA_PROTOCOL
42807 packet_unit_sscs_set_100_fields fields;
42808 struct packet_unit_sscs_set *old;
42809 bool differ;
42810 struct genhash **hash = pc->phs.sent + PACKET_UNIT_SSCS_SET;
42811#endif /* FREECIV_DELTA_PROTOCOL */
42812 SEND_PACKET_START(PACKET_UNIT_SSCS_SET);
42813#ifdef FREECIV_JSON_CONNECTION
42814 struct plocation field_addr;
42815 {
42816 struct plocation *field_addr_tmp = plocation_field_new(NULL);
42817 field_addr = *field_addr_tmp;
42818 FC_FREE(field_addr_tmp);
42819 }
42820#endif /* FREECIV_JSON_CONNECTION */
42821
42822 log_packet_detailed("packet_unit_sscs_set_100: sending info about ()");
42823
42824#ifdef FREECIV_DELTA_PROTOCOL
42825 if (NULL == *hash) {
42826 *hash = genhash_new_full(hash_packet_unit_sscs_set_100, cmp_packet_unit_sscs_set_100,
42827 NULL, NULL, NULL, free);
42828 }
42829 BV_CLR_ALL(fields);
42830
42831 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
42832 old = fc_malloc(sizeof(*old));
42833 *old = *real_packet;
42834 genhash_insert(*hash, old, old);
42835 memset(old, 0, sizeof(*old));
42836 }
42837 differ = (old->unit_id32 != real_packet->unit_id32);
42838 if (differ) {
42839 BV_SET(fields, 0);
42840 }
42841
42842 differ = (old->type != real_packet->type);
42843 if (differ) {
42844 BV_SET(fields, 1);
42845 }
42846
42847 differ = (old->value != real_packet->value);
42848 if (differ) {
42849 BV_SET(fields, 2);
42850 }
42851
42852
42853#ifdef FREECIV_JSON_CONNECTION
42854 field_addr.name = "fields";
42855#endif /* FREECIV_JSON_CONNECTION */
42856 DIO_BV_PUT(&dout, &field_addr, fields);
42857
42858 if (BV_ISSET(fields, 0)) {
42859 log_packet_detailed(" field 'unit_id32' has changed");
42860 #ifdef FREECIV_JSON_CONNECTION
42861 field_addr.name = "unit_id32";
42862#endif /* FREECIV_JSON_CONNECTION */
42863 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
42864 }
42865 if (BV_ISSET(fields, 1)) {
42866 log_packet_detailed(" field 'type' has changed");
42867 #ifdef FREECIV_JSON_CONNECTION
42868 field_addr.name = "type";
42869#endif /* FREECIV_JSON_CONNECTION */
42870 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
42871 }
42872 if (BV_ISSET(fields, 2)) {
42873 log_packet_detailed(" field 'value' has changed");
42874 #ifdef FREECIV_JSON_CONNECTION
42875 field_addr.name = "value";
42876#endif /* FREECIV_JSON_CONNECTION */
42877 DIO_PUT(sint32, &dout, &field_addr, real_packet->value);
42878 }
42879
42880 *old = *real_packet;
42881#endif /* FREECIV_DELTA_PROTOCOL */
42882#ifndef FREECIV_DELTA_PROTOCOL
42883#ifdef FREECIV_JSON_CONNECTION
42884 field_addr.name = "unit_id32";
42885#endif /* FREECIV_JSON_CONNECTION */
42886 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
42887#ifdef FREECIV_JSON_CONNECTION
42888 field_addr.name = "type";
42889#endif /* FREECIV_JSON_CONNECTION */
42890 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
42891#ifdef FREECIV_JSON_CONNECTION
42892 field_addr.name = "value";
42893#endif /* FREECIV_JSON_CONNECTION */
42894 DIO_PUT(sint32, &dout, &field_addr, real_packet->value);
42895
42896#endif
42897 SEND_PACKET_END(PACKET_UNIT_SSCS_SET);
42898}
42899
42900#ifdef FREECIV_DELTA_PROTOCOL
42901#define hash_packet_unit_sscs_set_101 hash_const
42902
42903#define cmp_packet_unit_sscs_set_101 cmp_const
42904
42905 BV_DEFINE(packet_unit_sscs_set_101_fields, 3);
42906#endif /* FREECIV_DELTA_PROTOCOL */
42907
42908 static struct packet_unit_sscs_set *receive_packet_unit_sscs_set_101(struct connection *pc)
42909{
42910#ifdef FREECIV_DELTA_PROTOCOL
42911 packet_unit_sscs_set_101_fields fields;
42912 struct packet_unit_sscs_set *old;
42913 struct genhash **hash = pc->phs.received + PACKET_UNIT_SSCS_SET;
42914#endif /* FREECIV_DELTA_PROTOCOL */
42915 RECEIVE_PACKET_START(packet_unit_sscs_set, real_packet);
42916#ifdef FREECIV_JSON_CONNECTION
42917 struct plocation field_addr;
42918 {
42919 struct plocation *field_addr_tmp = plocation_field_new(NULL);
42920 field_addr = *field_addr_tmp;
42921 FC_FREE(field_addr_tmp);
42922 }
42923#endif /* FREECIV_JSON_CONNECTION */
42924
42925#ifdef FREECIV_DELTA_PROTOCOL
42926#ifdef FREECIV_JSON_CONNECTION
42927 field_addr.name = "fields";
42928#endif /* FREECIV_JSON_CONNECTION */
42929 DIO_BV_GET(&din, &field_addr, fields);
42930
42931#else /* FREECIV_DELTA_PROTOCOL */
42932 #ifdef FREECIV_JSON_CONNECTION
42933 field_addr.name = "unit_id16";
42934 #endif /* FREECIV_JSON_CONNECTION */
42935 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
42936 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
42937 }
42938 #ifdef FREECIV_JSON_CONNECTION
42939 field_addr.name = "type";
42940 #endif /* FREECIV_JSON_CONNECTION */
42941 {
42942 int readin;
42943
42944 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
42945 RECEIVE_PACKET_FIELD_ERROR(type);
42946 }
42947 real_packet->type = readin;
42948 }
42949 #ifdef FREECIV_JSON_CONNECTION
42950 field_addr.name = "value";
42951 #endif /* FREECIV_JSON_CONNECTION */
42952 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->value)) {
42953 RECEIVE_PACKET_FIELD_ERROR(value);
42954 }
42955
42956#endif
42957 log_packet_detailed("packet_unit_sscs_set_101: got info about ()");
42958
42959#ifdef FREECIV_DELTA_PROTOCOL
42960 if (NULL == *hash) {
42961 *hash = genhash_new_full(hash_packet_unit_sscs_set_101, cmp_packet_unit_sscs_set_101,
42962 NULL, NULL, NULL, free);
42963 }
42964
42965 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
42966 *real_packet = *old;
42967 } else {
42968 log_packet_detailed(" no old info");
42969 memset(real_packet, 0, sizeof(*real_packet));
42970 }
42971
42972 if (BV_ISSET(fields, 0)) {
42973 log_packet_detailed(" got field 'unit_id16'");
42974 #ifdef FREECIV_JSON_CONNECTION
42975 field_addr.name = "unit_id16";
42976 #endif /* FREECIV_JSON_CONNECTION */
42977 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
42978 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
42979 }
42980 }
42981 if (BV_ISSET(fields, 1)) {
42982 log_packet_detailed(" got field 'type'");
42983 #ifdef FREECIV_JSON_CONNECTION
42984 field_addr.name = "type";
42985 #endif /* FREECIV_JSON_CONNECTION */
42986 {
42987 int readin;
42988
42989 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
42990 RECEIVE_PACKET_FIELD_ERROR(type);
42991 }
42992 real_packet->type = readin;
42993 }
42994 }
42995 if (BV_ISSET(fields, 2)) {
42996 log_packet_detailed(" got field 'value'");
42997 #ifdef FREECIV_JSON_CONNECTION
42998 field_addr.name = "value";
42999 #endif /* FREECIV_JSON_CONNECTION */
43000 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->value)) {
43001 RECEIVE_PACKET_FIELD_ERROR(value);
43002 }
43003 }
43004
43005 if (NULL == old) {
43006 old = fc_malloc(sizeof(*old));
43007 *old = *real_packet;
43008 genhash_insert(*hash, old, old);
43009 } else {
43010 *old = *real_packet;
43011 }
43012
43013#endif /* FREECIV_DELTA_PROTOCOL */
43014 RECEIVE_PACKET_END(real_packet);
43015}
43016
43017 static int send_packet_unit_sscs_set_101(struct connection *pc, const struct packet_unit_sscs_set *packet)
43018{
43019 const struct packet_unit_sscs_set *real_packet = packet;
43020#ifdef FREECIV_DELTA_PROTOCOL
43021 packet_unit_sscs_set_101_fields fields;
43022 struct packet_unit_sscs_set *old;
43023 bool differ;
43024 struct genhash **hash = pc->phs.sent + PACKET_UNIT_SSCS_SET;
43025#endif /* FREECIV_DELTA_PROTOCOL */
43026 SEND_PACKET_START(PACKET_UNIT_SSCS_SET);
43027#ifdef FREECIV_JSON_CONNECTION
43028 struct plocation field_addr;
43029 {
43030 struct plocation *field_addr_tmp = plocation_field_new(NULL);
43031 field_addr = *field_addr_tmp;
43032 FC_FREE(field_addr_tmp);
43033 }
43034#endif /* FREECIV_JSON_CONNECTION */
43035
43036 log_packet_detailed("packet_unit_sscs_set_101: sending info about ()");
43037
43038#ifdef FREECIV_DELTA_PROTOCOL
43039 if (NULL == *hash) {
43040 *hash = genhash_new_full(hash_packet_unit_sscs_set_101, cmp_packet_unit_sscs_set_101,
43041 NULL, NULL, NULL, free);
43042 }
43043 BV_CLR_ALL(fields);
43044
43045 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
43046 old = fc_malloc(sizeof(*old));
43047 *old = *real_packet;
43048 genhash_insert(*hash, old, old);
43049 memset(old, 0, sizeof(*old));
43050 }
43051 differ = (old->unit_id16 != real_packet->unit_id16);
43052 if (differ) {
43053 BV_SET(fields, 0);
43054 }
43055
43056 differ = (old->type != real_packet->type);
43057 if (differ) {
43058 BV_SET(fields, 1);
43059 }
43060
43061 differ = (old->value != real_packet->value);
43062 if (differ) {
43063 BV_SET(fields, 2);
43064 }
43065
43066
43067#ifdef FREECIV_JSON_CONNECTION
43068 field_addr.name = "fields";
43069#endif /* FREECIV_JSON_CONNECTION */
43070 DIO_BV_PUT(&dout, &field_addr, fields);
43071
43072 if (BV_ISSET(fields, 0)) {
43073 log_packet_detailed(" field 'unit_id16' has changed");
43074 #ifdef FREECIV_JSON_CONNECTION
43075 field_addr.name = "unit_id16";
43076#endif /* FREECIV_JSON_CONNECTION */
43077 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
43078 }
43079 if (BV_ISSET(fields, 1)) {
43080 log_packet_detailed(" field 'type' has changed");
43081 #ifdef FREECIV_JSON_CONNECTION
43082 field_addr.name = "type";
43083#endif /* FREECIV_JSON_CONNECTION */
43084 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
43085 }
43086 if (BV_ISSET(fields, 2)) {
43087 log_packet_detailed(" field 'value' has changed");
43088 #ifdef FREECIV_JSON_CONNECTION
43089 field_addr.name = "value";
43090#endif /* FREECIV_JSON_CONNECTION */
43091 DIO_PUT(sint32, &dout, &field_addr, real_packet->value);
43092 }
43093
43094 *old = *real_packet;
43095#endif /* FREECIV_DELTA_PROTOCOL */
43096#ifndef FREECIV_DELTA_PROTOCOL
43097#ifdef FREECIV_JSON_CONNECTION
43098 field_addr.name = "unit_id16";
43099#endif /* FREECIV_JSON_CONNECTION */
43100 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
43101#ifdef FREECIV_JSON_CONNECTION
43102 field_addr.name = "type";
43103#endif /* FREECIV_JSON_CONNECTION */
43104 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
43105#ifdef FREECIV_JSON_CONNECTION
43106 field_addr.name = "value";
43107#endif /* FREECIV_JSON_CONNECTION */
43108 DIO_PUT(sint32, &dout, &field_addr, real_packet->value);
43109
43110#endif
43111 SEND_PACKET_END(PACKET_UNIT_SSCS_SET);
43112}
43113
43114 int send_packet_unit_sscs_set(struct connection *pc, const struct packet_unit_sscs_set *packet)
43115{
43116 if (!pc->used) {
43117 log_error("WARNING: trying to send data to the closed connection %s",
43118 conn_description(pc));
43119 return -1;
43120 }
43121 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_SSCS_SET].packet != NULL, -1,
43122 "Handler for PACKET_UNIT_SSCS_SET not installed");
43123 return pc->phs.handlers->send[PACKET_UNIT_SSCS_SET].packet(pc, packet);
43124}
43125
43126 int dsend_packet_unit_sscs_set(struct connection *pc, int unit_id16, int unit_id32, enum unit_ss_data_type type, int value)
43127{
43128 struct packet_unit_sscs_set packet, *real_packet = &packet;
43129
43130 real_packet->unit_id16 = unit_id16;
43131 real_packet->unit_id32 = unit_id32;
43132 real_packet->type = type;
43133 real_packet->value = value;
43134
43135 return send_packet_unit_sscs_set(pc, real_packet);
43136}
43137
43138#ifdef FREECIV_DELTA_PROTOCOL
43139#define hash_packet_unit_orders_100 hash_const
43140
43141#define cmp_packet_unit_orders_100 cmp_const
43142
43143 BV_DEFINE(packet_unit_orders_100_fields, 7);
43144#endif /* FREECIV_DELTA_PROTOCOL */
43145
43146 static struct packet_unit_orders *receive_packet_unit_orders_100(struct connection *pc)
43147{
43148#ifdef FREECIV_DELTA_PROTOCOL
43149 packet_unit_orders_100_fields fields;
43150 struct packet_unit_orders *old;
43151 struct genhash **hash = pc->phs.received + PACKET_UNIT_ORDERS;
43152#endif /* FREECIV_DELTA_PROTOCOL */
43153 RECEIVE_PACKET_START(packet_unit_orders, real_packet);
43154#ifdef FREECIV_JSON_CONNECTION
43155 struct plocation field_addr;
43156 {
43157 struct plocation *field_addr_tmp = plocation_field_new(NULL);
43158 field_addr = *field_addr_tmp;
43159 FC_FREE(field_addr_tmp);
43160 }
43161#endif /* FREECIV_JSON_CONNECTION */
43162
43163#ifdef FREECIV_DELTA_PROTOCOL
43164#ifdef FREECIV_JSON_CONNECTION
43165 field_addr.name = "fields";
43166#endif /* FREECIV_JSON_CONNECTION */
43167 DIO_BV_GET(&din, &field_addr, fields);
43168
43169#else /* FREECIV_DELTA_PROTOCOL */
43170 #ifdef FREECIV_JSON_CONNECTION
43171 field_addr.name = "unit_id32";
43172 #endif /* FREECIV_JSON_CONNECTION */
43173 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
43174 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
43175 }
43176 #ifdef FREECIV_JSON_CONNECTION
43177 field_addr.name = "src_tile";
43178 #endif /* FREECIV_JSON_CONNECTION */
43179 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->src_tile)) {
43180 RECEIVE_PACKET_FIELD_ERROR(src_tile);
43181 }
43182 #ifdef FREECIV_JSON_CONNECTION
43183 field_addr.name = "length";
43184 #endif /* FREECIV_JSON_CONNECTION */
43185 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
43186 RECEIVE_PACKET_FIELD_ERROR(length);
43187 }
43188 #ifdef FREECIV_JSON_CONNECTION
43189 field_addr.name = "repeat";
43190 #endif /* FREECIV_JSON_CONNECTION */
43191 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->repeat)) {
43192 RECEIVE_PACKET_FIELD_ERROR(repeat);
43193 }
43194 #ifdef FREECIV_JSON_CONNECTION
43195 field_addr.name = "vigilant";
43196 #endif /* FREECIV_JSON_CONNECTION */
43197 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->vigilant)) {
43198 RECEIVE_PACKET_FIELD_ERROR(vigilant);
43199 }
43200 #ifdef FREECIV_JSON_CONNECTION
43201 field_addr.name = "orders";
43202 #endif /* FREECIV_JSON_CONNECTION */
43203
43204 {
43205 int i;
43206
43207 #ifdef FREECIV_JSON_CONNECTION
43208 /* Enter array. */
43209 field_addr.sub_location = plocation_elem_new(0);
43210 #endif /* FREECIV_JSON_CONNECTION */
43211
43212 if (real_packet->length > MAX_LEN_ROUTE) {
43213 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
43214 }
43215 for (i = 0; i < real_packet->length; i++) {
43216 #ifdef FREECIV_JSON_CONNECTION
43217 field_addr.sub_location->number = i;
43218 #endif /* FREECIV_JSON_CONNECTION */
43219 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
43220 RECEIVE_PACKET_FIELD_ERROR(orders);
43221 }
43222 }
43223
43224 #ifdef FREECIV_JSON_CONNECTION
43225 /* Exit array. */
43226 free(field_addr.sub_location);
43227 field_addr.sub_location = NULL;
43228 #endif /* FREECIV_JSON_CONNECTION */
43229 }
43230 #ifdef FREECIV_JSON_CONNECTION
43231 field_addr.name = "dest_tile";
43232 #endif /* FREECIV_JSON_CONNECTION */
43233 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->dest_tile)) {
43234 RECEIVE_PACKET_FIELD_ERROR(dest_tile);
43235 }
43236
43237#endif
43238 log_packet_detailed("packet_unit_orders_100: got info about ()");
43239
43240#ifdef FREECIV_DELTA_PROTOCOL
43241 if (NULL == *hash) {
43242 *hash = genhash_new_full(hash_packet_unit_orders_100, cmp_packet_unit_orders_100,
43243 NULL, NULL, NULL, free);
43244 }
43245
43246 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
43247 *real_packet = *old;
43248 } else {
43249 log_packet_detailed(" no old info");
43250 memset(real_packet, 0, sizeof(*real_packet));
43251 }
43252
43253 if (BV_ISSET(fields, 0)) {
43254 log_packet_detailed(" got field 'unit_id32'");
43255 #ifdef FREECIV_JSON_CONNECTION
43256 field_addr.name = "unit_id32";
43257 #endif /* FREECIV_JSON_CONNECTION */
43258 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
43259 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
43260 }
43261 }
43262 if (BV_ISSET(fields, 1)) {
43263 log_packet_detailed(" got field 'src_tile'");
43264 #ifdef FREECIV_JSON_CONNECTION
43265 field_addr.name = "src_tile";
43266 #endif /* FREECIV_JSON_CONNECTION */
43267 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->src_tile)) {
43268 RECEIVE_PACKET_FIELD_ERROR(src_tile);
43269 }
43270 }
43271 if (BV_ISSET(fields, 2)) {
43272 log_packet_detailed(" got field 'length'");
43273 #ifdef FREECIV_JSON_CONNECTION
43274 field_addr.name = "length";
43275 #endif /* FREECIV_JSON_CONNECTION */
43276 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
43277 RECEIVE_PACKET_FIELD_ERROR(length);
43278 }
43279 }
43280 real_packet->repeat = BV_ISSET(fields, 3);
43281 real_packet->vigilant = BV_ISSET(fields, 4);
43282 if (BV_ISSET(fields, 5)) {
43283 log_packet_detailed(" got field 'orders'");
43284 #ifdef FREECIV_JSON_CONNECTION
43285 field_addr.name = "orders";
43286 #endif /* FREECIV_JSON_CONNECTION */
43287
43288 {
43289 int i;
43290
43291 #ifdef FREECIV_JSON_CONNECTION
43292 /* Enter array. */
43293 field_addr.sub_location = plocation_elem_new(0);
43294 #endif /* FREECIV_JSON_CONNECTION */
43295
43296 if (real_packet->length > MAX_LEN_ROUTE) {
43297 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
43298 }
43299 for (i = 0; i < real_packet->length; i++) {
43300 #ifdef FREECIV_JSON_CONNECTION
43301 field_addr.sub_location->number = i;
43302 #endif /* FREECIV_JSON_CONNECTION */
43303 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
43304 RECEIVE_PACKET_FIELD_ERROR(orders);
43305 }
43306 }
43307
43308 #ifdef FREECIV_JSON_CONNECTION
43309 /* Exit array. */
43310 free(field_addr.sub_location);
43311 field_addr.sub_location = NULL;
43312 #endif /* FREECIV_JSON_CONNECTION */
43313 }
43314 }
43315 if (BV_ISSET(fields, 6)) {
43316 log_packet_detailed(" got field 'dest_tile'");
43317 #ifdef FREECIV_JSON_CONNECTION
43318 field_addr.name = "dest_tile";
43319 #endif /* FREECIV_JSON_CONNECTION */
43320 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->dest_tile)) {
43321 RECEIVE_PACKET_FIELD_ERROR(dest_tile);
43322 }
43323 }
43324
43325 if (NULL == old) {
43326 old = fc_malloc(sizeof(*old));
43327 *old = *real_packet;
43328 genhash_insert(*hash, old, old);
43329 } else {
43330 *old = *real_packet;
43331 }
43332
43333#endif /* FREECIV_DELTA_PROTOCOL */
43334 RECEIVE_PACKET_END(real_packet);
43335}
43336
43337 static int send_packet_unit_orders_100(struct connection *pc, const struct packet_unit_orders *packet)
43338{
43339 const struct packet_unit_orders *real_packet = packet;
43340#ifdef FREECIV_DELTA_PROTOCOL
43341 packet_unit_orders_100_fields fields;
43342 struct packet_unit_orders *old;
43343 bool differ;
43344 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ORDERS;
43345#endif /* FREECIV_DELTA_PROTOCOL */
43346 SEND_PACKET_START(PACKET_UNIT_ORDERS);
43347#ifdef FREECIV_JSON_CONNECTION
43348 struct plocation field_addr;
43349 {
43350 struct plocation *field_addr_tmp = plocation_field_new(NULL);
43351 field_addr = *field_addr_tmp;
43352 FC_FREE(field_addr_tmp);
43353 }
43354#endif /* FREECIV_JSON_CONNECTION */
43355
43356 log_packet_detailed("packet_unit_orders_100: sending info about ()");
43357
43358#ifdef FREECIV_DELTA_PROTOCOL
43359 if (NULL == *hash) {
43360 *hash = genhash_new_full(hash_packet_unit_orders_100, cmp_packet_unit_orders_100,
43361 NULL, NULL, NULL, free);
43362 }
43363 BV_CLR_ALL(fields);
43364
43365 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
43366 old = fc_malloc(sizeof(*old));
43367 *old = *real_packet;
43368 genhash_insert(*hash, old, old);
43369 memset(old, 0, sizeof(*old));
43370 }
43371 differ = (old->unit_id32 != real_packet->unit_id32);
43372 if (differ) {
43373 BV_SET(fields, 0);
43374 }
43375
43376 differ = (old->src_tile != real_packet->src_tile);
43377 if (differ) {
43378 BV_SET(fields, 1);
43379 }
43380
43381 differ = (old->length != real_packet->length);
43382 if (differ) {
43383 BV_SET(fields, 2);
43384 }
43385
43386 if (packet->repeat) {
43387 BV_SET(fields, 3);
43388 }
43389
43390 if (packet->vigilant) {
43391 BV_SET(fields, 4);
43392 }
43393
43394
43395 {
43396 differ = (old->length != real_packet->length);
43397 if (!differ) {
43398 int i;
43399
43400 for (i = 0; i < real_packet->length; i++) {
43401 if (!are_unit_orders_equal(&old->orders[i], &real_packet->orders[i])) {
43402 differ = TRUE;
43403 break;
43404 }
43405 }
43406 }
43407 }
43408 if (differ) {
43409 BV_SET(fields, 5);
43410 }
43411
43412 differ = (old->dest_tile != real_packet->dest_tile);
43413 if (differ) {
43414 BV_SET(fields, 6);
43415 }
43416
43417
43418#ifdef FREECIV_JSON_CONNECTION
43419 field_addr.name = "fields";
43420#endif /* FREECIV_JSON_CONNECTION */
43421 DIO_BV_PUT(&dout, &field_addr, fields);
43422
43423 if (BV_ISSET(fields, 0)) {
43424 log_packet_detailed(" field 'unit_id32' has changed");
43425 #ifdef FREECIV_JSON_CONNECTION
43426 field_addr.name = "unit_id32";
43427#endif /* FREECIV_JSON_CONNECTION */
43428 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
43429 }
43430 if (BV_ISSET(fields, 1)) {
43431 log_packet_detailed(" field 'src_tile' has changed");
43432 #ifdef FREECIV_JSON_CONNECTION
43433 field_addr.name = "src_tile";
43434#endif /* FREECIV_JSON_CONNECTION */
43435 DIO_PUT(sint32, &dout, &field_addr, real_packet->src_tile);
43436 }
43437 if (BV_ISSET(fields, 2)) {
43438 log_packet_detailed(" field 'length' has changed");
43439 #ifdef FREECIV_JSON_CONNECTION
43440 field_addr.name = "length";
43441#endif /* FREECIV_JSON_CONNECTION */
43442 DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
43443 }
43444 /* field 3 is folded into the header */
43445 /* field 4 is folded into the header */
43446 if (BV_ISSET(fields, 5)) {
43447 log_packet_detailed(" field 'orders' has changed");
43448 #ifdef FREECIV_JSON_CONNECTION
43449 field_addr.name = "orders";
43450#endif /* FREECIV_JSON_CONNECTION */
43451
43452 {
43453 int i;
43454
43455#ifdef FREECIV_JSON_CONNECTION
43456 /* Create the array. */
43457 DIO_PUT(farray, &dout, &field_addr, real_packet->length);
43458
43459 /* Enter the array. */
43460 field_addr.sub_location = plocation_elem_new(0);
43461#endif /* FREECIV_JSON_CONNECTION */
43462
43463 for (i = 0; i < real_packet->length; i++) {
43464#ifdef FREECIV_JSON_CONNECTION
43465 /* Next array element. */
43466 field_addr.sub_location->number = i;
43467#endif /* FREECIV_JSON_CONNECTION */
43468 DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
43469 }
43470
43471#ifdef FREECIV_JSON_CONNECTION
43472 /* Exit array. */
43473 free(field_addr.sub_location);
43474 field_addr.sub_location = NULL;
43475#endif /* FREECIV_JSON_CONNECTION */
43476 }
43477 }
43478 if (BV_ISSET(fields, 6)) {
43479 log_packet_detailed(" field 'dest_tile' has changed");
43480 #ifdef FREECIV_JSON_CONNECTION
43481 field_addr.name = "dest_tile";
43482#endif /* FREECIV_JSON_CONNECTION */
43483 DIO_PUT(sint32, &dout, &field_addr, real_packet->dest_tile);
43484 }
43485
43486 *old = *real_packet;
43487#endif /* FREECIV_DELTA_PROTOCOL */
43488#ifndef FREECIV_DELTA_PROTOCOL
43489#ifdef FREECIV_JSON_CONNECTION
43490 field_addr.name = "unit_id32";
43491#endif /* FREECIV_JSON_CONNECTION */
43492 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
43493#ifdef FREECIV_JSON_CONNECTION
43494 field_addr.name = "src_tile";
43495#endif /* FREECIV_JSON_CONNECTION */
43496 DIO_PUT(sint32, &dout, &field_addr, real_packet->src_tile);
43497#ifdef FREECIV_JSON_CONNECTION
43498 field_addr.name = "length";
43499#endif /* FREECIV_JSON_CONNECTION */
43500 DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
43501#ifdef FREECIV_JSON_CONNECTION
43502 field_addr.name = "repeat";
43503#endif /* FREECIV_JSON_CONNECTION */
43504 DIO_PUT(bool8, &dout, &field_addr, real_packet->repeat);
43505#ifdef FREECIV_JSON_CONNECTION
43506 field_addr.name = "vigilant";
43507#endif /* FREECIV_JSON_CONNECTION */
43508 DIO_PUT(bool8, &dout, &field_addr, real_packet->vigilant);
43509#ifdef FREECIV_JSON_CONNECTION
43510 field_addr.name = "orders";
43511#endif /* FREECIV_JSON_CONNECTION */
43512
43513 {
43514 int i;
43515
43516#ifdef FREECIV_JSON_CONNECTION
43517 /* Create the array. */
43518 DIO_PUT(farray, &dout, &field_addr, real_packet->length);
43519
43520 /* Enter the array. */
43521 field_addr.sub_location = plocation_elem_new(0);
43522#endif /* FREECIV_JSON_CONNECTION */
43523
43524 for (i = 0; i < real_packet->length; i++) {
43525#ifdef FREECIV_JSON_CONNECTION
43526 /* Next array element. */
43527 field_addr.sub_location->number = i;
43528#endif /* FREECIV_JSON_CONNECTION */
43529 DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
43530 }
43531
43532#ifdef FREECIV_JSON_CONNECTION
43533 /* Exit array. */
43534 free(field_addr.sub_location);
43535 field_addr.sub_location = NULL;
43536#endif /* FREECIV_JSON_CONNECTION */
43537 }
43538#ifdef FREECIV_JSON_CONNECTION
43539 field_addr.name = "dest_tile";
43540#endif /* FREECIV_JSON_CONNECTION */
43541 DIO_PUT(sint32, &dout, &field_addr, real_packet->dest_tile);
43542
43543#endif
43544 SEND_PACKET_END(PACKET_UNIT_ORDERS);
43545}
43546
43547#ifdef FREECIV_DELTA_PROTOCOL
43548#define hash_packet_unit_orders_101 hash_const
43549
43550#define cmp_packet_unit_orders_101 cmp_const
43551
43552 BV_DEFINE(packet_unit_orders_101_fields, 7);
43553#endif /* FREECIV_DELTA_PROTOCOL */
43554
43555 static struct packet_unit_orders *receive_packet_unit_orders_101(struct connection *pc)
43556{
43557#ifdef FREECIV_DELTA_PROTOCOL
43558 packet_unit_orders_101_fields fields;
43559 struct packet_unit_orders *old;
43560 struct genhash **hash = pc->phs.received + PACKET_UNIT_ORDERS;
43561#endif /* FREECIV_DELTA_PROTOCOL */
43562 RECEIVE_PACKET_START(packet_unit_orders, real_packet);
43563#ifdef FREECIV_JSON_CONNECTION
43564 struct plocation field_addr;
43565 {
43566 struct plocation *field_addr_tmp = plocation_field_new(NULL);
43567 field_addr = *field_addr_tmp;
43568 FC_FREE(field_addr_tmp);
43569 }
43570#endif /* FREECIV_JSON_CONNECTION */
43571
43572#ifdef FREECIV_DELTA_PROTOCOL
43573#ifdef FREECIV_JSON_CONNECTION
43574 field_addr.name = "fields";
43575#endif /* FREECIV_JSON_CONNECTION */
43576 DIO_BV_GET(&din, &field_addr, fields);
43577
43578#else /* FREECIV_DELTA_PROTOCOL */
43579 #ifdef FREECIV_JSON_CONNECTION
43580 field_addr.name = "unit_id16";
43581 #endif /* FREECIV_JSON_CONNECTION */
43582 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
43583 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
43584 }
43585 #ifdef FREECIV_JSON_CONNECTION
43586 field_addr.name = "src_tile";
43587 #endif /* FREECIV_JSON_CONNECTION */
43588 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->src_tile)) {
43589 RECEIVE_PACKET_FIELD_ERROR(src_tile);
43590 }
43591 #ifdef FREECIV_JSON_CONNECTION
43592 field_addr.name = "length";
43593 #endif /* FREECIV_JSON_CONNECTION */
43594 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
43595 RECEIVE_PACKET_FIELD_ERROR(length);
43596 }
43597 #ifdef FREECIV_JSON_CONNECTION
43598 field_addr.name = "repeat";
43599 #endif /* FREECIV_JSON_CONNECTION */
43600 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->repeat)) {
43601 RECEIVE_PACKET_FIELD_ERROR(repeat);
43602 }
43603 #ifdef FREECIV_JSON_CONNECTION
43604 field_addr.name = "vigilant";
43605 #endif /* FREECIV_JSON_CONNECTION */
43606 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->vigilant)) {
43607 RECEIVE_PACKET_FIELD_ERROR(vigilant);
43608 }
43609 #ifdef FREECIV_JSON_CONNECTION
43610 field_addr.name = "orders";
43611 #endif /* FREECIV_JSON_CONNECTION */
43612
43613 {
43614 int i;
43615
43616 #ifdef FREECIV_JSON_CONNECTION
43617 /* Enter array. */
43618 field_addr.sub_location = plocation_elem_new(0);
43619 #endif /* FREECIV_JSON_CONNECTION */
43620
43621 if (real_packet->length > MAX_LEN_ROUTE) {
43622 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
43623 }
43624 for (i = 0; i < real_packet->length; i++) {
43625 #ifdef FREECIV_JSON_CONNECTION
43626 field_addr.sub_location->number = i;
43627 #endif /* FREECIV_JSON_CONNECTION */
43628 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
43629 RECEIVE_PACKET_FIELD_ERROR(orders);
43630 }
43631 }
43632
43633 #ifdef FREECIV_JSON_CONNECTION
43634 /* Exit array. */
43635 free(field_addr.sub_location);
43636 field_addr.sub_location = NULL;
43637 #endif /* FREECIV_JSON_CONNECTION */
43638 }
43639 #ifdef FREECIV_JSON_CONNECTION
43640 field_addr.name = "dest_tile";
43641 #endif /* FREECIV_JSON_CONNECTION */
43642 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->dest_tile)) {
43643 RECEIVE_PACKET_FIELD_ERROR(dest_tile);
43644 }
43645
43646#endif
43647 log_packet_detailed("packet_unit_orders_101: got info about ()");
43648
43649#ifdef FREECIV_DELTA_PROTOCOL
43650 if (NULL == *hash) {
43651 *hash = genhash_new_full(hash_packet_unit_orders_101, cmp_packet_unit_orders_101,
43652 NULL, NULL, NULL, free);
43653 }
43654
43655 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
43656 *real_packet = *old;
43657 } else {
43658 log_packet_detailed(" no old info");
43659 memset(real_packet, 0, sizeof(*real_packet));
43660 }
43661
43662 if (BV_ISSET(fields, 0)) {
43663 log_packet_detailed(" got field 'unit_id16'");
43664 #ifdef FREECIV_JSON_CONNECTION
43665 field_addr.name = "unit_id16";
43666 #endif /* FREECIV_JSON_CONNECTION */
43667 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
43668 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
43669 }
43670 }
43671 if (BV_ISSET(fields, 1)) {
43672 log_packet_detailed(" got field 'src_tile'");
43673 #ifdef FREECIV_JSON_CONNECTION
43674 field_addr.name = "src_tile";
43675 #endif /* FREECIV_JSON_CONNECTION */
43676 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->src_tile)) {
43677 RECEIVE_PACKET_FIELD_ERROR(src_tile);
43678 }
43679 }
43680 if (BV_ISSET(fields, 2)) {
43681 log_packet_detailed(" got field 'length'");
43682 #ifdef FREECIV_JSON_CONNECTION
43683 field_addr.name = "length";
43684 #endif /* FREECIV_JSON_CONNECTION */
43685 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
43686 RECEIVE_PACKET_FIELD_ERROR(length);
43687 }
43688 }
43689 real_packet->repeat = BV_ISSET(fields, 3);
43690 real_packet->vigilant = BV_ISSET(fields, 4);
43691 if (BV_ISSET(fields, 5)) {
43692 log_packet_detailed(" got field 'orders'");
43693 #ifdef FREECIV_JSON_CONNECTION
43694 field_addr.name = "orders";
43695 #endif /* FREECIV_JSON_CONNECTION */
43696
43697 {
43698 int i;
43699
43700 #ifdef FREECIV_JSON_CONNECTION
43701 /* Enter array. */
43702 field_addr.sub_location = plocation_elem_new(0);
43703 #endif /* FREECIV_JSON_CONNECTION */
43704
43705 if (real_packet->length > MAX_LEN_ROUTE) {
43706 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
43707 }
43708 for (i = 0; i < real_packet->length; i++) {
43709 #ifdef FREECIV_JSON_CONNECTION
43710 field_addr.sub_location->number = i;
43711 #endif /* FREECIV_JSON_CONNECTION */
43712 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
43713 RECEIVE_PACKET_FIELD_ERROR(orders);
43714 }
43715 }
43716
43717 #ifdef FREECIV_JSON_CONNECTION
43718 /* Exit array. */
43719 free(field_addr.sub_location);
43720 field_addr.sub_location = NULL;
43721 #endif /* FREECIV_JSON_CONNECTION */
43722 }
43723 }
43724 if (BV_ISSET(fields, 6)) {
43725 log_packet_detailed(" got field 'dest_tile'");
43726 #ifdef FREECIV_JSON_CONNECTION
43727 field_addr.name = "dest_tile";
43728 #endif /* FREECIV_JSON_CONNECTION */
43729 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->dest_tile)) {
43730 RECEIVE_PACKET_FIELD_ERROR(dest_tile);
43731 }
43732 }
43733
43734 if (NULL == old) {
43735 old = fc_malloc(sizeof(*old));
43736 *old = *real_packet;
43737 genhash_insert(*hash, old, old);
43738 } else {
43739 *old = *real_packet;
43740 }
43741
43742#endif /* FREECIV_DELTA_PROTOCOL */
43743 RECEIVE_PACKET_END(real_packet);
43744}
43745
43746 static int send_packet_unit_orders_101(struct connection *pc, const struct packet_unit_orders *packet)
43747{
43748 const struct packet_unit_orders *real_packet = packet;
43749#ifdef FREECIV_DELTA_PROTOCOL
43750 packet_unit_orders_101_fields fields;
43751 struct packet_unit_orders *old;
43752 bool differ;
43753 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ORDERS;
43754#endif /* FREECIV_DELTA_PROTOCOL */
43755 SEND_PACKET_START(PACKET_UNIT_ORDERS);
43756#ifdef FREECIV_JSON_CONNECTION
43757 struct plocation field_addr;
43758 {
43759 struct plocation *field_addr_tmp = plocation_field_new(NULL);
43760 field_addr = *field_addr_tmp;
43761 FC_FREE(field_addr_tmp);
43762 }
43763#endif /* FREECIV_JSON_CONNECTION */
43764
43765 log_packet_detailed("packet_unit_orders_101: sending info about ()");
43766
43767#ifdef FREECIV_DELTA_PROTOCOL
43768 if (NULL == *hash) {
43769 *hash = genhash_new_full(hash_packet_unit_orders_101, cmp_packet_unit_orders_101,
43770 NULL, NULL, NULL, free);
43771 }
43772 BV_CLR_ALL(fields);
43773
43774 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
43775 old = fc_malloc(sizeof(*old));
43776 *old = *real_packet;
43777 genhash_insert(*hash, old, old);
43778 memset(old, 0, sizeof(*old));
43779 }
43780 differ = (old->unit_id16 != real_packet->unit_id16);
43781 if (differ) {
43782 BV_SET(fields, 0);
43783 }
43784
43785 differ = (old->src_tile != real_packet->src_tile);
43786 if (differ) {
43787 BV_SET(fields, 1);
43788 }
43789
43790 differ = (old->length != real_packet->length);
43791 if (differ) {
43792 BV_SET(fields, 2);
43793 }
43794
43795 if (packet->repeat) {
43796 BV_SET(fields, 3);
43797 }
43798
43799 if (packet->vigilant) {
43800 BV_SET(fields, 4);
43801 }
43802
43803
43804 {
43805 differ = (old->length != real_packet->length);
43806 if (!differ) {
43807 int i;
43808
43809 for (i = 0; i < real_packet->length; i++) {
43810 if (!are_unit_orders_equal(&old->orders[i], &real_packet->orders[i])) {
43811 differ = TRUE;
43812 break;
43813 }
43814 }
43815 }
43816 }
43817 if (differ) {
43818 BV_SET(fields, 5);
43819 }
43820
43821 differ = (old->dest_tile != real_packet->dest_tile);
43822 if (differ) {
43823 BV_SET(fields, 6);
43824 }
43825
43826
43827#ifdef FREECIV_JSON_CONNECTION
43828 field_addr.name = "fields";
43829#endif /* FREECIV_JSON_CONNECTION */
43830 DIO_BV_PUT(&dout, &field_addr, fields);
43831
43832 if (BV_ISSET(fields, 0)) {
43833 log_packet_detailed(" field 'unit_id16' has changed");
43834 #ifdef FREECIV_JSON_CONNECTION
43835 field_addr.name = "unit_id16";
43836#endif /* FREECIV_JSON_CONNECTION */
43837 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
43838 }
43839 if (BV_ISSET(fields, 1)) {
43840 log_packet_detailed(" field 'src_tile' has changed");
43841 #ifdef FREECIV_JSON_CONNECTION
43842 field_addr.name = "src_tile";
43843#endif /* FREECIV_JSON_CONNECTION */
43844 DIO_PUT(sint32, &dout, &field_addr, real_packet->src_tile);
43845 }
43846 if (BV_ISSET(fields, 2)) {
43847 log_packet_detailed(" field 'length' has changed");
43848 #ifdef FREECIV_JSON_CONNECTION
43849 field_addr.name = "length";
43850#endif /* FREECIV_JSON_CONNECTION */
43851 DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
43852 }
43853 /* field 3 is folded into the header */
43854 /* field 4 is folded into the header */
43855 if (BV_ISSET(fields, 5)) {
43856 log_packet_detailed(" field 'orders' has changed");
43857 #ifdef FREECIV_JSON_CONNECTION
43858 field_addr.name = "orders";
43859#endif /* FREECIV_JSON_CONNECTION */
43860
43861 {
43862 int i;
43863
43864#ifdef FREECIV_JSON_CONNECTION
43865 /* Create the array. */
43866 DIO_PUT(farray, &dout, &field_addr, real_packet->length);
43867
43868 /* Enter the array. */
43869 field_addr.sub_location = plocation_elem_new(0);
43870#endif /* FREECIV_JSON_CONNECTION */
43871
43872 for (i = 0; i < real_packet->length; i++) {
43873#ifdef FREECIV_JSON_CONNECTION
43874 /* Next array element. */
43875 field_addr.sub_location->number = i;
43876#endif /* FREECIV_JSON_CONNECTION */
43877 DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
43878 }
43879
43880#ifdef FREECIV_JSON_CONNECTION
43881 /* Exit array. */
43882 free(field_addr.sub_location);
43883 field_addr.sub_location = NULL;
43884#endif /* FREECIV_JSON_CONNECTION */
43885 }
43886 }
43887 if (BV_ISSET(fields, 6)) {
43888 log_packet_detailed(" field 'dest_tile' has changed");
43889 #ifdef FREECIV_JSON_CONNECTION
43890 field_addr.name = "dest_tile";
43891#endif /* FREECIV_JSON_CONNECTION */
43892 DIO_PUT(sint32, &dout, &field_addr, real_packet->dest_tile);
43893 }
43894
43895 *old = *real_packet;
43896#endif /* FREECIV_DELTA_PROTOCOL */
43897#ifndef FREECIV_DELTA_PROTOCOL
43898#ifdef FREECIV_JSON_CONNECTION
43899 field_addr.name = "unit_id16";
43900#endif /* FREECIV_JSON_CONNECTION */
43901 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
43902#ifdef FREECIV_JSON_CONNECTION
43903 field_addr.name = "src_tile";
43904#endif /* FREECIV_JSON_CONNECTION */
43905 DIO_PUT(sint32, &dout, &field_addr, real_packet->src_tile);
43906#ifdef FREECIV_JSON_CONNECTION
43907 field_addr.name = "length";
43908#endif /* FREECIV_JSON_CONNECTION */
43909 DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
43910#ifdef FREECIV_JSON_CONNECTION
43911 field_addr.name = "repeat";
43912#endif /* FREECIV_JSON_CONNECTION */
43913 DIO_PUT(bool8, &dout, &field_addr, real_packet->repeat);
43914#ifdef FREECIV_JSON_CONNECTION
43915 field_addr.name = "vigilant";
43916#endif /* FREECIV_JSON_CONNECTION */
43917 DIO_PUT(bool8, &dout, &field_addr, real_packet->vigilant);
43918#ifdef FREECIV_JSON_CONNECTION
43919 field_addr.name = "orders";
43920#endif /* FREECIV_JSON_CONNECTION */
43921
43922 {
43923 int i;
43924
43925#ifdef FREECIV_JSON_CONNECTION
43926 /* Create the array. */
43927 DIO_PUT(farray, &dout, &field_addr, real_packet->length);
43928
43929 /* Enter the array. */
43930 field_addr.sub_location = plocation_elem_new(0);
43931#endif /* FREECIV_JSON_CONNECTION */
43932
43933 for (i = 0; i < real_packet->length; i++) {
43934#ifdef FREECIV_JSON_CONNECTION
43935 /* Next array element. */
43936 field_addr.sub_location->number = i;
43937#endif /* FREECIV_JSON_CONNECTION */
43938 DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
43939 }
43940
43941#ifdef FREECIV_JSON_CONNECTION
43942 /* Exit array. */
43943 free(field_addr.sub_location);
43944 field_addr.sub_location = NULL;
43945#endif /* FREECIV_JSON_CONNECTION */
43946 }
43947#ifdef FREECIV_JSON_CONNECTION
43948 field_addr.name = "dest_tile";
43949#endif /* FREECIV_JSON_CONNECTION */
43950 DIO_PUT(sint32, &dout, &field_addr, real_packet->dest_tile);
43951
43952#endif
43953 SEND_PACKET_END(PACKET_UNIT_ORDERS);
43954}
43955
43956 int send_packet_unit_orders(struct connection *pc, const struct packet_unit_orders *packet)
43957{
43958 if (!pc->used) {
43959 log_error("WARNING: trying to send data to the closed connection %s",
43960 conn_description(pc));
43961 return -1;
43962 }
43963 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_ORDERS].packet != NULL, -1,
43964 "Handler for PACKET_UNIT_ORDERS not installed");
43965 return pc->phs.handlers->send[PACKET_UNIT_ORDERS].packet(pc, packet);
43966}
43967
43968#ifdef FREECIV_DELTA_PROTOCOL
43969#define hash_packet_unit_server_side_agent_set_100 hash_const
43970
43971#define cmp_packet_unit_server_side_agent_set_100 cmp_const
43972
43973 BV_DEFINE(packet_unit_server_side_agent_set_100_fields, 2);
43974#endif /* FREECIV_DELTA_PROTOCOL */
43975
43976 static struct packet_unit_server_side_agent_set *receive_packet_unit_server_side_agent_set_100(struct connection *pc)
43977{
43978#ifdef FREECIV_DELTA_PROTOCOL
43979 packet_unit_server_side_agent_set_100_fields fields;
43980 struct packet_unit_server_side_agent_set *old;
43981 struct genhash **hash = pc->phs.received + PACKET_UNIT_SERVER_SIDE_AGENT_SET;
43982#endif /* FREECIV_DELTA_PROTOCOL */
43983 RECEIVE_PACKET_START(packet_unit_server_side_agent_set, real_packet);
43984#ifdef FREECIV_JSON_CONNECTION
43985 struct plocation field_addr;
43986 {
43987 struct plocation *field_addr_tmp = plocation_field_new(NULL);
43988 field_addr = *field_addr_tmp;
43989 FC_FREE(field_addr_tmp);
43990 }
43991#endif /* FREECIV_JSON_CONNECTION */
43992
43993#ifdef FREECIV_DELTA_PROTOCOL
43994#ifdef FREECIV_JSON_CONNECTION
43995 field_addr.name = "fields";
43996#endif /* FREECIV_JSON_CONNECTION */
43997 DIO_BV_GET(&din, &field_addr, fields);
43998
43999#else /* FREECIV_DELTA_PROTOCOL */
44000 #ifdef FREECIV_JSON_CONNECTION
44001 field_addr.name = "unit_id32";
44002 #endif /* FREECIV_JSON_CONNECTION */
44003 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
44004 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
44005 }
44006 #ifdef FREECIV_JSON_CONNECTION
44007 field_addr.name = "agent";
44008 #endif /* FREECIV_JSON_CONNECTION */
44009 {
44010 int readin;
44011
44012 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
44013 RECEIVE_PACKET_FIELD_ERROR(agent);
44014 }
44015 real_packet->agent = readin;
44016 }
44017
44018#endif
44019 log_packet_detailed("packet_unit_server_side_agent_set_100: got info about ()");
44020
44021#ifdef FREECIV_DELTA_PROTOCOL
44022 if (NULL == *hash) {
44023 *hash = genhash_new_full(hash_packet_unit_server_side_agent_set_100, cmp_packet_unit_server_side_agent_set_100,
44024 NULL, NULL, NULL, free);
44025 }
44026
44027 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
44028 *real_packet = *old;
44029 } else {
44030 log_packet_detailed(" no old info");
44031 memset(real_packet, 0, sizeof(*real_packet));
44032 }
44033
44034 if (BV_ISSET(fields, 0)) {
44035 log_packet_detailed(" got field 'unit_id32'");
44036 #ifdef FREECIV_JSON_CONNECTION
44037 field_addr.name = "unit_id32";
44038 #endif /* FREECIV_JSON_CONNECTION */
44039 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
44040 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
44041 }
44042 }
44043 if (BV_ISSET(fields, 1)) {
44044 log_packet_detailed(" got field 'agent'");
44045 #ifdef FREECIV_JSON_CONNECTION
44046 field_addr.name = "agent";
44047 #endif /* FREECIV_JSON_CONNECTION */
44048 {
44049 int readin;
44050
44051 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
44052 RECEIVE_PACKET_FIELD_ERROR(agent);
44053 }
44054 real_packet->agent = readin;
44055 }
44056 }
44057
44058 if (NULL == old) {
44059 old = fc_malloc(sizeof(*old));
44060 *old = *real_packet;
44061 genhash_insert(*hash, old, old);
44062 } else {
44063 *old = *real_packet;
44064 }
44065
44066#endif /* FREECIV_DELTA_PROTOCOL */
44067 RECEIVE_PACKET_END(real_packet);
44068}
44069
44070 static int send_packet_unit_server_side_agent_set_100(struct connection *pc, const struct packet_unit_server_side_agent_set *packet)
44071{
44072 const struct packet_unit_server_side_agent_set *real_packet = packet;
44073#ifdef FREECIV_DELTA_PROTOCOL
44074 packet_unit_server_side_agent_set_100_fields fields;
44075 struct packet_unit_server_side_agent_set *old;
44076 bool differ;
44077 struct genhash **hash = pc->phs.sent + PACKET_UNIT_SERVER_SIDE_AGENT_SET;
44078#endif /* FREECIV_DELTA_PROTOCOL */
44079 SEND_PACKET_START(PACKET_UNIT_SERVER_SIDE_AGENT_SET);
44080#ifdef FREECIV_JSON_CONNECTION
44081 struct plocation field_addr;
44082 {
44083 struct plocation *field_addr_tmp = plocation_field_new(NULL);
44084 field_addr = *field_addr_tmp;
44085 FC_FREE(field_addr_tmp);
44086 }
44087#endif /* FREECIV_JSON_CONNECTION */
44088
44089 log_packet_detailed("packet_unit_server_side_agent_set_100: sending info about ()");
44090
44091#ifdef FREECIV_DELTA_PROTOCOL
44092 if (NULL == *hash) {
44093 *hash = genhash_new_full(hash_packet_unit_server_side_agent_set_100, cmp_packet_unit_server_side_agent_set_100,
44094 NULL, NULL, NULL, free);
44095 }
44096 BV_CLR_ALL(fields);
44097
44098 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
44099 old = fc_malloc(sizeof(*old));
44100 *old = *real_packet;
44101 genhash_insert(*hash, old, old);
44102 memset(old, 0, sizeof(*old));
44103 }
44104 differ = (old->unit_id32 != real_packet->unit_id32);
44105 if (differ) {
44106 BV_SET(fields, 0);
44107 }
44108
44109 differ = (old->agent != real_packet->agent);
44110 if (differ) {
44111 BV_SET(fields, 1);
44112 }
44113
44114
44115#ifdef FREECIV_JSON_CONNECTION
44116 field_addr.name = "fields";
44117#endif /* FREECIV_JSON_CONNECTION */
44118 DIO_BV_PUT(&dout, &field_addr, fields);
44119
44120 if (BV_ISSET(fields, 0)) {
44121 log_packet_detailed(" field 'unit_id32' has changed");
44122 #ifdef FREECIV_JSON_CONNECTION
44123 field_addr.name = "unit_id32";
44124#endif /* FREECIV_JSON_CONNECTION */
44125 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
44126 }
44127 if (BV_ISSET(fields, 1)) {
44128 log_packet_detailed(" field 'agent' has changed");
44129 #ifdef FREECIV_JSON_CONNECTION
44130 field_addr.name = "agent";
44131#endif /* FREECIV_JSON_CONNECTION */
44132 DIO_PUT(uint8, &dout, &field_addr, real_packet->agent);
44133 }
44134
44135 *old = *real_packet;
44136#endif /* FREECIV_DELTA_PROTOCOL */
44137#ifndef FREECIV_DELTA_PROTOCOL
44138#ifdef FREECIV_JSON_CONNECTION
44139 field_addr.name = "unit_id32";
44140#endif /* FREECIV_JSON_CONNECTION */
44141 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
44142#ifdef FREECIV_JSON_CONNECTION
44143 field_addr.name = "agent";
44144#endif /* FREECIV_JSON_CONNECTION */
44145 DIO_PUT(uint8, &dout, &field_addr, real_packet->agent);
44146
44147#endif
44148 SEND_PACKET_END(PACKET_UNIT_SERVER_SIDE_AGENT_SET);
44149}
44150
44151#ifdef FREECIV_DELTA_PROTOCOL
44152#define hash_packet_unit_server_side_agent_set_101 hash_const
44153
44154#define cmp_packet_unit_server_side_agent_set_101 cmp_const
44155
44156 BV_DEFINE(packet_unit_server_side_agent_set_101_fields, 2);
44157#endif /* FREECIV_DELTA_PROTOCOL */
44158
44159 static struct packet_unit_server_side_agent_set *receive_packet_unit_server_side_agent_set_101(struct connection *pc)
44160{
44161#ifdef FREECIV_DELTA_PROTOCOL
44162 packet_unit_server_side_agent_set_101_fields fields;
44163 struct packet_unit_server_side_agent_set *old;
44164 struct genhash **hash = pc->phs.received + PACKET_UNIT_SERVER_SIDE_AGENT_SET;
44165#endif /* FREECIV_DELTA_PROTOCOL */
44166 RECEIVE_PACKET_START(packet_unit_server_side_agent_set, real_packet);
44167#ifdef FREECIV_JSON_CONNECTION
44168 struct plocation field_addr;
44169 {
44170 struct plocation *field_addr_tmp = plocation_field_new(NULL);
44171 field_addr = *field_addr_tmp;
44172 FC_FREE(field_addr_tmp);
44173 }
44174#endif /* FREECIV_JSON_CONNECTION */
44175
44176#ifdef FREECIV_DELTA_PROTOCOL
44177#ifdef FREECIV_JSON_CONNECTION
44178 field_addr.name = "fields";
44179#endif /* FREECIV_JSON_CONNECTION */
44180 DIO_BV_GET(&din, &field_addr, fields);
44181
44182#else /* FREECIV_DELTA_PROTOCOL */
44183 #ifdef FREECIV_JSON_CONNECTION
44184 field_addr.name = "unit_id16";
44185 #endif /* FREECIV_JSON_CONNECTION */
44186 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
44187 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
44188 }
44189 #ifdef FREECIV_JSON_CONNECTION
44190 field_addr.name = "agent";
44191 #endif /* FREECIV_JSON_CONNECTION */
44192 {
44193 int readin;
44194
44195 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
44196 RECEIVE_PACKET_FIELD_ERROR(agent);
44197 }
44198 real_packet->agent = readin;
44199 }
44200
44201#endif
44202 log_packet_detailed("packet_unit_server_side_agent_set_101: got info about ()");
44203
44204#ifdef FREECIV_DELTA_PROTOCOL
44205 if (NULL == *hash) {
44206 *hash = genhash_new_full(hash_packet_unit_server_side_agent_set_101, cmp_packet_unit_server_side_agent_set_101,
44207 NULL, NULL, NULL, free);
44208 }
44209
44210 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
44211 *real_packet = *old;
44212 } else {
44213 log_packet_detailed(" no old info");
44214 memset(real_packet, 0, sizeof(*real_packet));
44215 }
44216
44217 if (BV_ISSET(fields, 0)) {
44218 log_packet_detailed(" got field 'unit_id16'");
44219 #ifdef FREECIV_JSON_CONNECTION
44220 field_addr.name = "unit_id16";
44221 #endif /* FREECIV_JSON_CONNECTION */
44222 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
44223 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
44224 }
44225 }
44226 if (BV_ISSET(fields, 1)) {
44227 log_packet_detailed(" got field 'agent'");
44228 #ifdef FREECIV_JSON_CONNECTION
44229 field_addr.name = "agent";
44230 #endif /* FREECIV_JSON_CONNECTION */
44231 {
44232 int readin;
44233
44234 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
44235 RECEIVE_PACKET_FIELD_ERROR(agent);
44236 }
44237 real_packet->agent = readin;
44238 }
44239 }
44240
44241 if (NULL == old) {
44242 old = fc_malloc(sizeof(*old));
44243 *old = *real_packet;
44244 genhash_insert(*hash, old, old);
44245 } else {
44246 *old = *real_packet;
44247 }
44248
44249#endif /* FREECIV_DELTA_PROTOCOL */
44250 RECEIVE_PACKET_END(real_packet);
44251}
44252
44253 static int send_packet_unit_server_side_agent_set_101(struct connection *pc, const struct packet_unit_server_side_agent_set *packet)
44254{
44255 const struct packet_unit_server_side_agent_set *real_packet = packet;
44256#ifdef FREECIV_DELTA_PROTOCOL
44257 packet_unit_server_side_agent_set_101_fields fields;
44258 struct packet_unit_server_side_agent_set *old;
44259 bool differ;
44260 struct genhash **hash = pc->phs.sent + PACKET_UNIT_SERVER_SIDE_AGENT_SET;
44261#endif /* FREECIV_DELTA_PROTOCOL */
44262 SEND_PACKET_START(PACKET_UNIT_SERVER_SIDE_AGENT_SET);
44263#ifdef FREECIV_JSON_CONNECTION
44264 struct plocation field_addr;
44265 {
44266 struct plocation *field_addr_tmp = plocation_field_new(NULL);
44267 field_addr = *field_addr_tmp;
44268 FC_FREE(field_addr_tmp);
44269 }
44270#endif /* FREECIV_JSON_CONNECTION */
44271
44272 log_packet_detailed("packet_unit_server_side_agent_set_101: sending info about ()");
44273
44274#ifdef FREECIV_DELTA_PROTOCOL
44275 if (NULL == *hash) {
44276 *hash = genhash_new_full(hash_packet_unit_server_side_agent_set_101, cmp_packet_unit_server_side_agent_set_101,
44277 NULL, NULL, NULL, free);
44278 }
44279 BV_CLR_ALL(fields);
44280
44281 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
44282 old = fc_malloc(sizeof(*old));
44283 *old = *real_packet;
44284 genhash_insert(*hash, old, old);
44285 memset(old, 0, sizeof(*old));
44286 }
44287 differ = (old->unit_id16 != real_packet->unit_id16);
44288 if (differ) {
44289 BV_SET(fields, 0);
44290 }
44291
44292 differ = (old->agent != real_packet->agent);
44293 if (differ) {
44294 BV_SET(fields, 1);
44295 }
44296
44297
44298#ifdef FREECIV_JSON_CONNECTION
44299 field_addr.name = "fields";
44300#endif /* FREECIV_JSON_CONNECTION */
44301 DIO_BV_PUT(&dout, &field_addr, fields);
44302
44303 if (BV_ISSET(fields, 0)) {
44304 log_packet_detailed(" field 'unit_id16' has changed");
44305 #ifdef FREECIV_JSON_CONNECTION
44306 field_addr.name = "unit_id16";
44307#endif /* FREECIV_JSON_CONNECTION */
44308 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
44309 }
44310 if (BV_ISSET(fields, 1)) {
44311 log_packet_detailed(" field 'agent' has changed");
44312 #ifdef FREECIV_JSON_CONNECTION
44313 field_addr.name = "agent";
44314#endif /* FREECIV_JSON_CONNECTION */
44315 DIO_PUT(uint8, &dout, &field_addr, real_packet->agent);
44316 }
44317
44318 *old = *real_packet;
44319#endif /* FREECIV_DELTA_PROTOCOL */
44320#ifndef FREECIV_DELTA_PROTOCOL
44321#ifdef FREECIV_JSON_CONNECTION
44322 field_addr.name = "unit_id16";
44323#endif /* FREECIV_JSON_CONNECTION */
44324 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
44325#ifdef FREECIV_JSON_CONNECTION
44326 field_addr.name = "agent";
44327#endif /* FREECIV_JSON_CONNECTION */
44328 DIO_PUT(uint8, &dout, &field_addr, real_packet->agent);
44329
44330#endif
44331 SEND_PACKET_END(PACKET_UNIT_SERVER_SIDE_AGENT_SET);
44332}
44333
44334 int send_packet_unit_server_side_agent_set(struct connection *pc, const struct packet_unit_server_side_agent_set *packet)
44335{
44336 if (!pc->used) {
44337 log_error("WARNING: trying to send data to the closed connection %s",
44338 conn_description(pc));
44339 return -1;
44340 }
44341 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_SERVER_SIDE_AGENT_SET].packet != NULL, -1,
44342 "Handler for PACKET_UNIT_SERVER_SIDE_AGENT_SET not installed");
44343 return pc->phs.handlers->send[PACKET_UNIT_SERVER_SIDE_AGENT_SET].packet(pc, packet);
44344}
44345
44346 int dsend_packet_unit_server_side_agent_set(struct connection *pc, int unit_id16, int unit_id32, enum server_side_agent agent)
44347{
44348 struct packet_unit_server_side_agent_set packet, *real_packet = &packet;
44349
44350 real_packet->unit_id16 = unit_id16;
44351 real_packet->unit_id32 = unit_id32;
44352 real_packet->agent = agent;
44353
44354 return send_packet_unit_server_side_agent_set(pc, real_packet);
44355}
44356
44357#ifdef FREECIV_DELTA_PROTOCOL
44358#define hash_packet_unit_action_query_100 hash_const
44359
44360#define cmp_packet_unit_action_query_100 cmp_const
44361
44362 BV_DEFINE(packet_unit_action_query_100_fields, 4);
44363#endif /* FREECIV_DELTA_PROTOCOL */
44364
44365 static struct packet_unit_action_query *receive_packet_unit_action_query_100(struct connection *pc)
44366{
44367#ifdef FREECIV_DELTA_PROTOCOL
44368 packet_unit_action_query_100_fields fields;
44369 struct packet_unit_action_query *old;
44370 struct genhash **hash = pc->phs.received + PACKET_UNIT_ACTION_QUERY;
44371#endif /* FREECIV_DELTA_PROTOCOL */
44372 RECEIVE_PACKET_START(packet_unit_action_query, real_packet);
44373#ifdef FREECIV_JSON_CONNECTION
44374 struct plocation field_addr;
44375 {
44376 struct plocation *field_addr_tmp = plocation_field_new(NULL);
44377 field_addr = *field_addr_tmp;
44378 FC_FREE(field_addr_tmp);
44379 }
44380#endif /* FREECIV_JSON_CONNECTION */
44381
44382#ifdef FREECIV_DELTA_PROTOCOL
44383#ifdef FREECIV_JSON_CONNECTION
44384 field_addr.name = "fields";
44385#endif /* FREECIV_JSON_CONNECTION */
44386 DIO_BV_GET(&din, &field_addr, fields);
44387
44388#else /* FREECIV_DELTA_PROTOCOL */
44389 #ifdef FREECIV_JSON_CONNECTION
44390 field_addr.name = "actor_id32";
44391 #endif /* FREECIV_JSON_CONNECTION */
44392 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id32)) {
44393 RECEIVE_PACKET_FIELD_ERROR(actor_id32);
44394 }
44395 #ifdef FREECIV_JSON_CONNECTION
44396 field_addr.name = "target_id";
44397 #endif /* FREECIV_JSON_CONNECTION */
44398 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
44399 RECEIVE_PACKET_FIELD_ERROR(target_id);
44400 }
44401 #ifdef FREECIV_JSON_CONNECTION
44402 field_addr.name = "action_type";
44403 #endif /* FREECIV_JSON_CONNECTION */
44404 {
44405 int readin;
44406
44407 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
44408 RECEIVE_PACKET_FIELD_ERROR(action_type);
44409 }
44410 real_packet->action_type = readin;
44411 }
44412 #ifdef FREECIV_JSON_CONNECTION
44413 field_addr.name = "request_kind";
44414 #endif /* FREECIV_JSON_CONNECTION */
44415 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
44416 RECEIVE_PACKET_FIELD_ERROR(request_kind);
44417 }
44418
44419#endif
44420 log_packet_detailed("packet_unit_action_query_100: got info about ()");
44421
44422#ifdef FREECIV_DELTA_PROTOCOL
44423 if (NULL == *hash) {
44424 *hash = genhash_new_full(hash_packet_unit_action_query_100, cmp_packet_unit_action_query_100,
44425 NULL, NULL, NULL, free);
44426 }
44427
44428 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
44429 *real_packet = *old;
44430 } else {
44431 log_packet_detailed(" no old info");
44432 memset(real_packet, 0, sizeof(*real_packet));
44433 }
44434
44435 if (BV_ISSET(fields, 0)) {
44436 log_packet_detailed(" got field 'actor_id32'");
44437 #ifdef FREECIV_JSON_CONNECTION
44438 field_addr.name = "actor_id32";
44439 #endif /* FREECIV_JSON_CONNECTION */
44440 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id32)) {
44441 RECEIVE_PACKET_FIELD_ERROR(actor_id32);
44442 }
44443 }
44444 if (BV_ISSET(fields, 1)) {
44445 log_packet_detailed(" got field 'target_id'");
44446 #ifdef FREECIV_JSON_CONNECTION
44447 field_addr.name = "target_id";
44448 #endif /* FREECIV_JSON_CONNECTION */
44449 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
44450 RECEIVE_PACKET_FIELD_ERROR(target_id);
44451 }
44452 }
44453 if (BV_ISSET(fields, 2)) {
44454 log_packet_detailed(" got field 'action_type'");
44455 #ifdef FREECIV_JSON_CONNECTION
44456 field_addr.name = "action_type";
44457 #endif /* FREECIV_JSON_CONNECTION */
44458 {
44459 int readin;
44460
44461 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
44462 RECEIVE_PACKET_FIELD_ERROR(action_type);
44463 }
44464 real_packet->action_type = readin;
44465 }
44466 }
44467 if (BV_ISSET(fields, 3)) {
44468 log_packet_detailed(" got field 'request_kind'");
44469 #ifdef FREECIV_JSON_CONNECTION
44470 field_addr.name = "request_kind";
44471 #endif /* FREECIV_JSON_CONNECTION */
44472 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
44473 RECEIVE_PACKET_FIELD_ERROR(request_kind);
44474 }
44475 }
44476
44477 if (NULL == old) {
44478 old = fc_malloc(sizeof(*old));
44479 *old = *real_packet;
44480 genhash_insert(*hash, old, old);
44481 } else {
44482 *old = *real_packet;
44483 }
44484
44485#endif /* FREECIV_DELTA_PROTOCOL */
44486 RECEIVE_PACKET_END(real_packet);
44487}
44488
44489 static int send_packet_unit_action_query_100(struct connection *pc, const struct packet_unit_action_query *packet)
44490{
44491 const struct packet_unit_action_query *real_packet = packet;
44492#ifdef FREECIV_DELTA_PROTOCOL
44493 packet_unit_action_query_100_fields fields;
44494 struct packet_unit_action_query *old;
44495 bool differ;
44496 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ACTION_QUERY;
44497#endif /* FREECIV_DELTA_PROTOCOL */
44498 SEND_PACKET_START(PACKET_UNIT_ACTION_QUERY);
44499#ifdef FREECIV_JSON_CONNECTION
44500 struct plocation field_addr;
44501 {
44502 struct plocation *field_addr_tmp = plocation_field_new(NULL);
44503 field_addr = *field_addr_tmp;
44504 FC_FREE(field_addr_tmp);
44505 }
44506#endif /* FREECIV_JSON_CONNECTION */
44507
44508 log_packet_detailed("packet_unit_action_query_100: sending info about ()");
44509
44510#ifdef FREECIV_DELTA_PROTOCOL
44511 if (NULL == *hash) {
44512 *hash = genhash_new_full(hash_packet_unit_action_query_100, cmp_packet_unit_action_query_100,
44513 NULL, NULL, NULL, free);
44514 }
44515 BV_CLR_ALL(fields);
44516
44517 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
44518 old = fc_malloc(sizeof(*old));
44519 *old = *real_packet;
44520 genhash_insert(*hash, old, old);
44521 memset(old, 0, sizeof(*old));
44522 }
44523 differ = (old->actor_id32 != real_packet->actor_id32);
44524 if (differ) {
44525 BV_SET(fields, 0);
44526 }
44527
44528 differ = (old->target_id != real_packet->target_id);
44529 if (differ) {
44530 BV_SET(fields, 1);
44531 }
44532
44533 differ = (old->action_type != real_packet->action_type);
44534 if (differ) {
44535 BV_SET(fields, 2);
44536 }
44537
44538 differ = (old->request_kind != real_packet->request_kind);
44539 if (differ) {
44540 BV_SET(fields, 3);
44541 }
44542
44543
44544#ifdef FREECIV_JSON_CONNECTION
44545 field_addr.name = "fields";
44546#endif /* FREECIV_JSON_CONNECTION */
44547 DIO_BV_PUT(&dout, &field_addr, fields);
44548
44549 if (BV_ISSET(fields, 0)) {
44550 log_packet_detailed(" field 'actor_id32' has changed");
44551 #ifdef FREECIV_JSON_CONNECTION
44552 field_addr.name = "actor_id32";
44553#endif /* FREECIV_JSON_CONNECTION */
44554 DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id32);
44555 }
44556 if (BV_ISSET(fields, 1)) {
44557 log_packet_detailed(" field 'target_id' has changed");
44558 #ifdef FREECIV_JSON_CONNECTION
44559 field_addr.name = "target_id";
44560#endif /* FREECIV_JSON_CONNECTION */
44561 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
44562 }
44563 if (BV_ISSET(fields, 2)) {
44564 log_packet_detailed(" field 'action_type' has changed");
44565 #ifdef FREECIV_JSON_CONNECTION
44566 field_addr.name = "action_type";
44567#endif /* FREECIV_JSON_CONNECTION */
44568 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
44569 }
44570 if (BV_ISSET(fields, 3)) {
44571 log_packet_detailed(" field 'request_kind' has changed");
44572 #ifdef FREECIV_JSON_CONNECTION
44573 field_addr.name = "request_kind";
44574#endif /* FREECIV_JSON_CONNECTION */
44575 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
44576 }
44577
44578 *old = *real_packet;
44579#endif /* FREECIV_DELTA_PROTOCOL */
44580#ifndef FREECIV_DELTA_PROTOCOL
44581#ifdef FREECIV_JSON_CONNECTION
44582 field_addr.name = "actor_id32";
44583#endif /* FREECIV_JSON_CONNECTION */
44584 DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id32);
44585#ifdef FREECIV_JSON_CONNECTION
44586 field_addr.name = "target_id";
44587#endif /* FREECIV_JSON_CONNECTION */
44588 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
44589#ifdef FREECIV_JSON_CONNECTION
44590 field_addr.name = "action_type";
44591#endif /* FREECIV_JSON_CONNECTION */
44592 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
44593#ifdef FREECIV_JSON_CONNECTION
44594 field_addr.name = "request_kind";
44595#endif /* FREECIV_JSON_CONNECTION */
44596 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
44597
44598#endif
44599 SEND_PACKET_END(PACKET_UNIT_ACTION_QUERY);
44600}
44601
44602#ifdef FREECIV_DELTA_PROTOCOL
44603#define hash_packet_unit_action_query_101 hash_const
44604
44605#define cmp_packet_unit_action_query_101 cmp_const
44606
44607 BV_DEFINE(packet_unit_action_query_101_fields, 4);
44608#endif /* FREECIV_DELTA_PROTOCOL */
44609
44610 static struct packet_unit_action_query *receive_packet_unit_action_query_101(struct connection *pc)
44611{
44612#ifdef FREECIV_DELTA_PROTOCOL
44613 packet_unit_action_query_101_fields fields;
44614 struct packet_unit_action_query *old;
44615 struct genhash **hash = pc->phs.received + PACKET_UNIT_ACTION_QUERY;
44616#endif /* FREECIV_DELTA_PROTOCOL */
44617 RECEIVE_PACKET_START(packet_unit_action_query, real_packet);
44618#ifdef FREECIV_JSON_CONNECTION
44619 struct plocation field_addr;
44620 {
44621 struct plocation *field_addr_tmp = plocation_field_new(NULL);
44622 field_addr = *field_addr_tmp;
44623 FC_FREE(field_addr_tmp);
44624 }
44625#endif /* FREECIV_JSON_CONNECTION */
44626
44627#ifdef FREECIV_DELTA_PROTOCOL
44628#ifdef FREECIV_JSON_CONNECTION
44629 field_addr.name = "fields";
44630#endif /* FREECIV_JSON_CONNECTION */
44631 DIO_BV_GET(&din, &field_addr, fields);
44632
44633#else /* FREECIV_DELTA_PROTOCOL */
44634 #ifdef FREECIV_JSON_CONNECTION
44635 field_addr.name = "actor_id16";
44636 #endif /* FREECIV_JSON_CONNECTION */
44637 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->actor_id16)) {
44638 RECEIVE_PACKET_FIELD_ERROR(actor_id16);
44639 }
44640 #ifdef FREECIV_JSON_CONNECTION
44641 field_addr.name = "target_id";
44642 #endif /* FREECIV_JSON_CONNECTION */
44643 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
44644 RECEIVE_PACKET_FIELD_ERROR(target_id);
44645 }
44646 #ifdef FREECIV_JSON_CONNECTION
44647 field_addr.name = "action_type";
44648 #endif /* FREECIV_JSON_CONNECTION */
44649 {
44650 int readin;
44651
44652 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
44653 RECEIVE_PACKET_FIELD_ERROR(action_type);
44654 }
44655 real_packet->action_type = readin;
44656 }
44657 #ifdef FREECIV_JSON_CONNECTION
44658 field_addr.name = "request_kind";
44659 #endif /* FREECIV_JSON_CONNECTION */
44660 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
44661 RECEIVE_PACKET_FIELD_ERROR(request_kind);
44662 }
44663
44664#endif
44665 log_packet_detailed("packet_unit_action_query_101: got info about ()");
44666
44667#ifdef FREECIV_DELTA_PROTOCOL
44668 if (NULL == *hash) {
44669 *hash = genhash_new_full(hash_packet_unit_action_query_101, cmp_packet_unit_action_query_101,
44670 NULL, NULL, NULL, free);
44671 }
44672
44673 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
44674 *real_packet = *old;
44675 } else {
44676 log_packet_detailed(" no old info");
44677 memset(real_packet, 0, sizeof(*real_packet));
44678 }
44679
44680 if (BV_ISSET(fields, 0)) {
44681 log_packet_detailed(" got field 'actor_id16'");
44682 #ifdef FREECIV_JSON_CONNECTION
44683 field_addr.name = "actor_id16";
44684 #endif /* FREECIV_JSON_CONNECTION */
44685 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->actor_id16)) {
44686 RECEIVE_PACKET_FIELD_ERROR(actor_id16);
44687 }
44688 }
44689 if (BV_ISSET(fields, 1)) {
44690 log_packet_detailed(" got field 'target_id'");
44691 #ifdef FREECIV_JSON_CONNECTION
44692 field_addr.name = "target_id";
44693 #endif /* FREECIV_JSON_CONNECTION */
44694 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
44695 RECEIVE_PACKET_FIELD_ERROR(target_id);
44696 }
44697 }
44698 if (BV_ISSET(fields, 2)) {
44699 log_packet_detailed(" got field 'action_type'");
44700 #ifdef FREECIV_JSON_CONNECTION
44701 field_addr.name = "action_type";
44702 #endif /* FREECIV_JSON_CONNECTION */
44703 {
44704 int readin;
44705
44706 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
44707 RECEIVE_PACKET_FIELD_ERROR(action_type);
44708 }
44709 real_packet->action_type = readin;
44710 }
44711 }
44712 if (BV_ISSET(fields, 3)) {
44713 log_packet_detailed(" got field 'request_kind'");
44714 #ifdef FREECIV_JSON_CONNECTION
44715 field_addr.name = "request_kind";
44716 #endif /* FREECIV_JSON_CONNECTION */
44717 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
44718 RECEIVE_PACKET_FIELD_ERROR(request_kind);
44719 }
44720 }
44721
44722 if (NULL == old) {
44723 old = fc_malloc(sizeof(*old));
44724 *old = *real_packet;
44725 genhash_insert(*hash, old, old);
44726 } else {
44727 *old = *real_packet;
44728 }
44729
44730#endif /* FREECIV_DELTA_PROTOCOL */
44731 RECEIVE_PACKET_END(real_packet);
44732}
44733
44734 static int send_packet_unit_action_query_101(struct connection *pc, const struct packet_unit_action_query *packet)
44735{
44736 const struct packet_unit_action_query *real_packet = packet;
44737#ifdef FREECIV_DELTA_PROTOCOL
44738 packet_unit_action_query_101_fields fields;
44739 struct packet_unit_action_query *old;
44740 bool differ;
44741 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ACTION_QUERY;
44742#endif /* FREECIV_DELTA_PROTOCOL */
44743 SEND_PACKET_START(PACKET_UNIT_ACTION_QUERY);
44744#ifdef FREECIV_JSON_CONNECTION
44745 struct plocation field_addr;
44746 {
44747 struct plocation *field_addr_tmp = plocation_field_new(NULL);
44748 field_addr = *field_addr_tmp;
44749 FC_FREE(field_addr_tmp);
44750 }
44751#endif /* FREECIV_JSON_CONNECTION */
44752
44753 log_packet_detailed("packet_unit_action_query_101: sending info about ()");
44754
44755#ifdef FREECIV_DELTA_PROTOCOL
44756 if (NULL == *hash) {
44757 *hash = genhash_new_full(hash_packet_unit_action_query_101, cmp_packet_unit_action_query_101,
44758 NULL, NULL, NULL, free);
44759 }
44760 BV_CLR_ALL(fields);
44761
44762 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
44763 old = fc_malloc(sizeof(*old));
44764 *old = *real_packet;
44765 genhash_insert(*hash, old, old);
44766 memset(old, 0, sizeof(*old));
44767 }
44768 differ = (old->actor_id16 != real_packet->actor_id16);
44769 if (differ) {
44770 BV_SET(fields, 0);
44771 }
44772
44773 differ = (old->target_id != real_packet->target_id);
44774 if (differ) {
44775 BV_SET(fields, 1);
44776 }
44777
44778 differ = (old->action_type != real_packet->action_type);
44779 if (differ) {
44780 BV_SET(fields, 2);
44781 }
44782
44783 differ = (old->request_kind != real_packet->request_kind);
44784 if (differ) {
44785 BV_SET(fields, 3);
44786 }
44787
44788
44789#ifdef FREECIV_JSON_CONNECTION
44790 field_addr.name = "fields";
44791#endif /* FREECIV_JSON_CONNECTION */
44792 DIO_BV_PUT(&dout, &field_addr, fields);
44793
44794 if (BV_ISSET(fields, 0)) {
44795 log_packet_detailed(" field 'actor_id16' has changed");
44796 #ifdef FREECIV_JSON_CONNECTION
44797 field_addr.name = "actor_id16";
44798#endif /* FREECIV_JSON_CONNECTION */
44799 DIO_PUT(uint16, &dout, &field_addr, real_packet->actor_id16);
44800 }
44801 if (BV_ISSET(fields, 1)) {
44802 log_packet_detailed(" field 'target_id' has changed");
44803 #ifdef FREECIV_JSON_CONNECTION
44804 field_addr.name = "target_id";
44805#endif /* FREECIV_JSON_CONNECTION */
44806 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
44807 }
44808 if (BV_ISSET(fields, 2)) {
44809 log_packet_detailed(" field 'action_type' has changed");
44810 #ifdef FREECIV_JSON_CONNECTION
44811 field_addr.name = "action_type";
44812#endif /* FREECIV_JSON_CONNECTION */
44813 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
44814 }
44815 if (BV_ISSET(fields, 3)) {
44816 log_packet_detailed(" field 'request_kind' has changed");
44817 #ifdef FREECIV_JSON_CONNECTION
44818 field_addr.name = "request_kind";
44819#endif /* FREECIV_JSON_CONNECTION */
44820 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
44821 }
44822
44823 *old = *real_packet;
44824#endif /* FREECIV_DELTA_PROTOCOL */
44825#ifndef FREECIV_DELTA_PROTOCOL
44826#ifdef FREECIV_JSON_CONNECTION
44827 field_addr.name = "actor_id16";
44828#endif /* FREECIV_JSON_CONNECTION */
44829 DIO_PUT(uint16, &dout, &field_addr, real_packet->actor_id16);
44830#ifdef FREECIV_JSON_CONNECTION
44831 field_addr.name = "target_id";
44832#endif /* FREECIV_JSON_CONNECTION */
44833 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
44834#ifdef FREECIV_JSON_CONNECTION
44835 field_addr.name = "action_type";
44836#endif /* FREECIV_JSON_CONNECTION */
44837 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
44838#ifdef FREECIV_JSON_CONNECTION
44839 field_addr.name = "request_kind";
44840#endif /* FREECIV_JSON_CONNECTION */
44841 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
44842
44843#endif
44844 SEND_PACKET_END(PACKET_UNIT_ACTION_QUERY);
44845}
44846
44847 int send_packet_unit_action_query(struct connection *pc, const struct packet_unit_action_query *packet)
44848{
44849 if (!pc->used) {
44850 log_error("WARNING: trying to send data to the closed connection %s",
44851 conn_description(pc));
44852 return -1;
44853 }
44854 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_ACTION_QUERY].packet != NULL, -1,
44855 "Handler for PACKET_UNIT_ACTION_QUERY not installed");
44856 return pc->phs.handlers->send[PACKET_UNIT_ACTION_QUERY].packet(pc, packet);
44857}
44858
44859 int dsend_packet_unit_action_query(struct connection *pc, int actor_id16, int actor_id32, int target_id, action_id action_type, int request_kind)
44860{
44861 struct packet_unit_action_query packet, *real_packet = &packet;
44862
44863 real_packet->actor_id16 = actor_id16;
44864 real_packet->actor_id32 = actor_id32;
44865 real_packet->target_id = target_id;
44866 real_packet->action_type = action_type;
44867 real_packet->request_kind = request_kind;
44868
44869 return send_packet_unit_action_query(pc, real_packet);
44870}
44871
44872#ifdef FREECIV_DELTA_PROTOCOL
44873#define hash_packet_unit_type_upgrade_100 hash_const
44874
44875#define cmp_packet_unit_type_upgrade_100 cmp_const
44876
44877 BV_DEFINE(packet_unit_type_upgrade_100_fields, 1);
44878#endif /* FREECIV_DELTA_PROTOCOL */
44879
44880 static struct packet_unit_type_upgrade *receive_packet_unit_type_upgrade_100(struct connection *pc)
44881{
44882#ifdef FREECIV_DELTA_PROTOCOL
44883 packet_unit_type_upgrade_100_fields fields;
44884 struct packet_unit_type_upgrade *old;
44885 struct genhash **hash = pc->phs.received + PACKET_UNIT_TYPE_UPGRADE;
44886#endif /* FREECIV_DELTA_PROTOCOL */
44887 RECEIVE_PACKET_START(packet_unit_type_upgrade, real_packet);
44888#ifdef FREECIV_JSON_CONNECTION
44889 struct plocation field_addr;
44890 {
44891 struct plocation *field_addr_tmp = plocation_field_new(NULL);
44892 field_addr = *field_addr_tmp;
44893 FC_FREE(field_addr_tmp);
44894 }
44895#endif /* FREECIV_JSON_CONNECTION */
44896
44897#ifdef FREECIV_DELTA_PROTOCOL
44898#ifdef FREECIV_JSON_CONNECTION
44899 field_addr.name = "fields";
44900#endif /* FREECIV_JSON_CONNECTION */
44901 DIO_BV_GET(&din, &field_addr, fields);
44902
44903#else /* FREECIV_DELTA_PROTOCOL */
44904 #ifdef FREECIV_JSON_CONNECTION
44905 field_addr.name = "type";
44906 #endif /* FREECIV_JSON_CONNECTION */
44907 {
44908 int readin;
44909
44910 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
44911 RECEIVE_PACKET_FIELD_ERROR(type);
44912 }
44913 real_packet->type = readin;
44914 }
44915
44916#endif
44917 log_packet_detailed("packet_unit_type_upgrade_100: got info about ()");
44918
44919#ifdef FREECIV_DELTA_PROTOCOL
44920 if (NULL == *hash) {
44921 *hash = genhash_new_full(hash_packet_unit_type_upgrade_100, cmp_packet_unit_type_upgrade_100,
44922 NULL, NULL, NULL, free);
44923 }
44924
44925 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
44926 *real_packet = *old;
44927 } else {
44928 log_packet_detailed(" no old info");
44929 memset(real_packet, 0, sizeof(*real_packet));
44930 }
44931
44932 if (BV_ISSET(fields, 0)) {
44933 log_packet_detailed(" got field 'type'");
44934 #ifdef FREECIV_JSON_CONNECTION
44935 field_addr.name = "type";
44936 #endif /* FREECIV_JSON_CONNECTION */
44937 {
44938 int readin;
44939
44940 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
44941 RECEIVE_PACKET_FIELD_ERROR(type);
44942 }
44943 real_packet->type = readin;
44944 }
44945 }
44946
44947 if (NULL == old) {
44948 old = fc_malloc(sizeof(*old));
44949 *old = *real_packet;
44950 genhash_insert(*hash, old, old);
44951 } else {
44952 *old = *real_packet;
44953 }
44954
44955#endif /* FREECIV_DELTA_PROTOCOL */
44956 RECEIVE_PACKET_END(real_packet);
44957}
44958
44959 static int send_packet_unit_type_upgrade_100(struct connection *pc, const struct packet_unit_type_upgrade *packet)
44960{
44961 const struct packet_unit_type_upgrade *real_packet = packet;
44962#ifdef FREECIV_DELTA_PROTOCOL
44963 packet_unit_type_upgrade_100_fields fields;
44964 struct packet_unit_type_upgrade *old;
44965 bool differ;
44966 struct genhash **hash = pc->phs.sent + PACKET_UNIT_TYPE_UPGRADE;
44967#endif /* FREECIV_DELTA_PROTOCOL */
44968 SEND_PACKET_START(PACKET_UNIT_TYPE_UPGRADE);
44969#ifdef FREECIV_JSON_CONNECTION
44970 struct plocation field_addr;
44971 {
44972 struct plocation *field_addr_tmp = plocation_field_new(NULL);
44973 field_addr = *field_addr_tmp;
44974 FC_FREE(field_addr_tmp);
44975 }
44976#endif /* FREECIV_JSON_CONNECTION */
44977
44978 log_packet_detailed("packet_unit_type_upgrade_100: sending info about ()");
44979
44980#ifdef FREECIV_DELTA_PROTOCOL
44981 if (NULL == *hash) {
44982 *hash = genhash_new_full(hash_packet_unit_type_upgrade_100, cmp_packet_unit_type_upgrade_100,
44983 NULL, NULL, NULL, free);
44984 }
44985 BV_CLR_ALL(fields);
44986
44987 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
44988 old = fc_malloc(sizeof(*old));
44989 *old = *real_packet;
44990 genhash_insert(*hash, old, old);
44991 memset(old, 0, sizeof(*old));
44992 }
44993 differ = (old->type != real_packet->type);
44994 if (differ) {
44995 BV_SET(fields, 0);
44996 }
44997
44998
44999#ifdef FREECIV_JSON_CONNECTION
45000 field_addr.name = "fields";
45001#endif /* FREECIV_JSON_CONNECTION */
45002 DIO_BV_PUT(&dout, &field_addr, fields);
45003
45004 if (BV_ISSET(fields, 0)) {
45005 log_packet_detailed(" field 'type' has changed");
45006 #ifdef FREECIV_JSON_CONNECTION
45007 field_addr.name = "type";
45008#endif /* FREECIV_JSON_CONNECTION */
45009 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
45010 }
45011
45012 *old = *real_packet;
45013#endif /* FREECIV_DELTA_PROTOCOL */
45014#ifndef FREECIV_DELTA_PROTOCOL
45015#ifdef FREECIV_JSON_CONNECTION
45016 field_addr.name = "type";
45017#endif /* FREECIV_JSON_CONNECTION */
45018 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
45019
45020#endif
45021 SEND_PACKET_END(PACKET_UNIT_TYPE_UPGRADE);
45022}
45023
45024 int send_packet_unit_type_upgrade(struct connection *pc, const struct packet_unit_type_upgrade *packet)
45025{
45026 if (!pc->used) {
45027 log_error("WARNING: trying to send data to the closed connection %s",
45028 conn_description(pc));
45029 return -1;
45030 }
45031 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_TYPE_UPGRADE].packet != NULL, -1,
45032 "Handler for PACKET_UNIT_TYPE_UPGRADE not installed");
45033 return pc->phs.handlers->send[PACKET_UNIT_TYPE_UPGRADE].packet(pc, packet);
45034}
45035
45036 int dsend_packet_unit_type_upgrade(struct connection *pc, Unit_type_id type)
45037{
45038 struct packet_unit_type_upgrade packet, *real_packet = &packet;
45039
45040 real_packet->type = type;
45041
45042 return send_packet_unit_type_upgrade(pc, real_packet);
45043}
45044
45045#ifdef FREECIV_DELTA_PROTOCOL
45046#define hash_packet_unit_do_action_100 hash_const
45047
45048#define cmp_packet_unit_do_action_100 cmp_const
45049
45050 BV_DEFINE(packet_unit_do_action_100_fields, 5);
45051#endif /* FREECIV_DELTA_PROTOCOL */
45052
45053 static struct packet_unit_do_action *receive_packet_unit_do_action_100(struct connection *pc)
45054{
45055#ifdef FREECIV_DELTA_PROTOCOL
45056 packet_unit_do_action_100_fields fields;
45057 struct packet_unit_do_action *old;
45058 struct genhash **hash = pc->phs.received + PACKET_UNIT_DO_ACTION;
45059#endif /* FREECIV_DELTA_PROTOCOL */
45060 RECEIVE_PACKET_START(packet_unit_do_action, real_packet);
45061#ifdef FREECIV_JSON_CONNECTION
45062 struct plocation field_addr;
45063 {
45064 struct plocation *field_addr_tmp = plocation_field_new(NULL);
45065 field_addr = *field_addr_tmp;
45066 FC_FREE(field_addr_tmp);
45067 }
45068#endif /* FREECIV_JSON_CONNECTION */
45069
45070#ifdef FREECIV_DELTA_PROTOCOL
45071#ifdef FREECIV_JSON_CONNECTION
45072 field_addr.name = "fields";
45073#endif /* FREECIV_JSON_CONNECTION */
45074 DIO_BV_GET(&din, &field_addr, fields);
45075
45076#else /* FREECIV_DELTA_PROTOCOL */
45077 #ifdef FREECIV_JSON_CONNECTION
45078 field_addr.name = "actor_id32";
45079 #endif /* FREECIV_JSON_CONNECTION */
45080 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id32)) {
45081 RECEIVE_PACKET_FIELD_ERROR(actor_id32);
45082 }
45083 #ifdef FREECIV_JSON_CONNECTION
45084 field_addr.name = "target_id";
45085 #endif /* FREECIV_JSON_CONNECTION */
45086 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
45087 RECEIVE_PACKET_FIELD_ERROR(target_id);
45088 }
45089 #ifdef FREECIV_JSON_CONNECTION
45090 field_addr.name = "sub_tgt_id";
45091 #endif /* FREECIV_JSON_CONNECTION */
45092 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->sub_tgt_id)) {
45093 RECEIVE_PACKET_FIELD_ERROR(sub_tgt_id);
45094 }
45095 #ifdef FREECIV_JSON_CONNECTION
45096 field_addr.name = "name";
45097 #endif /* FREECIV_JSON_CONNECTION */
45098 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
45099 RECEIVE_PACKET_FIELD_ERROR(name);
45100 }
45101 #ifdef FREECIV_JSON_CONNECTION
45102 field_addr.name = "action_type";
45103 #endif /* FREECIV_JSON_CONNECTION */
45104 {
45105 int readin;
45106
45107 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
45108 RECEIVE_PACKET_FIELD_ERROR(action_type);
45109 }
45110 real_packet->action_type = readin;
45111 }
45112
45113#endif
45114 log_packet_detailed("packet_unit_do_action_100: got info about ()");
45115
45116#ifdef FREECIV_DELTA_PROTOCOL
45117 if (NULL == *hash) {
45118 *hash = genhash_new_full(hash_packet_unit_do_action_100, cmp_packet_unit_do_action_100,
45119 NULL, NULL, NULL, free);
45120 }
45121
45122 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
45123 *real_packet = *old;
45124 } else {
45125 log_packet_detailed(" no old info");
45126 memset(real_packet, 0, sizeof(*real_packet));
45127 }
45128
45129 if (BV_ISSET(fields, 0)) {
45130 log_packet_detailed(" got field 'actor_id32'");
45131 #ifdef FREECIV_JSON_CONNECTION
45132 field_addr.name = "actor_id32";
45133 #endif /* FREECIV_JSON_CONNECTION */
45134 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id32)) {
45135 RECEIVE_PACKET_FIELD_ERROR(actor_id32);
45136 }
45137 }
45138 if (BV_ISSET(fields, 1)) {
45139 log_packet_detailed(" got field 'target_id'");
45140 #ifdef FREECIV_JSON_CONNECTION
45141 field_addr.name = "target_id";
45142 #endif /* FREECIV_JSON_CONNECTION */
45143 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
45144 RECEIVE_PACKET_FIELD_ERROR(target_id);
45145 }
45146 }
45147 if (BV_ISSET(fields, 2)) {
45148 log_packet_detailed(" got field 'sub_tgt_id'");
45149 #ifdef FREECIV_JSON_CONNECTION
45150 field_addr.name = "sub_tgt_id";
45151 #endif /* FREECIV_JSON_CONNECTION */
45152 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->sub_tgt_id)) {
45153 RECEIVE_PACKET_FIELD_ERROR(sub_tgt_id);
45154 }
45155 }
45156 if (BV_ISSET(fields, 3)) {
45157 log_packet_detailed(" got field 'name'");
45158 #ifdef FREECIV_JSON_CONNECTION
45159 field_addr.name = "name";
45160 #endif /* FREECIV_JSON_CONNECTION */
45161 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
45162 RECEIVE_PACKET_FIELD_ERROR(name);
45163 }
45164 }
45165 if (BV_ISSET(fields, 4)) {
45166 log_packet_detailed(" got field 'action_type'");
45167 #ifdef FREECIV_JSON_CONNECTION
45168 field_addr.name = "action_type";
45169 #endif /* FREECIV_JSON_CONNECTION */
45170 {
45171 int readin;
45172
45173 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
45174 RECEIVE_PACKET_FIELD_ERROR(action_type);
45175 }
45176 real_packet->action_type = readin;
45177 }
45178 }
45179
45180 if (NULL == old) {
45181 old = fc_malloc(sizeof(*old));
45182 *old = *real_packet;
45183 genhash_insert(*hash, old, old);
45184 } else {
45185 *old = *real_packet;
45186 }
45187
45188#endif /* FREECIV_DELTA_PROTOCOL */
45189 RECEIVE_PACKET_END(real_packet);
45190}
45191
45192 static int send_packet_unit_do_action_100(struct connection *pc, const struct packet_unit_do_action *packet)
45193{
45194 const struct packet_unit_do_action *real_packet = packet;
45195#ifdef FREECIV_DELTA_PROTOCOL
45196 packet_unit_do_action_100_fields fields;
45197 struct packet_unit_do_action *old;
45198 bool differ;
45199 struct genhash **hash = pc->phs.sent + PACKET_UNIT_DO_ACTION;
45200#endif /* FREECIV_DELTA_PROTOCOL */
45201 SEND_PACKET_START(PACKET_UNIT_DO_ACTION);
45202#ifdef FREECIV_JSON_CONNECTION
45203 struct plocation field_addr;
45204 {
45205 struct plocation *field_addr_tmp = plocation_field_new(NULL);
45206 field_addr = *field_addr_tmp;
45207 FC_FREE(field_addr_tmp);
45208 }
45209#endif /* FREECIV_JSON_CONNECTION */
45210
45211 log_packet_detailed("packet_unit_do_action_100: sending info about ()");
45212
45213#ifdef FREECIV_DELTA_PROTOCOL
45214 if (NULL == *hash) {
45215 *hash = genhash_new_full(hash_packet_unit_do_action_100, cmp_packet_unit_do_action_100,
45216 NULL, NULL, NULL, free);
45217 }
45218 BV_CLR_ALL(fields);
45219
45220 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
45221 old = fc_malloc(sizeof(*old));
45222 *old = *real_packet;
45223 genhash_insert(*hash, old, old);
45224 memset(old, 0, sizeof(*old));
45225 }
45226 differ = (old->actor_id32 != real_packet->actor_id32);
45227 if (differ) {
45228 BV_SET(fields, 0);
45229 }
45230
45231 differ = (old->target_id != real_packet->target_id);
45232 if (differ) {
45233 BV_SET(fields, 1);
45234 }
45235
45236 differ = (old->sub_tgt_id != real_packet->sub_tgt_id);
45237 if (differ) {
45238 BV_SET(fields, 2);
45239 }
45240
45241 differ = (strcmp(old->name, real_packet->name) != 0);
45242 if (differ) {
45243 BV_SET(fields, 3);
45244 }
45245
45246 differ = (old->action_type != real_packet->action_type);
45247 if (differ) {
45248 BV_SET(fields, 4);
45249 }
45250
45251
45252#ifdef FREECIV_JSON_CONNECTION
45253 field_addr.name = "fields";
45254#endif /* FREECIV_JSON_CONNECTION */
45255 DIO_BV_PUT(&dout, &field_addr, fields);
45256
45257 if (BV_ISSET(fields, 0)) {
45258 log_packet_detailed(" field 'actor_id32' has changed");
45259 #ifdef FREECIV_JSON_CONNECTION
45260 field_addr.name = "actor_id32";
45261#endif /* FREECIV_JSON_CONNECTION */
45262 DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id32);
45263 }
45264 if (BV_ISSET(fields, 1)) {
45265 log_packet_detailed(" field 'target_id' has changed");
45266 #ifdef FREECIV_JSON_CONNECTION
45267 field_addr.name = "target_id";
45268#endif /* FREECIV_JSON_CONNECTION */
45269 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
45270 }
45271 if (BV_ISSET(fields, 2)) {
45272 log_packet_detailed(" field 'sub_tgt_id' has changed");
45273 #ifdef FREECIV_JSON_CONNECTION
45274 field_addr.name = "sub_tgt_id";
45275#endif /* FREECIV_JSON_CONNECTION */
45276 DIO_PUT(sint16, &dout, &field_addr, real_packet->sub_tgt_id);
45277 }
45278 if (BV_ISSET(fields, 3)) {
45279 log_packet_detailed(" field 'name' has changed");
45280 #ifdef FREECIV_JSON_CONNECTION
45281 field_addr.name = "name";
45282#endif /* FREECIV_JSON_CONNECTION */
45283 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
45284 }
45285 if (BV_ISSET(fields, 4)) {
45286 log_packet_detailed(" field 'action_type' has changed");
45287 #ifdef FREECIV_JSON_CONNECTION
45288 field_addr.name = "action_type";
45289#endif /* FREECIV_JSON_CONNECTION */
45290 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
45291 }
45292
45293 *old = *real_packet;
45294#endif /* FREECIV_DELTA_PROTOCOL */
45295#ifndef FREECIV_DELTA_PROTOCOL
45296#ifdef FREECIV_JSON_CONNECTION
45297 field_addr.name = "actor_id32";
45298#endif /* FREECIV_JSON_CONNECTION */
45299 DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id32);
45300#ifdef FREECIV_JSON_CONNECTION
45301 field_addr.name = "target_id";
45302#endif /* FREECIV_JSON_CONNECTION */
45303 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
45304#ifdef FREECIV_JSON_CONNECTION
45305 field_addr.name = "sub_tgt_id";
45306#endif /* FREECIV_JSON_CONNECTION */
45307 DIO_PUT(sint16, &dout, &field_addr, real_packet->sub_tgt_id);
45308#ifdef FREECIV_JSON_CONNECTION
45309 field_addr.name = "name";
45310#endif /* FREECIV_JSON_CONNECTION */
45311 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
45312#ifdef FREECIV_JSON_CONNECTION
45313 field_addr.name = "action_type";
45314#endif /* FREECIV_JSON_CONNECTION */
45315 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
45316
45317#endif
45318 SEND_PACKET_END(PACKET_UNIT_DO_ACTION);
45319}
45320
45321#ifdef FREECIV_DELTA_PROTOCOL
45322#define hash_packet_unit_do_action_101 hash_const
45323
45324#define cmp_packet_unit_do_action_101 cmp_const
45325
45326 BV_DEFINE(packet_unit_do_action_101_fields, 5);
45327#endif /* FREECIV_DELTA_PROTOCOL */
45328
45329 static struct packet_unit_do_action *receive_packet_unit_do_action_101(struct connection *pc)
45330{
45331#ifdef FREECIV_DELTA_PROTOCOL
45332 packet_unit_do_action_101_fields fields;
45333 struct packet_unit_do_action *old;
45334 struct genhash **hash = pc->phs.received + PACKET_UNIT_DO_ACTION;
45335#endif /* FREECIV_DELTA_PROTOCOL */
45336 RECEIVE_PACKET_START(packet_unit_do_action, real_packet);
45337#ifdef FREECIV_JSON_CONNECTION
45338 struct plocation field_addr;
45339 {
45340 struct plocation *field_addr_tmp = plocation_field_new(NULL);
45341 field_addr = *field_addr_tmp;
45342 FC_FREE(field_addr_tmp);
45343 }
45344#endif /* FREECIV_JSON_CONNECTION */
45345
45346#ifdef FREECIV_DELTA_PROTOCOL
45347#ifdef FREECIV_JSON_CONNECTION
45348 field_addr.name = "fields";
45349#endif /* FREECIV_JSON_CONNECTION */
45350 DIO_BV_GET(&din, &field_addr, fields);
45351
45352#else /* FREECIV_DELTA_PROTOCOL */
45353 #ifdef FREECIV_JSON_CONNECTION
45354 field_addr.name = "actor_id16";
45355 #endif /* FREECIV_JSON_CONNECTION */
45356 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->actor_id16)) {
45357 RECEIVE_PACKET_FIELD_ERROR(actor_id16);
45358 }
45359 #ifdef FREECIV_JSON_CONNECTION
45360 field_addr.name = "target_id";
45361 #endif /* FREECIV_JSON_CONNECTION */
45362 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
45363 RECEIVE_PACKET_FIELD_ERROR(target_id);
45364 }
45365 #ifdef FREECIV_JSON_CONNECTION
45366 field_addr.name = "sub_tgt_id";
45367 #endif /* FREECIV_JSON_CONNECTION */
45368 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->sub_tgt_id)) {
45369 RECEIVE_PACKET_FIELD_ERROR(sub_tgt_id);
45370 }
45371 #ifdef FREECIV_JSON_CONNECTION
45372 field_addr.name = "name";
45373 #endif /* FREECIV_JSON_CONNECTION */
45374 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
45375 RECEIVE_PACKET_FIELD_ERROR(name);
45376 }
45377 #ifdef FREECIV_JSON_CONNECTION
45378 field_addr.name = "action_type";
45379 #endif /* FREECIV_JSON_CONNECTION */
45380 {
45381 int readin;
45382
45383 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
45384 RECEIVE_PACKET_FIELD_ERROR(action_type);
45385 }
45386 real_packet->action_type = readin;
45387 }
45388
45389#endif
45390 log_packet_detailed("packet_unit_do_action_101: got info about ()");
45391
45392#ifdef FREECIV_DELTA_PROTOCOL
45393 if (NULL == *hash) {
45394 *hash = genhash_new_full(hash_packet_unit_do_action_101, cmp_packet_unit_do_action_101,
45395 NULL, NULL, NULL, free);
45396 }
45397
45398 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
45399 *real_packet = *old;
45400 } else {
45401 log_packet_detailed(" no old info");
45402 memset(real_packet, 0, sizeof(*real_packet));
45403 }
45404
45405 if (BV_ISSET(fields, 0)) {
45406 log_packet_detailed(" got field 'actor_id16'");
45407 #ifdef FREECIV_JSON_CONNECTION
45408 field_addr.name = "actor_id16";
45409 #endif /* FREECIV_JSON_CONNECTION */
45410 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->actor_id16)) {
45411 RECEIVE_PACKET_FIELD_ERROR(actor_id16);
45412 }
45413 }
45414 if (BV_ISSET(fields, 1)) {
45415 log_packet_detailed(" got field 'target_id'");
45416 #ifdef FREECIV_JSON_CONNECTION
45417 field_addr.name = "target_id";
45418 #endif /* FREECIV_JSON_CONNECTION */
45419 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
45420 RECEIVE_PACKET_FIELD_ERROR(target_id);
45421 }
45422 }
45423 if (BV_ISSET(fields, 2)) {
45424 log_packet_detailed(" got field 'sub_tgt_id'");
45425 #ifdef FREECIV_JSON_CONNECTION
45426 field_addr.name = "sub_tgt_id";
45427 #endif /* FREECIV_JSON_CONNECTION */
45428 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->sub_tgt_id)) {
45429 RECEIVE_PACKET_FIELD_ERROR(sub_tgt_id);
45430 }
45431 }
45432 if (BV_ISSET(fields, 3)) {
45433 log_packet_detailed(" got field 'name'");
45434 #ifdef FREECIV_JSON_CONNECTION
45435 field_addr.name = "name";
45436 #endif /* FREECIV_JSON_CONNECTION */
45437 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
45438 RECEIVE_PACKET_FIELD_ERROR(name);
45439 }
45440 }
45441 if (BV_ISSET(fields, 4)) {
45442 log_packet_detailed(" got field 'action_type'");
45443 #ifdef FREECIV_JSON_CONNECTION
45444 field_addr.name = "action_type";
45445 #endif /* FREECIV_JSON_CONNECTION */
45446 {
45447 int readin;
45448
45449 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
45450 RECEIVE_PACKET_FIELD_ERROR(action_type);
45451 }
45452 real_packet->action_type = readin;
45453 }
45454 }
45455
45456 if (NULL == old) {
45457 old = fc_malloc(sizeof(*old));
45458 *old = *real_packet;
45459 genhash_insert(*hash, old, old);
45460 } else {
45461 *old = *real_packet;
45462 }
45463
45464#endif /* FREECIV_DELTA_PROTOCOL */
45465 RECEIVE_PACKET_END(real_packet);
45466}
45467
45468 static int send_packet_unit_do_action_101(struct connection *pc, const struct packet_unit_do_action *packet)
45469{
45470 const struct packet_unit_do_action *real_packet = packet;
45471#ifdef FREECIV_DELTA_PROTOCOL
45472 packet_unit_do_action_101_fields fields;
45473 struct packet_unit_do_action *old;
45474 bool differ;
45475 struct genhash **hash = pc->phs.sent + PACKET_UNIT_DO_ACTION;
45476#endif /* FREECIV_DELTA_PROTOCOL */
45477 SEND_PACKET_START(PACKET_UNIT_DO_ACTION);
45478#ifdef FREECIV_JSON_CONNECTION
45479 struct plocation field_addr;
45480 {
45481 struct plocation *field_addr_tmp = plocation_field_new(NULL);
45482 field_addr = *field_addr_tmp;
45483 FC_FREE(field_addr_tmp);
45484 }
45485#endif /* FREECIV_JSON_CONNECTION */
45486
45487 log_packet_detailed("packet_unit_do_action_101: sending info about ()");
45488
45489#ifdef FREECIV_DELTA_PROTOCOL
45490 if (NULL == *hash) {
45491 *hash = genhash_new_full(hash_packet_unit_do_action_101, cmp_packet_unit_do_action_101,
45492 NULL, NULL, NULL, free);
45493 }
45494 BV_CLR_ALL(fields);
45495
45496 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
45497 old = fc_malloc(sizeof(*old));
45498 *old = *real_packet;
45499 genhash_insert(*hash, old, old);
45500 memset(old, 0, sizeof(*old));
45501 }
45502 differ = (old->actor_id16 != real_packet->actor_id16);
45503 if (differ) {
45504 BV_SET(fields, 0);
45505 }
45506
45507 differ = (old->target_id != real_packet->target_id);
45508 if (differ) {
45509 BV_SET(fields, 1);
45510 }
45511
45512 differ = (old->sub_tgt_id != real_packet->sub_tgt_id);
45513 if (differ) {
45514 BV_SET(fields, 2);
45515 }
45516
45517 differ = (strcmp(old->name, real_packet->name) != 0);
45518 if (differ) {
45519 BV_SET(fields, 3);
45520 }
45521
45522 differ = (old->action_type != real_packet->action_type);
45523 if (differ) {
45524 BV_SET(fields, 4);
45525 }
45526
45527
45528#ifdef FREECIV_JSON_CONNECTION
45529 field_addr.name = "fields";
45530#endif /* FREECIV_JSON_CONNECTION */
45531 DIO_BV_PUT(&dout, &field_addr, fields);
45532
45533 if (BV_ISSET(fields, 0)) {
45534 log_packet_detailed(" field 'actor_id16' has changed");
45535 #ifdef FREECIV_JSON_CONNECTION
45536 field_addr.name = "actor_id16";
45537#endif /* FREECIV_JSON_CONNECTION */
45538 DIO_PUT(uint16, &dout, &field_addr, real_packet->actor_id16);
45539 }
45540 if (BV_ISSET(fields, 1)) {
45541 log_packet_detailed(" field 'target_id' has changed");
45542 #ifdef FREECIV_JSON_CONNECTION
45543 field_addr.name = "target_id";
45544#endif /* FREECIV_JSON_CONNECTION */
45545 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
45546 }
45547 if (BV_ISSET(fields, 2)) {
45548 log_packet_detailed(" field 'sub_tgt_id' has changed");
45549 #ifdef FREECIV_JSON_CONNECTION
45550 field_addr.name = "sub_tgt_id";
45551#endif /* FREECIV_JSON_CONNECTION */
45552 DIO_PUT(sint16, &dout, &field_addr, real_packet->sub_tgt_id);
45553 }
45554 if (BV_ISSET(fields, 3)) {
45555 log_packet_detailed(" field 'name' has changed");
45556 #ifdef FREECIV_JSON_CONNECTION
45557 field_addr.name = "name";
45558#endif /* FREECIV_JSON_CONNECTION */
45559 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
45560 }
45561 if (BV_ISSET(fields, 4)) {
45562 log_packet_detailed(" field 'action_type' has changed");
45563 #ifdef FREECIV_JSON_CONNECTION
45564 field_addr.name = "action_type";
45565#endif /* FREECIV_JSON_CONNECTION */
45566 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
45567 }
45568
45569 *old = *real_packet;
45570#endif /* FREECIV_DELTA_PROTOCOL */
45571#ifndef FREECIV_DELTA_PROTOCOL
45572#ifdef FREECIV_JSON_CONNECTION
45573 field_addr.name = "actor_id16";
45574#endif /* FREECIV_JSON_CONNECTION */
45575 DIO_PUT(uint16, &dout, &field_addr, real_packet->actor_id16);
45576#ifdef FREECIV_JSON_CONNECTION
45577 field_addr.name = "target_id";
45578#endif /* FREECIV_JSON_CONNECTION */
45579 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
45580#ifdef FREECIV_JSON_CONNECTION
45581 field_addr.name = "sub_tgt_id";
45582#endif /* FREECIV_JSON_CONNECTION */
45583 DIO_PUT(sint16, &dout, &field_addr, real_packet->sub_tgt_id);
45584#ifdef FREECIV_JSON_CONNECTION
45585 field_addr.name = "name";
45586#endif /* FREECIV_JSON_CONNECTION */
45587 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
45588#ifdef FREECIV_JSON_CONNECTION
45589 field_addr.name = "action_type";
45590#endif /* FREECIV_JSON_CONNECTION */
45591 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
45592
45593#endif
45594 SEND_PACKET_END(PACKET_UNIT_DO_ACTION);
45595}
45596
45597 int send_packet_unit_do_action(struct connection *pc, const struct packet_unit_do_action *packet)
45598{
45599 if (!pc->used) {
45600 log_error("WARNING: trying to send data to the closed connection %s",
45601 conn_description(pc));
45602 return -1;
45603 }
45604 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_DO_ACTION].packet != NULL, -1,
45605 "Handler for PACKET_UNIT_DO_ACTION not installed");
45606 return pc->phs.handlers->send[PACKET_UNIT_DO_ACTION].packet(pc, packet);
45607}
45608
45609 int dsend_packet_unit_do_action(struct connection *pc, int actor_id16, int actor_id32, int target_id, int sub_tgt_id, const char *name, action_id action_type)
45610{
45611 struct packet_unit_do_action packet, *real_packet = &packet;
45612
45613 real_packet->actor_id16 = actor_id16;
45614 real_packet->actor_id32 = actor_id32;
45615 real_packet->target_id = target_id;
45616 real_packet->sub_tgt_id = sub_tgt_id;
45617 sz_strlcpy(real_packet->name, name);
45618 real_packet->action_type = action_type;
45619
45620 return send_packet_unit_do_action(pc, real_packet);
45621}
45622
45623#ifdef FREECIV_DELTA_PROTOCOL
45624#define hash_packet_unit_action_answer_100 hash_const
45625
45626#define cmp_packet_unit_action_answer_100 cmp_const
45627
45628 BV_DEFINE(packet_unit_action_answer_100_fields, 5);
45629#endif /* FREECIV_DELTA_PROTOCOL */
45630
45631 static struct packet_unit_action_answer *receive_packet_unit_action_answer_100(struct connection *pc)
45632{
45633#ifdef FREECIV_DELTA_PROTOCOL
45634 packet_unit_action_answer_100_fields fields;
45635 struct packet_unit_action_answer *old;
45636 struct genhash **hash = pc->phs.received + PACKET_UNIT_ACTION_ANSWER;
45637#endif /* FREECIV_DELTA_PROTOCOL */
45638 RECEIVE_PACKET_START(packet_unit_action_answer, real_packet);
45639#ifdef FREECIV_JSON_CONNECTION
45640 struct plocation field_addr;
45641 {
45642 struct plocation *field_addr_tmp = plocation_field_new(NULL);
45643 field_addr = *field_addr_tmp;
45644 FC_FREE(field_addr_tmp);
45645 }
45646#endif /* FREECIV_JSON_CONNECTION */
45647
45648#ifdef FREECIV_DELTA_PROTOCOL
45649#ifdef FREECIV_JSON_CONNECTION
45650 field_addr.name = "fields";
45651#endif /* FREECIV_JSON_CONNECTION */
45652 DIO_BV_GET(&din, &field_addr, fields);
45653
45654#else /* FREECIV_DELTA_PROTOCOL */
45655 #ifdef FREECIV_JSON_CONNECTION
45656 field_addr.name = "actor_id32";
45657 #endif /* FREECIV_JSON_CONNECTION */
45658 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id32)) {
45659 RECEIVE_PACKET_FIELD_ERROR(actor_id32);
45660 }
45661 #ifdef FREECIV_JSON_CONNECTION
45662 field_addr.name = "target_id";
45663 #endif /* FREECIV_JSON_CONNECTION */
45664 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
45665 RECEIVE_PACKET_FIELD_ERROR(target_id);
45666 }
45667 #ifdef FREECIV_JSON_CONNECTION
45668 field_addr.name = "cost";
45669 #endif /* FREECIV_JSON_CONNECTION */
45670 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->cost)) {
45671 RECEIVE_PACKET_FIELD_ERROR(cost);
45672 }
45673 #ifdef FREECIV_JSON_CONNECTION
45674 field_addr.name = "action_type";
45675 #endif /* FREECIV_JSON_CONNECTION */
45676 {
45677 int readin;
45678
45679 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
45680 RECEIVE_PACKET_FIELD_ERROR(action_type);
45681 }
45682 real_packet->action_type = readin;
45683 }
45684 #ifdef FREECIV_JSON_CONNECTION
45685 field_addr.name = "request_kind";
45686 #endif /* FREECIV_JSON_CONNECTION */
45687 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
45688 RECEIVE_PACKET_FIELD_ERROR(request_kind);
45689 }
45690
45691#endif
45692 log_packet_detailed("packet_unit_action_answer_100: got info about ()");
45693
45694#ifdef FREECIV_DELTA_PROTOCOL
45695 if (NULL == *hash) {
45696 *hash = genhash_new_full(hash_packet_unit_action_answer_100, cmp_packet_unit_action_answer_100,
45697 NULL, NULL, NULL, free);
45698 }
45699
45700 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
45701 *real_packet = *old;
45702 } else {
45703 log_packet_detailed(" no old info");
45704 memset(real_packet, 0, sizeof(*real_packet));
45705 }
45706
45707 if (BV_ISSET(fields, 0)) {
45708 log_packet_detailed(" got field 'actor_id32'");
45709 #ifdef FREECIV_JSON_CONNECTION
45710 field_addr.name = "actor_id32";
45711 #endif /* FREECIV_JSON_CONNECTION */
45712 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id32)) {
45713 RECEIVE_PACKET_FIELD_ERROR(actor_id32);
45714 }
45715 }
45716 if (BV_ISSET(fields, 1)) {
45717 log_packet_detailed(" got field 'target_id'");
45718 #ifdef FREECIV_JSON_CONNECTION
45719 field_addr.name = "target_id";
45720 #endif /* FREECIV_JSON_CONNECTION */
45721 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
45722 RECEIVE_PACKET_FIELD_ERROR(target_id);
45723 }
45724 }
45725 if (BV_ISSET(fields, 2)) {
45726 log_packet_detailed(" got field 'cost'");
45727 #ifdef FREECIV_JSON_CONNECTION
45728 field_addr.name = "cost";
45729 #endif /* FREECIV_JSON_CONNECTION */
45730 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->cost)) {
45731 RECEIVE_PACKET_FIELD_ERROR(cost);
45732 }
45733 }
45734 if (BV_ISSET(fields, 3)) {
45735 log_packet_detailed(" got field 'action_type'");
45736 #ifdef FREECIV_JSON_CONNECTION
45737 field_addr.name = "action_type";
45738 #endif /* FREECIV_JSON_CONNECTION */
45739 {
45740 int readin;
45741
45742 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
45743 RECEIVE_PACKET_FIELD_ERROR(action_type);
45744 }
45745 real_packet->action_type = readin;
45746 }
45747 }
45748 if (BV_ISSET(fields, 4)) {
45749 log_packet_detailed(" got field 'request_kind'");
45750 #ifdef FREECIV_JSON_CONNECTION
45751 field_addr.name = "request_kind";
45752 #endif /* FREECIV_JSON_CONNECTION */
45753 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
45754 RECEIVE_PACKET_FIELD_ERROR(request_kind);
45755 }
45756 }
45757
45758 if (NULL == old) {
45759 old = fc_malloc(sizeof(*old));
45760 *old = *real_packet;
45761 genhash_insert(*hash, old, old);
45762 } else {
45763 *old = *real_packet;
45764 }
45765
45766#endif /* FREECIV_DELTA_PROTOCOL */
45767 RECEIVE_PACKET_END(real_packet);
45768}
45769
45770 static int send_packet_unit_action_answer_100(struct connection *pc, const struct packet_unit_action_answer *packet)
45771{
45772 const struct packet_unit_action_answer *real_packet = packet;
45773#ifdef FREECIV_DELTA_PROTOCOL
45774 packet_unit_action_answer_100_fields fields;
45775 struct packet_unit_action_answer *old;
45776 bool differ;
45777 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ACTION_ANSWER;
45778#endif /* FREECIV_DELTA_PROTOCOL */
45779 SEND_PACKET_START(PACKET_UNIT_ACTION_ANSWER);
45780#ifdef FREECIV_JSON_CONNECTION
45781 struct plocation field_addr;
45782 {
45783 struct plocation *field_addr_tmp = plocation_field_new(NULL);
45784 field_addr = *field_addr_tmp;
45785 FC_FREE(field_addr_tmp);
45786 }
45787#endif /* FREECIV_JSON_CONNECTION */
45788
45789 log_packet_detailed("packet_unit_action_answer_100: sending info about ()");
45790
45791#ifdef FREECIV_DELTA_PROTOCOL
45792 if (NULL == *hash) {
45793 *hash = genhash_new_full(hash_packet_unit_action_answer_100, cmp_packet_unit_action_answer_100,
45794 NULL, NULL, NULL, free);
45795 }
45796 BV_CLR_ALL(fields);
45797
45798 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
45799 old = fc_malloc(sizeof(*old));
45800 *old = *real_packet;
45801 genhash_insert(*hash, old, old);
45802 memset(old, 0, sizeof(*old));
45803 }
45804 differ = (old->actor_id32 != real_packet->actor_id32);
45805 if (differ) {
45806 BV_SET(fields, 0);
45807 }
45808
45809 differ = (old->target_id != real_packet->target_id);
45810 if (differ) {
45811 BV_SET(fields, 1);
45812 }
45813
45814 differ = (old->cost != real_packet->cost);
45815 if (differ) {
45816 BV_SET(fields, 2);
45817 }
45818
45819 differ = (old->action_type != real_packet->action_type);
45820 if (differ) {
45821 BV_SET(fields, 3);
45822 }
45823
45824 differ = (old->request_kind != real_packet->request_kind);
45825 if (differ) {
45826 BV_SET(fields, 4);
45827 }
45828
45829
45830#ifdef FREECIV_JSON_CONNECTION
45831 field_addr.name = "fields";
45832#endif /* FREECIV_JSON_CONNECTION */
45833 DIO_BV_PUT(&dout, &field_addr, fields);
45834
45835 if (BV_ISSET(fields, 0)) {
45836 log_packet_detailed(" field 'actor_id32' has changed");
45837 #ifdef FREECIV_JSON_CONNECTION
45838 field_addr.name = "actor_id32";
45839#endif /* FREECIV_JSON_CONNECTION */
45840 DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id32);
45841 }
45842 if (BV_ISSET(fields, 1)) {
45843 log_packet_detailed(" field 'target_id' has changed");
45844 #ifdef FREECIV_JSON_CONNECTION
45845 field_addr.name = "target_id";
45846#endif /* FREECIV_JSON_CONNECTION */
45847 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
45848 }
45849 if (BV_ISSET(fields, 2)) {
45850 log_packet_detailed(" field 'cost' has changed");
45851 #ifdef FREECIV_JSON_CONNECTION
45852 field_addr.name = "cost";
45853#endif /* FREECIV_JSON_CONNECTION */
45854 DIO_PUT(uint32, &dout, &field_addr, real_packet->cost);
45855 }
45856 if (BV_ISSET(fields, 3)) {
45857 log_packet_detailed(" field 'action_type' has changed");
45858 #ifdef FREECIV_JSON_CONNECTION
45859 field_addr.name = "action_type";
45860#endif /* FREECIV_JSON_CONNECTION */
45861 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
45862 }
45863 if (BV_ISSET(fields, 4)) {
45864 log_packet_detailed(" field 'request_kind' has changed");
45865 #ifdef FREECIV_JSON_CONNECTION
45866 field_addr.name = "request_kind";
45867#endif /* FREECIV_JSON_CONNECTION */
45868 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
45869 }
45870
45871 *old = *real_packet;
45872#endif /* FREECIV_DELTA_PROTOCOL */
45873#ifndef FREECIV_DELTA_PROTOCOL
45874#ifdef FREECIV_JSON_CONNECTION
45875 field_addr.name = "actor_id32";
45876#endif /* FREECIV_JSON_CONNECTION */
45877 DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id32);
45878#ifdef FREECIV_JSON_CONNECTION
45879 field_addr.name = "target_id";
45880#endif /* FREECIV_JSON_CONNECTION */
45881 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
45882#ifdef FREECIV_JSON_CONNECTION
45883 field_addr.name = "cost";
45884#endif /* FREECIV_JSON_CONNECTION */
45885 DIO_PUT(uint32, &dout, &field_addr, real_packet->cost);
45886#ifdef FREECIV_JSON_CONNECTION
45887 field_addr.name = "action_type";
45888#endif /* FREECIV_JSON_CONNECTION */
45889 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
45890#ifdef FREECIV_JSON_CONNECTION
45891 field_addr.name = "request_kind";
45892#endif /* FREECIV_JSON_CONNECTION */
45893 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
45894
45895#endif
45896 SEND_PACKET_END(PACKET_UNIT_ACTION_ANSWER);
45897}
45898
45899#ifdef FREECIV_DELTA_PROTOCOL
45900#define hash_packet_unit_action_answer_101 hash_const
45901
45902#define cmp_packet_unit_action_answer_101 cmp_const
45903
45904 BV_DEFINE(packet_unit_action_answer_101_fields, 5);
45905#endif /* FREECIV_DELTA_PROTOCOL */
45906
45907 static struct packet_unit_action_answer *receive_packet_unit_action_answer_101(struct connection *pc)
45908{
45909#ifdef FREECIV_DELTA_PROTOCOL
45910 packet_unit_action_answer_101_fields fields;
45911 struct packet_unit_action_answer *old;
45912 struct genhash **hash = pc->phs.received + PACKET_UNIT_ACTION_ANSWER;
45913#endif /* FREECIV_DELTA_PROTOCOL */
45914 RECEIVE_PACKET_START(packet_unit_action_answer, real_packet);
45915#ifdef FREECIV_JSON_CONNECTION
45916 struct plocation field_addr;
45917 {
45918 struct plocation *field_addr_tmp = plocation_field_new(NULL);
45919 field_addr = *field_addr_tmp;
45920 FC_FREE(field_addr_tmp);
45921 }
45922#endif /* FREECIV_JSON_CONNECTION */
45923
45924#ifdef FREECIV_DELTA_PROTOCOL
45925#ifdef FREECIV_JSON_CONNECTION
45926 field_addr.name = "fields";
45927#endif /* FREECIV_JSON_CONNECTION */
45928 DIO_BV_GET(&din, &field_addr, fields);
45929
45930#else /* FREECIV_DELTA_PROTOCOL */
45931 #ifdef FREECIV_JSON_CONNECTION
45932 field_addr.name = "actor_id16";
45933 #endif /* FREECIV_JSON_CONNECTION */
45934 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->actor_id16)) {
45935 RECEIVE_PACKET_FIELD_ERROR(actor_id16);
45936 }
45937 #ifdef FREECIV_JSON_CONNECTION
45938 field_addr.name = "target_id";
45939 #endif /* FREECIV_JSON_CONNECTION */
45940 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
45941 RECEIVE_PACKET_FIELD_ERROR(target_id);
45942 }
45943 #ifdef FREECIV_JSON_CONNECTION
45944 field_addr.name = "cost";
45945 #endif /* FREECIV_JSON_CONNECTION */
45946 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->cost)) {
45947 RECEIVE_PACKET_FIELD_ERROR(cost);
45948 }
45949 #ifdef FREECIV_JSON_CONNECTION
45950 field_addr.name = "action_type";
45951 #endif /* FREECIV_JSON_CONNECTION */
45952 {
45953 int readin;
45954
45955 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
45956 RECEIVE_PACKET_FIELD_ERROR(action_type);
45957 }
45958 real_packet->action_type = readin;
45959 }
45960 #ifdef FREECIV_JSON_CONNECTION
45961 field_addr.name = "request_kind";
45962 #endif /* FREECIV_JSON_CONNECTION */
45963 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
45964 RECEIVE_PACKET_FIELD_ERROR(request_kind);
45965 }
45966
45967#endif
45968 log_packet_detailed("packet_unit_action_answer_101: got info about ()");
45969
45970#ifdef FREECIV_DELTA_PROTOCOL
45971 if (NULL == *hash) {
45972 *hash = genhash_new_full(hash_packet_unit_action_answer_101, cmp_packet_unit_action_answer_101,
45973 NULL, NULL, NULL, free);
45974 }
45975
45976 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
45977 *real_packet = *old;
45978 } else {
45979 log_packet_detailed(" no old info");
45980 memset(real_packet, 0, sizeof(*real_packet));
45981 }
45982
45983 if (BV_ISSET(fields, 0)) {
45984 log_packet_detailed(" got field 'actor_id16'");
45985 #ifdef FREECIV_JSON_CONNECTION
45986 field_addr.name = "actor_id16";
45987 #endif /* FREECIV_JSON_CONNECTION */
45988 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->actor_id16)) {
45989 RECEIVE_PACKET_FIELD_ERROR(actor_id16);
45990 }
45991 }
45992 if (BV_ISSET(fields, 1)) {
45993 log_packet_detailed(" got field 'target_id'");
45994 #ifdef FREECIV_JSON_CONNECTION
45995 field_addr.name = "target_id";
45996 #endif /* FREECIV_JSON_CONNECTION */
45997 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
45998 RECEIVE_PACKET_FIELD_ERROR(target_id);
45999 }
46000 }
46001 if (BV_ISSET(fields, 2)) {
46002 log_packet_detailed(" got field 'cost'");
46003 #ifdef FREECIV_JSON_CONNECTION
46004 field_addr.name = "cost";
46005 #endif /* FREECIV_JSON_CONNECTION */
46006 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->cost)) {
46007 RECEIVE_PACKET_FIELD_ERROR(cost);
46008 }
46009 }
46010 if (BV_ISSET(fields, 3)) {
46011 log_packet_detailed(" got field 'action_type'");
46012 #ifdef FREECIV_JSON_CONNECTION
46013 field_addr.name = "action_type";
46014 #endif /* FREECIV_JSON_CONNECTION */
46015 {
46016 int readin;
46017
46018 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
46019 RECEIVE_PACKET_FIELD_ERROR(action_type);
46020 }
46021 real_packet->action_type = readin;
46022 }
46023 }
46024 if (BV_ISSET(fields, 4)) {
46025 log_packet_detailed(" got field 'request_kind'");
46026 #ifdef FREECIV_JSON_CONNECTION
46027 field_addr.name = "request_kind";
46028 #endif /* FREECIV_JSON_CONNECTION */
46029 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
46030 RECEIVE_PACKET_FIELD_ERROR(request_kind);
46031 }
46032 }
46033
46034 if (NULL == old) {
46035 old = fc_malloc(sizeof(*old));
46036 *old = *real_packet;
46037 genhash_insert(*hash, old, old);
46038 } else {
46039 *old = *real_packet;
46040 }
46041
46042#endif /* FREECIV_DELTA_PROTOCOL */
46043 RECEIVE_PACKET_END(real_packet);
46044}
46045
46046 static int send_packet_unit_action_answer_101(struct connection *pc, const struct packet_unit_action_answer *packet)
46047{
46048 const struct packet_unit_action_answer *real_packet = packet;
46049#ifdef FREECIV_DELTA_PROTOCOL
46050 packet_unit_action_answer_101_fields fields;
46051 struct packet_unit_action_answer *old;
46052 bool differ;
46053 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ACTION_ANSWER;
46054#endif /* FREECIV_DELTA_PROTOCOL */
46055 SEND_PACKET_START(PACKET_UNIT_ACTION_ANSWER);
46056#ifdef FREECIV_JSON_CONNECTION
46057 struct plocation field_addr;
46058 {
46059 struct plocation *field_addr_tmp = plocation_field_new(NULL);
46060 field_addr = *field_addr_tmp;
46061 FC_FREE(field_addr_tmp);
46062 }
46063#endif /* FREECIV_JSON_CONNECTION */
46064
46065 log_packet_detailed("packet_unit_action_answer_101: sending info about ()");
46066
46067#ifdef FREECIV_DELTA_PROTOCOL
46068 if (NULL == *hash) {
46069 *hash = genhash_new_full(hash_packet_unit_action_answer_101, cmp_packet_unit_action_answer_101,
46070 NULL, NULL, NULL, free);
46071 }
46072 BV_CLR_ALL(fields);
46073
46074 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
46075 old = fc_malloc(sizeof(*old));
46076 *old = *real_packet;
46077 genhash_insert(*hash, old, old);
46078 memset(old, 0, sizeof(*old));
46079 }
46080 differ = (old->actor_id16 != real_packet->actor_id16);
46081 if (differ) {
46082 BV_SET(fields, 0);
46083 }
46084
46085 differ = (old->target_id != real_packet->target_id);
46086 if (differ) {
46087 BV_SET(fields, 1);
46088 }
46089
46090 differ = (old->cost != real_packet->cost);
46091 if (differ) {
46092 BV_SET(fields, 2);
46093 }
46094
46095 differ = (old->action_type != real_packet->action_type);
46096 if (differ) {
46097 BV_SET(fields, 3);
46098 }
46099
46100 differ = (old->request_kind != real_packet->request_kind);
46101 if (differ) {
46102 BV_SET(fields, 4);
46103 }
46104
46105
46106#ifdef FREECIV_JSON_CONNECTION
46107 field_addr.name = "fields";
46108#endif /* FREECIV_JSON_CONNECTION */
46109 DIO_BV_PUT(&dout, &field_addr, fields);
46110
46111 if (BV_ISSET(fields, 0)) {
46112 log_packet_detailed(" field 'actor_id16' has changed");
46113 #ifdef FREECIV_JSON_CONNECTION
46114 field_addr.name = "actor_id16";
46115#endif /* FREECIV_JSON_CONNECTION */
46116 DIO_PUT(uint16, &dout, &field_addr, real_packet->actor_id16);
46117 }
46118 if (BV_ISSET(fields, 1)) {
46119 log_packet_detailed(" field 'target_id' has changed");
46120 #ifdef FREECIV_JSON_CONNECTION
46121 field_addr.name = "target_id";
46122#endif /* FREECIV_JSON_CONNECTION */
46123 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
46124 }
46125 if (BV_ISSET(fields, 2)) {
46126 log_packet_detailed(" field 'cost' has changed");
46127 #ifdef FREECIV_JSON_CONNECTION
46128 field_addr.name = "cost";
46129#endif /* FREECIV_JSON_CONNECTION */
46130 DIO_PUT(uint32, &dout, &field_addr, real_packet->cost);
46131 }
46132 if (BV_ISSET(fields, 3)) {
46133 log_packet_detailed(" field 'action_type' has changed");
46134 #ifdef FREECIV_JSON_CONNECTION
46135 field_addr.name = "action_type";
46136#endif /* FREECIV_JSON_CONNECTION */
46137 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
46138 }
46139 if (BV_ISSET(fields, 4)) {
46140 log_packet_detailed(" field 'request_kind' has changed");
46141 #ifdef FREECIV_JSON_CONNECTION
46142 field_addr.name = "request_kind";
46143#endif /* FREECIV_JSON_CONNECTION */
46144 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
46145 }
46146
46147 *old = *real_packet;
46148#endif /* FREECIV_DELTA_PROTOCOL */
46149#ifndef FREECIV_DELTA_PROTOCOL
46150#ifdef FREECIV_JSON_CONNECTION
46151 field_addr.name = "actor_id16";
46152#endif /* FREECIV_JSON_CONNECTION */
46153 DIO_PUT(uint16, &dout, &field_addr, real_packet->actor_id16);
46154#ifdef FREECIV_JSON_CONNECTION
46155 field_addr.name = "target_id";
46156#endif /* FREECIV_JSON_CONNECTION */
46157 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
46158#ifdef FREECIV_JSON_CONNECTION
46159 field_addr.name = "cost";
46160#endif /* FREECIV_JSON_CONNECTION */
46161 DIO_PUT(uint32, &dout, &field_addr, real_packet->cost);
46162#ifdef FREECIV_JSON_CONNECTION
46163 field_addr.name = "action_type";
46164#endif /* FREECIV_JSON_CONNECTION */
46165 DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
46166#ifdef FREECIV_JSON_CONNECTION
46167 field_addr.name = "request_kind";
46168#endif /* FREECIV_JSON_CONNECTION */
46169 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
46170
46171#endif
46172 SEND_PACKET_END(PACKET_UNIT_ACTION_ANSWER);
46173}
46174
46175 int send_packet_unit_action_answer(struct connection *pc, const struct packet_unit_action_answer *packet)
46176{
46177 if (!pc->used) {
46178 log_error("WARNING: trying to send data to the closed connection %s",
46179 conn_description(pc));
46180 return -1;
46181 }
46182 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_ACTION_ANSWER].packet != NULL, -1,
46183 "Handler for PACKET_UNIT_ACTION_ANSWER not installed");
46184 return pc->phs.handlers->send[PACKET_UNIT_ACTION_ANSWER].packet(pc, packet);
46185}
46186
46187 int dsend_packet_unit_action_answer(struct connection *pc, int actor_id16, int actor_id32, int target_id, int cost, action_id action_type, int request_kind)
46188{
46189 struct packet_unit_action_answer packet, *real_packet = &packet;
46190
46191 real_packet->actor_id16 = actor_id16;
46192 real_packet->actor_id32 = actor_id32;
46193 real_packet->target_id = target_id;
46194 real_packet->cost = cost;
46195 real_packet->action_type = action_type;
46196 real_packet->request_kind = request_kind;
46197
46198 return send_packet_unit_action_answer(pc, real_packet);
46199}
46200
46201#ifdef FREECIV_DELTA_PROTOCOL
46202#define hash_packet_unit_get_actions_100 hash_const
46203
46204#define cmp_packet_unit_get_actions_100 cmp_const
46205
46206 BV_DEFINE(packet_unit_get_actions_100_fields, 5);
46207#endif /* FREECIV_DELTA_PROTOCOL */
46208
46209 static struct packet_unit_get_actions *receive_packet_unit_get_actions_100(struct connection *pc)
46210{
46211#ifdef FREECIV_DELTA_PROTOCOL
46212 packet_unit_get_actions_100_fields fields;
46213 struct packet_unit_get_actions *old;
46214 struct genhash **hash = pc->phs.received + PACKET_UNIT_GET_ACTIONS;
46215#endif /* FREECIV_DELTA_PROTOCOL */
46216 RECEIVE_PACKET_START(packet_unit_get_actions, real_packet);
46217#ifdef FREECIV_JSON_CONNECTION
46218 struct plocation field_addr;
46219 {
46220 struct plocation *field_addr_tmp = plocation_field_new(NULL);
46221 field_addr = *field_addr_tmp;
46222 FC_FREE(field_addr_tmp);
46223 }
46224#endif /* FREECIV_JSON_CONNECTION */
46225
46226#ifdef FREECIV_DELTA_PROTOCOL
46227#ifdef FREECIV_JSON_CONNECTION
46228 field_addr.name = "fields";
46229#endif /* FREECIV_JSON_CONNECTION */
46230 DIO_BV_GET(&din, &field_addr, fields);
46231
46232#else /* FREECIV_DELTA_PROTOCOL */
46233 #ifdef FREECIV_JSON_CONNECTION
46234 field_addr.name = "actor_unit_id32";
46235 #endif /* FREECIV_JSON_CONNECTION */
46236 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_unit_id32)) {
46237 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id32);
46238 }
46239 #ifdef FREECIV_JSON_CONNECTION
46240 field_addr.name = "target_unit_id32";
46241 #endif /* FREECIV_JSON_CONNECTION */
46242 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_unit_id32)) {
46243 RECEIVE_PACKET_FIELD_ERROR(target_unit_id32);
46244 }
46245 #ifdef FREECIV_JSON_CONNECTION
46246 field_addr.name = "target_tile_id";
46247 #endif /* FREECIV_JSON_CONNECTION */
46248 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
46249 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
46250 }
46251 #ifdef FREECIV_JSON_CONNECTION
46252 field_addr.name = "target_extra_id";
46253 #endif /* FREECIV_JSON_CONNECTION */
46254 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
46255 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
46256 }
46257 #ifdef FREECIV_JSON_CONNECTION
46258 field_addr.name = "request_kind";
46259 #endif /* FREECIV_JSON_CONNECTION */
46260 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
46261 RECEIVE_PACKET_FIELD_ERROR(request_kind);
46262 }
46263
46264#endif
46265 log_packet_detailed("packet_unit_get_actions_100: got info about ()");
46266
46267#ifdef FREECIV_DELTA_PROTOCOL
46268 if (NULL == *hash) {
46269 *hash = genhash_new_full(hash_packet_unit_get_actions_100, cmp_packet_unit_get_actions_100,
46270 NULL, NULL, NULL, free);
46271 }
46272
46273 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
46274 *real_packet = *old;
46275 } else {
46276 log_packet_detailed(" no old info");
46277 memset(real_packet, 0, sizeof(*real_packet));
46278 }
46279
46280 if (BV_ISSET(fields, 0)) {
46281 log_packet_detailed(" got field 'actor_unit_id32'");
46282 #ifdef FREECIV_JSON_CONNECTION
46283 field_addr.name = "actor_unit_id32";
46284 #endif /* FREECIV_JSON_CONNECTION */
46285 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_unit_id32)) {
46286 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id32);
46287 }
46288 }
46289 if (BV_ISSET(fields, 1)) {
46290 log_packet_detailed(" got field 'target_unit_id32'");
46291 #ifdef FREECIV_JSON_CONNECTION
46292 field_addr.name = "target_unit_id32";
46293 #endif /* FREECIV_JSON_CONNECTION */
46294 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_unit_id32)) {
46295 RECEIVE_PACKET_FIELD_ERROR(target_unit_id32);
46296 }
46297 }
46298 if (BV_ISSET(fields, 2)) {
46299 log_packet_detailed(" got field 'target_tile_id'");
46300 #ifdef FREECIV_JSON_CONNECTION
46301 field_addr.name = "target_tile_id";
46302 #endif /* FREECIV_JSON_CONNECTION */
46303 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
46304 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
46305 }
46306 }
46307 if (BV_ISSET(fields, 3)) {
46308 log_packet_detailed(" got field 'target_extra_id'");
46309 #ifdef FREECIV_JSON_CONNECTION
46310 field_addr.name = "target_extra_id";
46311 #endif /* FREECIV_JSON_CONNECTION */
46312 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
46313 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
46314 }
46315 }
46316 if (BV_ISSET(fields, 4)) {
46317 log_packet_detailed(" got field 'request_kind'");
46318 #ifdef FREECIV_JSON_CONNECTION
46319 field_addr.name = "request_kind";
46320 #endif /* FREECIV_JSON_CONNECTION */
46321 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
46322 RECEIVE_PACKET_FIELD_ERROR(request_kind);
46323 }
46324 }
46325
46326 if (NULL == old) {
46327 old = fc_malloc(sizeof(*old));
46328 *old = *real_packet;
46329 genhash_insert(*hash, old, old);
46330 } else {
46331 *old = *real_packet;
46332 }
46333
46334#endif /* FREECIV_DELTA_PROTOCOL */
46335 RECEIVE_PACKET_END(real_packet);
46336}
46337
46338 static int send_packet_unit_get_actions_100(struct connection *pc, const struct packet_unit_get_actions *packet)
46339{
46340 const struct packet_unit_get_actions *real_packet = packet;
46341#ifdef FREECIV_DELTA_PROTOCOL
46342 packet_unit_get_actions_100_fields fields;
46343 struct packet_unit_get_actions *old;
46344 bool differ;
46345 struct genhash **hash = pc->phs.sent + PACKET_UNIT_GET_ACTIONS;
46346#endif /* FREECIV_DELTA_PROTOCOL */
46347 SEND_PACKET_START(PACKET_UNIT_GET_ACTIONS);
46348#ifdef FREECIV_JSON_CONNECTION
46349 struct plocation field_addr;
46350 {
46351 struct plocation *field_addr_tmp = plocation_field_new(NULL);
46352 field_addr = *field_addr_tmp;
46353 FC_FREE(field_addr_tmp);
46354 }
46355#endif /* FREECIV_JSON_CONNECTION */
46356
46357 log_packet_detailed("packet_unit_get_actions_100: sending info about ()");
46358
46359#ifdef FREECIV_DELTA_PROTOCOL
46360 if (NULL == *hash) {
46361 *hash = genhash_new_full(hash_packet_unit_get_actions_100, cmp_packet_unit_get_actions_100,
46362 NULL, NULL, NULL, free);
46363 }
46364 BV_CLR_ALL(fields);
46365
46366 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
46367 old = fc_malloc(sizeof(*old));
46368 *old = *real_packet;
46369 genhash_insert(*hash, old, old);
46370 memset(old, 0, sizeof(*old));
46371 }
46372 differ = (old->actor_unit_id32 != real_packet->actor_unit_id32);
46373 if (differ) {
46374 BV_SET(fields, 0);
46375 }
46376
46377 differ = (old->target_unit_id32 != real_packet->target_unit_id32);
46378 if (differ) {
46379 BV_SET(fields, 1);
46380 }
46381
46382 differ = (old->target_tile_id != real_packet->target_tile_id);
46383 if (differ) {
46384 BV_SET(fields, 2);
46385 }
46386
46387 differ = (old->target_extra_id != real_packet->target_extra_id);
46388 if (differ) {
46389 BV_SET(fields, 3);
46390 }
46391
46392 differ = (old->request_kind != real_packet->request_kind);
46393 if (differ) {
46394 BV_SET(fields, 4);
46395 }
46396
46397
46398#ifdef FREECIV_JSON_CONNECTION
46399 field_addr.name = "fields";
46400#endif /* FREECIV_JSON_CONNECTION */
46401 DIO_BV_PUT(&dout, &field_addr, fields);
46402
46403 if (BV_ISSET(fields, 0)) {
46404 log_packet_detailed(" field 'actor_unit_id32' has changed");
46405 #ifdef FREECIV_JSON_CONNECTION
46406 field_addr.name = "actor_unit_id32";
46407#endif /* FREECIV_JSON_CONNECTION */
46408 DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_unit_id32);
46409 }
46410 if (BV_ISSET(fields, 1)) {
46411 log_packet_detailed(" field 'target_unit_id32' has changed");
46412 #ifdef FREECIV_JSON_CONNECTION
46413 field_addr.name = "target_unit_id32";
46414#endif /* FREECIV_JSON_CONNECTION */
46415 DIO_PUT(uint32, &dout, &field_addr, real_packet->target_unit_id32);
46416 }
46417 if (BV_ISSET(fields, 2)) {
46418 log_packet_detailed(" field 'target_tile_id' has changed");
46419 #ifdef FREECIV_JSON_CONNECTION
46420 field_addr.name = "target_tile_id";
46421#endif /* FREECIV_JSON_CONNECTION */
46422 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
46423 }
46424 if (BV_ISSET(fields, 3)) {
46425 log_packet_detailed(" field 'target_extra_id' has changed");
46426 #ifdef FREECIV_JSON_CONNECTION
46427 field_addr.name = "target_extra_id";
46428#endif /* FREECIV_JSON_CONNECTION */
46429 DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
46430 }
46431 if (BV_ISSET(fields, 4)) {
46432 log_packet_detailed(" field 'request_kind' has changed");
46433 #ifdef FREECIV_JSON_CONNECTION
46434 field_addr.name = "request_kind";
46435#endif /* FREECIV_JSON_CONNECTION */
46436 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
46437 }
46438
46439 *old = *real_packet;
46440#endif /* FREECIV_DELTA_PROTOCOL */
46441#ifndef FREECIV_DELTA_PROTOCOL
46442#ifdef FREECIV_JSON_CONNECTION
46443 field_addr.name = "actor_unit_id32";
46444#endif /* FREECIV_JSON_CONNECTION */
46445 DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_unit_id32);
46446#ifdef FREECIV_JSON_CONNECTION
46447 field_addr.name = "target_unit_id32";
46448#endif /* FREECIV_JSON_CONNECTION */
46449 DIO_PUT(uint32, &dout, &field_addr, real_packet->target_unit_id32);
46450#ifdef FREECIV_JSON_CONNECTION
46451 field_addr.name = "target_tile_id";
46452#endif /* FREECIV_JSON_CONNECTION */
46453 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
46454#ifdef FREECIV_JSON_CONNECTION
46455 field_addr.name = "target_extra_id";
46456#endif /* FREECIV_JSON_CONNECTION */
46457 DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
46458#ifdef FREECIV_JSON_CONNECTION
46459 field_addr.name = "request_kind";
46460#endif /* FREECIV_JSON_CONNECTION */
46461 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
46462
46463#endif
46464 SEND_PACKET_END(PACKET_UNIT_GET_ACTIONS);
46465}
46466
46467#ifdef FREECIV_DELTA_PROTOCOL
46468#define hash_packet_unit_get_actions_101 hash_const
46469
46470#define cmp_packet_unit_get_actions_101 cmp_const
46471
46472 BV_DEFINE(packet_unit_get_actions_101_fields, 5);
46473#endif /* FREECIV_DELTA_PROTOCOL */
46474
46475 static struct packet_unit_get_actions *receive_packet_unit_get_actions_101(struct connection *pc)
46476{
46477#ifdef FREECIV_DELTA_PROTOCOL
46478 packet_unit_get_actions_101_fields fields;
46479 struct packet_unit_get_actions *old;
46480 struct genhash **hash = pc->phs.received + PACKET_UNIT_GET_ACTIONS;
46481#endif /* FREECIV_DELTA_PROTOCOL */
46482 RECEIVE_PACKET_START(packet_unit_get_actions, real_packet);
46483#ifdef FREECIV_JSON_CONNECTION
46484 struct plocation field_addr;
46485 {
46486 struct plocation *field_addr_tmp = plocation_field_new(NULL);
46487 field_addr = *field_addr_tmp;
46488 FC_FREE(field_addr_tmp);
46489 }
46490#endif /* FREECIV_JSON_CONNECTION */
46491
46492#ifdef FREECIV_DELTA_PROTOCOL
46493#ifdef FREECIV_JSON_CONNECTION
46494 field_addr.name = "fields";
46495#endif /* FREECIV_JSON_CONNECTION */
46496 DIO_BV_GET(&din, &field_addr, fields);
46497
46498#else /* FREECIV_DELTA_PROTOCOL */
46499 #ifdef FREECIV_JSON_CONNECTION
46500 field_addr.name = "actor_unit_id16";
46501 #endif /* FREECIV_JSON_CONNECTION */
46502 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->actor_unit_id16)) {
46503 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id16);
46504 }
46505 #ifdef FREECIV_JSON_CONNECTION
46506 field_addr.name = "target_unit_id16";
46507 #endif /* FREECIV_JSON_CONNECTION */
46508 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->target_unit_id16)) {
46509 RECEIVE_PACKET_FIELD_ERROR(target_unit_id16);
46510 }
46511 #ifdef FREECIV_JSON_CONNECTION
46512 field_addr.name = "target_tile_id";
46513 #endif /* FREECIV_JSON_CONNECTION */
46514 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
46515 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
46516 }
46517 #ifdef FREECIV_JSON_CONNECTION
46518 field_addr.name = "target_extra_id";
46519 #endif /* FREECIV_JSON_CONNECTION */
46520 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
46521 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
46522 }
46523 #ifdef FREECIV_JSON_CONNECTION
46524 field_addr.name = "request_kind";
46525 #endif /* FREECIV_JSON_CONNECTION */
46526 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
46527 RECEIVE_PACKET_FIELD_ERROR(request_kind);
46528 }
46529
46530#endif
46531 log_packet_detailed("packet_unit_get_actions_101: got info about ()");
46532
46533#ifdef FREECIV_DELTA_PROTOCOL
46534 if (NULL == *hash) {
46535 *hash = genhash_new_full(hash_packet_unit_get_actions_101, cmp_packet_unit_get_actions_101,
46536 NULL, NULL, NULL, free);
46537 }
46538
46539 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
46540 *real_packet = *old;
46541 } else {
46542 log_packet_detailed(" no old info");
46543 memset(real_packet, 0, sizeof(*real_packet));
46544 }
46545
46546 if (BV_ISSET(fields, 0)) {
46547 log_packet_detailed(" got field 'actor_unit_id16'");
46548 #ifdef FREECIV_JSON_CONNECTION
46549 field_addr.name = "actor_unit_id16";
46550 #endif /* FREECIV_JSON_CONNECTION */
46551 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->actor_unit_id16)) {
46552 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id16);
46553 }
46554 }
46555 if (BV_ISSET(fields, 1)) {
46556 log_packet_detailed(" got field 'target_unit_id16'");
46557 #ifdef FREECIV_JSON_CONNECTION
46558 field_addr.name = "target_unit_id16";
46559 #endif /* FREECIV_JSON_CONNECTION */
46560 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->target_unit_id16)) {
46561 RECEIVE_PACKET_FIELD_ERROR(target_unit_id16);
46562 }
46563 }
46564 if (BV_ISSET(fields, 2)) {
46565 log_packet_detailed(" got field 'target_tile_id'");
46566 #ifdef FREECIV_JSON_CONNECTION
46567 field_addr.name = "target_tile_id";
46568 #endif /* FREECIV_JSON_CONNECTION */
46569 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
46570 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
46571 }
46572 }
46573 if (BV_ISSET(fields, 3)) {
46574 log_packet_detailed(" got field 'target_extra_id'");
46575 #ifdef FREECIV_JSON_CONNECTION
46576 field_addr.name = "target_extra_id";
46577 #endif /* FREECIV_JSON_CONNECTION */
46578 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
46579 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
46580 }
46581 }
46582 if (BV_ISSET(fields, 4)) {
46583 log_packet_detailed(" got field 'request_kind'");
46584 #ifdef FREECIV_JSON_CONNECTION
46585 field_addr.name = "request_kind";
46586 #endif /* FREECIV_JSON_CONNECTION */
46587 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
46588 RECEIVE_PACKET_FIELD_ERROR(request_kind);
46589 }
46590 }
46591
46592 if (NULL == old) {
46593 old = fc_malloc(sizeof(*old));
46594 *old = *real_packet;
46595 genhash_insert(*hash, old, old);
46596 } else {
46597 *old = *real_packet;
46598 }
46599
46600#endif /* FREECIV_DELTA_PROTOCOL */
46601 RECEIVE_PACKET_END(real_packet);
46602}
46603
46604 static int send_packet_unit_get_actions_101(struct connection *pc, const struct packet_unit_get_actions *packet)
46605{
46606 const struct packet_unit_get_actions *real_packet = packet;
46607#ifdef FREECIV_DELTA_PROTOCOL
46608 packet_unit_get_actions_101_fields fields;
46609 struct packet_unit_get_actions *old;
46610 bool differ;
46611 struct genhash **hash = pc->phs.sent + PACKET_UNIT_GET_ACTIONS;
46612#endif /* FREECIV_DELTA_PROTOCOL */
46613 SEND_PACKET_START(PACKET_UNIT_GET_ACTIONS);
46614#ifdef FREECIV_JSON_CONNECTION
46615 struct plocation field_addr;
46616 {
46617 struct plocation *field_addr_tmp = plocation_field_new(NULL);
46618 field_addr = *field_addr_tmp;
46619 FC_FREE(field_addr_tmp);
46620 }
46621#endif /* FREECIV_JSON_CONNECTION */
46622
46623 log_packet_detailed("packet_unit_get_actions_101: sending info about ()");
46624
46625#ifdef FREECIV_DELTA_PROTOCOL
46626 if (NULL == *hash) {
46627 *hash = genhash_new_full(hash_packet_unit_get_actions_101, cmp_packet_unit_get_actions_101,
46628 NULL, NULL, NULL, free);
46629 }
46630 BV_CLR_ALL(fields);
46631
46632 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
46633 old = fc_malloc(sizeof(*old));
46634 *old = *real_packet;
46635 genhash_insert(*hash, old, old);
46636 memset(old, 0, sizeof(*old));
46637 }
46638 differ = (old->actor_unit_id16 != real_packet->actor_unit_id16);
46639 if (differ) {
46640 BV_SET(fields, 0);
46641 }
46642
46643 differ = (old->target_unit_id16 != real_packet->target_unit_id16);
46644 if (differ) {
46645 BV_SET(fields, 1);
46646 }
46647
46648 differ = (old->target_tile_id != real_packet->target_tile_id);
46649 if (differ) {
46650 BV_SET(fields, 2);
46651 }
46652
46653 differ = (old->target_extra_id != real_packet->target_extra_id);
46654 if (differ) {
46655 BV_SET(fields, 3);
46656 }
46657
46658 differ = (old->request_kind != real_packet->request_kind);
46659 if (differ) {
46660 BV_SET(fields, 4);
46661 }
46662
46663
46664#ifdef FREECIV_JSON_CONNECTION
46665 field_addr.name = "fields";
46666#endif /* FREECIV_JSON_CONNECTION */
46667 DIO_BV_PUT(&dout, &field_addr, fields);
46668
46669 if (BV_ISSET(fields, 0)) {
46670 log_packet_detailed(" field 'actor_unit_id16' has changed");
46671 #ifdef FREECIV_JSON_CONNECTION
46672 field_addr.name = "actor_unit_id16";
46673#endif /* FREECIV_JSON_CONNECTION */
46674 DIO_PUT(uint16, &dout, &field_addr, real_packet->actor_unit_id16);
46675 }
46676 if (BV_ISSET(fields, 1)) {
46677 log_packet_detailed(" field 'target_unit_id16' has changed");
46678 #ifdef FREECIV_JSON_CONNECTION
46679 field_addr.name = "target_unit_id16";
46680#endif /* FREECIV_JSON_CONNECTION */
46681 DIO_PUT(uint16, &dout, &field_addr, real_packet->target_unit_id16);
46682 }
46683 if (BV_ISSET(fields, 2)) {
46684 log_packet_detailed(" field 'target_tile_id' has changed");
46685 #ifdef FREECIV_JSON_CONNECTION
46686 field_addr.name = "target_tile_id";
46687#endif /* FREECIV_JSON_CONNECTION */
46688 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
46689 }
46690 if (BV_ISSET(fields, 3)) {
46691 log_packet_detailed(" field 'target_extra_id' has changed");
46692 #ifdef FREECIV_JSON_CONNECTION
46693 field_addr.name = "target_extra_id";
46694#endif /* FREECIV_JSON_CONNECTION */
46695 DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
46696 }
46697 if (BV_ISSET(fields, 4)) {
46698 log_packet_detailed(" field 'request_kind' has changed");
46699 #ifdef FREECIV_JSON_CONNECTION
46700 field_addr.name = "request_kind";
46701#endif /* FREECIV_JSON_CONNECTION */
46702 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
46703 }
46704
46705 *old = *real_packet;
46706#endif /* FREECIV_DELTA_PROTOCOL */
46707#ifndef FREECIV_DELTA_PROTOCOL
46708#ifdef FREECIV_JSON_CONNECTION
46709 field_addr.name = "actor_unit_id16";
46710#endif /* FREECIV_JSON_CONNECTION */
46711 DIO_PUT(uint16, &dout, &field_addr, real_packet->actor_unit_id16);
46712#ifdef FREECIV_JSON_CONNECTION
46713 field_addr.name = "target_unit_id16";
46714#endif /* FREECIV_JSON_CONNECTION */
46715 DIO_PUT(uint16, &dout, &field_addr, real_packet->target_unit_id16);
46716#ifdef FREECIV_JSON_CONNECTION
46717 field_addr.name = "target_tile_id";
46718#endif /* FREECIV_JSON_CONNECTION */
46719 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
46720#ifdef FREECIV_JSON_CONNECTION
46721 field_addr.name = "target_extra_id";
46722#endif /* FREECIV_JSON_CONNECTION */
46723 DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
46724#ifdef FREECIV_JSON_CONNECTION
46725 field_addr.name = "request_kind";
46726#endif /* FREECIV_JSON_CONNECTION */
46727 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
46728
46729#endif
46730 SEND_PACKET_END(PACKET_UNIT_GET_ACTIONS);
46731}
46732
46733 int send_packet_unit_get_actions(struct connection *pc, const struct packet_unit_get_actions *packet)
46734{
46735 if (!pc->used) {
46736 log_error("WARNING: trying to send data to the closed connection %s",
46737 conn_description(pc));
46738 return -1;
46739 }
46740 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_GET_ACTIONS].packet != NULL, -1,
46741 "Handler for PACKET_UNIT_GET_ACTIONS not installed");
46742 return pc->phs.handlers->send[PACKET_UNIT_GET_ACTIONS].packet(pc, packet);
46743}
46744
46745 int dsend_packet_unit_get_actions(struct connection *pc, int actor_unit_id16, int actor_unit_id32, int target_unit_id16, int target_unit_id32, int target_tile_id, int target_extra_id, int request_kind)
46746{
46747 struct packet_unit_get_actions packet, *real_packet = &packet;
46748
46749 real_packet->actor_unit_id16 = actor_unit_id16;
46750 real_packet->actor_unit_id32 = actor_unit_id32;
46751 real_packet->target_unit_id16 = target_unit_id16;
46752 real_packet->target_unit_id32 = target_unit_id32;
46753 real_packet->target_tile_id = target_tile_id;
46754 real_packet->target_extra_id = target_extra_id;
46755 real_packet->request_kind = request_kind;
46756
46757 return send_packet_unit_get_actions(pc, real_packet);
46758}
46759
46760#ifdef FREECIV_DELTA_PROTOCOL
46761#define hash_packet_unit_actions_100 hash_const
46762
46763#define cmp_packet_unit_actions_100 cmp_const
46764
46765 BV_DEFINE(packet_unit_actions_100_fields, 7);
46766#endif /* FREECIV_DELTA_PROTOCOL */
46767
46768 static struct packet_unit_actions *receive_packet_unit_actions_100(struct connection *pc)
46769{
46770#ifdef FREECIV_DELTA_PROTOCOL
46771 packet_unit_actions_100_fields fields;
46772 struct packet_unit_actions *old;
46773 struct genhash **hash = pc->phs.received + PACKET_UNIT_ACTIONS;
46774#endif /* FREECIV_DELTA_PROTOCOL */
46775 RECEIVE_PACKET_START(packet_unit_actions, real_packet);
46776#ifdef FREECIV_JSON_CONNECTION
46777 struct plocation field_addr;
46778 {
46779 struct plocation *field_addr_tmp = plocation_field_new(NULL);
46780 field_addr = *field_addr_tmp;
46781 FC_FREE(field_addr_tmp);
46782 }
46783#endif /* FREECIV_JSON_CONNECTION */
46784
46785#ifdef FREECIV_DELTA_PROTOCOL
46786#ifdef FREECIV_JSON_CONNECTION
46787 field_addr.name = "fields";
46788#endif /* FREECIV_JSON_CONNECTION */
46789 DIO_BV_GET(&din, &field_addr, fields);
46790
46791#else /* FREECIV_DELTA_PROTOCOL */
46792 #ifdef FREECIV_JSON_CONNECTION
46793 field_addr.name = "actor_unit_id32";
46794 #endif /* FREECIV_JSON_CONNECTION */
46795 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_unit_id32)) {
46796 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id32);
46797 }
46798 #ifdef FREECIV_JSON_CONNECTION
46799 field_addr.name = "target_unit_id32";
46800 #endif /* FREECIV_JSON_CONNECTION */
46801 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_unit_id32)) {
46802 RECEIVE_PACKET_FIELD_ERROR(target_unit_id32);
46803 }
46804 #ifdef FREECIV_JSON_CONNECTION
46805 field_addr.name = "target_city_id32";
46806 #endif /* FREECIV_JSON_CONNECTION */
46807 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_city_id32)) {
46808 RECEIVE_PACKET_FIELD_ERROR(target_city_id32);
46809 }
46810 #ifdef FREECIV_JSON_CONNECTION
46811 field_addr.name = "target_tile_id";
46812 #endif /* FREECIV_JSON_CONNECTION */
46813 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
46814 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
46815 }
46816 #ifdef FREECIV_JSON_CONNECTION
46817 field_addr.name = "target_extra_id";
46818 #endif /* FREECIV_JSON_CONNECTION */
46819 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
46820 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
46821 }
46822 #ifdef FREECIV_JSON_CONNECTION
46823 field_addr.name = "request_kind";
46824 #endif /* FREECIV_JSON_CONNECTION */
46825 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
46826 RECEIVE_PACKET_FIELD_ERROR(request_kind);
46827 }
46828 #ifdef FREECIV_JSON_CONNECTION
46829 field_addr.name = "action_probabilities";
46830 #endif /* FREECIV_JSON_CONNECTION */
46831
46832 {
46833 int i;
46834
46835 #ifdef FREECIV_JSON_CONNECTION
46836 /* Enter array. */
46837 field_addr.sub_location = plocation_elem_new(0);
46838 #endif /* FREECIV_JSON_CONNECTION */
46839
46840 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
46841 #ifdef FREECIV_JSON_CONNECTION
46842 field_addr.sub_location->number = i;
46843 #endif /* FREECIV_JSON_CONNECTION */
46844 if (!DIO_GET(action_probability, &din, &field_addr, &real_packet->action_probabilities[i])) {
46845 RECEIVE_PACKET_FIELD_ERROR(action_probabilities);
46846 }
46847 }
46848
46849 #ifdef FREECIV_JSON_CONNECTION
46850 /* Exit array. */
46851 free(field_addr.sub_location);
46852 field_addr.sub_location = NULL;
46853 #endif /* FREECIV_JSON_CONNECTION */
46854 }
46855
46856#endif
46857 log_packet_detailed("packet_unit_actions_100: got info about ()");
46858
46859#ifdef FREECIV_DELTA_PROTOCOL
46860 if (NULL == *hash) {
46861 *hash = genhash_new_full(hash_packet_unit_actions_100, cmp_packet_unit_actions_100,
46862 NULL, NULL, NULL, free);
46863 }
46864
46865 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
46866 *real_packet = *old;
46867 } else {
46868 log_packet_detailed(" no old info");
46869 memset(real_packet, 0, sizeof(*real_packet));
46870 }
46871
46872 if (BV_ISSET(fields, 0)) {
46873 log_packet_detailed(" got field 'actor_unit_id32'");
46874 #ifdef FREECIV_JSON_CONNECTION
46875 field_addr.name = "actor_unit_id32";
46876 #endif /* FREECIV_JSON_CONNECTION */
46877 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_unit_id32)) {
46878 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id32);
46879 }
46880 }
46881 if (BV_ISSET(fields, 1)) {
46882 log_packet_detailed(" got field 'target_unit_id32'");
46883 #ifdef FREECIV_JSON_CONNECTION
46884 field_addr.name = "target_unit_id32";
46885 #endif /* FREECIV_JSON_CONNECTION */
46886 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_unit_id32)) {
46887 RECEIVE_PACKET_FIELD_ERROR(target_unit_id32);
46888 }
46889 }
46890 if (BV_ISSET(fields, 2)) {
46891 log_packet_detailed(" got field 'target_city_id32'");
46892 #ifdef FREECIV_JSON_CONNECTION
46893 field_addr.name = "target_city_id32";
46894 #endif /* FREECIV_JSON_CONNECTION */
46895 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_city_id32)) {
46896 RECEIVE_PACKET_FIELD_ERROR(target_city_id32);
46897 }
46898 }
46899 if (BV_ISSET(fields, 3)) {
46900 log_packet_detailed(" got field 'target_tile_id'");
46901 #ifdef FREECIV_JSON_CONNECTION
46902 field_addr.name = "target_tile_id";
46903 #endif /* FREECIV_JSON_CONNECTION */
46904 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
46905 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
46906 }
46907 }
46908 if (BV_ISSET(fields, 4)) {
46909 log_packet_detailed(" got field 'target_extra_id'");
46910 #ifdef FREECIV_JSON_CONNECTION
46911 field_addr.name = "target_extra_id";
46912 #endif /* FREECIV_JSON_CONNECTION */
46913 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
46914 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
46915 }
46916 }
46917 if (BV_ISSET(fields, 5)) {
46918 log_packet_detailed(" got field 'request_kind'");
46919 #ifdef FREECIV_JSON_CONNECTION
46920 field_addr.name = "request_kind";
46921 #endif /* FREECIV_JSON_CONNECTION */
46922 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
46923 RECEIVE_PACKET_FIELD_ERROR(request_kind);
46924 }
46925 }
46926 if (BV_ISSET(fields, 6)) {
46927 log_packet_detailed(" got field 'action_probabilities'");
46928 #ifdef FREECIV_JSON_CONNECTION
46929 field_addr.name = "action_probabilities";
46930 #endif /* FREECIV_JSON_CONNECTION */
46931
46932 {
46933 int i;
46934
46935 #ifdef FREECIV_JSON_CONNECTION
46936 /* Enter array. */
46937 field_addr.sub_location = plocation_elem_new(0);
46938 #endif /* FREECIV_JSON_CONNECTION */
46939
46940 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
46941 #ifdef FREECIV_JSON_CONNECTION
46942 field_addr.sub_location->number = i;
46943 #endif /* FREECIV_JSON_CONNECTION */
46944 if (!DIO_GET(action_probability, &din, &field_addr, &real_packet->action_probabilities[i])) {
46945 RECEIVE_PACKET_FIELD_ERROR(action_probabilities);
46946 }
46947 }
46948
46949 #ifdef FREECIV_JSON_CONNECTION
46950 /* Exit array. */
46951 free(field_addr.sub_location);
46952 field_addr.sub_location = NULL;
46953 #endif /* FREECIV_JSON_CONNECTION */
46954 }
46955 }
46956
46957 if (NULL == old) {
46958 old = fc_malloc(sizeof(*old));
46959 *old = *real_packet;
46960 genhash_insert(*hash, old, old);
46961 } else {
46962 *old = *real_packet;
46963 }
46964
46965#endif /* FREECIV_DELTA_PROTOCOL */
46966 RECEIVE_PACKET_END(real_packet);
46967}
46968
46969 static int send_packet_unit_actions_100(struct connection *pc, const struct packet_unit_actions *packet)
46970{
46971 const struct packet_unit_actions *real_packet = packet;
46972#ifdef FREECIV_DELTA_PROTOCOL
46973 packet_unit_actions_100_fields fields;
46974 struct packet_unit_actions *old;
46975 bool differ;
46976 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ACTIONS;
46977#endif /* FREECIV_DELTA_PROTOCOL */
46978 SEND_PACKET_START(PACKET_UNIT_ACTIONS);
46979#ifdef FREECIV_JSON_CONNECTION
46980 struct plocation field_addr;
46981 {
46982 struct plocation *field_addr_tmp = plocation_field_new(NULL);
46983 field_addr = *field_addr_tmp;
46984 FC_FREE(field_addr_tmp);
46985 }
46986#endif /* FREECIV_JSON_CONNECTION */
46987
46988 log_packet_detailed("packet_unit_actions_100: sending info about ()");
46989
46990#ifdef FREECIV_DELTA_PROTOCOL
46991 if (NULL == *hash) {
46992 *hash = genhash_new_full(hash_packet_unit_actions_100, cmp_packet_unit_actions_100,
46993 NULL, NULL, NULL, free);
46994 }
46995 BV_CLR_ALL(fields);
46996
46997 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
46998 old = fc_malloc(sizeof(*old));
46999 *old = *real_packet;
47000 genhash_insert(*hash, old, old);
47001 memset(old, 0, sizeof(*old));
47002 }
47003 differ = (old->actor_unit_id32 != real_packet->actor_unit_id32);
47004 if (differ) {
47005 BV_SET(fields, 0);
47006 }
47007
47008 differ = (old->target_unit_id32 != real_packet->target_unit_id32);
47009 if (differ) {
47010 BV_SET(fields, 1);
47011 }
47012
47013 differ = (old->target_city_id32 != real_packet->target_city_id32);
47014 if (differ) {
47015 BV_SET(fields, 2);
47016 }
47017
47018 differ = (old->target_tile_id != real_packet->target_tile_id);
47019 if (differ) {
47020 BV_SET(fields, 3);
47021 }
47022
47023 differ = (old->target_extra_id != real_packet->target_extra_id);
47024 if (differ) {
47025 BV_SET(fields, 4);
47026 }
47027
47028 differ = (old->request_kind != real_packet->request_kind);
47029 if (differ) {
47030 BV_SET(fields, 5);
47031 }
47032
47033
47034 {
47035 differ = FALSE;
47036 {
47037 int i;
47038
47039 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
47040 if (!are_action_probabilitys_equal(&old->action_probabilities[i], &real_packet->action_probabilities[i])) {
47041 differ = TRUE;
47042 break;
47043 }
47044 }
47045 }
47046 }
47047 if (differ) {
47048 BV_SET(fields, 6);
47049 }
47050
47051
47052#ifdef FREECIV_JSON_CONNECTION
47053 field_addr.name = "fields";
47054#endif /* FREECIV_JSON_CONNECTION */
47055 DIO_BV_PUT(&dout, &field_addr, fields);
47056
47057 if (BV_ISSET(fields, 0)) {
47058 log_packet_detailed(" field 'actor_unit_id32' has changed");
47059 #ifdef FREECIV_JSON_CONNECTION
47060 field_addr.name = "actor_unit_id32";
47061#endif /* FREECIV_JSON_CONNECTION */
47062 DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_unit_id32);
47063 }
47064 if (BV_ISSET(fields, 1)) {
47065 log_packet_detailed(" field 'target_unit_id32' has changed");
47066 #ifdef FREECIV_JSON_CONNECTION
47067 field_addr.name = "target_unit_id32";
47068#endif /* FREECIV_JSON_CONNECTION */
47069 DIO_PUT(uint32, &dout, &field_addr, real_packet->target_unit_id32);
47070 }
47071 if (BV_ISSET(fields, 2)) {
47072 log_packet_detailed(" field 'target_city_id32' has changed");
47073 #ifdef FREECIV_JSON_CONNECTION
47074 field_addr.name = "target_city_id32";
47075#endif /* FREECIV_JSON_CONNECTION */
47076 DIO_PUT(uint32, &dout, &field_addr, real_packet->target_city_id32);
47077 }
47078 if (BV_ISSET(fields, 3)) {
47079 log_packet_detailed(" field 'target_tile_id' has changed");
47080 #ifdef FREECIV_JSON_CONNECTION
47081 field_addr.name = "target_tile_id";
47082#endif /* FREECIV_JSON_CONNECTION */
47083 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
47084 }
47085 if (BV_ISSET(fields, 4)) {
47086 log_packet_detailed(" field 'target_extra_id' has changed");
47087 #ifdef FREECIV_JSON_CONNECTION
47088 field_addr.name = "target_extra_id";
47089#endif /* FREECIV_JSON_CONNECTION */
47090 DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
47091 }
47092 if (BV_ISSET(fields, 5)) {
47093 log_packet_detailed(" field 'request_kind' has changed");
47094 #ifdef FREECIV_JSON_CONNECTION
47095 field_addr.name = "request_kind";
47096#endif /* FREECIV_JSON_CONNECTION */
47097 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
47098 }
47099 if (BV_ISSET(fields, 6)) {
47100 log_packet_detailed(" field 'action_probabilities' has changed");
47101 #ifdef FREECIV_JSON_CONNECTION
47102 field_addr.name = "action_probabilities";
47103#endif /* FREECIV_JSON_CONNECTION */
47104
47105 {
47106 int i;
47107
47108#ifdef FREECIV_JSON_CONNECTION
47109 /* Create the array. */
47110 DIO_PUT(farray, &dout, &field_addr, MAX_NUM_ACTIONS);
47111
47112 /* Enter the array. */
47113 field_addr.sub_location = plocation_elem_new(0);
47114#endif /* FREECIV_JSON_CONNECTION */
47115
47116 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
47117#ifdef FREECIV_JSON_CONNECTION
47118 /* Next array element. */
47119 field_addr.sub_location->number = i;
47120#endif /* FREECIV_JSON_CONNECTION */
47121 DIO_PUT(action_probability, &dout, &field_addr, &real_packet->action_probabilities[i]);
47122 }
47123
47124#ifdef FREECIV_JSON_CONNECTION
47125 /* Exit array. */
47126 free(field_addr.sub_location);
47127 field_addr.sub_location = NULL;
47128#endif /* FREECIV_JSON_CONNECTION */
47129 }
47130 }
47131
47132 *old = *real_packet;
47133#endif /* FREECIV_DELTA_PROTOCOL */
47134#ifndef FREECIV_DELTA_PROTOCOL
47135#ifdef FREECIV_JSON_CONNECTION
47136 field_addr.name = "actor_unit_id32";
47137#endif /* FREECIV_JSON_CONNECTION */
47138 DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_unit_id32);
47139#ifdef FREECIV_JSON_CONNECTION
47140 field_addr.name = "target_unit_id32";
47141#endif /* FREECIV_JSON_CONNECTION */
47142 DIO_PUT(uint32, &dout, &field_addr, real_packet->target_unit_id32);
47143#ifdef FREECIV_JSON_CONNECTION
47144 field_addr.name = "target_city_id32";
47145#endif /* FREECIV_JSON_CONNECTION */
47146 DIO_PUT(uint32, &dout, &field_addr, real_packet->target_city_id32);
47147#ifdef FREECIV_JSON_CONNECTION
47148 field_addr.name = "target_tile_id";
47149#endif /* FREECIV_JSON_CONNECTION */
47150 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
47151#ifdef FREECIV_JSON_CONNECTION
47152 field_addr.name = "target_extra_id";
47153#endif /* FREECIV_JSON_CONNECTION */
47154 DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
47155#ifdef FREECIV_JSON_CONNECTION
47156 field_addr.name = "request_kind";
47157#endif /* FREECIV_JSON_CONNECTION */
47158 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
47159#ifdef FREECIV_JSON_CONNECTION
47160 field_addr.name = "action_probabilities";
47161#endif /* FREECIV_JSON_CONNECTION */
47162
47163 {
47164 int i;
47165
47166#ifdef FREECIV_JSON_CONNECTION
47167 /* Create the array. */
47168 DIO_PUT(farray, &dout, &field_addr, MAX_NUM_ACTIONS);
47169
47170 /* Enter the array. */
47171 field_addr.sub_location = plocation_elem_new(0);
47172#endif /* FREECIV_JSON_CONNECTION */
47173
47174 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
47175#ifdef FREECIV_JSON_CONNECTION
47176 /* Next array element. */
47177 field_addr.sub_location->number = i;
47178#endif /* FREECIV_JSON_CONNECTION */
47179 DIO_PUT(action_probability, &dout, &field_addr, &real_packet->action_probabilities[i]);
47180 }
47181
47182#ifdef FREECIV_JSON_CONNECTION
47183 /* Exit array. */
47184 free(field_addr.sub_location);
47185 field_addr.sub_location = NULL;
47186#endif /* FREECIV_JSON_CONNECTION */
47187 }
47188
47189#endif
47190 SEND_PACKET_END(PACKET_UNIT_ACTIONS);
47191}
47192
47193#ifdef FREECIV_DELTA_PROTOCOL
47194#define hash_packet_unit_actions_101 hash_const
47195
47196#define cmp_packet_unit_actions_101 cmp_const
47197
47198 BV_DEFINE(packet_unit_actions_101_fields, 7);
47199#endif /* FREECIV_DELTA_PROTOCOL */
47200
47201 static struct packet_unit_actions *receive_packet_unit_actions_101(struct connection *pc)
47202{
47203#ifdef FREECIV_DELTA_PROTOCOL
47204 packet_unit_actions_101_fields fields;
47205 struct packet_unit_actions *old;
47206 struct genhash **hash = pc->phs.received + PACKET_UNIT_ACTIONS;
47207#endif /* FREECIV_DELTA_PROTOCOL */
47208 RECEIVE_PACKET_START(packet_unit_actions, real_packet);
47209#ifdef FREECIV_JSON_CONNECTION
47210 struct plocation field_addr;
47211 {
47212 struct plocation *field_addr_tmp = plocation_field_new(NULL);
47213 field_addr = *field_addr_tmp;
47214 FC_FREE(field_addr_tmp);
47215 }
47216#endif /* FREECIV_JSON_CONNECTION */
47217
47218#ifdef FREECIV_DELTA_PROTOCOL
47219#ifdef FREECIV_JSON_CONNECTION
47220 field_addr.name = "fields";
47221#endif /* FREECIV_JSON_CONNECTION */
47222 DIO_BV_GET(&din, &field_addr, fields);
47223
47224#else /* FREECIV_DELTA_PROTOCOL */
47225 #ifdef FREECIV_JSON_CONNECTION
47226 field_addr.name = "actor_unit_id16";
47227 #endif /* FREECIV_JSON_CONNECTION */
47228 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->actor_unit_id16)) {
47229 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id16);
47230 }
47231 #ifdef FREECIV_JSON_CONNECTION
47232 field_addr.name = "target_unit_id16";
47233 #endif /* FREECIV_JSON_CONNECTION */
47234 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->target_unit_id16)) {
47235 RECEIVE_PACKET_FIELD_ERROR(target_unit_id16);
47236 }
47237 #ifdef FREECIV_JSON_CONNECTION
47238 field_addr.name = "target_city_id16";
47239 #endif /* FREECIV_JSON_CONNECTION */
47240 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->target_city_id16)) {
47241 RECEIVE_PACKET_FIELD_ERROR(target_city_id16);
47242 }
47243 #ifdef FREECIV_JSON_CONNECTION
47244 field_addr.name = "target_tile_id";
47245 #endif /* FREECIV_JSON_CONNECTION */
47246 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
47247 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
47248 }
47249 #ifdef FREECIV_JSON_CONNECTION
47250 field_addr.name = "target_extra_id";
47251 #endif /* FREECIV_JSON_CONNECTION */
47252 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
47253 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
47254 }
47255 #ifdef FREECIV_JSON_CONNECTION
47256 field_addr.name = "request_kind";
47257 #endif /* FREECIV_JSON_CONNECTION */
47258 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
47259 RECEIVE_PACKET_FIELD_ERROR(request_kind);
47260 }
47261 #ifdef FREECIV_JSON_CONNECTION
47262 field_addr.name = "action_probabilities";
47263 #endif /* FREECIV_JSON_CONNECTION */
47264
47265 {
47266 int i;
47267
47268 #ifdef FREECIV_JSON_CONNECTION
47269 /* Enter array. */
47270 field_addr.sub_location = plocation_elem_new(0);
47271 #endif /* FREECIV_JSON_CONNECTION */
47272
47273 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
47274 #ifdef FREECIV_JSON_CONNECTION
47275 field_addr.sub_location->number = i;
47276 #endif /* FREECIV_JSON_CONNECTION */
47277 if (!DIO_GET(action_probability, &din, &field_addr, &real_packet->action_probabilities[i])) {
47278 RECEIVE_PACKET_FIELD_ERROR(action_probabilities);
47279 }
47280 }
47281
47282 #ifdef FREECIV_JSON_CONNECTION
47283 /* Exit array. */
47284 free(field_addr.sub_location);
47285 field_addr.sub_location = NULL;
47286 #endif /* FREECIV_JSON_CONNECTION */
47287 }
47288
47289#endif
47290 log_packet_detailed("packet_unit_actions_101: got info about ()");
47291
47292#ifdef FREECIV_DELTA_PROTOCOL
47293 if (NULL == *hash) {
47294 *hash = genhash_new_full(hash_packet_unit_actions_101, cmp_packet_unit_actions_101,
47295 NULL, NULL, NULL, free);
47296 }
47297
47298 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
47299 *real_packet = *old;
47300 } else {
47301 log_packet_detailed(" no old info");
47302 memset(real_packet, 0, sizeof(*real_packet));
47303 }
47304
47305 if (BV_ISSET(fields, 0)) {
47306 log_packet_detailed(" got field 'actor_unit_id16'");
47307 #ifdef FREECIV_JSON_CONNECTION
47308 field_addr.name = "actor_unit_id16";
47309 #endif /* FREECIV_JSON_CONNECTION */
47310 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->actor_unit_id16)) {
47311 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id16);
47312 }
47313 }
47314 if (BV_ISSET(fields, 1)) {
47315 log_packet_detailed(" got field 'target_unit_id16'");
47316 #ifdef FREECIV_JSON_CONNECTION
47317 field_addr.name = "target_unit_id16";
47318 #endif /* FREECIV_JSON_CONNECTION */
47319 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->target_unit_id16)) {
47320 RECEIVE_PACKET_FIELD_ERROR(target_unit_id16);
47321 }
47322 }
47323 if (BV_ISSET(fields, 2)) {
47324 log_packet_detailed(" got field 'target_city_id16'");
47325 #ifdef FREECIV_JSON_CONNECTION
47326 field_addr.name = "target_city_id16";
47327 #endif /* FREECIV_JSON_CONNECTION */
47328 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->target_city_id16)) {
47329 RECEIVE_PACKET_FIELD_ERROR(target_city_id16);
47330 }
47331 }
47332 if (BV_ISSET(fields, 3)) {
47333 log_packet_detailed(" got field 'target_tile_id'");
47334 #ifdef FREECIV_JSON_CONNECTION
47335 field_addr.name = "target_tile_id";
47336 #endif /* FREECIV_JSON_CONNECTION */
47337 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
47338 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
47339 }
47340 }
47341 if (BV_ISSET(fields, 4)) {
47342 log_packet_detailed(" got field 'target_extra_id'");
47343 #ifdef FREECIV_JSON_CONNECTION
47344 field_addr.name = "target_extra_id";
47345 #endif /* FREECIV_JSON_CONNECTION */
47346 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
47347 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
47348 }
47349 }
47350 if (BV_ISSET(fields, 5)) {
47351 log_packet_detailed(" got field 'request_kind'");
47352 #ifdef FREECIV_JSON_CONNECTION
47353 field_addr.name = "request_kind";
47354 #endif /* FREECIV_JSON_CONNECTION */
47355 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
47356 RECEIVE_PACKET_FIELD_ERROR(request_kind);
47357 }
47358 }
47359 if (BV_ISSET(fields, 6)) {
47360 log_packet_detailed(" got field 'action_probabilities'");
47361 #ifdef FREECIV_JSON_CONNECTION
47362 field_addr.name = "action_probabilities";
47363 #endif /* FREECIV_JSON_CONNECTION */
47364
47365 {
47366 int i;
47367
47368 #ifdef FREECIV_JSON_CONNECTION
47369 /* Enter array. */
47370 field_addr.sub_location = plocation_elem_new(0);
47371 #endif /* FREECIV_JSON_CONNECTION */
47372
47373 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
47374 #ifdef FREECIV_JSON_CONNECTION
47375 field_addr.sub_location->number = i;
47376 #endif /* FREECIV_JSON_CONNECTION */
47377 if (!DIO_GET(action_probability, &din, &field_addr, &real_packet->action_probabilities[i])) {
47378 RECEIVE_PACKET_FIELD_ERROR(action_probabilities);
47379 }
47380 }
47381
47382 #ifdef FREECIV_JSON_CONNECTION
47383 /* Exit array. */
47384 free(field_addr.sub_location);
47385 field_addr.sub_location = NULL;
47386 #endif /* FREECIV_JSON_CONNECTION */
47387 }
47388 }
47389
47390 if (NULL == old) {
47391 old = fc_malloc(sizeof(*old));
47392 *old = *real_packet;
47393 genhash_insert(*hash, old, old);
47394 } else {
47395 *old = *real_packet;
47396 }
47397
47398#endif /* FREECIV_DELTA_PROTOCOL */
47399 RECEIVE_PACKET_END(real_packet);
47400}
47401
47402 static int send_packet_unit_actions_101(struct connection *pc, const struct packet_unit_actions *packet)
47403{
47404 const struct packet_unit_actions *real_packet = packet;
47405#ifdef FREECIV_DELTA_PROTOCOL
47406 packet_unit_actions_101_fields fields;
47407 struct packet_unit_actions *old;
47408 bool differ;
47409 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ACTIONS;
47410#endif /* FREECIV_DELTA_PROTOCOL */
47411 SEND_PACKET_START(PACKET_UNIT_ACTIONS);
47412#ifdef FREECIV_JSON_CONNECTION
47413 struct plocation field_addr;
47414 {
47415 struct plocation *field_addr_tmp = plocation_field_new(NULL);
47416 field_addr = *field_addr_tmp;
47417 FC_FREE(field_addr_tmp);
47418 }
47419#endif /* FREECIV_JSON_CONNECTION */
47420
47421 log_packet_detailed("packet_unit_actions_101: sending info about ()");
47422
47423#ifdef FREECIV_DELTA_PROTOCOL
47424 if (NULL == *hash) {
47425 *hash = genhash_new_full(hash_packet_unit_actions_101, cmp_packet_unit_actions_101,
47426 NULL, NULL, NULL, free);
47427 }
47428 BV_CLR_ALL(fields);
47429
47430 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
47431 old = fc_malloc(sizeof(*old));
47432 *old = *real_packet;
47433 genhash_insert(*hash, old, old);
47434 memset(old, 0, sizeof(*old));
47435 }
47436 differ = (old->actor_unit_id16 != real_packet->actor_unit_id16);
47437 if (differ) {
47438 BV_SET(fields, 0);
47439 }
47440
47441 differ = (old->target_unit_id16 != real_packet->target_unit_id16);
47442 if (differ) {
47443 BV_SET(fields, 1);
47444 }
47445
47446 differ = (old->target_city_id16 != real_packet->target_city_id16);
47447 if (differ) {
47448 BV_SET(fields, 2);
47449 }
47450
47451 differ = (old->target_tile_id != real_packet->target_tile_id);
47452 if (differ) {
47453 BV_SET(fields, 3);
47454 }
47455
47456 differ = (old->target_extra_id != real_packet->target_extra_id);
47457 if (differ) {
47458 BV_SET(fields, 4);
47459 }
47460
47461 differ = (old->request_kind != real_packet->request_kind);
47462 if (differ) {
47463 BV_SET(fields, 5);
47464 }
47465
47466
47467 {
47468 differ = FALSE;
47469 {
47470 int i;
47471
47472 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
47473 if (!are_action_probabilitys_equal(&old->action_probabilities[i], &real_packet->action_probabilities[i])) {
47474 differ = TRUE;
47475 break;
47476 }
47477 }
47478 }
47479 }
47480 if (differ) {
47481 BV_SET(fields, 6);
47482 }
47483
47484
47485#ifdef FREECIV_JSON_CONNECTION
47486 field_addr.name = "fields";
47487#endif /* FREECIV_JSON_CONNECTION */
47488 DIO_BV_PUT(&dout, &field_addr, fields);
47489
47490 if (BV_ISSET(fields, 0)) {
47491 log_packet_detailed(" field 'actor_unit_id16' has changed");
47492 #ifdef FREECIV_JSON_CONNECTION
47493 field_addr.name = "actor_unit_id16";
47494#endif /* FREECIV_JSON_CONNECTION */
47495 DIO_PUT(uint16, &dout, &field_addr, real_packet->actor_unit_id16);
47496 }
47497 if (BV_ISSET(fields, 1)) {
47498 log_packet_detailed(" field 'target_unit_id16' has changed");
47499 #ifdef FREECIV_JSON_CONNECTION
47500 field_addr.name = "target_unit_id16";
47501#endif /* FREECIV_JSON_CONNECTION */
47502 DIO_PUT(uint16, &dout, &field_addr, real_packet->target_unit_id16);
47503 }
47504 if (BV_ISSET(fields, 2)) {
47505 log_packet_detailed(" field 'target_city_id16' has changed");
47506 #ifdef FREECIV_JSON_CONNECTION
47507 field_addr.name = "target_city_id16";
47508#endif /* FREECIV_JSON_CONNECTION */
47509 DIO_PUT(uint16, &dout, &field_addr, real_packet->target_city_id16);
47510 }
47511 if (BV_ISSET(fields, 3)) {
47512 log_packet_detailed(" field 'target_tile_id' has changed");
47513 #ifdef FREECIV_JSON_CONNECTION
47514 field_addr.name = "target_tile_id";
47515#endif /* FREECIV_JSON_CONNECTION */
47516 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
47517 }
47518 if (BV_ISSET(fields, 4)) {
47519 log_packet_detailed(" field 'target_extra_id' has changed");
47520 #ifdef FREECIV_JSON_CONNECTION
47521 field_addr.name = "target_extra_id";
47522#endif /* FREECIV_JSON_CONNECTION */
47523 DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
47524 }
47525 if (BV_ISSET(fields, 5)) {
47526 log_packet_detailed(" field 'request_kind' has changed");
47527 #ifdef FREECIV_JSON_CONNECTION
47528 field_addr.name = "request_kind";
47529#endif /* FREECIV_JSON_CONNECTION */
47530 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
47531 }
47532 if (BV_ISSET(fields, 6)) {
47533 log_packet_detailed(" field 'action_probabilities' has changed");
47534 #ifdef FREECIV_JSON_CONNECTION
47535 field_addr.name = "action_probabilities";
47536#endif /* FREECIV_JSON_CONNECTION */
47537
47538 {
47539 int i;
47540
47541#ifdef FREECIV_JSON_CONNECTION
47542 /* Create the array. */
47543 DIO_PUT(farray, &dout, &field_addr, MAX_NUM_ACTIONS);
47544
47545 /* Enter the array. */
47546 field_addr.sub_location = plocation_elem_new(0);
47547#endif /* FREECIV_JSON_CONNECTION */
47548
47549 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
47550#ifdef FREECIV_JSON_CONNECTION
47551 /* Next array element. */
47552 field_addr.sub_location->number = i;
47553#endif /* FREECIV_JSON_CONNECTION */
47554 DIO_PUT(action_probability, &dout, &field_addr, &real_packet->action_probabilities[i]);
47555 }
47556
47557#ifdef FREECIV_JSON_CONNECTION
47558 /* Exit array. */
47559 free(field_addr.sub_location);
47560 field_addr.sub_location = NULL;
47561#endif /* FREECIV_JSON_CONNECTION */
47562 }
47563 }
47564
47565 *old = *real_packet;
47566#endif /* FREECIV_DELTA_PROTOCOL */
47567#ifndef FREECIV_DELTA_PROTOCOL
47568#ifdef FREECIV_JSON_CONNECTION
47569 field_addr.name = "actor_unit_id16";
47570#endif /* FREECIV_JSON_CONNECTION */
47571 DIO_PUT(uint16, &dout, &field_addr, real_packet->actor_unit_id16);
47572#ifdef FREECIV_JSON_CONNECTION
47573 field_addr.name = "target_unit_id16";
47574#endif /* FREECIV_JSON_CONNECTION */
47575 DIO_PUT(uint16, &dout, &field_addr, real_packet->target_unit_id16);
47576#ifdef FREECIV_JSON_CONNECTION
47577 field_addr.name = "target_city_id16";
47578#endif /* FREECIV_JSON_CONNECTION */
47579 DIO_PUT(uint16, &dout, &field_addr, real_packet->target_city_id16);
47580#ifdef FREECIV_JSON_CONNECTION
47581 field_addr.name = "target_tile_id";
47582#endif /* FREECIV_JSON_CONNECTION */
47583 DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
47584#ifdef FREECIV_JSON_CONNECTION
47585 field_addr.name = "target_extra_id";
47586#endif /* FREECIV_JSON_CONNECTION */
47587 DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
47588#ifdef FREECIV_JSON_CONNECTION
47589 field_addr.name = "request_kind";
47590#endif /* FREECIV_JSON_CONNECTION */
47591 DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
47592#ifdef FREECIV_JSON_CONNECTION
47593 field_addr.name = "action_probabilities";
47594#endif /* FREECIV_JSON_CONNECTION */
47595
47596 {
47597 int i;
47598
47599#ifdef FREECIV_JSON_CONNECTION
47600 /* Create the array. */
47601 DIO_PUT(farray, &dout, &field_addr, MAX_NUM_ACTIONS);
47602
47603 /* Enter the array. */
47604 field_addr.sub_location = plocation_elem_new(0);
47605#endif /* FREECIV_JSON_CONNECTION */
47606
47607 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
47608#ifdef FREECIV_JSON_CONNECTION
47609 /* Next array element. */
47610 field_addr.sub_location->number = i;
47611#endif /* FREECIV_JSON_CONNECTION */
47612 DIO_PUT(action_probability, &dout, &field_addr, &real_packet->action_probabilities[i]);
47613 }
47614
47615#ifdef FREECIV_JSON_CONNECTION
47616 /* Exit array. */
47617 free(field_addr.sub_location);
47618 field_addr.sub_location = NULL;
47619#endif /* FREECIV_JSON_CONNECTION */
47620 }
47621
47622#endif
47623 SEND_PACKET_END(PACKET_UNIT_ACTIONS);
47624}
47625
47626 int send_packet_unit_actions(struct connection *pc, const struct packet_unit_actions *packet)
47627{
47628 if (!pc->used) {
47629 log_error("WARNING: trying to send data to the closed connection %s",
47630 conn_description(pc));
47631 return -1;
47632 }
47633 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_ACTIONS].packet != NULL, -1,
47634 "Handler for PACKET_UNIT_ACTIONS not installed");
47635 return pc->phs.handlers->send[PACKET_UNIT_ACTIONS].packet(pc, packet);
47636}
47637
47638 int dsend_packet_unit_actions(struct connection *pc, int actor_unit_id16, int actor_unit_id32, int target_unit_id16, int target_unit_id32, int target_city_id16, int target_city_id32, int target_tile_id, int target_extra_id, int request_kind, const struct act_prob *action_probabilities)
47639{
47640 struct packet_unit_actions packet, *real_packet = &packet;
47641
47642 real_packet->actor_unit_id16 = actor_unit_id16;
47643 real_packet->actor_unit_id32 = actor_unit_id32;
47644 real_packet->target_unit_id16 = target_unit_id16;
47645 real_packet->target_unit_id32 = target_unit_id32;
47646 real_packet->target_city_id16 = target_city_id16;
47647 real_packet->target_city_id32 = target_city_id32;
47648 real_packet->target_tile_id = target_tile_id;
47649 real_packet->target_extra_id = target_extra_id;
47650 real_packet->request_kind = request_kind;
47651 {
47652 int i;
47653
47654 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
47655 real_packet->action_probabilities[i] = action_probabilities[i];
47656 }
47657 }
47658
47659 return send_packet_unit_actions(pc, real_packet);
47660}
47661
47662#ifdef FREECIV_DELTA_PROTOCOL
47663#define hash_packet_unit_change_activity_100 hash_const
47664
47665#define cmp_packet_unit_change_activity_100 cmp_const
47666
47667 BV_DEFINE(packet_unit_change_activity_100_fields, 3);
47668#endif /* FREECIV_DELTA_PROTOCOL */
47669
47670 static struct packet_unit_change_activity *receive_packet_unit_change_activity_100(struct connection *pc)
47671{
47672#ifdef FREECIV_DELTA_PROTOCOL
47673 packet_unit_change_activity_100_fields fields;
47674 struct packet_unit_change_activity *old;
47675 struct genhash **hash = pc->phs.received + PACKET_UNIT_CHANGE_ACTIVITY;
47676#endif /* FREECIV_DELTA_PROTOCOL */
47677 RECEIVE_PACKET_START(packet_unit_change_activity, real_packet);
47678#ifdef FREECIV_JSON_CONNECTION
47679 struct plocation field_addr;
47680 {
47681 struct plocation *field_addr_tmp = plocation_field_new(NULL);
47682 field_addr = *field_addr_tmp;
47683 FC_FREE(field_addr_tmp);
47684 }
47685#endif /* FREECIV_JSON_CONNECTION */
47686
47687#ifdef FREECIV_DELTA_PROTOCOL
47688#ifdef FREECIV_JSON_CONNECTION
47689 field_addr.name = "fields";
47690#endif /* FREECIV_JSON_CONNECTION */
47691 DIO_BV_GET(&din, &field_addr, fields);
47692
47693#else /* FREECIV_DELTA_PROTOCOL */
47694 #ifdef FREECIV_JSON_CONNECTION
47695 field_addr.name = "unit_id32";
47696 #endif /* FREECIV_JSON_CONNECTION */
47697 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
47698 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
47699 }
47700 #ifdef FREECIV_JSON_CONNECTION
47701 field_addr.name = "activity";
47702 #endif /* FREECIV_JSON_CONNECTION */
47703 {
47704 int readin;
47705
47706 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
47707 RECEIVE_PACKET_FIELD_ERROR(activity);
47708 }
47709 real_packet->activity = readin;
47710 }
47711 #ifdef FREECIV_JSON_CONNECTION
47712 field_addr.name = "target";
47713 #endif /* FREECIV_JSON_CONNECTION */
47714 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target)) {
47715 RECEIVE_PACKET_FIELD_ERROR(target);
47716 }
47717
47718#endif
47719 log_packet_detailed("packet_unit_change_activity_100: got info about ()");
47720
47721#ifdef FREECIV_DELTA_PROTOCOL
47722 if (NULL == *hash) {
47723 *hash = genhash_new_full(hash_packet_unit_change_activity_100, cmp_packet_unit_change_activity_100,
47724 NULL, NULL, NULL, free);
47725 }
47726
47727 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
47728 *real_packet = *old;
47729 } else {
47730 log_packet_detailed(" no old info");
47731 memset(real_packet, 0, sizeof(*real_packet));
47732 }
47733
47734 if (BV_ISSET(fields, 0)) {
47735 log_packet_detailed(" got field 'unit_id32'");
47736 #ifdef FREECIV_JSON_CONNECTION
47737 field_addr.name = "unit_id32";
47738 #endif /* FREECIV_JSON_CONNECTION */
47739 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id32)) {
47740 RECEIVE_PACKET_FIELD_ERROR(unit_id32);
47741 }
47742 }
47743 if (BV_ISSET(fields, 1)) {
47744 log_packet_detailed(" got field 'activity'");
47745 #ifdef FREECIV_JSON_CONNECTION
47746 field_addr.name = "activity";
47747 #endif /* FREECIV_JSON_CONNECTION */
47748 {
47749 int readin;
47750
47751 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
47752 RECEIVE_PACKET_FIELD_ERROR(activity);
47753 }
47754 real_packet->activity = readin;
47755 }
47756 }
47757 if (BV_ISSET(fields, 2)) {
47758 log_packet_detailed(" got field 'target'");
47759 #ifdef FREECIV_JSON_CONNECTION
47760 field_addr.name = "target";
47761 #endif /* FREECIV_JSON_CONNECTION */
47762 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target)) {
47763 RECEIVE_PACKET_FIELD_ERROR(target);
47764 }
47765 }
47766
47767 if (NULL == old) {
47768 old = fc_malloc(sizeof(*old));
47769 *old = *real_packet;
47770 genhash_insert(*hash, old, old);
47771 } else {
47772 *old = *real_packet;
47773 }
47774
47775#endif /* FREECIV_DELTA_PROTOCOL */
47776 RECEIVE_PACKET_END(real_packet);
47777}
47778
47779 static int send_packet_unit_change_activity_100(struct connection *pc, const struct packet_unit_change_activity *packet)
47780{
47781 const struct packet_unit_change_activity *real_packet = packet;
47782#ifdef FREECIV_DELTA_PROTOCOL
47783 packet_unit_change_activity_100_fields fields;
47784 struct packet_unit_change_activity *old;
47785 bool differ;
47786 struct genhash **hash = pc->phs.sent + PACKET_UNIT_CHANGE_ACTIVITY;
47787#endif /* FREECIV_DELTA_PROTOCOL */
47788 SEND_PACKET_START(PACKET_UNIT_CHANGE_ACTIVITY);
47789#ifdef FREECIV_JSON_CONNECTION
47790 struct plocation field_addr;
47791 {
47792 struct plocation *field_addr_tmp = plocation_field_new(NULL);
47793 field_addr = *field_addr_tmp;
47794 FC_FREE(field_addr_tmp);
47795 }
47796#endif /* FREECIV_JSON_CONNECTION */
47797
47798 log_packet_detailed("packet_unit_change_activity_100: sending info about ()");
47799
47800#ifdef FREECIV_DELTA_PROTOCOL
47801 if (NULL == *hash) {
47802 *hash = genhash_new_full(hash_packet_unit_change_activity_100, cmp_packet_unit_change_activity_100,
47803 NULL, NULL, NULL, free);
47804 }
47805 BV_CLR_ALL(fields);
47806
47807 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
47808 old = fc_malloc(sizeof(*old));
47809 *old = *real_packet;
47810 genhash_insert(*hash, old, old);
47811 memset(old, 0, sizeof(*old));
47812 }
47813 differ = (old->unit_id32 != real_packet->unit_id32);
47814 if (differ) {
47815 BV_SET(fields, 0);
47816 }
47817
47818 differ = (old->activity != real_packet->activity);
47819 if (differ) {
47820 BV_SET(fields, 1);
47821 }
47822
47823 differ = (old->target != real_packet->target);
47824 if (differ) {
47825 BV_SET(fields, 2);
47826 }
47827
47828
47829#ifdef FREECIV_JSON_CONNECTION
47830 field_addr.name = "fields";
47831#endif /* FREECIV_JSON_CONNECTION */
47832 DIO_BV_PUT(&dout, &field_addr, fields);
47833
47834 if (BV_ISSET(fields, 0)) {
47835 log_packet_detailed(" field 'unit_id32' has changed");
47836 #ifdef FREECIV_JSON_CONNECTION
47837 field_addr.name = "unit_id32";
47838#endif /* FREECIV_JSON_CONNECTION */
47839 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
47840 }
47841 if (BV_ISSET(fields, 1)) {
47842 log_packet_detailed(" field 'activity' has changed");
47843 #ifdef FREECIV_JSON_CONNECTION
47844 field_addr.name = "activity";
47845#endif /* FREECIV_JSON_CONNECTION */
47846 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
47847 }
47848 if (BV_ISSET(fields, 2)) {
47849 log_packet_detailed(" field 'target' has changed");
47850 #ifdef FREECIV_JSON_CONNECTION
47851 field_addr.name = "target";
47852#endif /* FREECIV_JSON_CONNECTION */
47853 DIO_PUT(sint8, &dout, &field_addr, real_packet->target);
47854 }
47855
47856 *old = *real_packet;
47857#endif /* FREECIV_DELTA_PROTOCOL */
47858#ifndef FREECIV_DELTA_PROTOCOL
47859#ifdef FREECIV_JSON_CONNECTION
47860 field_addr.name = "unit_id32";
47861#endif /* FREECIV_JSON_CONNECTION */
47862 DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id32);
47863#ifdef FREECIV_JSON_CONNECTION
47864 field_addr.name = "activity";
47865#endif /* FREECIV_JSON_CONNECTION */
47866 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
47867#ifdef FREECIV_JSON_CONNECTION
47868 field_addr.name = "target";
47869#endif /* FREECIV_JSON_CONNECTION */
47870 DIO_PUT(sint8, &dout, &field_addr, real_packet->target);
47871
47872#endif
47873 SEND_PACKET_END(PACKET_UNIT_CHANGE_ACTIVITY);
47874}
47875
47876#ifdef FREECIV_DELTA_PROTOCOL
47877#define hash_packet_unit_change_activity_101 hash_const
47878
47879#define cmp_packet_unit_change_activity_101 cmp_const
47880
47881 BV_DEFINE(packet_unit_change_activity_101_fields, 3);
47882#endif /* FREECIV_DELTA_PROTOCOL */
47883
47884 static struct packet_unit_change_activity *receive_packet_unit_change_activity_101(struct connection *pc)
47885{
47886#ifdef FREECIV_DELTA_PROTOCOL
47887 packet_unit_change_activity_101_fields fields;
47888 struct packet_unit_change_activity *old;
47889 struct genhash **hash = pc->phs.received + PACKET_UNIT_CHANGE_ACTIVITY;
47890#endif /* FREECIV_DELTA_PROTOCOL */
47891 RECEIVE_PACKET_START(packet_unit_change_activity, real_packet);
47892#ifdef FREECIV_JSON_CONNECTION
47893 struct plocation field_addr;
47894 {
47895 struct plocation *field_addr_tmp = plocation_field_new(NULL);
47896 field_addr = *field_addr_tmp;
47897 FC_FREE(field_addr_tmp);
47898 }
47899#endif /* FREECIV_JSON_CONNECTION */
47900
47901#ifdef FREECIV_DELTA_PROTOCOL
47902#ifdef FREECIV_JSON_CONNECTION
47903 field_addr.name = "fields";
47904#endif /* FREECIV_JSON_CONNECTION */
47905 DIO_BV_GET(&din, &field_addr, fields);
47906
47907#else /* FREECIV_DELTA_PROTOCOL */
47908 #ifdef FREECIV_JSON_CONNECTION
47909 field_addr.name = "unit_id16";
47910 #endif /* FREECIV_JSON_CONNECTION */
47911 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
47912 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
47913 }
47914 #ifdef FREECIV_JSON_CONNECTION
47915 field_addr.name = "activity";
47916 #endif /* FREECIV_JSON_CONNECTION */
47917 {
47918 int readin;
47919
47920 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
47921 RECEIVE_PACKET_FIELD_ERROR(activity);
47922 }
47923 real_packet->activity = readin;
47924 }
47925 #ifdef FREECIV_JSON_CONNECTION
47926 field_addr.name = "target";
47927 #endif /* FREECIV_JSON_CONNECTION */
47928 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target)) {
47929 RECEIVE_PACKET_FIELD_ERROR(target);
47930 }
47931
47932#endif
47933 log_packet_detailed("packet_unit_change_activity_101: got info about ()");
47934
47935#ifdef FREECIV_DELTA_PROTOCOL
47936 if (NULL == *hash) {
47937 *hash = genhash_new_full(hash_packet_unit_change_activity_101, cmp_packet_unit_change_activity_101,
47938 NULL, NULL, NULL, free);
47939 }
47940
47941 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
47942 *real_packet = *old;
47943 } else {
47944 log_packet_detailed(" no old info");
47945 memset(real_packet, 0, sizeof(*real_packet));
47946 }
47947
47948 if (BV_ISSET(fields, 0)) {
47949 log_packet_detailed(" got field 'unit_id16'");
47950 #ifdef FREECIV_JSON_CONNECTION
47951 field_addr.name = "unit_id16";
47952 #endif /* FREECIV_JSON_CONNECTION */
47953 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->unit_id16)) {
47954 RECEIVE_PACKET_FIELD_ERROR(unit_id16);
47955 }
47956 }
47957 if (BV_ISSET(fields, 1)) {
47958 log_packet_detailed(" got field 'activity'");
47959 #ifdef FREECIV_JSON_CONNECTION
47960 field_addr.name = "activity";
47961 #endif /* FREECIV_JSON_CONNECTION */
47962 {
47963 int readin;
47964
47965 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
47966 RECEIVE_PACKET_FIELD_ERROR(activity);
47967 }
47968 real_packet->activity = readin;
47969 }
47970 }
47971 if (BV_ISSET(fields, 2)) {
47972 log_packet_detailed(" got field 'target'");
47973 #ifdef FREECIV_JSON_CONNECTION
47974 field_addr.name = "target";
47975 #endif /* FREECIV_JSON_CONNECTION */
47976 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target)) {
47977 RECEIVE_PACKET_FIELD_ERROR(target);
47978 }
47979 }
47980
47981 if (NULL == old) {
47982 old = fc_malloc(sizeof(*old));
47983 *old = *real_packet;
47984 genhash_insert(*hash, old, old);
47985 } else {
47986 *old = *real_packet;
47987 }
47988
47989#endif /* FREECIV_DELTA_PROTOCOL */
47990 RECEIVE_PACKET_END(real_packet);
47991}
47992
47993 static int send_packet_unit_change_activity_101(struct connection *pc, const struct packet_unit_change_activity *packet)
47994{
47995 const struct packet_unit_change_activity *real_packet = packet;
47996#ifdef FREECIV_DELTA_PROTOCOL
47997 packet_unit_change_activity_101_fields fields;
47998 struct packet_unit_change_activity *old;
47999 bool differ;
48000 struct genhash **hash = pc->phs.sent + PACKET_UNIT_CHANGE_ACTIVITY;
48001#endif /* FREECIV_DELTA_PROTOCOL */
48002 SEND_PACKET_START(PACKET_UNIT_CHANGE_ACTIVITY);
48003#ifdef FREECIV_JSON_CONNECTION
48004 struct plocation field_addr;
48005 {
48006 struct plocation *field_addr_tmp = plocation_field_new(NULL);
48007 field_addr = *field_addr_tmp;
48008 FC_FREE(field_addr_tmp);
48009 }
48010#endif /* FREECIV_JSON_CONNECTION */
48011
48012 log_packet_detailed("packet_unit_change_activity_101: sending info about ()");
48013
48014#ifdef FREECIV_DELTA_PROTOCOL
48015 if (NULL == *hash) {
48016 *hash = genhash_new_full(hash_packet_unit_change_activity_101, cmp_packet_unit_change_activity_101,
48017 NULL, NULL, NULL, free);
48018 }
48019 BV_CLR_ALL(fields);
48020
48021 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
48022 old = fc_malloc(sizeof(*old));
48023 *old = *real_packet;
48024 genhash_insert(*hash, old, old);
48025 memset(old, 0, sizeof(*old));
48026 }
48027 differ = (old->unit_id16 != real_packet->unit_id16);
48028 if (differ) {
48029 BV_SET(fields, 0);
48030 }
48031
48032 differ = (old->activity != real_packet->activity);
48033 if (differ) {
48034 BV_SET(fields, 1);
48035 }
48036
48037 differ = (old->target != real_packet->target);
48038 if (differ) {
48039 BV_SET(fields, 2);
48040 }
48041
48042
48043#ifdef FREECIV_JSON_CONNECTION
48044 field_addr.name = "fields";
48045#endif /* FREECIV_JSON_CONNECTION */
48046 DIO_BV_PUT(&dout, &field_addr, fields);
48047
48048 if (BV_ISSET(fields, 0)) {
48049 log_packet_detailed(" field 'unit_id16' has changed");
48050 #ifdef FREECIV_JSON_CONNECTION
48051 field_addr.name = "unit_id16";
48052#endif /* FREECIV_JSON_CONNECTION */
48053 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
48054 }
48055 if (BV_ISSET(fields, 1)) {
48056 log_packet_detailed(" field 'activity' has changed");
48057 #ifdef FREECIV_JSON_CONNECTION
48058 field_addr.name = "activity";
48059#endif /* FREECIV_JSON_CONNECTION */
48060 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
48061 }
48062 if (BV_ISSET(fields, 2)) {
48063 log_packet_detailed(" field 'target' has changed");
48064 #ifdef FREECIV_JSON_CONNECTION
48065 field_addr.name = "target";
48066#endif /* FREECIV_JSON_CONNECTION */
48067 DIO_PUT(sint8, &dout, &field_addr, real_packet->target);
48068 }
48069
48070 *old = *real_packet;
48071#endif /* FREECIV_DELTA_PROTOCOL */
48072#ifndef FREECIV_DELTA_PROTOCOL
48073#ifdef FREECIV_JSON_CONNECTION
48074 field_addr.name = "unit_id16";
48075#endif /* FREECIV_JSON_CONNECTION */
48076 DIO_PUT(uint16, &dout, &field_addr, real_packet->unit_id16);
48077#ifdef FREECIV_JSON_CONNECTION
48078 field_addr.name = "activity";
48079#endif /* FREECIV_JSON_CONNECTION */
48080 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
48081#ifdef FREECIV_JSON_CONNECTION
48082 field_addr.name = "target";
48083#endif /* FREECIV_JSON_CONNECTION */
48084 DIO_PUT(sint8, &dout, &field_addr, real_packet->target);
48085
48086#endif
48087 SEND_PACKET_END(PACKET_UNIT_CHANGE_ACTIVITY);
48088}
48089
48090 int send_packet_unit_change_activity(struct connection *pc, const struct packet_unit_change_activity *packet)
48091{
48092 if (!pc->used) {
48093 log_error("WARNING: trying to send data to the closed connection %s",
48094 conn_description(pc));
48095 return -1;
48096 }
48097 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_CHANGE_ACTIVITY].packet != NULL, -1,
48098 "Handler for PACKET_UNIT_CHANGE_ACTIVITY not installed");
48099 return pc->phs.handlers->send[PACKET_UNIT_CHANGE_ACTIVITY].packet(pc, packet);
48100}
48101
48102 int dsend_packet_unit_change_activity(struct connection *pc, int unit_id16, int unit_id32, enum unit_activity activity, int target)
48103{
48104 struct packet_unit_change_activity packet, *real_packet = &packet;
48105
48106 real_packet->unit_id16 = unit_id16;
48107 real_packet->unit_id32 = unit_id32;
48108 real_packet->activity = activity;
48109 real_packet->target = target;
48110
48111 return send_packet_unit_change_activity(pc, real_packet);
48112}
48113
48114#ifdef FREECIV_DELTA_PROTOCOL
48115#define hash_packet_diplomacy_init_meeting_req_100 hash_const
48116
48117#define cmp_packet_diplomacy_init_meeting_req_100 cmp_const
48118
48119 BV_DEFINE(packet_diplomacy_init_meeting_req_100_fields, 1);
48120#endif /* FREECIV_DELTA_PROTOCOL */
48121
48122 static struct packet_diplomacy_init_meeting_req *receive_packet_diplomacy_init_meeting_req_100(struct connection *pc)
48123{
48124#ifdef FREECIV_DELTA_PROTOCOL
48125 packet_diplomacy_init_meeting_req_100_fields fields;
48126 struct packet_diplomacy_init_meeting_req *old;
48127 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_INIT_MEETING_REQ;
48128#endif /* FREECIV_DELTA_PROTOCOL */
48129 RECEIVE_PACKET_START(packet_diplomacy_init_meeting_req, real_packet);
48130#ifdef FREECIV_JSON_CONNECTION
48131 struct plocation field_addr;
48132 {
48133 struct plocation *field_addr_tmp = plocation_field_new(NULL);
48134 field_addr = *field_addr_tmp;
48135 FC_FREE(field_addr_tmp);
48136 }
48137#endif /* FREECIV_JSON_CONNECTION */
48138
48139#ifdef FREECIV_DELTA_PROTOCOL
48140#ifdef FREECIV_JSON_CONNECTION
48141 field_addr.name = "fields";
48142#endif /* FREECIV_JSON_CONNECTION */
48143 DIO_BV_GET(&din, &field_addr, fields);
48144
48145#else /* FREECIV_DELTA_PROTOCOL */
48146 #ifdef FREECIV_JSON_CONNECTION
48147 field_addr.name = "counterpart";
48148 #endif /* FREECIV_JSON_CONNECTION */
48149 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
48150 RECEIVE_PACKET_FIELD_ERROR(counterpart);
48151 }
48152
48153#endif
48154 log_packet_detailed("packet_diplomacy_init_meeting_req_100: got info about ()");
48155
48156#ifdef FREECIV_DELTA_PROTOCOL
48157 if (NULL == *hash) {
48158 *hash = genhash_new_full(hash_packet_diplomacy_init_meeting_req_100, cmp_packet_diplomacy_init_meeting_req_100,
48159 NULL, NULL, NULL, free);
48160 }
48161
48162 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
48163 *real_packet = *old;
48164 } else {
48165 log_packet_detailed(" no old info");
48166 memset(real_packet, 0, sizeof(*real_packet));
48167 }
48168
48169 if (BV_ISSET(fields, 0)) {
48170 log_packet_detailed(" got field 'counterpart'");
48171 #ifdef FREECIV_JSON_CONNECTION
48172 field_addr.name = "counterpart";
48173 #endif /* FREECIV_JSON_CONNECTION */
48174 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
48175 RECEIVE_PACKET_FIELD_ERROR(counterpart);
48176 }
48177 }
48178
48179 if (NULL == old) {
48180 old = fc_malloc(sizeof(*old));
48181 *old = *real_packet;
48182 genhash_insert(*hash, old, old);
48183 } else {
48184 *old = *real_packet;
48185 }
48186
48187#endif /* FREECIV_DELTA_PROTOCOL */
48188 RECEIVE_PACKET_END(real_packet);
48189}
48190
48191 static int send_packet_diplomacy_init_meeting_req_100(struct connection *pc, const struct packet_diplomacy_init_meeting_req *packet)
48192{
48193 const struct packet_diplomacy_init_meeting_req *real_packet = packet;
48194#ifdef FREECIV_DELTA_PROTOCOL
48195 packet_diplomacy_init_meeting_req_100_fields fields;
48196 struct packet_diplomacy_init_meeting_req *old;
48197 bool differ;
48198 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_INIT_MEETING_REQ;
48199#endif /* FREECIV_DELTA_PROTOCOL */
48200 SEND_PACKET_START(PACKET_DIPLOMACY_INIT_MEETING_REQ);
48201#ifdef FREECIV_JSON_CONNECTION
48202 struct plocation field_addr;
48203 {
48204 struct plocation *field_addr_tmp = plocation_field_new(NULL);
48205 field_addr = *field_addr_tmp;
48206 FC_FREE(field_addr_tmp);
48207 }
48208#endif /* FREECIV_JSON_CONNECTION */
48209
48210 log_packet_detailed("packet_diplomacy_init_meeting_req_100: sending info about ()");
48211
48212#ifdef FREECIV_DELTA_PROTOCOL
48213 if (NULL == *hash) {
48214 *hash = genhash_new_full(hash_packet_diplomacy_init_meeting_req_100, cmp_packet_diplomacy_init_meeting_req_100,
48215 NULL, NULL, NULL, free);
48216 }
48217 BV_CLR_ALL(fields);
48218
48219 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
48220 old = fc_malloc(sizeof(*old));
48221 *old = *real_packet;
48222 genhash_insert(*hash, old, old);
48223 memset(old, 0, sizeof(*old));
48224 }
48225 differ = (old->counterpart != real_packet->counterpart);
48226 if (differ) {
48227 BV_SET(fields, 0);
48228 }
48229
48230
48231#ifdef FREECIV_JSON_CONNECTION
48232 field_addr.name = "fields";
48233#endif /* FREECIV_JSON_CONNECTION */
48234 DIO_BV_PUT(&dout, &field_addr, fields);
48235
48236 if (BV_ISSET(fields, 0)) {
48237 log_packet_detailed(" field 'counterpart' has changed");
48238 #ifdef FREECIV_JSON_CONNECTION
48239 field_addr.name = "counterpart";
48240#endif /* FREECIV_JSON_CONNECTION */
48241 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
48242 }
48243
48244 *old = *real_packet;
48245#endif /* FREECIV_DELTA_PROTOCOL */
48246#ifndef FREECIV_DELTA_PROTOCOL
48247#ifdef FREECIV_JSON_CONNECTION
48248 field_addr.name = "counterpart";
48249#endif /* FREECIV_JSON_CONNECTION */
48250 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
48251
48252#endif
48253 SEND_PACKET_END(PACKET_DIPLOMACY_INIT_MEETING_REQ);
48254}
48255
48256 int send_packet_diplomacy_init_meeting_req(struct connection *pc, const struct packet_diplomacy_init_meeting_req *packet)
48257{
48258 if (!pc->used) {
48259 log_error("WARNING: trying to send data to the closed connection %s",
48260 conn_description(pc));
48261 return -1;
48262 }
48263 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_INIT_MEETING_REQ].packet != NULL, -1,
48264 "Handler for PACKET_DIPLOMACY_INIT_MEETING_REQ not installed");
48265 return pc->phs.handlers->send[PACKET_DIPLOMACY_INIT_MEETING_REQ].packet(pc, packet);
48266}
48267
48268 int dsend_packet_diplomacy_init_meeting_req(struct connection *pc, int counterpart)
48269{
48270 struct packet_diplomacy_init_meeting_req packet, *real_packet = &packet;
48271
48272 real_packet->counterpart = counterpart;
48273
48274 return send_packet_diplomacy_init_meeting_req(pc, real_packet);
48275}
48276
48277#ifdef FREECIV_DELTA_PROTOCOL
48278#define hash_packet_diplomacy_init_meeting_100 hash_const
48279
48280#define cmp_packet_diplomacy_init_meeting_100 cmp_const
48281
48282 BV_DEFINE(packet_diplomacy_init_meeting_100_fields, 2);
48283#endif /* FREECIV_DELTA_PROTOCOL */
48284
48285 static struct packet_diplomacy_init_meeting *receive_packet_diplomacy_init_meeting_100(struct connection *pc)
48286{
48287#ifdef FREECIV_DELTA_PROTOCOL
48288 packet_diplomacy_init_meeting_100_fields fields;
48289 struct packet_diplomacy_init_meeting *old;
48290 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_INIT_MEETING;
48291#endif /* FREECIV_DELTA_PROTOCOL */
48292 RECEIVE_PACKET_START(packet_diplomacy_init_meeting, real_packet);
48293#ifdef FREECIV_JSON_CONNECTION
48294 struct plocation field_addr;
48295 {
48296 struct plocation *field_addr_tmp = plocation_field_new(NULL);
48297 field_addr = *field_addr_tmp;
48298 FC_FREE(field_addr_tmp);
48299 }
48300#endif /* FREECIV_JSON_CONNECTION */
48301
48302#ifdef FREECIV_DELTA_PROTOCOL
48303#ifdef FREECIV_JSON_CONNECTION
48304 field_addr.name = "fields";
48305#endif /* FREECIV_JSON_CONNECTION */
48306 DIO_BV_GET(&din, &field_addr, fields);
48307
48308#else /* FREECIV_DELTA_PROTOCOL */
48309 #ifdef FREECIV_JSON_CONNECTION
48310 field_addr.name = "counterpart";
48311 #endif /* FREECIV_JSON_CONNECTION */
48312 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
48313 RECEIVE_PACKET_FIELD_ERROR(counterpart);
48314 }
48315 #ifdef FREECIV_JSON_CONNECTION
48316 field_addr.name = "initiated_from";
48317 #endif /* FREECIV_JSON_CONNECTION */
48318 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->initiated_from)) {
48319 RECEIVE_PACKET_FIELD_ERROR(initiated_from);
48320 }
48321
48322#endif
48323 log_packet_detailed("packet_diplomacy_init_meeting_100: got info about ()");
48324
48325#ifdef FREECIV_DELTA_PROTOCOL
48326 if (NULL == *hash) {
48327 *hash = genhash_new_full(hash_packet_diplomacy_init_meeting_100, cmp_packet_diplomacy_init_meeting_100,
48328 NULL, NULL, NULL, free);
48329 }
48330
48331 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
48332 *real_packet = *old;
48333 } else {
48334 log_packet_detailed(" no old info");
48335 memset(real_packet, 0, sizeof(*real_packet));
48336 }
48337
48338 if (BV_ISSET(fields, 0)) {
48339 log_packet_detailed(" got field 'counterpart'");
48340 #ifdef FREECIV_JSON_CONNECTION
48341 field_addr.name = "counterpart";
48342 #endif /* FREECIV_JSON_CONNECTION */
48343 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
48344 RECEIVE_PACKET_FIELD_ERROR(counterpart);
48345 }
48346 }
48347 if (BV_ISSET(fields, 1)) {
48348 log_packet_detailed(" got field 'initiated_from'");
48349 #ifdef FREECIV_JSON_CONNECTION
48350 field_addr.name = "initiated_from";
48351 #endif /* FREECIV_JSON_CONNECTION */
48352 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->initiated_from)) {
48353 RECEIVE_PACKET_FIELD_ERROR(initiated_from);
48354 }
48355 }
48356
48357 if (NULL == old) {
48358 old = fc_malloc(sizeof(*old));
48359 *old = *real_packet;
48360 genhash_insert(*hash, old, old);
48361 } else {
48362 *old = *real_packet;
48363 }
48364
48365#endif /* FREECIV_DELTA_PROTOCOL */
48366 RECEIVE_PACKET_END(real_packet);
48367}
48368
48369 static int send_packet_diplomacy_init_meeting_100(struct connection *pc, const struct packet_diplomacy_init_meeting *packet)
48370{
48371 const struct packet_diplomacy_init_meeting *real_packet = packet;
48372#ifdef FREECIV_DELTA_PROTOCOL
48373 packet_diplomacy_init_meeting_100_fields fields;
48374 struct packet_diplomacy_init_meeting *old;
48375 bool differ;
48376 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_INIT_MEETING;
48377#endif /* FREECIV_DELTA_PROTOCOL */
48378 SEND_PACKET_START(PACKET_DIPLOMACY_INIT_MEETING);
48379#ifdef FREECIV_JSON_CONNECTION
48380 struct plocation field_addr;
48381 {
48382 struct plocation *field_addr_tmp = plocation_field_new(NULL);
48383 field_addr = *field_addr_tmp;
48384 FC_FREE(field_addr_tmp);
48385 }
48386#endif /* FREECIV_JSON_CONNECTION */
48387
48388 log_packet_detailed("packet_diplomacy_init_meeting_100: sending info about ()");
48389
48390#ifdef FREECIV_DELTA_PROTOCOL
48391 if (NULL == *hash) {
48392 *hash = genhash_new_full(hash_packet_diplomacy_init_meeting_100, cmp_packet_diplomacy_init_meeting_100,
48393 NULL, NULL, NULL, free);
48394 }
48395 BV_CLR_ALL(fields);
48396
48397 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
48398 old = fc_malloc(sizeof(*old));
48399 *old = *real_packet;
48400 genhash_insert(*hash, old, old);
48401 memset(old, 0, sizeof(*old));
48402 }
48403 differ = (old->counterpart != real_packet->counterpart);
48404 if (differ) {
48405 BV_SET(fields, 0);
48406 }
48407
48408 differ = (old->initiated_from != real_packet->initiated_from);
48409 if (differ) {
48410 BV_SET(fields, 1);
48411 }
48412
48413
48414#ifdef FREECIV_JSON_CONNECTION
48415 field_addr.name = "fields";
48416#endif /* FREECIV_JSON_CONNECTION */
48417 DIO_BV_PUT(&dout, &field_addr, fields);
48418
48419 if (BV_ISSET(fields, 0)) {
48420 log_packet_detailed(" field 'counterpart' has changed");
48421 #ifdef FREECIV_JSON_CONNECTION
48422 field_addr.name = "counterpart";
48423#endif /* FREECIV_JSON_CONNECTION */
48424 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
48425 }
48426 if (BV_ISSET(fields, 1)) {
48427 log_packet_detailed(" field 'initiated_from' has changed");
48428 #ifdef FREECIV_JSON_CONNECTION
48429 field_addr.name = "initiated_from";
48430#endif /* FREECIV_JSON_CONNECTION */
48431 DIO_PUT(uint16, &dout, &field_addr, real_packet->initiated_from);
48432 }
48433
48434 *old = *real_packet;
48435#endif /* FREECIV_DELTA_PROTOCOL */
48436#ifndef FREECIV_DELTA_PROTOCOL
48437#ifdef FREECIV_JSON_CONNECTION
48438 field_addr.name = "counterpart";
48439#endif /* FREECIV_JSON_CONNECTION */
48440 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
48441#ifdef FREECIV_JSON_CONNECTION
48442 field_addr.name = "initiated_from";
48443#endif /* FREECIV_JSON_CONNECTION */
48444 DIO_PUT(uint16, &dout, &field_addr, real_packet->initiated_from);
48445
48446#endif
48447 SEND_PACKET_END(PACKET_DIPLOMACY_INIT_MEETING);
48448}
48449
48450 int send_packet_diplomacy_init_meeting(struct connection *pc, const struct packet_diplomacy_init_meeting *packet)
48451{
48452 if (!pc->used) {
48453 log_error("WARNING: trying to send data to the closed connection %s",
48454 conn_description(pc));
48455 return -1;
48456 }
48457 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_INIT_MEETING].packet != NULL, -1,
48458 "Handler for PACKET_DIPLOMACY_INIT_MEETING not installed");
48459 return pc->phs.handlers->send[PACKET_DIPLOMACY_INIT_MEETING].packet(pc, packet);
48460}
48461
48462 void lsend_packet_diplomacy_init_meeting(struct conn_list *dest, const struct packet_diplomacy_init_meeting *packet)
48463{
48464 conn_list_iterate(dest, pconn) {
48465 send_packet_diplomacy_init_meeting(pconn, packet);
48466 } conn_list_iterate_end;
48467}
48468
48469 int dsend_packet_diplomacy_init_meeting(struct connection *pc, int counterpart, int initiated_from)
48470{
48471 struct packet_diplomacy_init_meeting packet, *real_packet = &packet;
48472
48473 real_packet->counterpart = counterpart;
48474 real_packet->initiated_from = initiated_from;
48475
48476 return send_packet_diplomacy_init_meeting(pc, real_packet);
48477}
48478
48479 void dlsend_packet_diplomacy_init_meeting(struct conn_list *dest, int counterpart, int initiated_from)
48480{
48481 struct packet_diplomacy_init_meeting packet, *real_packet = &packet;
48482
48483 real_packet->counterpart = counterpart;
48484 real_packet->initiated_from = initiated_from;
48485
48486 lsend_packet_diplomacy_init_meeting(dest, real_packet);
48487}
48488
48489#ifdef FREECIV_DELTA_PROTOCOL
48490#define hash_packet_diplomacy_cancel_meeting_req_100 hash_const
48491
48492#define cmp_packet_diplomacy_cancel_meeting_req_100 cmp_const
48493
48494 BV_DEFINE(packet_diplomacy_cancel_meeting_req_100_fields, 1);
48495#endif /* FREECIV_DELTA_PROTOCOL */
48496
48497 static struct packet_diplomacy_cancel_meeting_req *receive_packet_diplomacy_cancel_meeting_req_100(struct connection *pc)
48498{
48499#ifdef FREECIV_DELTA_PROTOCOL
48500 packet_diplomacy_cancel_meeting_req_100_fields fields;
48501 struct packet_diplomacy_cancel_meeting_req *old;
48502 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CANCEL_MEETING_REQ;
48503#endif /* FREECIV_DELTA_PROTOCOL */
48504 RECEIVE_PACKET_START(packet_diplomacy_cancel_meeting_req, real_packet);
48505#ifdef FREECIV_JSON_CONNECTION
48506 struct plocation field_addr;
48507 {
48508 struct plocation *field_addr_tmp = plocation_field_new(NULL);
48509 field_addr = *field_addr_tmp;
48510 FC_FREE(field_addr_tmp);
48511 }
48512#endif /* FREECIV_JSON_CONNECTION */
48513
48514#ifdef FREECIV_DELTA_PROTOCOL
48515#ifdef FREECIV_JSON_CONNECTION
48516 field_addr.name = "fields";
48517#endif /* FREECIV_JSON_CONNECTION */
48518 DIO_BV_GET(&din, &field_addr, fields);
48519
48520#else /* FREECIV_DELTA_PROTOCOL */
48521 #ifdef FREECIV_JSON_CONNECTION
48522 field_addr.name = "counterpart";
48523 #endif /* FREECIV_JSON_CONNECTION */
48524 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
48525 RECEIVE_PACKET_FIELD_ERROR(counterpart);
48526 }
48527
48528#endif
48529 log_packet_detailed("packet_diplomacy_cancel_meeting_req_100: got info about ()");
48530
48531#ifdef FREECIV_DELTA_PROTOCOL
48532 if (NULL == *hash) {
48533 *hash = genhash_new_full(hash_packet_diplomacy_cancel_meeting_req_100, cmp_packet_diplomacy_cancel_meeting_req_100,
48534 NULL, NULL, NULL, free);
48535 }
48536
48537 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
48538 *real_packet = *old;
48539 } else {
48540 log_packet_detailed(" no old info");
48541 memset(real_packet, 0, sizeof(*real_packet));
48542 }
48543
48544 if (BV_ISSET(fields, 0)) {
48545 log_packet_detailed(" got field 'counterpart'");
48546 #ifdef FREECIV_JSON_CONNECTION
48547 field_addr.name = "counterpart";
48548 #endif /* FREECIV_JSON_CONNECTION */
48549 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
48550 RECEIVE_PACKET_FIELD_ERROR(counterpart);
48551 }
48552 }
48553
48554 if (NULL == old) {
48555 old = fc_malloc(sizeof(*old));
48556 *old = *real_packet;
48557 genhash_insert(*hash, old, old);
48558 } else {
48559 *old = *real_packet;
48560 }
48561
48562#endif /* FREECIV_DELTA_PROTOCOL */
48563 RECEIVE_PACKET_END(real_packet);
48564}
48565
48566 static int send_packet_diplomacy_cancel_meeting_req_100(struct connection *pc, const struct packet_diplomacy_cancel_meeting_req *packet)
48567{
48568 const struct packet_diplomacy_cancel_meeting_req *real_packet = packet;
48569#ifdef FREECIV_DELTA_PROTOCOL
48570 packet_diplomacy_cancel_meeting_req_100_fields fields;
48571 struct packet_diplomacy_cancel_meeting_req *old;
48572 bool differ;
48573 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CANCEL_MEETING_REQ;
48574#endif /* FREECIV_DELTA_PROTOCOL */
48575 SEND_PACKET_START(PACKET_DIPLOMACY_CANCEL_MEETING_REQ);
48576#ifdef FREECIV_JSON_CONNECTION
48577 struct plocation field_addr;
48578 {
48579 struct plocation *field_addr_tmp = plocation_field_new(NULL);
48580 field_addr = *field_addr_tmp;
48581 FC_FREE(field_addr_tmp);
48582 }
48583#endif /* FREECIV_JSON_CONNECTION */
48584
48585 log_packet_detailed("packet_diplomacy_cancel_meeting_req_100: sending info about ()");
48586
48587#ifdef FREECIV_DELTA_PROTOCOL
48588 if (NULL == *hash) {
48589 *hash = genhash_new_full(hash_packet_diplomacy_cancel_meeting_req_100, cmp_packet_diplomacy_cancel_meeting_req_100,
48590 NULL, NULL, NULL, free);
48591 }
48592 BV_CLR_ALL(fields);
48593
48594 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
48595 old = fc_malloc(sizeof(*old));
48596 *old = *real_packet;
48597 genhash_insert(*hash, old, old);
48598 memset(old, 0, sizeof(*old));
48599 }
48600 differ = (old->counterpart != real_packet->counterpart);
48601 if (differ) {
48602 BV_SET(fields, 0);
48603 }
48604
48605
48606#ifdef FREECIV_JSON_CONNECTION
48607 field_addr.name = "fields";
48608#endif /* FREECIV_JSON_CONNECTION */
48609 DIO_BV_PUT(&dout, &field_addr, fields);
48610
48611 if (BV_ISSET(fields, 0)) {
48612 log_packet_detailed(" field 'counterpart' has changed");
48613 #ifdef FREECIV_JSON_CONNECTION
48614 field_addr.name = "counterpart";
48615#endif /* FREECIV_JSON_CONNECTION */
48616 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
48617 }
48618
48619 *old = *real_packet;
48620#endif /* FREECIV_DELTA_PROTOCOL */
48621#ifndef FREECIV_DELTA_PROTOCOL
48622#ifdef FREECIV_JSON_CONNECTION
48623 field_addr.name = "counterpart";
48624#endif /* FREECIV_JSON_CONNECTION */
48625 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
48626
48627#endif
48628 SEND_PACKET_END(PACKET_DIPLOMACY_CANCEL_MEETING_REQ);
48629}
48630
48631 int send_packet_diplomacy_cancel_meeting_req(struct connection *pc, const struct packet_diplomacy_cancel_meeting_req *packet)
48632{
48633 if (!pc->used) {
48634 log_error("WARNING: trying to send data to the closed connection %s",
48635 conn_description(pc));
48636 return -1;
48637 }
48638 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_MEETING_REQ].packet != NULL, -1,
48639 "Handler for PACKET_DIPLOMACY_CANCEL_MEETING_REQ not installed");
48640 return pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_MEETING_REQ].packet(pc, packet);
48641}
48642
48643 int dsend_packet_diplomacy_cancel_meeting_req(struct connection *pc, int counterpart)
48644{
48645 struct packet_diplomacy_cancel_meeting_req packet, *real_packet = &packet;
48646
48647 real_packet->counterpart = counterpart;
48648
48649 return send_packet_diplomacy_cancel_meeting_req(pc, real_packet);
48650}
48651
48652#ifdef FREECIV_DELTA_PROTOCOL
48653#define hash_packet_diplomacy_cancel_meeting_100 hash_const
48654
48655#define cmp_packet_diplomacy_cancel_meeting_100 cmp_const
48656
48657 BV_DEFINE(packet_diplomacy_cancel_meeting_100_fields, 2);
48658#endif /* FREECIV_DELTA_PROTOCOL */
48659
48660 static struct packet_diplomacy_cancel_meeting *receive_packet_diplomacy_cancel_meeting_100(struct connection *pc)
48661{
48662#ifdef FREECIV_DELTA_PROTOCOL
48663 packet_diplomacy_cancel_meeting_100_fields fields;
48664 struct packet_diplomacy_cancel_meeting *old;
48665 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CANCEL_MEETING;
48666#endif /* FREECIV_DELTA_PROTOCOL */
48667 RECEIVE_PACKET_START(packet_diplomacy_cancel_meeting, real_packet);
48668#ifdef FREECIV_JSON_CONNECTION
48669 struct plocation field_addr;
48670 {
48671 struct plocation *field_addr_tmp = plocation_field_new(NULL);
48672 field_addr = *field_addr_tmp;
48673 FC_FREE(field_addr_tmp);
48674 }
48675#endif /* FREECIV_JSON_CONNECTION */
48676
48677#ifdef FREECIV_DELTA_PROTOCOL
48678#ifdef FREECIV_JSON_CONNECTION
48679 field_addr.name = "fields";
48680#endif /* FREECIV_JSON_CONNECTION */
48681 DIO_BV_GET(&din, &field_addr, fields);
48682
48683#else /* FREECIV_DELTA_PROTOCOL */
48684 #ifdef FREECIV_JSON_CONNECTION
48685 field_addr.name = "counterpart";
48686 #endif /* FREECIV_JSON_CONNECTION */
48687 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
48688 RECEIVE_PACKET_FIELD_ERROR(counterpart);
48689 }
48690 #ifdef FREECIV_JSON_CONNECTION
48691 field_addr.name = "initiated_from";
48692 #endif /* FREECIV_JSON_CONNECTION */
48693 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->initiated_from)) {
48694 RECEIVE_PACKET_FIELD_ERROR(initiated_from);
48695 }
48696
48697#endif
48698 log_packet_detailed("packet_diplomacy_cancel_meeting_100: got info about ()");
48699
48700#ifdef FREECIV_DELTA_PROTOCOL
48701 if (NULL == *hash) {
48702 *hash = genhash_new_full(hash_packet_diplomacy_cancel_meeting_100, cmp_packet_diplomacy_cancel_meeting_100,
48703 NULL, NULL, NULL, free);
48704 }
48705
48706 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
48707 *real_packet = *old;
48708 } else {
48709 log_packet_detailed(" no old info");
48710 memset(real_packet, 0, sizeof(*real_packet));
48711 }
48712
48713 if (BV_ISSET(fields, 0)) {
48714 log_packet_detailed(" got field 'counterpart'");
48715 #ifdef FREECIV_JSON_CONNECTION
48716 field_addr.name = "counterpart";
48717 #endif /* FREECIV_JSON_CONNECTION */
48718 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
48719 RECEIVE_PACKET_FIELD_ERROR(counterpart);
48720 }
48721 }
48722 if (BV_ISSET(fields, 1)) {
48723 log_packet_detailed(" got field 'initiated_from'");
48724 #ifdef FREECIV_JSON_CONNECTION
48725 field_addr.name = "initiated_from";
48726 #endif /* FREECIV_JSON_CONNECTION */
48727 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->initiated_from)) {
48728 RECEIVE_PACKET_FIELD_ERROR(initiated_from);
48729 }
48730 }
48731
48732 if (NULL == old) {
48733 old = fc_malloc(sizeof(*old));
48734 *old = *real_packet;
48735 genhash_insert(*hash, old, old);
48736 } else {
48737 *old = *real_packet;
48738 }
48739
48740#endif /* FREECIV_DELTA_PROTOCOL */
48741 RECEIVE_PACKET_END(real_packet);
48742}
48743
48744 static int send_packet_diplomacy_cancel_meeting_100(struct connection *pc, const struct packet_diplomacy_cancel_meeting *packet)
48745{
48746 const struct packet_diplomacy_cancel_meeting *real_packet = packet;
48747#ifdef FREECIV_DELTA_PROTOCOL
48748 packet_diplomacy_cancel_meeting_100_fields fields;
48749 struct packet_diplomacy_cancel_meeting *old;
48750 bool differ;
48751 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CANCEL_MEETING;
48752#endif /* FREECIV_DELTA_PROTOCOL */
48753 SEND_PACKET_START(PACKET_DIPLOMACY_CANCEL_MEETING);
48754#ifdef FREECIV_JSON_CONNECTION
48755 struct plocation field_addr;
48756 {
48757 struct plocation *field_addr_tmp = plocation_field_new(NULL);
48758 field_addr = *field_addr_tmp;
48759 FC_FREE(field_addr_tmp);
48760 }
48761#endif /* FREECIV_JSON_CONNECTION */
48762
48763 log_packet_detailed("packet_diplomacy_cancel_meeting_100: sending info about ()");
48764
48765#ifdef FREECIV_DELTA_PROTOCOL
48766 if (NULL == *hash) {
48767 *hash = genhash_new_full(hash_packet_diplomacy_cancel_meeting_100, cmp_packet_diplomacy_cancel_meeting_100,
48768 NULL, NULL, NULL, free);
48769 }
48770 BV_CLR_ALL(fields);
48771
48772 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
48773 old = fc_malloc(sizeof(*old));
48774 *old = *real_packet;
48775 genhash_insert(*hash, old, old);
48776 memset(old, 0, sizeof(*old));
48777 }
48778 differ = (old->counterpart != real_packet->counterpart);
48779 if (differ) {
48780 BV_SET(fields, 0);
48781 }
48782
48783 differ = (old->initiated_from != real_packet->initiated_from);
48784 if (differ) {
48785 BV_SET(fields, 1);
48786 }
48787
48788
48789#ifdef FREECIV_JSON_CONNECTION
48790 field_addr.name = "fields";
48791#endif /* FREECIV_JSON_CONNECTION */
48792 DIO_BV_PUT(&dout, &field_addr, fields);
48793
48794 if (BV_ISSET(fields, 0)) {
48795 log_packet_detailed(" field 'counterpart' has changed");
48796 #ifdef FREECIV_JSON_CONNECTION
48797 field_addr.name = "counterpart";
48798#endif /* FREECIV_JSON_CONNECTION */
48799 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
48800 }
48801 if (BV_ISSET(fields, 1)) {
48802 log_packet_detailed(" field 'initiated_from' has changed");
48803 #ifdef FREECIV_JSON_CONNECTION
48804 field_addr.name = "initiated_from";
48805#endif /* FREECIV_JSON_CONNECTION */
48806 DIO_PUT(uint16, &dout, &field_addr, real_packet->initiated_from);
48807 }
48808
48809 *old = *real_packet;
48810#endif /* FREECIV_DELTA_PROTOCOL */
48811#ifndef FREECIV_DELTA_PROTOCOL
48812#ifdef FREECIV_JSON_CONNECTION
48813 field_addr.name = "counterpart";
48814#endif /* FREECIV_JSON_CONNECTION */
48815 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
48816#ifdef FREECIV_JSON_CONNECTION
48817 field_addr.name = "initiated_from";
48818#endif /* FREECIV_JSON_CONNECTION */
48819 DIO_PUT(uint16, &dout, &field_addr, real_packet->initiated_from);
48820
48821#endif
48822 SEND_PACKET_END(PACKET_DIPLOMACY_CANCEL_MEETING);
48823}
48824
48825 int send_packet_diplomacy_cancel_meeting(struct connection *pc, const struct packet_diplomacy_cancel_meeting *packet)
48826{
48827 if (!pc->used) {
48828 log_error("WARNING: trying to send data to the closed connection %s",
48829 conn_description(pc));
48830 return -1;
48831 }
48832 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_MEETING].packet != NULL, -1,
48833 "Handler for PACKET_DIPLOMACY_CANCEL_MEETING not installed");
48834 return pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_MEETING].packet(pc, packet);
48835}
48836
48837 void lsend_packet_diplomacy_cancel_meeting(struct conn_list *dest, const struct packet_diplomacy_cancel_meeting *packet)
48838{
48839 conn_list_iterate(dest, pconn) {
48840 send_packet_diplomacy_cancel_meeting(pconn, packet);
48841 } conn_list_iterate_end;
48842}
48843
48844 int dsend_packet_diplomacy_cancel_meeting(struct connection *pc, int counterpart, int initiated_from)
48845{
48846 struct packet_diplomacy_cancel_meeting packet, *real_packet = &packet;
48847
48848 real_packet->counterpart = counterpart;
48849 real_packet->initiated_from = initiated_from;
48850
48851 return send_packet_diplomacy_cancel_meeting(pc, real_packet);
48852}
48853
48854 void dlsend_packet_diplomacy_cancel_meeting(struct conn_list *dest, int counterpart, int initiated_from)
48855{
48856 struct packet_diplomacy_cancel_meeting packet, *real_packet = &packet;
48857
48858 real_packet->counterpart = counterpart;
48859 real_packet->initiated_from = initiated_from;
48860
48861 lsend_packet_diplomacy_cancel_meeting(dest, real_packet);
48862}
48863
48864#ifdef FREECIV_DELTA_PROTOCOL
48865#define hash_packet_diplomacy_create_clause_req_100 hash_const
48866
48867#define cmp_packet_diplomacy_create_clause_req_100 cmp_const
48868
48869 BV_DEFINE(packet_diplomacy_create_clause_req_100_fields, 4);
48870#endif /* FREECIV_DELTA_PROTOCOL */
48871
48872 static struct packet_diplomacy_create_clause_req *receive_packet_diplomacy_create_clause_req_100(struct connection *pc)
48873{
48874#ifdef FREECIV_DELTA_PROTOCOL
48875 packet_diplomacy_create_clause_req_100_fields fields;
48876 struct packet_diplomacy_create_clause_req *old;
48877 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CREATE_CLAUSE_REQ;
48878#endif /* FREECIV_DELTA_PROTOCOL */
48879 RECEIVE_PACKET_START(packet_diplomacy_create_clause_req, real_packet);
48880#ifdef FREECIV_JSON_CONNECTION
48881 struct plocation field_addr;
48882 {
48883 struct plocation *field_addr_tmp = plocation_field_new(NULL);
48884 field_addr = *field_addr_tmp;
48885 FC_FREE(field_addr_tmp);
48886 }
48887#endif /* FREECIV_JSON_CONNECTION */
48888
48889#ifdef FREECIV_DELTA_PROTOCOL
48890#ifdef FREECIV_JSON_CONNECTION
48891 field_addr.name = "fields";
48892#endif /* FREECIV_JSON_CONNECTION */
48893 DIO_BV_GET(&din, &field_addr, fields);
48894
48895#else /* FREECIV_DELTA_PROTOCOL */
48896 #ifdef FREECIV_JSON_CONNECTION
48897 field_addr.name = "counterpart";
48898 #endif /* FREECIV_JSON_CONNECTION */
48899 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
48900 RECEIVE_PACKET_FIELD_ERROR(counterpart);
48901 }
48902 #ifdef FREECIV_JSON_CONNECTION
48903 field_addr.name = "giver";
48904 #endif /* FREECIV_JSON_CONNECTION */
48905 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
48906 RECEIVE_PACKET_FIELD_ERROR(giver);
48907 }
48908 #ifdef FREECIV_JSON_CONNECTION
48909 field_addr.name = "type";
48910 #endif /* FREECIV_JSON_CONNECTION */
48911 {
48912 int readin;
48913
48914 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
48915 RECEIVE_PACKET_FIELD_ERROR(type);
48916 }
48917 real_packet->type = readin;
48918 }
48919 #ifdef FREECIV_JSON_CONNECTION
48920 field_addr.name = "value";
48921 #endif /* FREECIV_JSON_CONNECTION */
48922 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
48923 RECEIVE_PACKET_FIELD_ERROR(value);
48924 }
48925
48926#endif
48927 log_packet_detailed("packet_diplomacy_create_clause_req_100: got info about ()");
48928
48929#ifdef FREECIV_DELTA_PROTOCOL
48930 if (NULL == *hash) {
48931 *hash = genhash_new_full(hash_packet_diplomacy_create_clause_req_100, cmp_packet_diplomacy_create_clause_req_100,
48932 NULL, NULL, NULL, free);
48933 }
48934
48935 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
48936 *real_packet = *old;
48937 } else {
48938 log_packet_detailed(" no old info");
48939 memset(real_packet, 0, sizeof(*real_packet));
48940 }
48941
48942 if (BV_ISSET(fields, 0)) {
48943 log_packet_detailed(" got field 'counterpart'");
48944 #ifdef FREECIV_JSON_CONNECTION
48945 field_addr.name = "counterpart";
48946 #endif /* FREECIV_JSON_CONNECTION */
48947 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
48948 RECEIVE_PACKET_FIELD_ERROR(counterpart);
48949 }
48950 }
48951 if (BV_ISSET(fields, 1)) {
48952 log_packet_detailed(" got field 'giver'");
48953 #ifdef FREECIV_JSON_CONNECTION
48954 field_addr.name = "giver";
48955 #endif /* FREECIV_JSON_CONNECTION */
48956 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
48957 RECEIVE_PACKET_FIELD_ERROR(giver);
48958 }
48959 }
48960 if (BV_ISSET(fields, 2)) {
48961 log_packet_detailed(" got field 'type'");
48962 #ifdef FREECIV_JSON_CONNECTION
48963 field_addr.name = "type";
48964 #endif /* FREECIV_JSON_CONNECTION */
48965 {
48966 int readin;
48967
48968 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
48969 RECEIVE_PACKET_FIELD_ERROR(type);
48970 }
48971 real_packet->type = readin;
48972 }
48973 }
48974 if (BV_ISSET(fields, 3)) {
48975 log_packet_detailed(" got field 'value'");
48976 #ifdef FREECIV_JSON_CONNECTION
48977 field_addr.name = "value";
48978 #endif /* FREECIV_JSON_CONNECTION */
48979 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
48980 RECEIVE_PACKET_FIELD_ERROR(value);
48981 }
48982 }
48983
48984 if (NULL == old) {
48985 old = fc_malloc(sizeof(*old));
48986 *old = *real_packet;
48987 genhash_insert(*hash, old, old);
48988 } else {
48989 *old = *real_packet;
48990 }
48991
48992#endif /* FREECIV_DELTA_PROTOCOL */
48993 RECEIVE_PACKET_END(real_packet);
48994}
48995
48996 static int send_packet_diplomacy_create_clause_req_100(struct connection *pc, const struct packet_diplomacy_create_clause_req *packet)
48997{
48998 const struct packet_diplomacy_create_clause_req *real_packet = packet;
48999#ifdef FREECIV_DELTA_PROTOCOL
49000 packet_diplomacy_create_clause_req_100_fields fields;
49001 struct packet_diplomacy_create_clause_req *old;
49002 bool differ;
49003 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CREATE_CLAUSE_REQ;
49004#endif /* FREECIV_DELTA_PROTOCOL */
49005 SEND_PACKET_START(PACKET_DIPLOMACY_CREATE_CLAUSE_REQ);
49006#ifdef FREECIV_JSON_CONNECTION
49007 struct plocation field_addr;
49008 {
49009 struct plocation *field_addr_tmp = plocation_field_new(NULL);
49010 field_addr = *field_addr_tmp;
49011 FC_FREE(field_addr_tmp);
49012 }
49013#endif /* FREECIV_JSON_CONNECTION */
49014
49015 log_packet_detailed("packet_diplomacy_create_clause_req_100: sending info about ()");
49016
49017#ifdef FREECIV_DELTA_PROTOCOL
49018 if (NULL == *hash) {
49019 *hash = genhash_new_full(hash_packet_diplomacy_create_clause_req_100, cmp_packet_diplomacy_create_clause_req_100,
49020 NULL, NULL, NULL, free);
49021 }
49022 BV_CLR_ALL(fields);
49023
49024 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
49025 old = fc_malloc(sizeof(*old));
49026 *old = *real_packet;
49027 genhash_insert(*hash, old, old);
49028 memset(old, 0, sizeof(*old));
49029 }
49030 differ = (old->counterpart != real_packet->counterpart);
49031 if (differ) {
49032 BV_SET(fields, 0);
49033 }
49034
49035 differ = (old->giver != real_packet->giver);
49036 if (differ) {
49037 BV_SET(fields, 1);
49038 }
49039
49040 differ = (old->type != real_packet->type);
49041 if (differ) {
49042 BV_SET(fields, 2);
49043 }
49044
49045 differ = (old->value != real_packet->value);
49046 if (differ) {
49047 BV_SET(fields, 3);
49048 }
49049
49050
49051#ifdef FREECIV_JSON_CONNECTION
49052 field_addr.name = "fields";
49053#endif /* FREECIV_JSON_CONNECTION */
49054 DIO_BV_PUT(&dout, &field_addr, fields);
49055
49056 if (BV_ISSET(fields, 0)) {
49057 log_packet_detailed(" field 'counterpart' has changed");
49058 #ifdef FREECIV_JSON_CONNECTION
49059 field_addr.name = "counterpart";
49060#endif /* FREECIV_JSON_CONNECTION */
49061 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
49062 }
49063 if (BV_ISSET(fields, 1)) {
49064 log_packet_detailed(" field 'giver' has changed");
49065 #ifdef FREECIV_JSON_CONNECTION
49066 field_addr.name = "giver";
49067#endif /* FREECIV_JSON_CONNECTION */
49068 DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
49069 }
49070 if (BV_ISSET(fields, 2)) {
49071 log_packet_detailed(" field 'type' has changed");
49072 #ifdef FREECIV_JSON_CONNECTION
49073 field_addr.name = "type";
49074#endif /* FREECIV_JSON_CONNECTION */
49075 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
49076 }
49077 if (BV_ISSET(fields, 3)) {
49078 log_packet_detailed(" field 'value' has changed");
49079 #ifdef FREECIV_JSON_CONNECTION
49080 field_addr.name = "value";
49081#endif /* FREECIV_JSON_CONNECTION */
49082 DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
49083 }
49084
49085 *old = *real_packet;
49086#endif /* FREECIV_DELTA_PROTOCOL */
49087#ifndef FREECIV_DELTA_PROTOCOL
49088#ifdef FREECIV_JSON_CONNECTION
49089 field_addr.name = "counterpart";
49090#endif /* FREECIV_JSON_CONNECTION */
49091 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
49092#ifdef FREECIV_JSON_CONNECTION
49093 field_addr.name = "giver";
49094#endif /* FREECIV_JSON_CONNECTION */
49095 DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
49096#ifdef FREECIV_JSON_CONNECTION
49097 field_addr.name = "type";
49098#endif /* FREECIV_JSON_CONNECTION */
49099 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
49100#ifdef FREECIV_JSON_CONNECTION
49101 field_addr.name = "value";
49102#endif /* FREECIV_JSON_CONNECTION */
49103 DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
49104
49105#endif
49106 SEND_PACKET_END(PACKET_DIPLOMACY_CREATE_CLAUSE_REQ);
49107}
49108
49109 int send_packet_diplomacy_create_clause_req(struct connection *pc, const struct packet_diplomacy_create_clause_req *packet)
49110{
49111 if (!pc->used) {
49112 log_error("WARNING: trying to send data to the closed connection %s",
49113 conn_description(pc));
49114 return -1;
49115 }
49116 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE_REQ].packet != NULL, -1,
49117 "Handler for PACKET_DIPLOMACY_CREATE_CLAUSE_REQ not installed");
49118 return pc->phs.handlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE_REQ].packet(pc, packet);
49119}
49120
49121 int dsend_packet_diplomacy_create_clause_req(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
49122{
49123 struct packet_diplomacy_create_clause_req packet, *real_packet = &packet;
49124
49125 real_packet->counterpart = counterpart;
49126 real_packet->giver = giver;
49127 real_packet->type = type;
49128 real_packet->value = value;
49129
49130 return send_packet_diplomacy_create_clause_req(pc, real_packet);
49131}
49132
49133#ifdef FREECIV_DELTA_PROTOCOL
49134#define hash_packet_diplomacy_create_clause_100 hash_const
49135
49136#define cmp_packet_diplomacy_create_clause_100 cmp_const
49137
49138 BV_DEFINE(packet_diplomacy_create_clause_100_fields, 4);
49139#endif /* FREECIV_DELTA_PROTOCOL */
49140
49141 static struct packet_diplomacy_create_clause *receive_packet_diplomacy_create_clause_100(struct connection *pc)
49142{
49143#ifdef FREECIV_DELTA_PROTOCOL
49144 packet_diplomacy_create_clause_100_fields fields;
49145 struct packet_diplomacy_create_clause *old;
49146 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CREATE_CLAUSE;
49147#endif /* FREECIV_DELTA_PROTOCOL */
49148 RECEIVE_PACKET_START(packet_diplomacy_create_clause, real_packet);
49149#ifdef FREECIV_JSON_CONNECTION
49150 struct plocation field_addr;
49151 {
49152 struct plocation *field_addr_tmp = plocation_field_new(NULL);
49153 field_addr = *field_addr_tmp;
49154 FC_FREE(field_addr_tmp);
49155 }
49156#endif /* FREECIV_JSON_CONNECTION */
49157
49158#ifdef FREECIV_DELTA_PROTOCOL
49159#ifdef FREECIV_JSON_CONNECTION
49160 field_addr.name = "fields";
49161#endif /* FREECIV_JSON_CONNECTION */
49162 DIO_BV_GET(&din, &field_addr, fields);
49163
49164#else /* FREECIV_DELTA_PROTOCOL */
49165 #ifdef FREECIV_JSON_CONNECTION
49166 field_addr.name = "counterpart";
49167 #endif /* FREECIV_JSON_CONNECTION */
49168 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
49169 RECEIVE_PACKET_FIELD_ERROR(counterpart);
49170 }
49171 #ifdef FREECIV_JSON_CONNECTION
49172 field_addr.name = "giver";
49173 #endif /* FREECIV_JSON_CONNECTION */
49174 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
49175 RECEIVE_PACKET_FIELD_ERROR(giver);
49176 }
49177 #ifdef FREECIV_JSON_CONNECTION
49178 field_addr.name = "type";
49179 #endif /* FREECIV_JSON_CONNECTION */
49180 {
49181 int readin;
49182
49183 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
49184 RECEIVE_PACKET_FIELD_ERROR(type);
49185 }
49186 real_packet->type = readin;
49187 }
49188 #ifdef FREECIV_JSON_CONNECTION
49189 field_addr.name = "value";
49190 #endif /* FREECIV_JSON_CONNECTION */
49191 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
49192 RECEIVE_PACKET_FIELD_ERROR(value);
49193 }
49194
49195#endif
49196 log_packet_detailed("packet_diplomacy_create_clause_100: got info about ()");
49197
49198#ifdef FREECIV_DELTA_PROTOCOL
49199 if (NULL == *hash) {
49200 *hash = genhash_new_full(hash_packet_diplomacy_create_clause_100, cmp_packet_diplomacy_create_clause_100,
49201 NULL, NULL, NULL, free);
49202 }
49203
49204 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
49205 *real_packet = *old;
49206 } else {
49207 log_packet_detailed(" no old info");
49208 memset(real_packet, 0, sizeof(*real_packet));
49209 }
49210
49211 if (BV_ISSET(fields, 0)) {
49212 log_packet_detailed(" got field 'counterpart'");
49213 #ifdef FREECIV_JSON_CONNECTION
49214 field_addr.name = "counterpart";
49215 #endif /* FREECIV_JSON_CONNECTION */
49216 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
49217 RECEIVE_PACKET_FIELD_ERROR(counterpart);
49218 }
49219 }
49220 if (BV_ISSET(fields, 1)) {
49221 log_packet_detailed(" got field 'giver'");
49222 #ifdef FREECIV_JSON_CONNECTION
49223 field_addr.name = "giver";
49224 #endif /* FREECIV_JSON_CONNECTION */
49225 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
49226 RECEIVE_PACKET_FIELD_ERROR(giver);
49227 }
49228 }
49229 if (BV_ISSET(fields, 2)) {
49230 log_packet_detailed(" got field 'type'");
49231 #ifdef FREECIV_JSON_CONNECTION
49232 field_addr.name = "type";
49233 #endif /* FREECIV_JSON_CONNECTION */
49234 {
49235 int readin;
49236
49237 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
49238 RECEIVE_PACKET_FIELD_ERROR(type);
49239 }
49240 real_packet->type = readin;
49241 }
49242 }
49243 if (BV_ISSET(fields, 3)) {
49244 log_packet_detailed(" got field 'value'");
49245 #ifdef FREECIV_JSON_CONNECTION
49246 field_addr.name = "value";
49247 #endif /* FREECIV_JSON_CONNECTION */
49248 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
49249 RECEIVE_PACKET_FIELD_ERROR(value);
49250 }
49251 }
49252
49253 if (NULL == old) {
49254 old = fc_malloc(sizeof(*old));
49255 *old = *real_packet;
49256 genhash_insert(*hash, old, old);
49257 } else {
49258 *old = *real_packet;
49259 }
49260
49261#endif /* FREECIV_DELTA_PROTOCOL */
49262 RECEIVE_PACKET_END(real_packet);
49263}
49264
49265 static int send_packet_diplomacy_create_clause_100(struct connection *pc, const struct packet_diplomacy_create_clause *packet)
49266{
49267 const struct packet_diplomacy_create_clause *real_packet = packet;
49268#ifdef FREECIV_DELTA_PROTOCOL
49269 packet_diplomacy_create_clause_100_fields fields;
49270 struct packet_diplomacy_create_clause *old;
49271 bool differ;
49272 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CREATE_CLAUSE;
49273#endif /* FREECIV_DELTA_PROTOCOL */
49274 SEND_PACKET_START(PACKET_DIPLOMACY_CREATE_CLAUSE);
49275#ifdef FREECIV_JSON_CONNECTION
49276 struct plocation field_addr;
49277 {
49278 struct plocation *field_addr_tmp = plocation_field_new(NULL);
49279 field_addr = *field_addr_tmp;
49280 FC_FREE(field_addr_tmp);
49281 }
49282#endif /* FREECIV_JSON_CONNECTION */
49283
49284 log_packet_detailed("packet_diplomacy_create_clause_100: sending info about ()");
49285
49286#ifdef FREECIV_DELTA_PROTOCOL
49287 if (NULL == *hash) {
49288 *hash = genhash_new_full(hash_packet_diplomacy_create_clause_100, cmp_packet_diplomacy_create_clause_100,
49289 NULL, NULL, NULL, free);
49290 }
49291 BV_CLR_ALL(fields);
49292
49293 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
49294 old = fc_malloc(sizeof(*old));
49295 *old = *real_packet;
49296 genhash_insert(*hash, old, old);
49297 memset(old, 0, sizeof(*old));
49298 }
49299 differ = (old->counterpart != real_packet->counterpart);
49300 if (differ) {
49301 BV_SET(fields, 0);
49302 }
49303
49304 differ = (old->giver != real_packet->giver);
49305 if (differ) {
49306 BV_SET(fields, 1);
49307 }
49308
49309 differ = (old->type != real_packet->type);
49310 if (differ) {
49311 BV_SET(fields, 2);
49312 }
49313
49314 differ = (old->value != real_packet->value);
49315 if (differ) {
49316 BV_SET(fields, 3);
49317 }
49318
49319
49320#ifdef FREECIV_JSON_CONNECTION
49321 field_addr.name = "fields";
49322#endif /* FREECIV_JSON_CONNECTION */
49323 DIO_BV_PUT(&dout, &field_addr, fields);
49324
49325 if (BV_ISSET(fields, 0)) {
49326 log_packet_detailed(" field 'counterpart' has changed");
49327 #ifdef FREECIV_JSON_CONNECTION
49328 field_addr.name = "counterpart";
49329#endif /* FREECIV_JSON_CONNECTION */
49330 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
49331 }
49332 if (BV_ISSET(fields, 1)) {
49333 log_packet_detailed(" field 'giver' has changed");
49334 #ifdef FREECIV_JSON_CONNECTION
49335 field_addr.name = "giver";
49336#endif /* FREECIV_JSON_CONNECTION */
49337 DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
49338 }
49339 if (BV_ISSET(fields, 2)) {
49340 log_packet_detailed(" field 'type' has changed");
49341 #ifdef FREECIV_JSON_CONNECTION
49342 field_addr.name = "type";
49343#endif /* FREECIV_JSON_CONNECTION */
49344 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
49345 }
49346 if (BV_ISSET(fields, 3)) {
49347 log_packet_detailed(" field 'value' has changed");
49348 #ifdef FREECIV_JSON_CONNECTION
49349 field_addr.name = "value";
49350#endif /* FREECIV_JSON_CONNECTION */
49351 DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
49352 }
49353
49354 *old = *real_packet;
49355#endif /* FREECIV_DELTA_PROTOCOL */
49356#ifndef FREECIV_DELTA_PROTOCOL
49357#ifdef FREECIV_JSON_CONNECTION
49358 field_addr.name = "counterpart";
49359#endif /* FREECIV_JSON_CONNECTION */
49360 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
49361#ifdef FREECIV_JSON_CONNECTION
49362 field_addr.name = "giver";
49363#endif /* FREECIV_JSON_CONNECTION */
49364 DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
49365#ifdef FREECIV_JSON_CONNECTION
49366 field_addr.name = "type";
49367#endif /* FREECIV_JSON_CONNECTION */
49368 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
49369#ifdef FREECIV_JSON_CONNECTION
49370 field_addr.name = "value";
49371#endif /* FREECIV_JSON_CONNECTION */
49372 DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
49373
49374#endif
49375 SEND_PACKET_END(PACKET_DIPLOMACY_CREATE_CLAUSE);
49376}
49377
49378 int send_packet_diplomacy_create_clause(struct connection *pc, const struct packet_diplomacy_create_clause *packet)
49379{
49380 if (!pc->used) {
49381 log_error("WARNING: trying to send data to the closed connection %s",
49382 conn_description(pc));
49383 return -1;
49384 }
49385 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE].packet != NULL, -1,
49386 "Handler for PACKET_DIPLOMACY_CREATE_CLAUSE not installed");
49387 return pc->phs.handlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE].packet(pc, packet);
49388}
49389
49390 void lsend_packet_diplomacy_create_clause(struct conn_list *dest, const struct packet_diplomacy_create_clause *packet)
49391{
49392 conn_list_iterate(dest, pconn) {
49393 send_packet_diplomacy_create_clause(pconn, packet);
49394 } conn_list_iterate_end;
49395}
49396
49397 int dsend_packet_diplomacy_create_clause(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
49398{
49399 struct packet_diplomacy_create_clause packet, *real_packet = &packet;
49400
49401 real_packet->counterpart = counterpart;
49402 real_packet->giver = giver;
49403 real_packet->type = type;
49404 real_packet->value = value;
49405
49406 return send_packet_diplomacy_create_clause(pc, real_packet);
49407}
49408
49409 void dlsend_packet_diplomacy_create_clause(struct conn_list *dest, int counterpart, int giver, enum clause_type type, int value)
49410{
49411 struct packet_diplomacy_create_clause packet, *real_packet = &packet;
49412
49413 real_packet->counterpart = counterpart;
49414 real_packet->giver = giver;
49415 real_packet->type = type;
49416 real_packet->value = value;
49417
49418 lsend_packet_diplomacy_create_clause(dest, real_packet);
49419}
49420
49421#ifdef FREECIV_DELTA_PROTOCOL
49422#define hash_packet_diplomacy_remove_clause_req_100 hash_const
49423
49424#define cmp_packet_diplomacy_remove_clause_req_100 cmp_const
49425
49426 BV_DEFINE(packet_diplomacy_remove_clause_req_100_fields, 4);
49427#endif /* FREECIV_DELTA_PROTOCOL */
49428
49429 static struct packet_diplomacy_remove_clause_req *receive_packet_diplomacy_remove_clause_req_100(struct connection *pc)
49430{
49431#ifdef FREECIV_DELTA_PROTOCOL
49432 packet_diplomacy_remove_clause_req_100_fields fields;
49433 struct packet_diplomacy_remove_clause_req *old;
49434 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ;
49435#endif /* FREECIV_DELTA_PROTOCOL */
49436 RECEIVE_PACKET_START(packet_diplomacy_remove_clause_req, real_packet);
49437#ifdef FREECIV_JSON_CONNECTION
49438 struct plocation field_addr;
49439 {
49440 struct plocation *field_addr_tmp = plocation_field_new(NULL);
49441 field_addr = *field_addr_tmp;
49442 FC_FREE(field_addr_tmp);
49443 }
49444#endif /* FREECIV_JSON_CONNECTION */
49445
49446#ifdef FREECIV_DELTA_PROTOCOL
49447#ifdef FREECIV_JSON_CONNECTION
49448 field_addr.name = "fields";
49449#endif /* FREECIV_JSON_CONNECTION */
49450 DIO_BV_GET(&din, &field_addr, fields);
49451
49452#else /* FREECIV_DELTA_PROTOCOL */
49453 #ifdef FREECIV_JSON_CONNECTION
49454 field_addr.name = "counterpart";
49455 #endif /* FREECIV_JSON_CONNECTION */
49456 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
49457 RECEIVE_PACKET_FIELD_ERROR(counterpart);
49458 }
49459 #ifdef FREECIV_JSON_CONNECTION
49460 field_addr.name = "giver";
49461 #endif /* FREECIV_JSON_CONNECTION */
49462 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
49463 RECEIVE_PACKET_FIELD_ERROR(giver);
49464 }
49465 #ifdef FREECIV_JSON_CONNECTION
49466 field_addr.name = "type";
49467 #endif /* FREECIV_JSON_CONNECTION */
49468 {
49469 int readin;
49470
49471 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
49472 RECEIVE_PACKET_FIELD_ERROR(type);
49473 }
49474 real_packet->type = readin;
49475 }
49476 #ifdef FREECIV_JSON_CONNECTION
49477 field_addr.name = "value";
49478 #endif /* FREECIV_JSON_CONNECTION */
49479 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
49480 RECEIVE_PACKET_FIELD_ERROR(value);
49481 }
49482
49483#endif
49484 log_packet_detailed("packet_diplomacy_remove_clause_req_100: got info about ()");
49485
49486#ifdef FREECIV_DELTA_PROTOCOL
49487 if (NULL == *hash) {
49488 *hash = genhash_new_full(hash_packet_diplomacy_remove_clause_req_100, cmp_packet_diplomacy_remove_clause_req_100,
49489 NULL, NULL, NULL, free);
49490 }
49491
49492 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
49493 *real_packet = *old;
49494 } else {
49495 log_packet_detailed(" no old info");
49496 memset(real_packet, 0, sizeof(*real_packet));
49497 }
49498
49499 if (BV_ISSET(fields, 0)) {
49500 log_packet_detailed(" got field 'counterpart'");
49501 #ifdef FREECIV_JSON_CONNECTION
49502 field_addr.name = "counterpart";
49503 #endif /* FREECIV_JSON_CONNECTION */
49504 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
49505 RECEIVE_PACKET_FIELD_ERROR(counterpart);
49506 }
49507 }
49508 if (BV_ISSET(fields, 1)) {
49509 log_packet_detailed(" got field 'giver'");
49510 #ifdef FREECIV_JSON_CONNECTION
49511 field_addr.name = "giver";
49512 #endif /* FREECIV_JSON_CONNECTION */
49513 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
49514 RECEIVE_PACKET_FIELD_ERROR(giver);
49515 }
49516 }
49517 if (BV_ISSET(fields, 2)) {
49518 log_packet_detailed(" got field 'type'");
49519 #ifdef FREECIV_JSON_CONNECTION
49520 field_addr.name = "type";
49521 #endif /* FREECIV_JSON_CONNECTION */
49522 {
49523 int readin;
49524
49525 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
49526 RECEIVE_PACKET_FIELD_ERROR(type);
49527 }
49528 real_packet->type = readin;
49529 }
49530 }
49531 if (BV_ISSET(fields, 3)) {
49532 log_packet_detailed(" got field 'value'");
49533 #ifdef FREECIV_JSON_CONNECTION
49534 field_addr.name = "value";
49535 #endif /* FREECIV_JSON_CONNECTION */
49536 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
49537 RECEIVE_PACKET_FIELD_ERROR(value);
49538 }
49539 }
49540
49541 if (NULL == old) {
49542 old = fc_malloc(sizeof(*old));
49543 *old = *real_packet;
49544 genhash_insert(*hash, old, old);
49545 } else {
49546 *old = *real_packet;
49547 }
49548
49549#endif /* FREECIV_DELTA_PROTOCOL */
49550 RECEIVE_PACKET_END(real_packet);
49551}
49552
49553 static int send_packet_diplomacy_remove_clause_req_100(struct connection *pc, const struct packet_diplomacy_remove_clause_req *packet)
49554{
49555 const struct packet_diplomacy_remove_clause_req *real_packet = packet;
49556#ifdef FREECIV_DELTA_PROTOCOL
49557 packet_diplomacy_remove_clause_req_100_fields fields;
49558 struct packet_diplomacy_remove_clause_req *old;
49559 bool differ;
49560 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ;
49561#endif /* FREECIV_DELTA_PROTOCOL */
49562 SEND_PACKET_START(PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ);
49563#ifdef FREECIV_JSON_CONNECTION
49564 struct plocation field_addr;
49565 {
49566 struct plocation *field_addr_tmp = plocation_field_new(NULL);
49567 field_addr = *field_addr_tmp;
49568 FC_FREE(field_addr_tmp);
49569 }
49570#endif /* FREECIV_JSON_CONNECTION */
49571
49572 log_packet_detailed("packet_diplomacy_remove_clause_req_100: sending info about ()");
49573
49574#ifdef FREECIV_DELTA_PROTOCOL
49575 if (NULL == *hash) {
49576 *hash = genhash_new_full(hash_packet_diplomacy_remove_clause_req_100, cmp_packet_diplomacy_remove_clause_req_100,
49577 NULL, NULL, NULL, free);
49578 }
49579 BV_CLR_ALL(fields);
49580
49581 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
49582 old = fc_malloc(sizeof(*old));
49583 *old = *real_packet;
49584 genhash_insert(*hash, old, old);
49585 memset(old, 0, sizeof(*old));
49586 }
49587 differ = (old->counterpart != real_packet->counterpart);
49588 if (differ) {
49589 BV_SET(fields, 0);
49590 }
49591
49592 differ = (old->giver != real_packet->giver);
49593 if (differ) {
49594 BV_SET(fields, 1);
49595 }
49596
49597 differ = (old->type != real_packet->type);
49598 if (differ) {
49599 BV_SET(fields, 2);
49600 }
49601
49602 differ = (old->value != real_packet->value);
49603 if (differ) {
49604 BV_SET(fields, 3);
49605 }
49606
49607
49608#ifdef FREECIV_JSON_CONNECTION
49609 field_addr.name = "fields";
49610#endif /* FREECIV_JSON_CONNECTION */
49611 DIO_BV_PUT(&dout, &field_addr, fields);
49612
49613 if (BV_ISSET(fields, 0)) {
49614 log_packet_detailed(" field 'counterpart' has changed");
49615 #ifdef FREECIV_JSON_CONNECTION
49616 field_addr.name = "counterpart";
49617#endif /* FREECIV_JSON_CONNECTION */
49618 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
49619 }
49620 if (BV_ISSET(fields, 1)) {
49621 log_packet_detailed(" field 'giver' has changed");
49622 #ifdef FREECIV_JSON_CONNECTION
49623 field_addr.name = "giver";
49624#endif /* FREECIV_JSON_CONNECTION */
49625 DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
49626 }
49627 if (BV_ISSET(fields, 2)) {
49628 log_packet_detailed(" field 'type' has changed");
49629 #ifdef FREECIV_JSON_CONNECTION
49630 field_addr.name = "type";
49631#endif /* FREECIV_JSON_CONNECTION */
49632 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
49633 }
49634 if (BV_ISSET(fields, 3)) {
49635 log_packet_detailed(" field 'value' has changed");
49636 #ifdef FREECIV_JSON_CONNECTION
49637 field_addr.name = "value";
49638#endif /* FREECIV_JSON_CONNECTION */
49639 DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
49640 }
49641
49642 *old = *real_packet;
49643#endif /* FREECIV_DELTA_PROTOCOL */
49644#ifndef FREECIV_DELTA_PROTOCOL
49645#ifdef FREECIV_JSON_CONNECTION
49646 field_addr.name = "counterpart";
49647#endif /* FREECIV_JSON_CONNECTION */
49648 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
49649#ifdef FREECIV_JSON_CONNECTION
49650 field_addr.name = "giver";
49651#endif /* FREECIV_JSON_CONNECTION */
49652 DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
49653#ifdef FREECIV_JSON_CONNECTION
49654 field_addr.name = "type";
49655#endif /* FREECIV_JSON_CONNECTION */
49656 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
49657#ifdef FREECIV_JSON_CONNECTION
49658 field_addr.name = "value";
49659#endif /* FREECIV_JSON_CONNECTION */
49660 DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
49661
49662#endif
49663 SEND_PACKET_END(PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ);
49664}
49665
49666 int send_packet_diplomacy_remove_clause_req(struct connection *pc, const struct packet_diplomacy_remove_clause_req *packet)
49667{
49668 if (!pc->used) {
49669 log_error("WARNING: trying to send data to the closed connection %s",
49670 conn_description(pc));
49671 return -1;
49672 }
49673 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ].packet != NULL, -1,
49674 "Handler for PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ not installed");
49675 return pc->phs.handlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ].packet(pc, packet);
49676}
49677
49678 int dsend_packet_diplomacy_remove_clause_req(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
49679{
49680 struct packet_diplomacy_remove_clause_req packet, *real_packet = &packet;
49681
49682 real_packet->counterpart = counterpart;
49683 real_packet->giver = giver;
49684 real_packet->type = type;
49685 real_packet->value = value;
49686
49687 return send_packet_diplomacy_remove_clause_req(pc, real_packet);
49688}
49689
49690#ifdef FREECIV_DELTA_PROTOCOL
49691#define hash_packet_diplomacy_remove_clause_100 hash_const
49692
49693#define cmp_packet_diplomacy_remove_clause_100 cmp_const
49694
49695 BV_DEFINE(packet_diplomacy_remove_clause_100_fields, 4);
49696#endif /* FREECIV_DELTA_PROTOCOL */
49697
49698 static struct packet_diplomacy_remove_clause *receive_packet_diplomacy_remove_clause_100(struct connection *pc)
49699{
49700#ifdef FREECIV_DELTA_PROTOCOL
49701 packet_diplomacy_remove_clause_100_fields fields;
49702 struct packet_diplomacy_remove_clause *old;
49703 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_REMOVE_CLAUSE;
49704#endif /* FREECIV_DELTA_PROTOCOL */
49705 RECEIVE_PACKET_START(packet_diplomacy_remove_clause, real_packet);
49706#ifdef FREECIV_JSON_CONNECTION
49707 struct plocation field_addr;
49708 {
49709 struct plocation *field_addr_tmp = plocation_field_new(NULL);
49710 field_addr = *field_addr_tmp;
49711 FC_FREE(field_addr_tmp);
49712 }
49713#endif /* FREECIV_JSON_CONNECTION */
49714
49715#ifdef FREECIV_DELTA_PROTOCOL
49716#ifdef FREECIV_JSON_CONNECTION
49717 field_addr.name = "fields";
49718#endif /* FREECIV_JSON_CONNECTION */
49719 DIO_BV_GET(&din, &field_addr, fields);
49720
49721#else /* FREECIV_DELTA_PROTOCOL */
49722 #ifdef FREECIV_JSON_CONNECTION
49723 field_addr.name = "counterpart";
49724 #endif /* FREECIV_JSON_CONNECTION */
49725 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
49726 RECEIVE_PACKET_FIELD_ERROR(counterpart);
49727 }
49728 #ifdef FREECIV_JSON_CONNECTION
49729 field_addr.name = "giver";
49730 #endif /* FREECIV_JSON_CONNECTION */
49731 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
49732 RECEIVE_PACKET_FIELD_ERROR(giver);
49733 }
49734 #ifdef FREECIV_JSON_CONNECTION
49735 field_addr.name = "type";
49736 #endif /* FREECIV_JSON_CONNECTION */
49737 {
49738 int readin;
49739
49740 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
49741 RECEIVE_PACKET_FIELD_ERROR(type);
49742 }
49743 real_packet->type = readin;
49744 }
49745 #ifdef FREECIV_JSON_CONNECTION
49746 field_addr.name = "value";
49747 #endif /* FREECIV_JSON_CONNECTION */
49748 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
49749 RECEIVE_PACKET_FIELD_ERROR(value);
49750 }
49751
49752#endif
49753 log_packet_detailed("packet_diplomacy_remove_clause_100: got info about ()");
49754
49755#ifdef FREECIV_DELTA_PROTOCOL
49756 if (NULL == *hash) {
49757 *hash = genhash_new_full(hash_packet_diplomacy_remove_clause_100, cmp_packet_diplomacy_remove_clause_100,
49758 NULL, NULL, NULL, free);
49759 }
49760
49761 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
49762 *real_packet = *old;
49763 } else {
49764 log_packet_detailed(" no old info");
49765 memset(real_packet, 0, sizeof(*real_packet));
49766 }
49767
49768 if (BV_ISSET(fields, 0)) {
49769 log_packet_detailed(" got field 'counterpart'");
49770 #ifdef FREECIV_JSON_CONNECTION
49771 field_addr.name = "counterpart";
49772 #endif /* FREECIV_JSON_CONNECTION */
49773 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
49774 RECEIVE_PACKET_FIELD_ERROR(counterpart);
49775 }
49776 }
49777 if (BV_ISSET(fields, 1)) {
49778 log_packet_detailed(" got field 'giver'");
49779 #ifdef FREECIV_JSON_CONNECTION
49780 field_addr.name = "giver";
49781 #endif /* FREECIV_JSON_CONNECTION */
49782 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
49783 RECEIVE_PACKET_FIELD_ERROR(giver);
49784 }
49785 }
49786 if (BV_ISSET(fields, 2)) {
49787 log_packet_detailed(" got field 'type'");
49788 #ifdef FREECIV_JSON_CONNECTION
49789 field_addr.name = "type";
49790 #endif /* FREECIV_JSON_CONNECTION */
49791 {
49792 int readin;
49793
49794 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
49795 RECEIVE_PACKET_FIELD_ERROR(type);
49796 }
49797 real_packet->type = readin;
49798 }
49799 }
49800 if (BV_ISSET(fields, 3)) {
49801 log_packet_detailed(" got field 'value'");
49802 #ifdef FREECIV_JSON_CONNECTION
49803 field_addr.name = "value";
49804 #endif /* FREECIV_JSON_CONNECTION */
49805 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
49806 RECEIVE_PACKET_FIELD_ERROR(value);
49807 }
49808 }
49809
49810 if (NULL == old) {
49811 old = fc_malloc(sizeof(*old));
49812 *old = *real_packet;
49813 genhash_insert(*hash, old, old);
49814 } else {
49815 *old = *real_packet;
49816 }
49817
49818#endif /* FREECIV_DELTA_PROTOCOL */
49819 RECEIVE_PACKET_END(real_packet);
49820}
49821
49822 static int send_packet_diplomacy_remove_clause_100(struct connection *pc, const struct packet_diplomacy_remove_clause *packet)
49823{
49824 const struct packet_diplomacy_remove_clause *real_packet = packet;
49825#ifdef FREECIV_DELTA_PROTOCOL
49826 packet_diplomacy_remove_clause_100_fields fields;
49827 struct packet_diplomacy_remove_clause *old;
49828 bool differ;
49829 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_REMOVE_CLAUSE;
49830#endif /* FREECIV_DELTA_PROTOCOL */
49831 SEND_PACKET_START(PACKET_DIPLOMACY_REMOVE_CLAUSE);
49832#ifdef FREECIV_JSON_CONNECTION
49833 struct plocation field_addr;
49834 {
49835 struct plocation *field_addr_tmp = plocation_field_new(NULL);
49836 field_addr = *field_addr_tmp;
49837 FC_FREE(field_addr_tmp);
49838 }
49839#endif /* FREECIV_JSON_CONNECTION */
49840
49841 log_packet_detailed("packet_diplomacy_remove_clause_100: sending info about ()");
49842
49843#ifdef FREECIV_DELTA_PROTOCOL
49844 if (NULL == *hash) {
49845 *hash = genhash_new_full(hash_packet_diplomacy_remove_clause_100, cmp_packet_diplomacy_remove_clause_100,
49846 NULL, NULL, NULL, free);
49847 }
49848 BV_CLR_ALL(fields);
49849
49850 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
49851 old = fc_malloc(sizeof(*old));
49852 *old = *real_packet;
49853 genhash_insert(*hash, old, old);
49854 memset(old, 0, sizeof(*old));
49855 }
49856 differ = (old->counterpart != real_packet->counterpart);
49857 if (differ) {
49858 BV_SET(fields, 0);
49859 }
49860
49861 differ = (old->giver != real_packet->giver);
49862 if (differ) {
49863 BV_SET(fields, 1);
49864 }
49865
49866 differ = (old->type != real_packet->type);
49867 if (differ) {
49868 BV_SET(fields, 2);
49869 }
49870
49871 differ = (old->value != real_packet->value);
49872 if (differ) {
49873 BV_SET(fields, 3);
49874 }
49875
49876
49877#ifdef FREECIV_JSON_CONNECTION
49878 field_addr.name = "fields";
49879#endif /* FREECIV_JSON_CONNECTION */
49880 DIO_BV_PUT(&dout, &field_addr, fields);
49881
49882 if (BV_ISSET(fields, 0)) {
49883 log_packet_detailed(" field 'counterpart' has changed");
49884 #ifdef FREECIV_JSON_CONNECTION
49885 field_addr.name = "counterpart";
49886#endif /* FREECIV_JSON_CONNECTION */
49887 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
49888 }
49889 if (BV_ISSET(fields, 1)) {
49890 log_packet_detailed(" field 'giver' has changed");
49891 #ifdef FREECIV_JSON_CONNECTION
49892 field_addr.name = "giver";
49893#endif /* FREECIV_JSON_CONNECTION */
49894 DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
49895 }
49896 if (BV_ISSET(fields, 2)) {
49897 log_packet_detailed(" field 'type' has changed");
49898 #ifdef FREECIV_JSON_CONNECTION
49899 field_addr.name = "type";
49900#endif /* FREECIV_JSON_CONNECTION */
49901 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
49902 }
49903 if (BV_ISSET(fields, 3)) {
49904 log_packet_detailed(" field 'value' has changed");
49905 #ifdef FREECIV_JSON_CONNECTION
49906 field_addr.name = "value";
49907#endif /* FREECIV_JSON_CONNECTION */
49908 DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
49909 }
49910
49911 *old = *real_packet;
49912#endif /* FREECIV_DELTA_PROTOCOL */
49913#ifndef FREECIV_DELTA_PROTOCOL
49914#ifdef FREECIV_JSON_CONNECTION
49915 field_addr.name = "counterpart";
49916#endif /* FREECIV_JSON_CONNECTION */
49917 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
49918#ifdef FREECIV_JSON_CONNECTION
49919 field_addr.name = "giver";
49920#endif /* FREECIV_JSON_CONNECTION */
49921 DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
49922#ifdef FREECIV_JSON_CONNECTION
49923 field_addr.name = "type";
49924#endif /* FREECIV_JSON_CONNECTION */
49925 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
49926#ifdef FREECIV_JSON_CONNECTION
49927 field_addr.name = "value";
49928#endif /* FREECIV_JSON_CONNECTION */
49929 DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
49930
49931#endif
49932 SEND_PACKET_END(PACKET_DIPLOMACY_REMOVE_CLAUSE);
49933}
49934
49935 int send_packet_diplomacy_remove_clause(struct connection *pc, const struct packet_diplomacy_remove_clause *packet)
49936{
49937 if (!pc->used) {
49938 log_error("WARNING: trying to send data to the closed connection %s",
49939 conn_description(pc));
49940 return -1;
49941 }
49942 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE].packet != NULL, -1,
49943 "Handler for PACKET_DIPLOMACY_REMOVE_CLAUSE not installed");
49944 return pc->phs.handlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE].packet(pc, packet);
49945}
49946
49947 void lsend_packet_diplomacy_remove_clause(struct conn_list *dest, const struct packet_diplomacy_remove_clause *packet)
49948{
49949 conn_list_iterate(dest, pconn) {
49950 send_packet_diplomacy_remove_clause(pconn, packet);
49951 } conn_list_iterate_end;
49952}
49953
49954 int dsend_packet_diplomacy_remove_clause(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
49955{
49956 struct packet_diplomacy_remove_clause packet, *real_packet = &packet;
49957
49958 real_packet->counterpart = counterpart;
49959 real_packet->giver = giver;
49960 real_packet->type = type;
49961 real_packet->value = value;
49962
49963 return send_packet_diplomacy_remove_clause(pc, real_packet);
49964}
49965
49966 void dlsend_packet_diplomacy_remove_clause(struct conn_list *dest, int counterpart, int giver, enum clause_type type, int value)
49967{
49968 struct packet_diplomacy_remove_clause packet, *real_packet = &packet;
49969
49970 real_packet->counterpart = counterpart;
49971 real_packet->giver = giver;
49972 real_packet->type = type;
49973 real_packet->value = value;
49974
49975 lsend_packet_diplomacy_remove_clause(dest, real_packet);
49976}
49977
49978#ifdef FREECIV_DELTA_PROTOCOL
49979#define hash_packet_diplomacy_accept_treaty_req_100 hash_const
49980
49981#define cmp_packet_diplomacy_accept_treaty_req_100 cmp_const
49982
49983 BV_DEFINE(packet_diplomacy_accept_treaty_req_100_fields, 1);
49984#endif /* FREECIV_DELTA_PROTOCOL */
49985
49986 static struct packet_diplomacy_accept_treaty_req *receive_packet_diplomacy_accept_treaty_req_100(struct connection *pc)
49987{
49988#ifdef FREECIV_DELTA_PROTOCOL
49989 packet_diplomacy_accept_treaty_req_100_fields fields;
49990 struct packet_diplomacy_accept_treaty_req *old;
49991 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_ACCEPT_TREATY_REQ;
49992#endif /* FREECIV_DELTA_PROTOCOL */
49993 RECEIVE_PACKET_START(packet_diplomacy_accept_treaty_req, real_packet);
49994#ifdef FREECIV_JSON_CONNECTION
49995 struct plocation field_addr;
49996 {
49997 struct plocation *field_addr_tmp = plocation_field_new(NULL);
49998 field_addr = *field_addr_tmp;
49999 FC_FREE(field_addr_tmp);
50000 }
50001#endif /* FREECIV_JSON_CONNECTION */
50002
50003#ifdef FREECIV_DELTA_PROTOCOL
50004#ifdef FREECIV_JSON_CONNECTION
50005 field_addr.name = "fields";
50006#endif /* FREECIV_JSON_CONNECTION */
50007 DIO_BV_GET(&din, &field_addr, fields);
50008
50009#else /* FREECIV_DELTA_PROTOCOL */
50010 #ifdef FREECIV_JSON_CONNECTION
50011 field_addr.name = "counterpart";
50012 #endif /* FREECIV_JSON_CONNECTION */
50013 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
50014 RECEIVE_PACKET_FIELD_ERROR(counterpart);
50015 }
50016
50017#endif
50018 log_packet_detailed("packet_diplomacy_accept_treaty_req_100: got info about ()");
50019
50020#ifdef FREECIV_DELTA_PROTOCOL
50021 if (NULL == *hash) {
50022 *hash = genhash_new_full(hash_packet_diplomacy_accept_treaty_req_100, cmp_packet_diplomacy_accept_treaty_req_100,
50023 NULL, NULL, NULL, free);
50024 }
50025
50026 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
50027 *real_packet = *old;
50028 } else {
50029 log_packet_detailed(" no old info");
50030 memset(real_packet, 0, sizeof(*real_packet));
50031 }
50032
50033 if (BV_ISSET(fields, 0)) {
50034 log_packet_detailed(" got field 'counterpart'");
50035 #ifdef FREECIV_JSON_CONNECTION
50036 field_addr.name = "counterpart";
50037 #endif /* FREECIV_JSON_CONNECTION */
50038 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
50039 RECEIVE_PACKET_FIELD_ERROR(counterpart);
50040 }
50041 }
50042
50043 if (NULL == old) {
50044 old = fc_malloc(sizeof(*old));
50045 *old = *real_packet;
50046 genhash_insert(*hash, old, old);
50047 } else {
50048 *old = *real_packet;
50049 }
50050
50051#endif /* FREECIV_DELTA_PROTOCOL */
50052 RECEIVE_PACKET_END(real_packet);
50053}
50054
50055 static int send_packet_diplomacy_accept_treaty_req_100(struct connection *pc, const struct packet_diplomacy_accept_treaty_req *packet)
50056{
50057 const struct packet_diplomacy_accept_treaty_req *real_packet = packet;
50058#ifdef FREECIV_DELTA_PROTOCOL
50059 packet_diplomacy_accept_treaty_req_100_fields fields;
50060 struct packet_diplomacy_accept_treaty_req *old;
50061 bool differ;
50062 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_ACCEPT_TREATY_REQ;
50063#endif /* FREECIV_DELTA_PROTOCOL */
50064 SEND_PACKET_START(PACKET_DIPLOMACY_ACCEPT_TREATY_REQ);
50065#ifdef FREECIV_JSON_CONNECTION
50066 struct plocation field_addr;
50067 {
50068 struct plocation *field_addr_tmp = plocation_field_new(NULL);
50069 field_addr = *field_addr_tmp;
50070 FC_FREE(field_addr_tmp);
50071 }
50072#endif /* FREECIV_JSON_CONNECTION */
50073
50074 log_packet_detailed("packet_diplomacy_accept_treaty_req_100: sending info about ()");
50075
50076#ifdef FREECIV_DELTA_PROTOCOL
50077 if (NULL == *hash) {
50078 *hash = genhash_new_full(hash_packet_diplomacy_accept_treaty_req_100, cmp_packet_diplomacy_accept_treaty_req_100,
50079 NULL, NULL, NULL, free);
50080 }
50081 BV_CLR_ALL(fields);
50082
50083 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
50084 old = fc_malloc(sizeof(*old));
50085 *old = *real_packet;
50086 genhash_insert(*hash, old, old);
50087 memset(old, 0, sizeof(*old));
50088 }
50089 differ = (old->counterpart != real_packet->counterpart);
50090 if (differ) {
50091 BV_SET(fields, 0);
50092 }
50093
50094
50095#ifdef FREECIV_JSON_CONNECTION
50096 field_addr.name = "fields";
50097#endif /* FREECIV_JSON_CONNECTION */
50098 DIO_BV_PUT(&dout, &field_addr, fields);
50099
50100 if (BV_ISSET(fields, 0)) {
50101 log_packet_detailed(" field 'counterpart' has changed");
50102 #ifdef FREECIV_JSON_CONNECTION
50103 field_addr.name = "counterpart";
50104#endif /* FREECIV_JSON_CONNECTION */
50105 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
50106 }
50107
50108 *old = *real_packet;
50109#endif /* FREECIV_DELTA_PROTOCOL */
50110#ifndef FREECIV_DELTA_PROTOCOL
50111#ifdef FREECIV_JSON_CONNECTION
50112 field_addr.name = "counterpart";
50113#endif /* FREECIV_JSON_CONNECTION */
50114 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
50115
50116#endif
50117 SEND_PACKET_END(PACKET_DIPLOMACY_ACCEPT_TREATY_REQ);
50118}
50119
50120 int send_packet_diplomacy_accept_treaty_req(struct connection *pc, const struct packet_diplomacy_accept_treaty_req *packet)
50121{
50122 if (!pc->used) {
50123 log_error("WARNING: trying to send data to the closed connection %s",
50124 conn_description(pc));
50125 return -1;
50126 }
50127 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY_REQ].packet != NULL, -1,
50128 "Handler for PACKET_DIPLOMACY_ACCEPT_TREATY_REQ not installed");
50129 return pc->phs.handlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY_REQ].packet(pc, packet);
50130}
50131
50132 int dsend_packet_diplomacy_accept_treaty_req(struct connection *pc, int counterpart)
50133{
50134 struct packet_diplomacy_accept_treaty_req packet, *real_packet = &packet;
50135
50136 real_packet->counterpart = counterpart;
50137
50138 return send_packet_diplomacy_accept_treaty_req(pc, real_packet);
50139}
50140
50141#ifdef FREECIV_DELTA_PROTOCOL
50142#define hash_packet_diplomacy_accept_treaty_100 hash_const
50143
50144#define cmp_packet_diplomacy_accept_treaty_100 cmp_const
50145
50146 BV_DEFINE(packet_diplomacy_accept_treaty_100_fields, 3);
50147#endif /* FREECIV_DELTA_PROTOCOL */
50148
50149 static struct packet_diplomacy_accept_treaty *receive_packet_diplomacy_accept_treaty_100(struct connection *pc)
50150{
50151#ifdef FREECIV_DELTA_PROTOCOL
50152 packet_diplomacy_accept_treaty_100_fields fields;
50153 struct packet_diplomacy_accept_treaty *old;
50154 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_ACCEPT_TREATY;
50155#endif /* FREECIV_DELTA_PROTOCOL */
50156 RECEIVE_PACKET_START(packet_diplomacy_accept_treaty, real_packet);
50157#ifdef FREECIV_JSON_CONNECTION
50158 struct plocation field_addr;
50159 {
50160 struct plocation *field_addr_tmp = plocation_field_new(NULL);
50161 field_addr = *field_addr_tmp;
50162 FC_FREE(field_addr_tmp);
50163 }
50164#endif /* FREECIV_JSON_CONNECTION */
50165
50166#ifdef FREECIV_DELTA_PROTOCOL
50167#ifdef FREECIV_JSON_CONNECTION
50168 field_addr.name = "fields";
50169#endif /* FREECIV_JSON_CONNECTION */
50170 DIO_BV_GET(&din, &field_addr, fields);
50171
50172#else /* FREECIV_DELTA_PROTOCOL */
50173 #ifdef FREECIV_JSON_CONNECTION
50174 field_addr.name = "counterpart";
50175 #endif /* FREECIV_JSON_CONNECTION */
50176 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
50177 RECEIVE_PACKET_FIELD_ERROR(counterpart);
50178 }
50179 #ifdef FREECIV_JSON_CONNECTION
50180 field_addr.name = "I_accepted";
50181 #endif /* FREECIV_JSON_CONNECTION */
50182 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->I_accepted)) {
50183 RECEIVE_PACKET_FIELD_ERROR(I_accepted);
50184 }
50185 #ifdef FREECIV_JSON_CONNECTION
50186 field_addr.name = "other_accepted";
50187 #endif /* FREECIV_JSON_CONNECTION */
50188 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->other_accepted)) {
50189 RECEIVE_PACKET_FIELD_ERROR(other_accepted);
50190 }
50191
50192#endif
50193 log_packet_detailed("packet_diplomacy_accept_treaty_100: got info about ()");
50194
50195#ifdef FREECIV_DELTA_PROTOCOL
50196 if (NULL == *hash) {
50197 *hash = genhash_new_full(hash_packet_diplomacy_accept_treaty_100, cmp_packet_diplomacy_accept_treaty_100,
50198 NULL, NULL, NULL, free);
50199 }
50200
50201 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
50202 *real_packet = *old;
50203 } else {
50204 log_packet_detailed(" no old info");
50205 memset(real_packet, 0, sizeof(*real_packet));
50206 }
50207
50208 if (BV_ISSET(fields, 0)) {
50209 log_packet_detailed(" got field 'counterpart'");
50210 #ifdef FREECIV_JSON_CONNECTION
50211 field_addr.name = "counterpart";
50212 #endif /* FREECIV_JSON_CONNECTION */
50213 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
50214 RECEIVE_PACKET_FIELD_ERROR(counterpart);
50215 }
50216 }
50217 real_packet->I_accepted = BV_ISSET(fields, 1);
50218 real_packet->other_accepted = BV_ISSET(fields, 2);
50219
50220 if (NULL == old) {
50221 old = fc_malloc(sizeof(*old));
50222 *old = *real_packet;
50223 genhash_insert(*hash, old, old);
50224 } else {
50225 *old = *real_packet;
50226 }
50227
50228#endif /* FREECIV_DELTA_PROTOCOL */
50229 RECEIVE_PACKET_END(real_packet);
50230}
50231
50232 static int send_packet_diplomacy_accept_treaty_100(struct connection *pc, const struct packet_diplomacy_accept_treaty *packet)
50233{
50234 const struct packet_diplomacy_accept_treaty *real_packet = packet;
50235#ifdef FREECIV_DELTA_PROTOCOL
50236 packet_diplomacy_accept_treaty_100_fields fields;
50237 struct packet_diplomacy_accept_treaty *old;
50238 bool differ;
50239 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_ACCEPT_TREATY;
50240#endif /* FREECIV_DELTA_PROTOCOL */
50241 SEND_PACKET_START(PACKET_DIPLOMACY_ACCEPT_TREATY);
50242#ifdef FREECIV_JSON_CONNECTION
50243 struct plocation field_addr;
50244 {
50245 struct plocation *field_addr_tmp = plocation_field_new(NULL);
50246 field_addr = *field_addr_tmp;
50247 FC_FREE(field_addr_tmp);
50248 }
50249#endif /* FREECIV_JSON_CONNECTION */
50250
50251 log_packet_detailed("packet_diplomacy_accept_treaty_100: sending info about ()");
50252
50253#ifdef FREECIV_DELTA_PROTOCOL
50254 if (NULL == *hash) {
50255 *hash = genhash_new_full(hash_packet_diplomacy_accept_treaty_100, cmp_packet_diplomacy_accept_treaty_100,
50256 NULL, NULL, NULL, free);
50257 }
50258 BV_CLR_ALL(fields);
50259
50260 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
50261 old = fc_malloc(sizeof(*old));
50262 *old = *real_packet;
50263 genhash_insert(*hash, old, old);
50264 memset(old, 0, sizeof(*old));
50265 }
50266 differ = (old->counterpart != real_packet->counterpart);
50267 if (differ) {
50268 BV_SET(fields, 0);
50269 }
50270
50271 if (packet->I_accepted) {
50272 BV_SET(fields, 1);
50273 }
50274
50275 if (packet->other_accepted) {
50276 BV_SET(fields, 2);
50277 }
50278
50279
50280#ifdef FREECIV_JSON_CONNECTION
50281 field_addr.name = "fields";
50282#endif /* FREECIV_JSON_CONNECTION */
50283 DIO_BV_PUT(&dout, &field_addr, fields);
50284
50285 if (BV_ISSET(fields, 0)) {
50286 log_packet_detailed(" field 'counterpart' has changed");
50287 #ifdef FREECIV_JSON_CONNECTION
50288 field_addr.name = "counterpart";
50289#endif /* FREECIV_JSON_CONNECTION */
50290 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
50291 }
50292 /* field 1 is folded into the header */
50293 /* field 2 is folded into the header */
50294
50295 *old = *real_packet;
50296#endif /* FREECIV_DELTA_PROTOCOL */
50297#ifndef FREECIV_DELTA_PROTOCOL
50298#ifdef FREECIV_JSON_CONNECTION
50299 field_addr.name = "counterpart";
50300#endif /* FREECIV_JSON_CONNECTION */
50301 DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
50302#ifdef FREECIV_JSON_CONNECTION
50303 field_addr.name = "I_accepted";
50304#endif /* FREECIV_JSON_CONNECTION */
50305 DIO_PUT(bool8, &dout, &field_addr, real_packet->I_accepted);
50306#ifdef FREECIV_JSON_CONNECTION
50307 field_addr.name = "other_accepted";
50308#endif /* FREECIV_JSON_CONNECTION */
50309 DIO_PUT(bool8, &dout, &field_addr, real_packet->other_accepted);
50310
50311#endif
50312 SEND_PACKET_END(PACKET_DIPLOMACY_ACCEPT_TREATY);
50313}
50314
50315 int send_packet_diplomacy_accept_treaty(struct connection *pc, const struct packet_diplomacy_accept_treaty *packet)
50316{
50317 if (!pc->used) {
50318 log_error("WARNING: trying to send data to the closed connection %s",
50319 conn_description(pc));
50320 return -1;
50321 }
50322 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY].packet != NULL, -1,
50323 "Handler for PACKET_DIPLOMACY_ACCEPT_TREATY not installed");
50324 return pc->phs.handlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY].packet(pc, packet);
50325}
50326
50327 void lsend_packet_diplomacy_accept_treaty(struct conn_list *dest, const struct packet_diplomacy_accept_treaty *packet)
50328{
50329 conn_list_iterate(dest, pconn) {
50330 send_packet_diplomacy_accept_treaty(pconn, packet);
50331 } conn_list_iterate_end;
50332}
50333
50334 int dsend_packet_diplomacy_accept_treaty(struct connection *pc, int counterpart, bool I_accepted, bool other_accepted)
50335{
50336 struct packet_diplomacy_accept_treaty packet, *real_packet = &packet;
50337
50338 real_packet->counterpart = counterpart;
50339 real_packet->I_accepted = I_accepted;
50340 real_packet->other_accepted = other_accepted;
50341
50342 return send_packet_diplomacy_accept_treaty(pc, real_packet);
50343}
50344
50345 void dlsend_packet_diplomacy_accept_treaty(struct conn_list *dest, int counterpart, bool I_accepted, bool other_accepted)
50346{
50347 struct packet_diplomacy_accept_treaty packet, *real_packet = &packet;
50348
50349 real_packet->counterpart = counterpart;
50350 real_packet->I_accepted = I_accepted;
50351 real_packet->other_accepted = other_accepted;
50352
50353 lsend_packet_diplomacy_accept_treaty(dest, real_packet);
50354}
50355
50356#ifdef FREECIV_DELTA_PROTOCOL
50357#define hash_packet_diplomacy_cancel_pact_100 hash_const
50358
50359#define cmp_packet_diplomacy_cancel_pact_100 cmp_const
50360
50361 BV_DEFINE(packet_diplomacy_cancel_pact_100_fields, 2);
50362#endif /* FREECIV_DELTA_PROTOCOL */
50363
50364 static struct packet_diplomacy_cancel_pact *receive_packet_diplomacy_cancel_pact_100(struct connection *pc)
50365{
50366#ifdef FREECIV_DELTA_PROTOCOL
50367 packet_diplomacy_cancel_pact_100_fields fields;
50368 struct packet_diplomacy_cancel_pact *old;
50369 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CANCEL_PACT;
50370#endif /* FREECIV_DELTA_PROTOCOL */
50371 RECEIVE_PACKET_START(packet_diplomacy_cancel_pact, real_packet);
50372#ifdef FREECIV_JSON_CONNECTION
50373 struct plocation field_addr;
50374 {
50375 struct plocation *field_addr_tmp = plocation_field_new(NULL);
50376 field_addr = *field_addr_tmp;
50377 FC_FREE(field_addr_tmp);
50378 }
50379#endif /* FREECIV_JSON_CONNECTION */
50380
50381#ifdef FREECIV_DELTA_PROTOCOL
50382#ifdef FREECIV_JSON_CONNECTION
50383 field_addr.name = "fields";
50384#endif /* FREECIV_JSON_CONNECTION */
50385 DIO_BV_GET(&din, &field_addr, fields);
50386
50387#else /* FREECIV_DELTA_PROTOCOL */
50388 #ifdef FREECIV_JSON_CONNECTION
50389 field_addr.name = "other_player_id";
50390 #endif /* FREECIV_JSON_CONNECTION */
50391 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->other_player_id)) {
50392 RECEIVE_PACKET_FIELD_ERROR(other_player_id);
50393 }
50394 #ifdef FREECIV_JSON_CONNECTION
50395 field_addr.name = "clause";
50396 #endif /* FREECIV_JSON_CONNECTION */
50397 {
50398 int readin;
50399
50400 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
50401 RECEIVE_PACKET_FIELD_ERROR(clause);
50402 }
50403 real_packet->clause = readin;
50404 }
50405
50406#endif
50407 log_packet_detailed("packet_diplomacy_cancel_pact_100: got info about ()");
50408
50409#ifdef FREECIV_DELTA_PROTOCOL
50410 if (NULL == *hash) {
50411 *hash = genhash_new_full(hash_packet_diplomacy_cancel_pact_100, cmp_packet_diplomacy_cancel_pact_100,
50412 NULL, NULL, NULL, free);
50413 }
50414
50415 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
50416 *real_packet = *old;
50417 } else {
50418 log_packet_detailed(" no old info");
50419 memset(real_packet, 0, sizeof(*real_packet));
50420 }
50421
50422 if (BV_ISSET(fields, 0)) {
50423 log_packet_detailed(" got field 'other_player_id'");
50424 #ifdef FREECIV_JSON_CONNECTION
50425 field_addr.name = "other_player_id";
50426 #endif /* FREECIV_JSON_CONNECTION */
50427 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->other_player_id)) {
50428 RECEIVE_PACKET_FIELD_ERROR(other_player_id);
50429 }
50430 }
50431 if (BV_ISSET(fields, 1)) {
50432 log_packet_detailed(" got field 'clause'");
50433 #ifdef FREECIV_JSON_CONNECTION
50434 field_addr.name = "clause";
50435 #endif /* FREECIV_JSON_CONNECTION */
50436 {
50437 int readin;
50438
50439 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
50440 RECEIVE_PACKET_FIELD_ERROR(clause);
50441 }
50442 real_packet->clause = readin;
50443 }
50444 }
50445
50446 if (NULL == old) {
50447 old = fc_malloc(sizeof(*old));
50448 *old = *real_packet;
50449 genhash_insert(*hash, old, old);
50450 } else {
50451 *old = *real_packet;
50452 }
50453
50454#endif /* FREECIV_DELTA_PROTOCOL */
50455 RECEIVE_PACKET_END(real_packet);
50456}
50457
50458 static int send_packet_diplomacy_cancel_pact_100(struct connection *pc, const struct packet_diplomacy_cancel_pact *packet)
50459{
50460 const struct packet_diplomacy_cancel_pact *real_packet = packet;
50461#ifdef FREECIV_DELTA_PROTOCOL
50462 packet_diplomacy_cancel_pact_100_fields fields;
50463 struct packet_diplomacy_cancel_pact *old;
50464 bool differ;
50465 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CANCEL_PACT;
50466#endif /* FREECIV_DELTA_PROTOCOL */
50467 SEND_PACKET_START(PACKET_DIPLOMACY_CANCEL_PACT);
50468#ifdef FREECIV_JSON_CONNECTION
50469 struct plocation field_addr;
50470 {
50471 struct plocation *field_addr_tmp = plocation_field_new(NULL);
50472 field_addr = *field_addr_tmp;
50473 FC_FREE(field_addr_tmp);
50474 }
50475#endif /* FREECIV_JSON_CONNECTION */
50476
50477 log_packet_detailed("packet_diplomacy_cancel_pact_100: sending info about ()");
50478
50479#ifdef FREECIV_DELTA_PROTOCOL
50480 if (NULL == *hash) {
50481 *hash = genhash_new_full(hash_packet_diplomacy_cancel_pact_100, cmp_packet_diplomacy_cancel_pact_100,
50482 NULL, NULL, NULL, free);
50483 }
50484 BV_CLR_ALL(fields);
50485
50486 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
50487 old = fc_malloc(sizeof(*old));
50488 *old = *real_packet;
50489 genhash_insert(*hash, old, old);
50490 memset(old, 0, sizeof(*old));
50491 }
50492 differ = (old->other_player_id != real_packet->other_player_id);
50493 if (differ) {
50494 BV_SET(fields, 0);
50495 }
50496
50497 differ = (old->clause != real_packet->clause);
50498 if (differ) {
50499 BV_SET(fields, 1);
50500 }
50501
50502
50503#ifdef FREECIV_JSON_CONNECTION
50504 field_addr.name = "fields";
50505#endif /* FREECIV_JSON_CONNECTION */
50506 DIO_BV_PUT(&dout, &field_addr, fields);
50507
50508 if (BV_ISSET(fields, 0)) {
50509 log_packet_detailed(" field 'other_player_id' has changed");
50510 #ifdef FREECIV_JSON_CONNECTION
50511 field_addr.name = "other_player_id";
50512#endif /* FREECIV_JSON_CONNECTION */
50513 DIO_PUT(uint16, &dout, &field_addr, real_packet->other_player_id);
50514 }
50515 if (BV_ISSET(fields, 1)) {
50516 log_packet_detailed(" field 'clause' has changed");
50517 #ifdef FREECIV_JSON_CONNECTION
50518 field_addr.name = "clause";
50519#endif /* FREECIV_JSON_CONNECTION */
50520 DIO_PUT(uint8, &dout, &field_addr, real_packet->clause);
50521 }
50522
50523 *old = *real_packet;
50524#endif /* FREECIV_DELTA_PROTOCOL */
50525#ifndef FREECIV_DELTA_PROTOCOL
50526#ifdef FREECIV_JSON_CONNECTION
50527 field_addr.name = "other_player_id";
50528#endif /* FREECIV_JSON_CONNECTION */
50529 DIO_PUT(uint16, &dout, &field_addr, real_packet->other_player_id);
50530#ifdef FREECIV_JSON_CONNECTION
50531 field_addr.name = "clause";
50532#endif /* FREECIV_JSON_CONNECTION */
50533 DIO_PUT(uint8, &dout, &field_addr, real_packet->clause);
50534
50535#endif
50536 SEND_PACKET_END(PACKET_DIPLOMACY_CANCEL_PACT);
50537}
50538
50539 int send_packet_diplomacy_cancel_pact(struct connection *pc, const struct packet_diplomacy_cancel_pact *packet)
50540{
50541 if (!pc->used) {
50542 log_error("WARNING: trying to send data to the closed connection %s",
50543 conn_description(pc));
50544 return -1;
50545 }
50546 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_PACT].packet != NULL, -1,
50547 "Handler for PACKET_DIPLOMACY_CANCEL_PACT not installed");
50548 return pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_PACT].packet(pc, packet);
50549}
50550
50551 int dsend_packet_diplomacy_cancel_pact(struct connection *pc, int other_player_id, enum clause_type clause)
50552{
50553 struct packet_diplomacy_cancel_pact packet, *real_packet = &packet;
50554
50555 real_packet->other_player_id = other_player_id;
50556 real_packet->clause = clause;
50557
50558 return send_packet_diplomacy_cancel_pact(pc, real_packet);
50559}
50560
50561#ifdef FREECIV_DELTA_PROTOCOL
50562#define hash_packet_page_msg_100 hash_const
50563
50564#define cmp_packet_page_msg_100 cmp_const
50565
50566 BV_DEFINE(packet_page_msg_100_fields, 5);
50567#endif /* FREECIV_DELTA_PROTOCOL */
50568
50569 static struct packet_page_msg *receive_packet_page_msg_100(struct connection *pc)
50570{
50571#ifdef FREECIV_DELTA_PROTOCOL
50572 packet_page_msg_100_fields fields;
50573 struct packet_page_msg *old;
50574 struct genhash **hash = pc->phs.received + PACKET_PAGE_MSG;
50575#endif /* FREECIV_DELTA_PROTOCOL */
50576 RECEIVE_PACKET_START(packet_page_msg, real_packet);
50577#ifdef FREECIV_JSON_CONNECTION
50578 struct plocation field_addr;
50579 {
50580 struct plocation *field_addr_tmp = plocation_field_new(NULL);
50581 field_addr = *field_addr_tmp;
50582 FC_FREE(field_addr_tmp);
50583 }
50584#endif /* FREECIV_JSON_CONNECTION */
50585
50586#ifdef FREECIV_DELTA_PROTOCOL
50587#ifdef FREECIV_JSON_CONNECTION
50588 field_addr.name = "fields";
50589#endif /* FREECIV_JSON_CONNECTION */
50590 DIO_BV_GET(&din, &field_addr, fields);
50591
50592#else /* FREECIV_DELTA_PROTOCOL */
50593 #ifdef FREECIV_JSON_CONNECTION
50594 field_addr.name = "caption";
50595 #endif /* FREECIV_JSON_CONNECTION */
50596 if (!DIO_GET(string, &din, &field_addr, real_packet->caption, sizeof(real_packet->caption))) {
50597 RECEIVE_PACKET_FIELD_ERROR(caption);
50598 }
50599 #ifdef FREECIV_JSON_CONNECTION
50600 field_addr.name = "headline";
50601 #endif /* FREECIV_JSON_CONNECTION */
50602 if (!DIO_GET(string, &din, &field_addr, real_packet->headline, sizeof(real_packet->headline))) {
50603 RECEIVE_PACKET_FIELD_ERROR(headline);
50604 }
50605 #ifdef FREECIV_JSON_CONNECTION
50606 field_addr.name = "event";
50607 #endif /* FREECIV_JSON_CONNECTION */
50608 {
50609 int readin;
50610
50611 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
50612 RECEIVE_PACKET_FIELD_ERROR(event);
50613 }
50614 real_packet->event = readin;
50615 }
50616 #ifdef FREECIV_JSON_CONNECTION
50617 field_addr.name = "len";
50618 #endif /* FREECIV_JSON_CONNECTION */
50619 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->len)) {
50620 RECEIVE_PACKET_FIELD_ERROR(len);
50621 }
50622 #ifdef FREECIV_JSON_CONNECTION
50623 field_addr.name = "parts";
50624 #endif /* FREECIV_JSON_CONNECTION */
50625 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->parts)) {
50626 RECEIVE_PACKET_FIELD_ERROR(parts);
50627 }
50628
50629#endif
50630 log_packet_detailed("packet_page_msg_100: got info about ()");
50631
50632#ifdef FREECIV_DELTA_PROTOCOL
50633 if (NULL == *hash) {
50634 *hash = genhash_new_full(hash_packet_page_msg_100, cmp_packet_page_msg_100,
50635 NULL, NULL, NULL, free);
50636 }
50637
50638 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
50639 *real_packet = *old;
50640 } else {
50641 log_packet_detailed(" no old info");
50642 memset(real_packet, 0, sizeof(*real_packet));
50643 }
50644
50645 if (BV_ISSET(fields, 0)) {
50646 log_packet_detailed(" got field 'caption'");
50647 #ifdef FREECIV_JSON_CONNECTION
50648 field_addr.name = "caption";
50649 #endif /* FREECIV_JSON_CONNECTION */
50650 if (!DIO_GET(string, &din, &field_addr, real_packet->caption, sizeof(real_packet->caption))) {
50651 RECEIVE_PACKET_FIELD_ERROR(caption);
50652 }
50653 }
50654 if (BV_ISSET(fields, 1)) {
50655 log_packet_detailed(" got field 'headline'");
50656 #ifdef FREECIV_JSON_CONNECTION
50657 field_addr.name = "headline";
50658 #endif /* FREECIV_JSON_CONNECTION */
50659 if (!DIO_GET(string, &din, &field_addr, real_packet->headline, sizeof(real_packet->headline))) {
50660 RECEIVE_PACKET_FIELD_ERROR(headline);
50661 }
50662 }
50663 if (BV_ISSET(fields, 2)) {
50664 log_packet_detailed(" got field 'event'");
50665 #ifdef FREECIV_JSON_CONNECTION
50666 field_addr.name = "event";
50667 #endif /* FREECIV_JSON_CONNECTION */
50668 {
50669 int readin;
50670
50671 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
50672 RECEIVE_PACKET_FIELD_ERROR(event);
50673 }
50674 real_packet->event = readin;
50675 }
50676 }
50677 if (BV_ISSET(fields, 3)) {
50678 log_packet_detailed(" got field 'len'");
50679 #ifdef FREECIV_JSON_CONNECTION
50680 field_addr.name = "len";
50681 #endif /* FREECIV_JSON_CONNECTION */
50682 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->len)) {
50683 RECEIVE_PACKET_FIELD_ERROR(len);
50684 }
50685 }
50686 if (BV_ISSET(fields, 4)) {
50687 log_packet_detailed(" got field 'parts'");
50688 #ifdef FREECIV_JSON_CONNECTION
50689 field_addr.name = "parts";
50690 #endif /* FREECIV_JSON_CONNECTION */
50691 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->parts)) {
50692 RECEIVE_PACKET_FIELD_ERROR(parts);
50693 }
50694 }
50695
50696 if (NULL == old) {
50697 old = fc_malloc(sizeof(*old));
50698 *old = *real_packet;
50699 genhash_insert(*hash, old, old);
50700 } else {
50701 *old = *real_packet;
50702 }
50703
50704#endif /* FREECIV_DELTA_PROTOCOL */
50705 RECEIVE_PACKET_END(real_packet);
50706}
50707
50708 static int send_packet_page_msg_100(struct connection *pc, const struct packet_page_msg *packet)
50709{
50710 const struct packet_page_msg *real_packet = packet;
50711#ifdef FREECIV_DELTA_PROTOCOL
50712 packet_page_msg_100_fields fields;
50713 struct packet_page_msg *old;
50714 bool differ;
50715 struct genhash **hash = pc->phs.sent + PACKET_PAGE_MSG;
50716#endif /* FREECIV_DELTA_PROTOCOL */
50717 SEND_PACKET_START(PACKET_PAGE_MSG);
50718#ifdef FREECIV_JSON_CONNECTION
50719 struct plocation field_addr;
50720 {
50721 struct plocation *field_addr_tmp = plocation_field_new(NULL);
50722 field_addr = *field_addr_tmp;
50723 FC_FREE(field_addr_tmp);
50724 }
50725#endif /* FREECIV_JSON_CONNECTION */
50726
50727 log_packet_detailed("packet_page_msg_100: sending info about ()");
50728
50729#ifdef FREECIV_DELTA_PROTOCOL
50730 if (NULL == *hash) {
50731 *hash = genhash_new_full(hash_packet_page_msg_100, cmp_packet_page_msg_100,
50732 NULL, NULL, NULL, free);
50733 }
50734 BV_CLR_ALL(fields);
50735
50736 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
50737 old = fc_malloc(sizeof(*old));
50738 *old = *real_packet;
50739 genhash_insert(*hash, old, old);
50740 memset(old, 0, sizeof(*old));
50741 }
50742 differ = (strcmp(old->caption, real_packet->caption) != 0);
50743 if (differ) {
50744 BV_SET(fields, 0);
50745 }
50746
50747 differ = (strcmp(old->headline, real_packet->headline) != 0);
50748 if (differ) {
50749 BV_SET(fields, 1);
50750 }
50751
50752 differ = (old->event != real_packet->event);
50753 if (differ) {
50754 BV_SET(fields, 2);
50755 }
50756
50757 differ = (old->len != real_packet->len);
50758 if (differ) {
50759 BV_SET(fields, 3);
50760 }
50761
50762 differ = (old->parts != real_packet->parts);
50763 if (differ) {
50764 BV_SET(fields, 4);
50765 }
50766
50767
50768#ifdef FREECIV_JSON_CONNECTION
50769 field_addr.name = "fields";
50770#endif /* FREECIV_JSON_CONNECTION */
50771 DIO_BV_PUT(&dout, &field_addr, fields);
50772
50773 if (BV_ISSET(fields, 0)) {
50774 log_packet_detailed(" field 'caption' has changed");
50775 #ifdef FREECIV_JSON_CONNECTION
50776 field_addr.name = "caption";
50777#endif /* FREECIV_JSON_CONNECTION */
50778 DIO_PUT(string, &dout, &field_addr, real_packet->caption);
50779 }
50780 if (BV_ISSET(fields, 1)) {
50781 log_packet_detailed(" field 'headline' has changed");
50782 #ifdef FREECIV_JSON_CONNECTION
50783 field_addr.name = "headline";
50784#endif /* FREECIV_JSON_CONNECTION */
50785 DIO_PUT(string, &dout, &field_addr, real_packet->headline);
50786 }
50787 if (BV_ISSET(fields, 2)) {
50788 log_packet_detailed(" field 'event' has changed");
50789 #ifdef FREECIV_JSON_CONNECTION
50790 field_addr.name = "event";
50791#endif /* FREECIV_JSON_CONNECTION */
50792 DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
50793 }
50794 if (BV_ISSET(fields, 3)) {
50795 log_packet_detailed(" field 'len' has changed");
50796 #ifdef FREECIV_JSON_CONNECTION
50797 field_addr.name = "len";
50798#endif /* FREECIV_JSON_CONNECTION */
50799 DIO_PUT(uint32, &dout, &field_addr, real_packet->len);
50800 }
50801 if (BV_ISSET(fields, 4)) {
50802 log_packet_detailed(" field 'parts' has changed");
50803 #ifdef FREECIV_JSON_CONNECTION
50804 field_addr.name = "parts";
50805#endif /* FREECIV_JSON_CONNECTION */
50806 DIO_PUT(uint16, &dout, &field_addr, real_packet->parts);
50807 }
50808
50809 *old = *real_packet;
50810#endif /* FREECIV_DELTA_PROTOCOL */
50811#ifndef FREECIV_DELTA_PROTOCOL
50812#ifdef FREECIV_JSON_CONNECTION
50813 field_addr.name = "caption";
50814#endif /* FREECIV_JSON_CONNECTION */
50815 DIO_PUT(string, &dout, &field_addr, real_packet->caption);
50816#ifdef FREECIV_JSON_CONNECTION
50817 field_addr.name = "headline";
50818#endif /* FREECIV_JSON_CONNECTION */
50819 DIO_PUT(string, &dout, &field_addr, real_packet->headline);
50820#ifdef FREECIV_JSON_CONNECTION
50821 field_addr.name = "event";
50822#endif /* FREECIV_JSON_CONNECTION */
50823 DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
50824#ifdef FREECIV_JSON_CONNECTION
50825 field_addr.name = "len";
50826#endif /* FREECIV_JSON_CONNECTION */
50827 DIO_PUT(uint32, &dout, &field_addr, real_packet->len);
50828#ifdef FREECIV_JSON_CONNECTION
50829 field_addr.name = "parts";
50830#endif /* FREECIV_JSON_CONNECTION */
50831 DIO_PUT(uint16, &dout, &field_addr, real_packet->parts);
50832
50833#endif
50834 SEND_PACKET_END(PACKET_PAGE_MSG);
50835}
50836
50837 int send_packet_page_msg(struct connection *pc, const struct packet_page_msg *packet)
50838{
50839 if (!pc->used) {
50840 log_error("WARNING: trying to send data to the closed connection %s",
50841 conn_description(pc));
50842 return -1;
50843 }
50844 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PAGE_MSG].packet != NULL, -1,
50845 "Handler for PACKET_PAGE_MSG not installed");
50846 return pc->phs.handlers->send[PACKET_PAGE_MSG].packet(pc, packet);
50847}
50848
50849 void lsend_packet_page_msg(struct conn_list *dest, const struct packet_page_msg *packet)
50850{
50851 conn_list_iterate(dest, pconn) {
50852 send_packet_page_msg(pconn, packet);
50853 } conn_list_iterate_end;
50854}
50855
50856#ifdef FREECIV_DELTA_PROTOCOL
50857#define hash_packet_page_msg_part_100 hash_const
50858
50859#define cmp_packet_page_msg_part_100 cmp_const
50860
50861 BV_DEFINE(packet_page_msg_part_100_fields, 1);
50862#endif /* FREECIV_DELTA_PROTOCOL */
50863
50864 static struct packet_page_msg_part *receive_packet_page_msg_part_100(struct connection *pc)
50865{
50866#ifdef FREECIV_DELTA_PROTOCOL
50867 packet_page_msg_part_100_fields fields;
50868 struct packet_page_msg_part *old;
50869 struct genhash **hash = pc->phs.received + PACKET_PAGE_MSG_PART;
50870#endif /* FREECIV_DELTA_PROTOCOL */
50871 RECEIVE_PACKET_START(packet_page_msg_part, real_packet);
50872#ifdef FREECIV_JSON_CONNECTION
50873 struct plocation field_addr;
50874 {
50875 struct plocation *field_addr_tmp = plocation_field_new(NULL);
50876 field_addr = *field_addr_tmp;
50877 FC_FREE(field_addr_tmp);
50878 }
50879#endif /* FREECIV_JSON_CONNECTION */
50880
50881#ifdef FREECIV_DELTA_PROTOCOL
50882#ifdef FREECIV_JSON_CONNECTION
50883 field_addr.name = "fields";
50884#endif /* FREECIV_JSON_CONNECTION */
50885 DIO_BV_GET(&din, &field_addr, fields);
50886
50887#else /* FREECIV_DELTA_PROTOCOL */
50888 #ifdef FREECIV_JSON_CONNECTION
50889 field_addr.name = "lines";
50890 #endif /* FREECIV_JSON_CONNECTION */
50891 if (!DIO_GET(string, &din, &field_addr, real_packet->lines, sizeof(real_packet->lines))) {
50892 RECEIVE_PACKET_FIELD_ERROR(lines);
50893 }
50894
50895#endif
50896 log_packet_detailed("packet_page_msg_part_100: got info about ()");
50897
50898#ifdef FREECIV_DELTA_PROTOCOL
50899 if (NULL == *hash) {
50900 *hash = genhash_new_full(hash_packet_page_msg_part_100, cmp_packet_page_msg_part_100,
50901 NULL, NULL, NULL, free);
50902 }
50903
50904 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
50905 *real_packet = *old;
50906 } else {
50907 log_packet_detailed(" no old info");
50908 memset(real_packet, 0, sizeof(*real_packet));
50909 }
50910
50911 if (BV_ISSET(fields, 0)) {
50912 log_packet_detailed(" got field 'lines'");
50913 #ifdef FREECIV_JSON_CONNECTION
50914 field_addr.name = "lines";
50915 #endif /* FREECIV_JSON_CONNECTION */
50916 if (!DIO_GET(string, &din, &field_addr, real_packet->lines, sizeof(real_packet->lines))) {
50917 RECEIVE_PACKET_FIELD_ERROR(lines);
50918 }
50919 }
50920
50921 if (NULL == old) {
50922 old = fc_malloc(sizeof(*old));
50923 *old = *real_packet;
50924 genhash_insert(*hash, old, old);
50925 } else {
50926 *old = *real_packet;
50927 }
50928
50929#endif /* FREECIV_DELTA_PROTOCOL */
50930 RECEIVE_PACKET_END(real_packet);
50931}
50932
50933 static int send_packet_page_msg_part_100(struct connection *pc, const struct packet_page_msg_part *packet)
50934{
50935 const struct packet_page_msg_part *real_packet = packet;
50936#ifdef FREECIV_DELTA_PROTOCOL
50937 packet_page_msg_part_100_fields fields;
50938 struct packet_page_msg_part *old;
50939 bool differ;
50940 struct genhash **hash = pc->phs.sent + PACKET_PAGE_MSG_PART;
50941#endif /* FREECIV_DELTA_PROTOCOL */
50942 SEND_PACKET_START(PACKET_PAGE_MSG_PART);
50943#ifdef FREECIV_JSON_CONNECTION
50944 struct plocation field_addr;
50945 {
50946 struct plocation *field_addr_tmp = plocation_field_new(NULL);
50947 field_addr = *field_addr_tmp;
50948 FC_FREE(field_addr_tmp);
50949 }
50950#endif /* FREECIV_JSON_CONNECTION */
50951
50952 log_packet_detailed("packet_page_msg_part_100: sending info about ()");
50953
50954#ifdef FREECIV_DELTA_PROTOCOL
50955 if (NULL == *hash) {
50956 *hash = genhash_new_full(hash_packet_page_msg_part_100, cmp_packet_page_msg_part_100,
50957 NULL, NULL, NULL, free);
50958 }
50959 BV_CLR_ALL(fields);
50960
50961 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
50962 old = fc_malloc(sizeof(*old));
50963 *old = *real_packet;
50964 genhash_insert(*hash, old, old);
50965 memset(old, 0, sizeof(*old));
50966 }
50967 differ = (strcmp(old->lines, real_packet->lines) != 0);
50968 if (differ) {
50969 BV_SET(fields, 0);
50970 }
50971
50972
50973#ifdef FREECIV_JSON_CONNECTION
50974 field_addr.name = "fields";
50975#endif /* FREECIV_JSON_CONNECTION */
50976 DIO_BV_PUT(&dout, &field_addr, fields);
50977
50978 if (BV_ISSET(fields, 0)) {
50979 log_packet_detailed(" field 'lines' has changed");
50980 #ifdef FREECIV_JSON_CONNECTION
50981 field_addr.name = "lines";
50982#endif /* FREECIV_JSON_CONNECTION */
50983 DIO_PUT(string, &dout, &field_addr, real_packet->lines);
50984 }
50985
50986 *old = *real_packet;
50987#endif /* FREECIV_DELTA_PROTOCOL */
50988#ifndef FREECIV_DELTA_PROTOCOL
50989#ifdef FREECIV_JSON_CONNECTION
50990 field_addr.name = "lines";
50991#endif /* FREECIV_JSON_CONNECTION */
50992 DIO_PUT(string, &dout, &field_addr, real_packet->lines);
50993
50994#endif
50995 SEND_PACKET_END(PACKET_PAGE_MSG_PART);
50996}
50997
50998 int send_packet_page_msg_part(struct connection *pc, const struct packet_page_msg_part *packet)
50999{
51000 if (!pc->used) {
51001 log_error("WARNING: trying to send data to the closed connection %s",
51002 conn_description(pc));
51003 return -1;
51004 }
51005 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PAGE_MSG_PART].packet != NULL, -1,
51006 "Handler for PACKET_PAGE_MSG_PART not installed");
51007 return pc->phs.handlers->send[PACKET_PAGE_MSG_PART].packet(pc, packet);
51008}
51009
51010 void lsend_packet_page_msg_part(struct conn_list *dest, const struct packet_page_msg_part *packet)
51011{
51012 conn_list_iterate(dest, pconn) {
51013 send_packet_page_msg_part(pconn, packet);
51014 } conn_list_iterate_end;
51015}
51016
51017#ifdef FREECIV_DELTA_PROTOCOL
51018#define hash_packet_report_req_100 hash_const
51019
51020#define cmp_packet_report_req_100 cmp_const
51021
51022 BV_DEFINE(packet_report_req_100_fields, 1);
51023#endif /* FREECIV_DELTA_PROTOCOL */
51024
51025 static struct packet_report_req *receive_packet_report_req_100(struct connection *pc)
51026{
51027#ifdef FREECIV_DELTA_PROTOCOL
51028 packet_report_req_100_fields fields;
51029 struct packet_report_req *old;
51030 struct genhash **hash = pc->phs.received + PACKET_REPORT_REQ;
51031#endif /* FREECIV_DELTA_PROTOCOL */
51032 RECEIVE_PACKET_START(packet_report_req, real_packet);
51033#ifdef FREECIV_JSON_CONNECTION
51034 struct plocation field_addr;
51035 {
51036 struct plocation *field_addr_tmp = plocation_field_new(NULL);
51037 field_addr = *field_addr_tmp;
51038 FC_FREE(field_addr_tmp);
51039 }
51040#endif /* FREECIV_JSON_CONNECTION */
51041
51042#ifdef FREECIV_DELTA_PROTOCOL
51043#ifdef FREECIV_JSON_CONNECTION
51044 field_addr.name = "fields";
51045#endif /* FREECIV_JSON_CONNECTION */
51046 DIO_BV_GET(&din, &field_addr, fields);
51047
51048#else /* FREECIV_DELTA_PROTOCOL */
51049 #ifdef FREECIV_JSON_CONNECTION
51050 field_addr.name = "type";
51051 #endif /* FREECIV_JSON_CONNECTION */
51052 {
51053 int readin;
51054
51055 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
51056 RECEIVE_PACKET_FIELD_ERROR(type);
51057 }
51058 real_packet->type = readin;
51059 }
51060
51061#endif
51062 log_packet_detailed("packet_report_req_100: got info about ()");
51063
51064#ifdef FREECIV_DELTA_PROTOCOL
51065 if (NULL == *hash) {
51066 *hash = genhash_new_full(hash_packet_report_req_100, cmp_packet_report_req_100,
51067 NULL, NULL, NULL, free);
51068 }
51069
51070 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
51071 *real_packet = *old;
51072 } else {
51073 log_packet_detailed(" no old info");
51074 memset(real_packet, 0, sizeof(*real_packet));
51075 }
51076
51077 if (BV_ISSET(fields, 0)) {
51078 log_packet_detailed(" got field 'type'");
51079 #ifdef FREECIV_JSON_CONNECTION
51080 field_addr.name = "type";
51081 #endif /* FREECIV_JSON_CONNECTION */
51082 {
51083 int readin;
51084
51085 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
51086 RECEIVE_PACKET_FIELD_ERROR(type);
51087 }
51088 real_packet->type = readin;
51089 }
51090 }
51091
51092 if (NULL == old) {
51093 old = fc_malloc(sizeof(*old));
51094 *old = *real_packet;
51095 genhash_insert(*hash, old, old);
51096 } else {
51097 *old = *real_packet;
51098 }
51099
51100#endif /* FREECIV_DELTA_PROTOCOL */
51101 RECEIVE_PACKET_END(real_packet);
51102}
51103
51104 static int send_packet_report_req_100(struct connection *pc, const struct packet_report_req *packet)
51105{
51106 const struct packet_report_req *real_packet = packet;
51107#ifdef FREECIV_DELTA_PROTOCOL
51108 packet_report_req_100_fields fields;
51109 struct packet_report_req *old;
51110 bool differ;
51111 struct genhash **hash = pc->phs.sent + PACKET_REPORT_REQ;
51112#endif /* FREECIV_DELTA_PROTOCOL */
51113 SEND_PACKET_START(PACKET_REPORT_REQ);
51114#ifdef FREECIV_JSON_CONNECTION
51115 struct plocation field_addr;
51116 {
51117 struct plocation *field_addr_tmp = plocation_field_new(NULL);
51118 field_addr = *field_addr_tmp;
51119 FC_FREE(field_addr_tmp);
51120 }
51121#endif /* FREECIV_JSON_CONNECTION */
51122
51123 log_packet_detailed("packet_report_req_100: sending info about ()");
51124
51125#ifdef FREECIV_DELTA_PROTOCOL
51126 if (NULL == *hash) {
51127 *hash = genhash_new_full(hash_packet_report_req_100, cmp_packet_report_req_100,
51128 NULL, NULL, NULL, free);
51129 }
51130 BV_CLR_ALL(fields);
51131
51132 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
51133 old = fc_malloc(sizeof(*old));
51134 *old = *real_packet;
51135 genhash_insert(*hash, old, old);
51136 memset(old, 0, sizeof(*old));
51137 }
51138 differ = (old->type != real_packet->type);
51139 if (differ) {
51140 BV_SET(fields, 0);
51141 }
51142
51143
51144#ifdef FREECIV_JSON_CONNECTION
51145 field_addr.name = "fields";
51146#endif /* FREECIV_JSON_CONNECTION */
51147 DIO_BV_PUT(&dout, &field_addr, fields);
51148
51149 if (BV_ISSET(fields, 0)) {
51150 log_packet_detailed(" field 'type' has changed");
51151 #ifdef FREECIV_JSON_CONNECTION
51152 field_addr.name = "type";
51153#endif /* FREECIV_JSON_CONNECTION */
51154 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
51155 }
51156
51157 *old = *real_packet;
51158#endif /* FREECIV_DELTA_PROTOCOL */
51159#ifndef FREECIV_DELTA_PROTOCOL
51160#ifdef FREECIV_JSON_CONNECTION
51161 field_addr.name = "type";
51162#endif /* FREECIV_JSON_CONNECTION */
51163 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
51164
51165#endif
51166 SEND_PACKET_END(PACKET_REPORT_REQ);
51167}
51168
51169 int send_packet_report_req(struct connection *pc, const struct packet_report_req *packet)
51170{
51171 if (!pc->used) {
51172 log_error("WARNING: trying to send data to the closed connection %s",
51173 conn_description(pc));
51174 return -1;
51175 }
51176 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_REPORT_REQ].packet != NULL, -1,
51177 "Handler for PACKET_REPORT_REQ not installed");
51178 return pc->phs.handlers->send[PACKET_REPORT_REQ].packet(pc, packet);
51179}
51180
51181 int dsend_packet_report_req(struct connection *pc, enum report_type type)
51182{
51183 struct packet_report_req packet, *real_packet = &packet;
51184
51185 real_packet->type = type;
51186
51187 return send_packet_report_req(pc, real_packet);
51188}
51189
51190#ifdef FREECIV_DELTA_PROTOCOL
51191static genhash_val_t hash_packet_conn_info_100(const void *vkey)
51192{
51193 const struct packet_conn_info *key = (const struct packet_conn_info *) vkey;
51194
51195 return key->id;
51196}
51197
51198static bool cmp_packet_conn_info_100(const void *vkey1, const void *vkey2)
51199{
51200 const struct packet_conn_info *key1 = (const struct packet_conn_info *) vkey1;
51201 const struct packet_conn_info *key2 = (const struct packet_conn_info *) vkey2;
51202
51203 return key1->id == key2->id;
51204}
51205 BV_DEFINE(packet_conn_info_100_fields, 8);
51206#endif /* FREECIV_DELTA_PROTOCOL */
51207
51208 static struct packet_conn_info *receive_packet_conn_info_100(struct connection *pc)
51209{
51210#ifdef FREECIV_DELTA_PROTOCOL
51211 packet_conn_info_100_fields fields;
51212 struct packet_conn_info *old;
51213 struct genhash **hash = pc->phs.received + PACKET_CONN_INFO;
51214#endif /* FREECIV_DELTA_PROTOCOL */
51215 RECEIVE_PACKET_START(packet_conn_info, real_packet);
51216#ifdef FREECIV_JSON_CONNECTION
51217 struct plocation field_addr;
51218 {
51219 struct plocation *field_addr_tmp = plocation_field_new(NULL);
51220 field_addr = *field_addr_tmp;
51221 FC_FREE(field_addr_tmp);
51222 }
51223#endif /* FREECIV_JSON_CONNECTION */
51224
51225#ifdef FREECIV_DELTA_PROTOCOL
51226#ifdef FREECIV_JSON_CONNECTION
51227 field_addr.name = "fields";
51228#endif /* FREECIV_JSON_CONNECTION */
51229 DIO_BV_GET(&din, &field_addr, fields);
51230 #ifdef FREECIV_JSON_CONNECTION
51231 field_addr.name = "id";
51232 #endif /* FREECIV_JSON_CONNECTION */
51233 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->id)) {
51234 RECEIVE_PACKET_FIELD_ERROR(id);
51235 }
51236
51237#else /* FREECIV_DELTA_PROTOCOL */
51238 #ifdef FREECIV_JSON_CONNECTION
51239 field_addr.name = "id";
51240 #endif /* FREECIV_JSON_CONNECTION */
51241 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->id)) {
51242 RECEIVE_PACKET_FIELD_ERROR(id);
51243 }
51244 #ifdef FREECIV_JSON_CONNECTION
51245 field_addr.name = "used";
51246 #endif /* FREECIV_JSON_CONNECTION */
51247 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->used)) {
51248 RECEIVE_PACKET_FIELD_ERROR(used);
51249 }
51250 #ifdef FREECIV_JSON_CONNECTION
51251 field_addr.name = "established";
51252 #endif /* FREECIV_JSON_CONNECTION */
51253 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->established)) {
51254 RECEIVE_PACKET_FIELD_ERROR(established);
51255 }
51256 #ifdef FREECIV_JSON_CONNECTION
51257 field_addr.name = "observer";
51258 #endif /* FREECIV_JSON_CONNECTION */
51259 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->observer)) {
51260 RECEIVE_PACKET_FIELD_ERROR(observer);
51261 }
51262 #ifdef FREECIV_JSON_CONNECTION
51263 field_addr.name = "player_num";
51264 #endif /* FREECIV_JSON_CONNECTION */
51265 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_num)) {
51266 RECEIVE_PACKET_FIELD_ERROR(player_num);
51267 }
51268 #ifdef FREECIV_JSON_CONNECTION
51269 field_addr.name = "access_level";
51270 #endif /* FREECIV_JSON_CONNECTION */
51271 {
51272 int readin;
51273
51274 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
51275 RECEIVE_PACKET_FIELD_ERROR(access_level);
51276 }
51277 real_packet->access_level = readin;
51278 }
51279 #ifdef FREECIV_JSON_CONNECTION
51280 field_addr.name = "username";
51281 #endif /* FREECIV_JSON_CONNECTION */
51282 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
51283 RECEIVE_PACKET_FIELD_ERROR(username);
51284 }
51285 #ifdef FREECIV_JSON_CONNECTION
51286 field_addr.name = "addr";
51287 #endif /* FREECIV_JSON_CONNECTION */
51288 if (!DIO_GET(string, &din, &field_addr, real_packet->addr, sizeof(real_packet->addr))) {
51289 RECEIVE_PACKET_FIELD_ERROR(addr);
51290 }
51291 #ifdef FREECIV_JSON_CONNECTION
51292 field_addr.name = "capability";
51293 #endif /* FREECIV_JSON_CONNECTION */
51294 if (!DIO_GET(string, &din, &field_addr, real_packet->capability, sizeof(real_packet->capability))) {
51295 RECEIVE_PACKET_FIELD_ERROR(capability);
51296 }
51297
51298#endif
51299 log_packet_detailed("packet_conn_info_100: got info about (%d)",
51300 real_packet->id);
51301
51302#ifdef FREECIV_DELTA_PROTOCOL
51303 if (NULL == *hash) {
51304 *hash = genhash_new_full(hash_packet_conn_info_100, cmp_packet_conn_info_100,
51305 NULL, NULL, NULL, free);
51306 }
51307
51308 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
51309 *real_packet = *old;
51310 } else {
51311 int id = real_packet->id;
51312
51313 log_packet_detailed(" no old info");
51314 memset(real_packet, 0, sizeof(*real_packet));
51315
51316 real_packet->id = id;
51317 }
51318
51319 real_packet->used = BV_ISSET(fields, 0);
51320 real_packet->established = BV_ISSET(fields, 1);
51321 real_packet->observer = BV_ISSET(fields, 2);
51322 if (BV_ISSET(fields, 3)) {
51323 log_packet_detailed(" got field 'player_num'");
51324 #ifdef FREECIV_JSON_CONNECTION
51325 field_addr.name = "player_num";
51326 #endif /* FREECIV_JSON_CONNECTION */
51327 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_num)) {
51328 RECEIVE_PACKET_FIELD_ERROR(player_num);
51329 }
51330 }
51331 if (BV_ISSET(fields, 4)) {
51332 log_packet_detailed(" got field 'access_level'");
51333 #ifdef FREECIV_JSON_CONNECTION
51334 field_addr.name = "access_level";
51335 #endif /* FREECIV_JSON_CONNECTION */
51336 {
51337 int readin;
51338
51339 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
51340 RECEIVE_PACKET_FIELD_ERROR(access_level);
51341 }
51342 real_packet->access_level = readin;
51343 }
51344 }
51345 if (BV_ISSET(fields, 5)) {
51346 log_packet_detailed(" got field 'username'");
51347 #ifdef FREECIV_JSON_CONNECTION
51348 field_addr.name = "username";
51349 #endif /* FREECIV_JSON_CONNECTION */
51350 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
51351 RECEIVE_PACKET_FIELD_ERROR(username);
51352 }
51353 }
51354 if (BV_ISSET(fields, 6)) {
51355 log_packet_detailed(" got field 'addr'");
51356 #ifdef FREECIV_JSON_CONNECTION
51357 field_addr.name = "addr";
51358 #endif /* FREECIV_JSON_CONNECTION */
51359 if (!DIO_GET(string, &din, &field_addr, real_packet->addr, sizeof(real_packet->addr))) {
51360 RECEIVE_PACKET_FIELD_ERROR(addr);
51361 }
51362 }
51363 if (BV_ISSET(fields, 7)) {
51364 log_packet_detailed(" got field 'capability'");
51365 #ifdef FREECIV_JSON_CONNECTION
51366 field_addr.name = "capability";
51367 #endif /* FREECIV_JSON_CONNECTION */
51368 if (!DIO_GET(string, &din, &field_addr, real_packet->capability, sizeof(real_packet->capability))) {
51369 RECEIVE_PACKET_FIELD_ERROR(capability);
51370 }
51371 }
51372
51373 if (NULL == old) {
51374 old = fc_malloc(sizeof(*old));
51375 *old = *real_packet;
51376 genhash_insert(*hash, old, old);
51377 } else {
51378 *old = *real_packet;
51379 }
51380
51381#endif /* FREECIV_DELTA_PROTOCOL */
51382 RECEIVE_PACKET_END(real_packet);
51383}
51384
51385 static int send_packet_conn_info_100(struct connection *pc, const struct packet_conn_info *packet)
51386{
51387 const struct packet_conn_info *real_packet = packet;
51388#ifdef FREECIV_DELTA_PROTOCOL
51389 packet_conn_info_100_fields fields;
51390 struct packet_conn_info *old;
51391 bool differ;
51392 struct genhash **hash = pc->phs.sent + PACKET_CONN_INFO;
51393 int different = 0;
51394#endif /* FREECIV_DELTA_PROTOCOL */
51395 SEND_PACKET_START(PACKET_CONN_INFO);
51396#ifdef FREECIV_JSON_CONNECTION
51397 struct plocation field_addr;
51398 {
51399 struct plocation *field_addr_tmp = plocation_field_new(NULL);
51400 field_addr = *field_addr_tmp;
51401 FC_FREE(field_addr_tmp);
51402 }
51403#endif /* FREECIV_JSON_CONNECTION */
51404
51405 log_packet_detailed("packet_conn_info_100: sending info about (%d)",
51406 real_packet->id);
51407
51408#ifdef FREECIV_DELTA_PROTOCOL
51409 if (NULL == *hash) {
51410 *hash = genhash_new_full(hash_packet_conn_info_100, cmp_packet_conn_info_100,
51411 NULL, NULL, NULL, free);
51412 }
51413 BV_CLR_ALL(fields);
51414
51415 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
51416 old = fc_malloc(sizeof(*old));
51417 *old = *real_packet;
51418 genhash_insert(*hash, old, old);
51419 memset(old, 0, sizeof(*old));
51420 different = 1; /* Force to send. */
51421 }
51422 differ = (old->used != real_packet->used);
51423 if (differ) {
51424 different++;
51425 }
51426 if (packet->used) {
51427 BV_SET(fields, 0);
51428 }
51429
51430 differ = (old->established != real_packet->established);
51431 if (differ) {
51432 different++;
51433 }
51434 if (packet->established) {
51435 BV_SET(fields, 1);
51436 }
51437
51438 differ = (old->observer != real_packet->observer);
51439 if (differ) {
51440 different++;
51441 }
51442 if (packet->observer) {
51443 BV_SET(fields, 2);
51444 }
51445
51446 differ = (old->player_num != real_packet->player_num);
51447 if (differ) {
51448 different++;
51449 BV_SET(fields, 3);
51450 }
51451
51452 differ = (old->access_level != real_packet->access_level);
51453 if (differ) {
51454 different++;
51455 BV_SET(fields, 4);
51456 }
51457
51458 differ = (strcmp(old->username, real_packet->username) != 0);
51459 if (differ) {
51460 different++;
51461 BV_SET(fields, 5);
51462 }
51463
51464 differ = (strcmp(old->addr, real_packet->addr) != 0);
51465 if (differ) {
51466 different++;
51467 BV_SET(fields, 6);
51468 }
51469
51470 differ = (strcmp(old->capability, real_packet->capability) != 0);
51471 if (differ) {
51472 different++;
51473 BV_SET(fields, 7);
51474 }
51475
51476
51477 if (different == 0) {
51478 log_packet_detailed(" no change -> discard");
51479 return 0;
51480 }
51481
51482#ifdef FREECIV_JSON_CONNECTION
51483 field_addr.name = "fields";
51484#endif /* FREECIV_JSON_CONNECTION */
51485 DIO_BV_PUT(&dout, &field_addr, fields);
51486#ifdef FREECIV_JSON_CONNECTION
51487 field_addr.name = "id";
51488#endif /* FREECIV_JSON_CONNECTION */
51489 DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
51490
51491 /* field 0 is folded into the header */
51492 /* field 1 is folded into the header */
51493 /* field 2 is folded into the header */
51494 if (BV_ISSET(fields, 3)) {
51495 log_packet_detailed(" field 'player_num' has changed");
51496 #ifdef FREECIV_JSON_CONNECTION
51497 field_addr.name = "player_num";
51498#endif /* FREECIV_JSON_CONNECTION */
51499 DIO_PUT(uint16, &dout, &field_addr, real_packet->player_num);
51500 }
51501 if (BV_ISSET(fields, 4)) {
51502 log_packet_detailed(" field 'access_level' has changed");
51503 #ifdef FREECIV_JSON_CONNECTION
51504 field_addr.name = "access_level";
51505#endif /* FREECIV_JSON_CONNECTION */
51506 DIO_PUT(uint8, &dout, &field_addr, real_packet->access_level);
51507 }
51508 if (BV_ISSET(fields, 5)) {
51509 log_packet_detailed(" field 'username' has changed");
51510 #ifdef FREECIV_JSON_CONNECTION
51511 field_addr.name = "username";
51512#endif /* FREECIV_JSON_CONNECTION */
51513 DIO_PUT(string, &dout, &field_addr, real_packet->username);
51514 }
51515 if (BV_ISSET(fields, 6)) {
51516 log_packet_detailed(" field 'addr' has changed");
51517 #ifdef FREECIV_JSON_CONNECTION
51518 field_addr.name = "addr";
51519#endif /* FREECIV_JSON_CONNECTION */
51520 DIO_PUT(string, &dout, &field_addr, real_packet->addr);
51521 }
51522 if (BV_ISSET(fields, 7)) {
51523 log_packet_detailed(" field 'capability' has changed");
51524 #ifdef FREECIV_JSON_CONNECTION
51525 field_addr.name = "capability";
51526#endif /* FREECIV_JSON_CONNECTION */
51527 DIO_PUT(string, &dout, &field_addr, real_packet->capability);
51528 }
51529
51530 *old = *real_packet;
51531#endif /* FREECIV_DELTA_PROTOCOL */
51532#ifndef FREECIV_DELTA_PROTOCOL
51533#ifdef FREECIV_JSON_CONNECTION
51534 field_addr.name = "id";
51535#endif /* FREECIV_JSON_CONNECTION */
51536 DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
51537#ifdef FREECIV_JSON_CONNECTION
51538 field_addr.name = "used";
51539#endif /* FREECIV_JSON_CONNECTION */
51540 DIO_PUT(bool8, &dout, &field_addr, real_packet->used);
51541#ifdef FREECIV_JSON_CONNECTION
51542 field_addr.name = "established";
51543#endif /* FREECIV_JSON_CONNECTION */
51544 DIO_PUT(bool8, &dout, &field_addr, real_packet->established);
51545#ifdef FREECIV_JSON_CONNECTION
51546 field_addr.name = "observer";
51547#endif /* FREECIV_JSON_CONNECTION */
51548 DIO_PUT(bool8, &dout, &field_addr, real_packet->observer);
51549#ifdef FREECIV_JSON_CONNECTION
51550 field_addr.name = "player_num";
51551#endif /* FREECIV_JSON_CONNECTION */
51552 DIO_PUT(uint16, &dout, &field_addr, real_packet->player_num);
51553#ifdef FREECIV_JSON_CONNECTION
51554 field_addr.name = "access_level";
51555#endif /* FREECIV_JSON_CONNECTION */
51556 DIO_PUT(uint8, &dout, &field_addr, real_packet->access_level);
51557#ifdef FREECIV_JSON_CONNECTION
51558 field_addr.name = "username";
51559#endif /* FREECIV_JSON_CONNECTION */
51560 DIO_PUT(string, &dout, &field_addr, real_packet->username);
51561#ifdef FREECIV_JSON_CONNECTION
51562 field_addr.name = "addr";
51563#endif /* FREECIV_JSON_CONNECTION */
51564 DIO_PUT(string, &dout, &field_addr, real_packet->addr);
51565#ifdef FREECIV_JSON_CONNECTION
51566 field_addr.name = "capability";
51567#endif /* FREECIV_JSON_CONNECTION */
51568 DIO_PUT(string, &dout, &field_addr, real_packet->capability);
51569
51570#endif
51571 SEND_PACKET_END(PACKET_CONN_INFO);
51572}
51573
51574 int send_packet_conn_info(struct connection *pc, const struct packet_conn_info *packet)
51575{
51576 if (!pc->used) {
51577 log_error("WARNING: trying to send data to the closed connection %s",
51578 conn_description(pc));
51579 return -1;
51580 }
51581 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONN_INFO].packet != NULL, -1,
51582 "Handler for PACKET_CONN_INFO not installed");
51583 return pc->phs.handlers->send[PACKET_CONN_INFO].packet(pc, packet);
51584}
51585
51586 void lsend_packet_conn_info(struct conn_list *dest, const struct packet_conn_info *packet)
51587{
51588 conn_list_iterate(dest, pconn) {
51589 send_packet_conn_info(pconn, packet);
51590 } conn_list_iterate_end;
51591}
51592
51593#ifdef FREECIV_DELTA_PROTOCOL
51594#define hash_packet_conn_ping_info_100 hash_const
51595
51596#define cmp_packet_conn_ping_info_100 cmp_const
51597
51598 BV_DEFINE(packet_conn_ping_info_100_fields, 3);
51599#endif /* FREECIV_DELTA_PROTOCOL */
51600
51601 static struct packet_conn_ping_info *receive_packet_conn_ping_info_100(struct connection *pc)
51602{
51603#ifdef FREECIV_DELTA_PROTOCOL
51604 packet_conn_ping_info_100_fields fields;
51605 struct packet_conn_ping_info *old;
51606 struct genhash **hash = pc->phs.received + PACKET_CONN_PING_INFO;
51607#endif /* FREECIV_DELTA_PROTOCOL */
51608 RECEIVE_PACKET_START(packet_conn_ping_info, real_packet);
51609#ifdef FREECIV_JSON_CONNECTION
51610 struct plocation field_addr;
51611 {
51612 struct plocation *field_addr_tmp = plocation_field_new(NULL);
51613 field_addr = *field_addr_tmp;
51614 FC_FREE(field_addr_tmp);
51615 }
51616#endif /* FREECIV_JSON_CONNECTION */
51617
51618#ifdef FREECIV_DELTA_PROTOCOL
51619#ifdef FREECIV_JSON_CONNECTION
51620 field_addr.name = "fields";
51621#endif /* FREECIV_JSON_CONNECTION */
51622 DIO_BV_GET(&din, &field_addr, fields);
51623
51624#else /* FREECIV_DELTA_PROTOCOL */
51625 #ifdef FREECIV_JSON_CONNECTION
51626 field_addr.name = "connections";
51627 #endif /* FREECIV_JSON_CONNECTION */
51628 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->connections)) {
51629 RECEIVE_PACKET_FIELD_ERROR(connections);
51630 }
51631 #ifdef FREECIV_JSON_CONNECTION
51632 field_addr.name = "conn_id";
51633 #endif /* FREECIV_JSON_CONNECTION */
51634
51635 {
51636 int i;
51637
51638 #ifdef FREECIV_JSON_CONNECTION
51639 /* Enter array. */
51640 field_addr.sub_location = plocation_elem_new(0);
51641 #endif /* FREECIV_JSON_CONNECTION */
51642
51643 if (real_packet->connections > MAX_NUM_CONNECTIONS) {
51644 RECEIVE_PACKET_FIELD_ERROR(conn_id, ": truncation array");
51645 }
51646 for (i = 0; i < real_packet->connections; i++) {
51647 #ifdef FREECIV_JSON_CONNECTION
51648 field_addr.sub_location->number = i;
51649 #endif /* FREECIV_JSON_CONNECTION */
51650 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id[i])) {
51651 RECEIVE_PACKET_FIELD_ERROR(conn_id);
51652 }
51653 }
51654
51655 #ifdef FREECIV_JSON_CONNECTION
51656 /* Exit array. */
51657 free(field_addr.sub_location);
51658 field_addr.sub_location = NULL;
51659 #endif /* FREECIV_JSON_CONNECTION */
51660 }
51661 #ifdef FREECIV_JSON_CONNECTION
51662 field_addr.name = "ping_time";
51663 #endif /* FREECIV_JSON_CONNECTION */
51664
51665 {
51666 int i;
51667
51668 #ifdef FREECIV_JSON_CONNECTION
51669 /* Enter array. */
51670 field_addr.sub_location = plocation_elem_new(0);
51671 #endif /* FREECIV_JSON_CONNECTION */
51672
51673 if (real_packet->connections > MAX_NUM_CONNECTIONS) {
51674 RECEIVE_PACKET_FIELD_ERROR(ping_time, ": truncation array");
51675 }
51676 for (i = 0; i < real_packet->connections; i++) {
51677 #ifdef FREECIV_JSON_CONNECTION
51678 field_addr.sub_location->number = i;
51679 #endif /* FREECIV_JSON_CONNECTION */
51680 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->ping_time[i], 100000)) {
51681 RECEIVE_PACKET_FIELD_ERROR(ping_time);
51682 }
51683 }
51684
51685 #ifdef FREECIV_JSON_CONNECTION
51686 /* Exit array. */
51687 free(field_addr.sub_location);
51688 field_addr.sub_location = NULL;
51689 #endif /* FREECIV_JSON_CONNECTION */
51690 }
51691
51692#endif
51693 log_packet_detailed("packet_conn_ping_info_100: got info about ()");
51694
51695#ifdef FREECIV_DELTA_PROTOCOL
51696 if (NULL == *hash) {
51697 *hash = genhash_new_full(hash_packet_conn_ping_info_100, cmp_packet_conn_ping_info_100,
51698 NULL, NULL, NULL, free);
51699 }
51700
51701 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
51702 *real_packet = *old;
51703 } else {
51704 log_packet_detailed(" no old info");
51705 memset(real_packet, 0, sizeof(*real_packet));
51706 }
51707
51708 if (BV_ISSET(fields, 0)) {
51709 log_packet_detailed(" got field 'connections'");
51710 #ifdef FREECIV_JSON_CONNECTION
51711 field_addr.name = "connections";
51712 #endif /* FREECIV_JSON_CONNECTION */
51713 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->connections)) {
51714 RECEIVE_PACKET_FIELD_ERROR(connections);
51715 }
51716 }
51717 if (BV_ISSET(fields, 1)) {
51718 log_packet_detailed(" got field 'conn_id'");
51719 #ifdef FREECIV_JSON_CONNECTION
51720 field_addr.name = "conn_id";
51721 #endif /* FREECIV_JSON_CONNECTION */
51722
51723 {
51724 int i;
51725
51726 #ifdef FREECIV_JSON_CONNECTION
51727 /* Enter array. */
51728 field_addr.sub_location = plocation_elem_new(0);
51729 #endif /* FREECIV_JSON_CONNECTION */
51730
51731 if (real_packet->connections > MAX_NUM_CONNECTIONS) {
51732 RECEIVE_PACKET_FIELD_ERROR(conn_id, ": truncation array");
51733 }
51734 for (i = 0; i < real_packet->connections; i++) {
51735 #ifdef FREECIV_JSON_CONNECTION
51736 field_addr.sub_location->number = i;
51737 #endif /* FREECIV_JSON_CONNECTION */
51738 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id[i])) {
51739 RECEIVE_PACKET_FIELD_ERROR(conn_id);
51740 }
51741 }
51742
51743 #ifdef FREECIV_JSON_CONNECTION
51744 /* Exit array. */
51745 free(field_addr.sub_location);
51746 field_addr.sub_location = NULL;
51747 #endif /* FREECIV_JSON_CONNECTION */
51748 }
51749 }
51750 if (BV_ISSET(fields, 2)) {
51751 log_packet_detailed(" got field 'ping_time'");
51752 #ifdef FREECIV_JSON_CONNECTION
51753 field_addr.name = "ping_time";
51754 #endif /* FREECIV_JSON_CONNECTION */
51755
51756 {
51757 int i;
51758
51759 #ifdef FREECIV_JSON_CONNECTION
51760 /* Enter array. */
51761 field_addr.sub_location = plocation_elem_new(0);
51762 #endif /* FREECIV_JSON_CONNECTION */
51763
51764 if (real_packet->connections > MAX_NUM_CONNECTIONS) {
51765 RECEIVE_PACKET_FIELD_ERROR(ping_time, ": truncation array");
51766 }
51767 for (i = 0; i < real_packet->connections; i++) {
51768 #ifdef FREECIV_JSON_CONNECTION
51769 field_addr.sub_location->number = i;
51770 #endif /* FREECIV_JSON_CONNECTION */
51771 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->ping_time[i], 100000)) {
51772 RECEIVE_PACKET_FIELD_ERROR(ping_time);
51773 }
51774 }
51775
51776 #ifdef FREECIV_JSON_CONNECTION
51777 /* Exit array. */
51778 free(field_addr.sub_location);
51779 field_addr.sub_location = NULL;
51780 #endif /* FREECIV_JSON_CONNECTION */
51781 }
51782 }
51783
51784 if (NULL == old) {
51785 old = fc_malloc(sizeof(*old));
51786 *old = *real_packet;
51787 genhash_insert(*hash, old, old);
51788 } else {
51789 *old = *real_packet;
51790 }
51791
51792#endif /* FREECIV_DELTA_PROTOCOL */
51793 RECEIVE_PACKET_END(real_packet);
51794}
51795
51796 static int send_packet_conn_ping_info_100(struct connection *pc, const struct packet_conn_ping_info *packet)
51797{
51798 const struct packet_conn_ping_info *real_packet = packet;
51799#ifdef FREECIV_DELTA_PROTOCOL
51800 packet_conn_ping_info_100_fields fields;
51801 struct packet_conn_ping_info *old;
51802 bool differ;
51803 struct genhash **hash = pc->phs.sent + PACKET_CONN_PING_INFO;
51804#endif /* FREECIV_DELTA_PROTOCOL */
51805 SEND_PACKET_START(PACKET_CONN_PING_INFO);
51806#ifdef FREECIV_JSON_CONNECTION
51807 struct plocation field_addr;
51808 {
51809 struct plocation *field_addr_tmp = plocation_field_new(NULL);
51810 field_addr = *field_addr_tmp;
51811 FC_FREE(field_addr_tmp);
51812 }
51813#endif /* FREECIV_JSON_CONNECTION */
51814
51815 log_packet_detailed("packet_conn_ping_info_100: sending info about ()");
51816
51817#ifdef FREECIV_DELTA_PROTOCOL
51818 if (NULL == *hash) {
51819 *hash = genhash_new_full(hash_packet_conn_ping_info_100, cmp_packet_conn_ping_info_100,
51820 NULL, NULL, NULL, free);
51821 }
51822 BV_CLR_ALL(fields);
51823
51824 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
51825 old = fc_malloc(sizeof(*old));
51826 *old = *real_packet;
51827 genhash_insert(*hash, old, old);
51828 memset(old, 0, sizeof(*old));
51829 }
51830 differ = (old->connections != real_packet->connections);
51831 if (differ) {
51832 BV_SET(fields, 0);
51833 }
51834
51835
51836 {
51837 differ = (old->connections != real_packet->connections);
51838 if (!differ) {
51839 int i;
51840
51841 for (i = 0; i < real_packet->connections; i++) {
51842 if (old->conn_id[i] != real_packet->conn_id[i]) {
51843 differ = TRUE;
51844 break;
51845 }
51846 }
51847 }
51848 }
51849 if (differ) {
51850 BV_SET(fields, 1);
51851 }
51852
51853
51854 {
51855 differ = (old->connections != real_packet->connections);
51856 if (!differ) {
51857 int i;
51858
51859 for (i = 0; i < real_packet->connections; i++) {
51860 if (old->ping_time[i] != real_packet->ping_time[i]) {
51861 differ = TRUE;
51862 break;
51863 }
51864 }
51865 }
51866 }
51867 if (differ) {
51868 BV_SET(fields, 2);
51869 }
51870
51871
51872#ifdef FREECIV_JSON_CONNECTION
51873 field_addr.name = "fields";
51874#endif /* FREECIV_JSON_CONNECTION */
51875 DIO_BV_PUT(&dout, &field_addr, fields);
51876
51877 if (BV_ISSET(fields, 0)) {
51878 log_packet_detailed(" field 'connections' has changed");
51879 #ifdef FREECIV_JSON_CONNECTION
51880 field_addr.name = "connections";
51881#endif /* FREECIV_JSON_CONNECTION */
51882 DIO_PUT(uint16, &dout, &field_addr, real_packet->connections);
51883 }
51884 if (BV_ISSET(fields, 1)) {
51885 log_packet_detailed(" field 'conn_id' has changed");
51886 #ifdef FREECIV_JSON_CONNECTION
51887 field_addr.name = "conn_id";
51888#endif /* FREECIV_JSON_CONNECTION */
51889
51890 {
51891 int i;
51892
51893#ifdef FREECIV_JSON_CONNECTION
51894 /* Create the array. */
51895 DIO_PUT(farray, &dout, &field_addr, real_packet->connections);
51896
51897 /* Enter the array. */
51898 field_addr.sub_location = plocation_elem_new(0);
51899#endif /* FREECIV_JSON_CONNECTION */
51900
51901 for (i = 0; i < real_packet->connections; i++) {
51902#ifdef FREECIV_JSON_CONNECTION
51903 /* Next array element. */
51904 field_addr.sub_location->number = i;
51905#endif /* FREECIV_JSON_CONNECTION */
51906 DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id[i]);
51907 }
51908
51909#ifdef FREECIV_JSON_CONNECTION
51910 /* Exit array. */
51911 free(field_addr.sub_location);
51912 field_addr.sub_location = NULL;
51913#endif /* FREECIV_JSON_CONNECTION */
51914 }
51915 }
51916 if (BV_ISSET(fields, 2)) {
51917 log_packet_detailed(" field 'ping_time' has changed");
51918 #ifdef FREECIV_JSON_CONNECTION
51919 field_addr.name = "ping_time";
51920#endif /* FREECIV_JSON_CONNECTION */
51921
51922 {
51923 int i;
51924
51925#ifdef FREECIV_JSON_CONNECTION
51926 /* Create the array. */
51927 DIO_PUT(farray, &dout, &field_addr, real_packet->connections);
51928
51929 /* Enter the array. */
51930 field_addr.sub_location = plocation_elem_new(0);
51931#endif /* FREECIV_JSON_CONNECTION */
51932
51933 for (i = 0; i < real_packet->connections; i++) {
51934#ifdef FREECIV_JSON_CONNECTION
51935 /* Next array element. */
51936 field_addr.sub_location->number = i;
51937#endif /* FREECIV_JSON_CONNECTION */
51938 DIO_PUT(sfloat, &dout, &field_addr, real_packet->ping_time[i], 100000);
51939 }
51940
51941#ifdef FREECIV_JSON_CONNECTION
51942 /* Exit array. */
51943 free(field_addr.sub_location);
51944 field_addr.sub_location = NULL;
51945#endif /* FREECIV_JSON_CONNECTION */
51946 }
51947 }
51948
51949 *old = *real_packet;
51950#endif /* FREECIV_DELTA_PROTOCOL */
51951#ifndef FREECIV_DELTA_PROTOCOL
51952#ifdef FREECIV_JSON_CONNECTION
51953 field_addr.name = "connections";
51954#endif /* FREECIV_JSON_CONNECTION */
51955 DIO_PUT(uint16, &dout, &field_addr, real_packet->connections);
51956#ifdef FREECIV_JSON_CONNECTION
51957 field_addr.name = "conn_id";
51958#endif /* FREECIV_JSON_CONNECTION */
51959
51960 {
51961 int i;
51962
51963#ifdef FREECIV_JSON_CONNECTION
51964 /* Create the array. */
51965 DIO_PUT(farray, &dout, &field_addr, real_packet->connections);
51966
51967 /* Enter the array. */
51968 field_addr.sub_location = plocation_elem_new(0);
51969#endif /* FREECIV_JSON_CONNECTION */
51970
51971 for (i = 0; i < real_packet->connections; i++) {
51972#ifdef FREECIV_JSON_CONNECTION
51973 /* Next array element. */
51974 field_addr.sub_location->number = i;
51975#endif /* FREECIV_JSON_CONNECTION */
51976 DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id[i]);
51977 }
51978
51979#ifdef FREECIV_JSON_CONNECTION
51980 /* Exit array. */
51981 free(field_addr.sub_location);
51982 field_addr.sub_location = NULL;
51983#endif /* FREECIV_JSON_CONNECTION */
51984 }
51985#ifdef FREECIV_JSON_CONNECTION
51986 field_addr.name = "ping_time";
51987#endif /* FREECIV_JSON_CONNECTION */
51988
51989 {
51990 int i;
51991
51992#ifdef FREECIV_JSON_CONNECTION
51993 /* Create the array. */
51994 DIO_PUT(farray, &dout, &field_addr, real_packet->connections);
51995
51996 /* Enter the array. */
51997 field_addr.sub_location = plocation_elem_new(0);
51998#endif /* FREECIV_JSON_CONNECTION */
51999
52000 for (i = 0; i < real_packet->connections; i++) {
52001#ifdef FREECIV_JSON_CONNECTION
52002 /* Next array element. */
52003 field_addr.sub_location->number = i;
52004#endif /* FREECIV_JSON_CONNECTION */
52005 DIO_PUT(sfloat, &dout, &field_addr, real_packet->ping_time[i], 100000);
52006 }
52007
52008#ifdef FREECIV_JSON_CONNECTION
52009 /* Exit array. */
52010 free(field_addr.sub_location);
52011 field_addr.sub_location = NULL;
52012#endif /* FREECIV_JSON_CONNECTION */
52013 }
52014
52015#endif
52016 SEND_PACKET_END(PACKET_CONN_PING_INFO);
52017}
52018
52019 int send_packet_conn_ping_info(struct connection *pc, const struct packet_conn_ping_info *packet)
52020{
52021 if (!pc->used) {
52022 log_error("WARNING: trying to send data to the closed connection %s",
52023 conn_description(pc));
52024 return -1;
52025 }
52026 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONN_PING_INFO].packet != NULL, -1,
52027 "Handler for PACKET_CONN_PING_INFO not installed");
52028 return pc->phs.handlers->send[PACKET_CONN_PING_INFO].packet(pc, packet);
52029}
52030
52031 void lsend_packet_conn_ping_info(struct conn_list *dest, const struct packet_conn_ping_info *packet)
52032{
52033 conn_list_iterate(dest, pconn) {
52034 send_packet_conn_ping_info(pconn, packet);
52035 } conn_list_iterate_end;
52036}
52037
52038 static struct packet_conn_ping *receive_packet_conn_ping_100(struct connection *pc)
52039{
52040 RECEIVE_PACKET_START(packet_conn_ping, real_packet);
52041#if 1 /* To match endif */
52042 real_packet->__dummy = 0xff;
52043#endif
52044 log_packet_detailed("packet_conn_ping_100: got info about ()");
52045 RECEIVE_PACKET_END(real_packet);
52046}
52047
52048 static int send_packet_conn_ping_100(struct connection *pc)
52049{
52050 SEND_PACKET_START(PACKET_CONN_PING);
52051
52052 log_packet_detailed("packet_conn_ping_100: sending info about ()");
52053 SEND_PACKET_END(PACKET_CONN_PING);
52054}
52055
52056 int send_packet_conn_ping(struct connection *pc)
52057{
52058 if (!pc->used) {
52059 log_error("WARNING: trying to send data to the closed connection %s",
52060 conn_description(pc));
52061 return -1;
52062 }
52063 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONN_PING].no_packet != NULL, -1,
52064 "Handler for PACKET_CONN_PING not installed");
52065 return pc->phs.handlers->send[PACKET_CONN_PING].no_packet(pc);
52066}
52067
52068 static struct packet_conn_pong *receive_packet_conn_pong_100(struct connection *pc)
52069{
52070 RECEIVE_PACKET_START(packet_conn_pong, real_packet);
52071#if 1 /* To match endif */
52072 real_packet->__dummy = 0xff;
52073#endif
52074 log_packet_detailed("packet_conn_pong_100: got info about ()");
52075 RECEIVE_PACKET_END(real_packet);
52076}
52077
52078 static int send_packet_conn_pong_100(struct connection *pc)
52079{
52080 SEND_PACKET_START(PACKET_CONN_PONG);
52081
52082 log_packet_detailed("packet_conn_pong_100: sending info about ()");
52083 SEND_PACKET_END(PACKET_CONN_PONG);
52084}
52085
52086 int send_packet_conn_pong(struct connection *pc)
52087{
52088 if (!pc->used) {
52089 log_error("WARNING: trying to send data to the closed connection %s",
52090 conn_description(pc));
52091 return -1;
52092 }
52093 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONN_PONG].no_packet != NULL, -1,
52094 "Handler for PACKET_CONN_PONG not installed");
52095 return pc->phs.handlers->send[PACKET_CONN_PONG].no_packet(pc);
52096}
52097
52098 static struct packet_client_heartbeat *receive_packet_client_heartbeat_100(struct connection *pc)
52099{
52100 RECEIVE_PACKET_START(packet_client_heartbeat, real_packet);
52101#if 1 /* To match endif */
52102 real_packet->__dummy = 0xff;
52103#endif
52104 log_packet_detailed("packet_client_heartbeat_100: got info about ()");
52105 RECEIVE_PACKET_END(real_packet);
52106}
52107
52108 static int send_packet_client_heartbeat_100(struct connection *pc)
52109{
52110 SEND_PACKET_START(PACKET_CLIENT_HEARTBEAT);
52111
52112 log_packet_detailed("packet_client_heartbeat_100: sending info about ()");
52113 SEND_PACKET_END(PACKET_CLIENT_HEARTBEAT);
52114}
52115
52116 int send_packet_client_heartbeat(struct connection *pc)
52117{
52118 if (!pc->used) {
52119 log_error("WARNING: trying to send data to the closed connection %s",
52120 conn_description(pc));
52121 return -1;
52122 }
52123 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CLIENT_HEARTBEAT].no_packet != NULL, -1,
52124 "Handler for PACKET_CLIENT_HEARTBEAT not installed");
52125 return pc->phs.handlers->send[PACKET_CLIENT_HEARTBEAT].no_packet(pc);
52126}
52127
52128#ifdef FREECIV_DELTA_PROTOCOL
52129#define hash_packet_client_info_100 hash_const
52130
52131#define cmp_packet_client_info_100 cmp_const
52132
52133 BV_DEFINE(packet_client_info_100_fields, 3);
52134#endif /* FREECIV_DELTA_PROTOCOL */
52135
52136 static struct packet_client_info *receive_packet_client_info_100(struct connection *pc)
52137{
52138#ifdef FREECIV_DELTA_PROTOCOL
52139 packet_client_info_100_fields fields;
52140 struct packet_client_info *old;
52141 struct genhash **hash = pc->phs.received + PACKET_CLIENT_INFO;
52142#endif /* FREECIV_DELTA_PROTOCOL */
52143 RECEIVE_PACKET_START(packet_client_info, real_packet);
52144#ifdef FREECIV_JSON_CONNECTION
52145 struct plocation field_addr;
52146 {
52147 struct plocation *field_addr_tmp = plocation_field_new(NULL);
52148 field_addr = *field_addr_tmp;
52149 FC_FREE(field_addr_tmp);
52150 }
52151#endif /* FREECIV_JSON_CONNECTION */
52152
52153#ifdef FREECIV_DELTA_PROTOCOL
52154#ifdef FREECIV_JSON_CONNECTION
52155 field_addr.name = "fields";
52156#endif /* FREECIV_JSON_CONNECTION */
52157 DIO_BV_GET(&din, &field_addr, fields);
52158
52159#else /* FREECIV_DELTA_PROTOCOL */
52160 #ifdef FREECIV_JSON_CONNECTION
52161 field_addr.name = "gui";
52162 #endif /* FREECIV_JSON_CONNECTION */
52163 {
52164 int readin;
52165
52166 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
52167 RECEIVE_PACKET_FIELD_ERROR(gui);
52168 }
52169 real_packet->gui = readin;
52170 }
52171 #ifdef FREECIV_JSON_CONNECTION
52172 field_addr.name = "emerg_version";
52173 #endif /* FREECIV_JSON_CONNECTION */
52174 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->emerg_version)) {
52175 RECEIVE_PACKET_FIELD_ERROR(emerg_version);
52176 }
52177 #ifdef FREECIV_JSON_CONNECTION
52178 field_addr.name = "distribution";
52179 #endif /* FREECIV_JSON_CONNECTION */
52180 if (!DIO_GET(string, &din, &field_addr, real_packet->distribution, sizeof(real_packet->distribution))) {
52181 RECEIVE_PACKET_FIELD_ERROR(distribution);
52182 }
52183
52184#endif
52185 log_packet_detailed("packet_client_info_100: got info about ()");
52186
52187#ifdef FREECIV_DELTA_PROTOCOL
52188 if (NULL == *hash) {
52189 *hash = genhash_new_full(hash_packet_client_info_100, cmp_packet_client_info_100,
52190 NULL, NULL, NULL, free);
52191 }
52192
52193 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
52194 *real_packet = *old;
52195 } else {
52196 log_packet_detailed(" no old info");
52197 memset(real_packet, 0, sizeof(*real_packet));
52198 }
52199
52200 if (BV_ISSET(fields, 0)) {
52201 log_packet_detailed(" got field 'gui'");
52202 #ifdef FREECIV_JSON_CONNECTION
52203 field_addr.name = "gui";
52204 #endif /* FREECIV_JSON_CONNECTION */
52205 {
52206 int readin;
52207
52208 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
52209 RECEIVE_PACKET_FIELD_ERROR(gui);
52210 }
52211 real_packet->gui = readin;
52212 }
52213 }
52214 if (BV_ISSET(fields, 1)) {
52215 log_packet_detailed(" got field 'emerg_version'");
52216 #ifdef FREECIV_JSON_CONNECTION
52217 field_addr.name = "emerg_version";
52218 #endif /* FREECIV_JSON_CONNECTION */
52219 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->emerg_version)) {
52220 RECEIVE_PACKET_FIELD_ERROR(emerg_version);
52221 }
52222 }
52223 if (BV_ISSET(fields, 2)) {
52224 log_packet_detailed(" got field 'distribution'");
52225 #ifdef FREECIV_JSON_CONNECTION
52226 field_addr.name = "distribution";
52227 #endif /* FREECIV_JSON_CONNECTION */
52228 if (!DIO_GET(string, &din, &field_addr, real_packet->distribution, sizeof(real_packet->distribution))) {
52229 RECEIVE_PACKET_FIELD_ERROR(distribution);
52230 }
52231 }
52232
52233 if (NULL == old) {
52234 old = fc_malloc(sizeof(*old));
52235 *old = *real_packet;
52236 genhash_insert(*hash, old, old);
52237 } else {
52238 *old = *real_packet;
52239 }
52240
52241#endif /* FREECIV_DELTA_PROTOCOL */
52242 RECEIVE_PACKET_END(real_packet);
52243}
52244
52245 static int send_packet_client_info_100(struct connection *pc, const struct packet_client_info *packet)
52246{
52247 const struct packet_client_info *real_packet = packet;
52248#ifdef FREECIV_DELTA_PROTOCOL
52249 packet_client_info_100_fields fields;
52250 struct packet_client_info *old;
52251 bool differ;
52252 struct genhash **hash = pc->phs.sent + PACKET_CLIENT_INFO;
52253#endif /* FREECIV_DELTA_PROTOCOL */
52254 SEND_PACKET_START(PACKET_CLIENT_INFO);
52255#ifdef FREECIV_JSON_CONNECTION
52256 struct plocation field_addr;
52257 {
52258 struct plocation *field_addr_tmp = plocation_field_new(NULL);
52259 field_addr = *field_addr_tmp;
52260 FC_FREE(field_addr_tmp);
52261 }
52262#endif /* FREECIV_JSON_CONNECTION */
52263
52264 log_packet_detailed("packet_client_info_100: sending info about ()");
52265
52266#ifdef FREECIV_DELTA_PROTOCOL
52267 if (NULL == *hash) {
52268 *hash = genhash_new_full(hash_packet_client_info_100, cmp_packet_client_info_100,
52269 NULL, NULL, NULL, free);
52270 }
52271 BV_CLR_ALL(fields);
52272
52273 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
52274 old = fc_malloc(sizeof(*old));
52275 *old = *real_packet;
52276 genhash_insert(*hash, old, old);
52277 memset(old, 0, sizeof(*old));
52278 }
52279 differ = (old->gui != real_packet->gui);
52280 if (differ) {
52281 BV_SET(fields, 0);
52282 }
52283
52284 differ = (old->emerg_version != real_packet->emerg_version);
52285 if (differ) {
52286 BV_SET(fields, 1);
52287 }
52288
52289 differ = (strcmp(old->distribution, real_packet->distribution) != 0);
52290 if (differ) {
52291 BV_SET(fields, 2);
52292 }
52293
52294
52295#ifdef FREECIV_JSON_CONNECTION
52296 field_addr.name = "fields";
52297#endif /* FREECIV_JSON_CONNECTION */
52298 DIO_BV_PUT(&dout, &field_addr, fields);
52299
52300 if (BV_ISSET(fields, 0)) {
52301 log_packet_detailed(" field 'gui' has changed");
52302 #ifdef FREECIV_JSON_CONNECTION
52303 field_addr.name = "gui";
52304#endif /* FREECIV_JSON_CONNECTION */
52305 DIO_PUT(uint8, &dout, &field_addr, real_packet->gui);
52306 }
52307 if (BV_ISSET(fields, 1)) {
52308 log_packet_detailed(" field 'emerg_version' has changed");
52309 #ifdef FREECIV_JSON_CONNECTION
52310 field_addr.name = "emerg_version";
52311#endif /* FREECIV_JSON_CONNECTION */
52312 DIO_PUT(uint32, &dout, &field_addr, real_packet->emerg_version);
52313 }
52314 if (BV_ISSET(fields, 2)) {
52315 log_packet_detailed(" field 'distribution' has changed");
52316 #ifdef FREECIV_JSON_CONNECTION
52317 field_addr.name = "distribution";
52318#endif /* FREECIV_JSON_CONNECTION */
52319 DIO_PUT(string, &dout, &field_addr, real_packet->distribution);
52320 }
52321
52322 *old = *real_packet;
52323#endif /* FREECIV_DELTA_PROTOCOL */
52324#ifndef FREECIV_DELTA_PROTOCOL
52325#ifdef FREECIV_JSON_CONNECTION
52326 field_addr.name = "gui";
52327#endif /* FREECIV_JSON_CONNECTION */
52328 DIO_PUT(uint8, &dout, &field_addr, real_packet->gui);
52329#ifdef FREECIV_JSON_CONNECTION
52330 field_addr.name = "emerg_version";
52331#endif /* FREECIV_JSON_CONNECTION */
52332 DIO_PUT(uint32, &dout, &field_addr, real_packet->emerg_version);
52333#ifdef FREECIV_JSON_CONNECTION
52334 field_addr.name = "distribution";
52335#endif /* FREECIV_JSON_CONNECTION */
52336 DIO_PUT(string, &dout, &field_addr, real_packet->distribution);
52337
52338#endif
52339 SEND_PACKET_END(PACKET_CLIENT_INFO);
52340}
52341
52342 int send_packet_client_info(struct connection *pc, const struct packet_client_info *packet)
52343{
52344 if (!pc->used) {
52345 log_error("WARNING: trying to send data to the closed connection %s",
52346 conn_description(pc));
52347 return -1;
52348 }
52349 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CLIENT_INFO].packet != NULL, -1,
52350 "Handler for PACKET_CLIENT_INFO not installed");
52351 return pc->phs.handlers->send[PACKET_CLIENT_INFO].packet(pc, packet);
52352}
52353
52354 static struct packet_end_phase *receive_packet_end_phase_100(struct connection *pc)
52355{
52356 RECEIVE_PACKET_START(packet_end_phase, real_packet);
52357#if 1 /* To match endif */
52358 real_packet->__dummy = 0xff;
52359#endif
52360 log_packet_detailed("packet_end_phase_100: got info about ()");
52361 RECEIVE_PACKET_END(real_packet);
52362}
52363
52364 static int send_packet_end_phase_100(struct connection *pc)
52365{
52366 SEND_PACKET_START(PACKET_END_PHASE);
52367
52368 log_packet_detailed("packet_end_phase_100: sending info about ()");
52369 SEND_PACKET_END(PACKET_END_PHASE);
52370}
52371
52372 int send_packet_end_phase(struct connection *pc)
52373{
52374 if (!pc->used) {
52375 log_error("WARNING: trying to send data to the closed connection %s",
52376 conn_description(pc));
52377 return -1;
52378 }
52379 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_END_PHASE].no_packet != NULL, -1,
52380 "Handler for PACKET_END_PHASE not installed");
52381 return pc->phs.handlers->send[PACKET_END_PHASE].no_packet(pc);
52382}
52383
52384 void lsend_packet_end_phase(struct conn_list *dest)
52385{
52386 conn_list_iterate(dest, pconn) {
52387 send_packet_end_phase(pconn);
52388 } conn_list_iterate_end;
52389}
52390
52391#ifdef FREECIV_DELTA_PROTOCOL
52392#define hash_packet_start_phase_100 hash_const
52393
52394#define cmp_packet_start_phase_100 cmp_const
52395
52396 BV_DEFINE(packet_start_phase_100_fields, 1);
52397#endif /* FREECIV_DELTA_PROTOCOL */
52398
52399 static struct packet_start_phase *receive_packet_start_phase_100(struct connection *pc)
52400{
52401#ifdef FREECIV_DELTA_PROTOCOL
52402 packet_start_phase_100_fields fields;
52403 struct packet_start_phase *old;
52404 struct genhash **hash = pc->phs.received + PACKET_START_PHASE;
52405#endif /* FREECIV_DELTA_PROTOCOL */
52406 RECEIVE_PACKET_START(packet_start_phase, real_packet);
52407#ifdef FREECIV_JSON_CONNECTION
52408 struct plocation field_addr;
52409 {
52410 struct plocation *field_addr_tmp = plocation_field_new(NULL);
52411 field_addr = *field_addr_tmp;
52412 FC_FREE(field_addr_tmp);
52413 }
52414#endif /* FREECIV_JSON_CONNECTION */
52415
52416#ifdef FREECIV_DELTA_PROTOCOL
52417#ifdef FREECIV_JSON_CONNECTION
52418 field_addr.name = "fields";
52419#endif /* FREECIV_JSON_CONNECTION */
52420 DIO_BV_GET(&din, &field_addr, fields);
52421
52422#else /* FREECIV_DELTA_PROTOCOL */
52423 #ifdef FREECIV_JSON_CONNECTION
52424 field_addr.name = "phase";
52425 #endif /* FREECIV_JSON_CONNECTION */
52426 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
52427 RECEIVE_PACKET_FIELD_ERROR(phase);
52428 }
52429
52430#endif
52431 log_packet_detailed("packet_start_phase_100: got info about ()");
52432
52433#ifdef FREECIV_DELTA_PROTOCOL
52434 if (NULL == *hash) {
52435 *hash = genhash_new_full(hash_packet_start_phase_100, cmp_packet_start_phase_100,
52436 NULL, NULL, NULL, free);
52437 }
52438
52439 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
52440 *real_packet = *old;
52441 } else {
52442 log_packet_detailed(" no old info");
52443 memset(real_packet, 0, sizeof(*real_packet));
52444 }
52445
52446 if (BV_ISSET(fields, 0)) {
52447 log_packet_detailed(" got field 'phase'");
52448 #ifdef FREECIV_JSON_CONNECTION
52449 field_addr.name = "phase";
52450 #endif /* FREECIV_JSON_CONNECTION */
52451 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
52452 RECEIVE_PACKET_FIELD_ERROR(phase);
52453 }
52454 }
52455
52456 if (NULL == old) {
52457 old = fc_malloc(sizeof(*old));
52458 *old = *real_packet;
52459 genhash_insert(*hash, old, old);
52460 } else {
52461 *old = *real_packet;
52462 }
52463
52464#endif /* FREECIV_DELTA_PROTOCOL */
52465 RECEIVE_PACKET_END(real_packet);
52466}
52467
52468 static int send_packet_start_phase_100(struct connection *pc, const struct packet_start_phase *packet)
52469{
52470 const struct packet_start_phase *real_packet = packet;
52471#ifdef FREECIV_DELTA_PROTOCOL
52472 packet_start_phase_100_fields fields;
52473 struct packet_start_phase *old;
52474 bool differ;
52475 struct genhash **hash = pc->phs.sent + PACKET_START_PHASE;
52476#endif /* FREECIV_DELTA_PROTOCOL */
52477 SEND_PACKET_START(PACKET_START_PHASE);
52478#ifdef FREECIV_JSON_CONNECTION
52479 struct plocation field_addr;
52480 {
52481 struct plocation *field_addr_tmp = plocation_field_new(NULL);
52482 field_addr = *field_addr_tmp;
52483 FC_FREE(field_addr_tmp);
52484 }
52485#endif /* FREECIV_JSON_CONNECTION */
52486
52487 log_packet_detailed("packet_start_phase_100: sending info about ()");
52488
52489#ifdef FREECIV_DELTA_PROTOCOL
52490 if (NULL == *hash) {
52491 *hash = genhash_new_full(hash_packet_start_phase_100, cmp_packet_start_phase_100,
52492 NULL, NULL, NULL, free);
52493 }
52494 BV_CLR_ALL(fields);
52495
52496 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
52497 old = fc_malloc(sizeof(*old));
52498 *old = *real_packet;
52499 genhash_insert(*hash, old, old);
52500 memset(old, 0, sizeof(*old));
52501 }
52502 differ = (old->phase != real_packet->phase);
52503 if (differ) {
52504 BV_SET(fields, 0);
52505 }
52506
52507
52508#ifdef FREECIV_JSON_CONNECTION
52509 field_addr.name = "fields";
52510#endif /* FREECIV_JSON_CONNECTION */
52511 DIO_BV_PUT(&dout, &field_addr, fields);
52512
52513 if (BV_ISSET(fields, 0)) {
52514 log_packet_detailed(" field 'phase' has changed");
52515 #ifdef FREECIV_JSON_CONNECTION
52516 field_addr.name = "phase";
52517#endif /* FREECIV_JSON_CONNECTION */
52518 DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
52519 }
52520
52521 *old = *real_packet;
52522#endif /* FREECIV_DELTA_PROTOCOL */
52523#ifndef FREECIV_DELTA_PROTOCOL
52524#ifdef FREECIV_JSON_CONNECTION
52525 field_addr.name = "phase";
52526#endif /* FREECIV_JSON_CONNECTION */
52527 DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
52528
52529#endif
52530 SEND_PACKET_END(PACKET_START_PHASE);
52531}
52532
52533 int send_packet_start_phase(struct connection *pc, const struct packet_start_phase *packet)
52534{
52535 if (!pc->used) {
52536 log_error("WARNING: trying to send data to the closed connection %s",
52537 conn_description(pc));
52538 return -1;
52539 }
52540 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_START_PHASE].packet != NULL, -1,
52541 "Handler for PACKET_START_PHASE not installed");
52542 return pc->phs.handlers->send[PACKET_START_PHASE].packet(pc, packet);
52543}
52544
52545 void lsend_packet_start_phase(struct conn_list *dest, const struct packet_start_phase *packet)
52546{
52547 conn_list_iterate(dest, pconn) {
52548 send_packet_start_phase(pconn, packet);
52549 } conn_list_iterate_end;
52550}
52551
52552 int dsend_packet_start_phase(struct connection *pc, int phase)
52553{
52554 struct packet_start_phase packet, *real_packet = &packet;
52555
52556 real_packet->phase = phase;
52557
52558 return send_packet_start_phase(pc, real_packet);
52559}
52560
52561 void dlsend_packet_start_phase(struct conn_list *dest, int phase)
52562{
52563 struct packet_start_phase packet, *real_packet = &packet;
52564
52565 real_packet->phase = phase;
52566
52567 lsend_packet_start_phase(dest, real_packet);
52568}
52569
52570#ifdef FREECIV_DELTA_PROTOCOL
52571#define hash_packet_new_year_100 hash_const
52572
52573#define cmp_packet_new_year_100 cmp_const
52574
52575 BV_DEFINE(packet_new_year_100_fields, 3);
52576#endif /* FREECIV_DELTA_PROTOCOL */
52577
52578 static struct packet_new_year *receive_packet_new_year_100(struct connection *pc)
52579{
52580#ifdef FREECIV_DELTA_PROTOCOL
52581 packet_new_year_100_fields fields;
52582 struct packet_new_year *old;
52583 struct genhash **hash = pc->phs.received + PACKET_NEW_YEAR;
52584#endif /* FREECIV_DELTA_PROTOCOL */
52585 RECEIVE_PACKET_START(packet_new_year, real_packet);
52586#ifdef FREECIV_JSON_CONNECTION
52587 struct plocation field_addr;
52588 {
52589 struct plocation *field_addr_tmp = plocation_field_new(NULL);
52590 field_addr = *field_addr_tmp;
52591 FC_FREE(field_addr_tmp);
52592 }
52593#endif /* FREECIV_JSON_CONNECTION */
52594
52595#ifdef FREECIV_DELTA_PROTOCOL
52596#ifdef FREECIV_JSON_CONNECTION
52597 field_addr.name = "fields";
52598#endif /* FREECIV_JSON_CONNECTION */
52599 DIO_BV_GET(&din, &field_addr, fields);
52600
52601#else /* FREECIV_DELTA_PROTOCOL */
52602 #ifdef FREECIV_JSON_CONNECTION
52603 field_addr.name = "year";
52604 #endif /* FREECIV_JSON_CONNECTION */
52605 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->year)) {
52606 RECEIVE_PACKET_FIELD_ERROR(year);
52607 }
52608 #ifdef FREECIV_JSON_CONNECTION
52609 field_addr.name = "fragments";
52610 #endif /* FREECIV_JSON_CONNECTION */
52611 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->fragments)) {
52612 RECEIVE_PACKET_FIELD_ERROR(fragments);
52613 }
52614 #ifdef FREECIV_JSON_CONNECTION
52615 field_addr.name = "turn";
52616 #endif /* FREECIV_JSON_CONNECTION */
52617 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
52618 RECEIVE_PACKET_FIELD_ERROR(turn);
52619 }
52620
52621#endif
52622 log_packet_detailed("packet_new_year_100: got info about ()");
52623
52624#ifdef FREECIV_DELTA_PROTOCOL
52625 if (NULL == *hash) {
52626 *hash = genhash_new_full(hash_packet_new_year_100, cmp_packet_new_year_100,
52627 NULL, NULL, NULL, free);
52628 }
52629
52630 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
52631 *real_packet = *old;
52632 } else {
52633 log_packet_detailed(" no old info");
52634 memset(real_packet, 0, sizeof(*real_packet));
52635 }
52636
52637 if (BV_ISSET(fields, 0)) {
52638 log_packet_detailed(" got field 'year'");
52639 #ifdef FREECIV_JSON_CONNECTION
52640 field_addr.name = "year";
52641 #endif /* FREECIV_JSON_CONNECTION */
52642 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->year)) {
52643 RECEIVE_PACKET_FIELD_ERROR(year);
52644 }
52645 }
52646 if (BV_ISSET(fields, 1)) {
52647 log_packet_detailed(" got field 'fragments'");
52648 #ifdef FREECIV_JSON_CONNECTION
52649 field_addr.name = "fragments";
52650 #endif /* FREECIV_JSON_CONNECTION */
52651 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->fragments)) {
52652 RECEIVE_PACKET_FIELD_ERROR(fragments);
52653 }
52654 }
52655 if (BV_ISSET(fields, 2)) {
52656 log_packet_detailed(" got field 'turn'");
52657 #ifdef FREECIV_JSON_CONNECTION
52658 field_addr.name = "turn";
52659 #endif /* FREECIV_JSON_CONNECTION */
52660 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
52661 RECEIVE_PACKET_FIELD_ERROR(turn);
52662 }
52663 }
52664
52665 if (NULL == old) {
52666 old = fc_malloc(sizeof(*old));
52667 *old = *real_packet;
52668 genhash_insert(*hash, old, old);
52669 } else {
52670 *old = *real_packet;
52671 }
52672
52673#endif /* FREECIV_DELTA_PROTOCOL */
52674 RECEIVE_PACKET_END(real_packet);
52675}
52676
52677 static int send_packet_new_year_100(struct connection *pc, const struct packet_new_year *packet)
52678{
52679 const struct packet_new_year *real_packet = packet;
52680#ifdef FREECIV_DELTA_PROTOCOL
52681 packet_new_year_100_fields fields;
52682 struct packet_new_year *old;
52683 bool differ;
52684 struct genhash **hash = pc->phs.sent + PACKET_NEW_YEAR;
52685#endif /* FREECIV_DELTA_PROTOCOL */
52686 SEND_PACKET_START(PACKET_NEW_YEAR);
52687#ifdef FREECIV_JSON_CONNECTION
52688 struct plocation field_addr;
52689 {
52690 struct plocation *field_addr_tmp = plocation_field_new(NULL);
52691 field_addr = *field_addr_tmp;
52692 FC_FREE(field_addr_tmp);
52693 }
52694#endif /* FREECIV_JSON_CONNECTION */
52695
52696 log_packet_detailed("packet_new_year_100: sending info about ()");
52697
52698#ifdef FREECIV_DELTA_PROTOCOL
52699 if (NULL == *hash) {
52700 *hash = genhash_new_full(hash_packet_new_year_100, cmp_packet_new_year_100,
52701 NULL, NULL, NULL, free);
52702 }
52703 BV_CLR_ALL(fields);
52704
52705 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
52706 old = fc_malloc(sizeof(*old));
52707 *old = *real_packet;
52708 genhash_insert(*hash, old, old);
52709 memset(old, 0, sizeof(*old));
52710 }
52711 differ = (old->year != real_packet->year);
52712 if (differ) {
52713 BV_SET(fields, 0);
52714 }
52715
52716 differ = (old->fragments != real_packet->fragments);
52717 if (differ) {
52718 BV_SET(fields, 1);
52719 }
52720
52721 differ = (old->turn != real_packet->turn);
52722 if (differ) {
52723 BV_SET(fields, 2);
52724 }
52725
52726
52727#ifdef FREECIV_JSON_CONNECTION
52728 field_addr.name = "fields";
52729#endif /* FREECIV_JSON_CONNECTION */
52730 DIO_BV_PUT(&dout, &field_addr, fields);
52731
52732 if (BV_ISSET(fields, 0)) {
52733 log_packet_detailed(" field 'year' has changed");
52734 #ifdef FREECIV_JSON_CONNECTION
52735 field_addr.name = "year";
52736#endif /* FREECIV_JSON_CONNECTION */
52737 DIO_PUT(sint32, &dout, &field_addr, real_packet->year);
52738 }
52739 if (BV_ISSET(fields, 1)) {
52740 log_packet_detailed(" field 'fragments' has changed");
52741 #ifdef FREECIV_JSON_CONNECTION
52742 field_addr.name = "fragments";
52743#endif /* FREECIV_JSON_CONNECTION */
52744 DIO_PUT(uint16, &dout, &field_addr, real_packet->fragments);
52745 }
52746 if (BV_ISSET(fields, 2)) {
52747 log_packet_detailed(" field 'turn' has changed");
52748 #ifdef FREECIV_JSON_CONNECTION
52749 field_addr.name = "turn";
52750#endif /* FREECIV_JSON_CONNECTION */
52751 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
52752 }
52753
52754 *old = *real_packet;
52755#endif /* FREECIV_DELTA_PROTOCOL */
52756#ifndef FREECIV_DELTA_PROTOCOL
52757#ifdef FREECIV_JSON_CONNECTION
52758 field_addr.name = "year";
52759#endif /* FREECIV_JSON_CONNECTION */
52760 DIO_PUT(sint32, &dout, &field_addr, real_packet->year);
52761#ifdef FREECIV_JSON_CONNECTION
52762 field_addr.name = "fragments";
52763#endif /* FREECIV_JSON_CONNECTION */
52764 DIO_PUT(uint16, &dout, &field_addr, real_packet->fragments);
52765#ifdef FREECIV_JSON_CONNECTION
52766 field_addr.name = "turn";
52767#endif /* FREECIV_JSON_CONNECTION */
52768 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
52769
52770#endif
52771 SEND_PACKET_END(PACKET_NEW_YEAR);
52772}
52773
52774 int send_packet_new_year(struct connection *pc, const struct packet_new_year *packet)
52775{
52776 if (!pc->used) {
52777 log_error("WARNING: trying to send data to the closed connection %s",
52778 conn_description(pc));
52779 return -1;
52780 }
52781 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_NEW_YEAR].packet != NULL, -1,
52782 "Handler for PACKET_NEW_YEAR not installed");
52783 return pc->phs.handlers->send[PACKET_NEW_YEAR].packet(pc, packet);
52784}
52785
52786 void lsend_packet_new_year(struct conn_list *dest, const struct packet_new_year *packet)
52787{
52788 conn_list_iterate(dest, pconn) {
52789 send_packet_new_year(pconn, packet);
52790 } conn_list_iterate_end;
52791}
52792
52793 static struct packet_begin_turn *receive_packet_begin_turn_100(struct connection *pc)
52794{
52795 RECEIVE_PACKET_START(packet_begin_turn, real_packet);
52796#if 1 /* To match endif */
52797 real_packet->__dummy = 0xff;
52798#endif
52799 log_packet_detailed("packet_begin_turn_100: got info about ()");
52800 RECEIVE_PACKET_END(real_packet);
52801}
52802
52803 static int send_packet_begin_turn_100(struct connection *pc)
52804{
52805 SEND_PACKET_START(PACKET_BEGIN_TURN);
52806
52807 log_packet_detailed("packet_begin_turn_100: sending info about ()");
52808 SEND_PACKET_END(PACKET_BEGIN_TURN);
52809}
52810
52811 int send_packet_begin_turn(struct connection *pc)
52812{
52813 if (!pc->used) {
52814 log_error("WARNING: trying to send data to the closed connection %s",
52815 conn_description(pc));
52816 return -1;
52817 }
52818 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_BEGIN_TURN].no_packet != NULL, -1,
52819 "Handler for PACKET_BEGIN_TURN not installed");
52820 return pc->phs.handlers->send[PACKET_BEGIN_TURN].no_packet(pc);
52821}
52822
52823 void lsend_packet_begin_turn(struct conn_list *dest)
52824{
52825 conn_list_iterate(dest, pconn) {
52826 send_packet_begin_turn(pconn);
52827 } conn_list_iterate_end;
52828}
52829
52830 static struct packet_end_turn *receive_packet_end_turn_100(struct connection *pc)
52831{
52832 RECEIVE_PACKET_START(packet_end_turn, real_packet);
52833#if 1 /* To match endif */
52834 real_packet->__dummy = 0xff;
52835#endif
52836 log_packet_detailed("packet_end_turn_100: got info about ()");
52837 RECEIVE_PACKET_END(real_packet);
52838}
52839
52840 static int send_packet_end_turn_100(struct connection *pc)
52841{
52842 SEND_PACKET_START(PACKET_END_TURN);
52843
52844 log_packet_detailed("packet_end_turn_100: sending info about ()");
52845 SEND_PACKET_END(PACKET_END_TURN);
52846}
52847
52848 int send_packet_end_turn(struct connection *pc)
52849{
52850 if (!pc->used) {
52851 log_error("WARNING: trying to send data to the closed connection %s",
52852 conn_description(pc));
52853 return -1;
52854 }
52855 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_END_TURN].no_packet != NULL, -1,
52856 "Handler for PACKET_END_TURN not installed");
52857 return pc->phs.handlers->send[PACKET_END_TURN].no_packet(pc);
52858}
52859
52860 void lsend_packet_end_turn(struct conn_list *dest)
52861{
52862 conn_list_iterate(dest, pconn) {
52863 send_packet_end_turn(pconn);
52864 } conn_list_iterate_end;
52865}
52866
52867 static struct packet_freeze_client *receive_packet_freeze_client_100(struct connection *pc)
52868{
52869 RECEIVE_PACKET_START(packet_freeze_client, real_packet);
52870#if 1 /* To match endif */
52871 real_packet->__dummy = 0xff;
52872#endif
52873 log_packet_detailed("packet_freeze_client_100: got info about ()");
52874 RECEIVE_PACKET_END(real_packet);
52875}
52876
52877 static int send_packet_freeze_client_100(struct connection *pc)
52878{
52879 SEND_PACKET_START(PACKET_FREEZE_CLIENT);
52880
52881 log_packet_detailed("packet_freeze_client_100: sending info about ()");
52882 SEND_PACKET_END(PACKET_FREEZE_CLIENT);
52883}
52884
52885 int send_packet_freeze_client(struct connection *pc)
52886{
52887 if (!pc->used) {
52888 log_error("WARNING: trying to send data to the closed connection %s",
52889 conn_description(pc));
52890 return -1;
52891 }
52892 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_FREEZE_CLIENT].no_packet != NULL, -1,
52893 "Handler for PACKET_FREEZE_CLIENT not installed");
52894 return pc->phs.handlers->send[PACKET_FREEZE_CLIENT].no_packet(pc);
52895}
52896
52897 void lsend_packet_freeze_client(struct conn_list *dest)
52898{
52899 conn_list_iterate(dest, pconn) {
52900 send_packet_freeze_client(pconn);
52901 } conn_list_iterate_end;
52902}
52903
52904 static struct packet_thaw_client *receive_packet_thaw_client_100(struct connection *pc)
52905{
52906 RECEIVE_PACKET_START(packet_thaw_client, real_packet);
52907#if 1 /* To match endif */
52908 real_packet->__dummy = 0xff;
52909#endif
52910 log_packet_detailed("packet_thaw_client_100: got info about ()");
52911 RECEIVE_PACKET_END(real_packet);
52912}
52913
52914 static int send_packet_thaw_client_100(struct connection *pc)
52915{
52916 SEND_PACKET_START(PACKET_THAW_CLIENT);
52917
52918 log_packet_detailed("packet_thaw_client_100: sending info about ()");
52919 SEND_PACKET_END(PACKET_THAW_CLIENT);
52920}
52921
52922 int send_packet_thaw_client(struct connection *pc)
52923{
52924 if (!pc->used) {
52925 log_error("WARNING: trying to send data to the closed connection %s",
52926 conn_description(pc));
52927 return -1;
52928 }
52929 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_THAW_CLIENT].no_packet != NULL, -1,
52930 "Handler for PACKET_THAW_CLIENT not installed");
52931 return pc->phs.handlers->send[PACKET_THAW_CLIENT].no_packet(pc);
52932}
52933
52934 void lsend_packet_thaw_client(struct conn_list *dest)
52935{
52936 conn_list_iterate(dest, pconn) {
52937 send_packet_thaw_client(pconn);
52938 } conn_list_iterate_end;
52939}
52940
52941 static struct packet_spaceship_launch *receive_packet_spaceship_launch_100(struct connection *pc)
52942{
52943 RECEIVE_PACKET_START(packet_spaceship_launch, real_packet);
52944#if 1 /* To match endif */
52945 real_packet->__dummy = 0xff;
52946#endif
52947 log_packet_detailed("packet_spaceship_launch_100: got info about ()");
52948 RECEIVE_PACKET_END(real_packet);
52949}
52950
52951 static int send_packet_spaceship_launch_100(struct connection *pc)
52952{
52953 SEND_PACKET_START(PACKET_SPACESHIP_LAUNCH);
52954
52955 log_packet_detailed("packet_spaceship_launch_100: sending info about ()");
52956 SEND_PACKET_END(PACKET_SPACESHIP_LAUNCH);
52957}
52958
52959 int send_packet_spaceship_launch(struct connection *pc)
52960{
52961 if (!pc->used) {
52962 log_error("WARNING: trying to send data to the closed connection %s",
52963 conn_description(pc));
52964 return -1;
52965 }
52966 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SPACESHIP_LAUNCH].no_packet != NULL, -1,
52967 "Handler for PACKET_SPACESHIP_LAUNCH not installed");
52968 return pc->phs.handlers->send[PACKET_SPACESHIP_LAUNCH].no_packet(pc);
52969}
52970
52971#ifdef FREECIV_DELTA_PROTOCOL
52972#define hash_packet_spaceship_place_100 hash_const
52973
52974#define cmp_packet_spaceship_place_100 cmp_const
52975
52976 BV_DEFINE(packet_spaceship_place_100_fields, 2);
52977#endif /* FREECIV_DELTA_PROTOCOL */
52978
52979 static struct packet_spaceship_place *receive_packet_spaceship_place_100(struct connection *pc)
52980{
52981#ifdef FREECIV_DELTA_PROTOCOL
52982 packet_spaceship_place_100_fields fields;
52983 struct packet_spaceship_place *old;
52984 struct genhash **hash = pc->phs.received + PACKET_SPACESHIP_PLACE;
52985#endif /* FREECIV_DELTA_PROTOCOL */
52986 RECEIVE_PACKET_START(packet_spaceship_place, real_packet);
52987#ifdef FREECIV_JSON_CONNECTION
52988 struct plocation field_addr;
52989 {
52990 struct plocation *field_addr_tmp = plocation_field_new(NULL);
52991 field_addr = *field_addr_tmp;
52992 FC_FREE(field_addr_tmp);
52993 }
52994#endif /* FREECIV_JSON_CONNECTION */
52995
52996#ifdef FREECIV_DELTA_PROTOCOL
52997#ifdef FREECIV_JSON_CONNECTION
52998 field_addr.name = "fields";
52999#endif /* FREECIV_JSON_CONNECTION */
53000 DIO_BV_GET(&din, &field_addr, fields);
53001
53002#else /* FREECIV_DELTA_PROTOCOL */
53003 #ifdef FREECIV_JSON_CONNECTION
53004 field_addr.name = "type";
53005 #endif /* FREECIV_JSON_CONNECTION */
53006 {
53007 int readin;
53008
53009 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
53010 RECEIVE_PACKET_FIELD_ERROR(type);
53011 }
53012 real_packet->type = readin;
53013 }
53014 #ifdef FREECIV_JSON_CONNECTION
53015 field_addr.name = "num";
53016 #endif /* FREECIV_JSON_CONNECTION */
53017 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num)) {
53018 RECEIVE_PACKET_FIELD_ERROR(num);
53019 }
53020
53021#endif
53022 log_packet_detailed("packet_spaceship_place_100: got info about ()");
53023
53024#ifdef FREECIV_DELTA_PROTOCOL
53025 if (NULL == *hash) {
53026 *hash = genhash_new_full(hash_packet_spaceship_place_100, cmp_packet_spaceship_place_100,
53027 NULL, NULL, NULL, free);
53028 }
53029
53030 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
53031 *real_packet = *old;
53032 } else {
53033 log_packet_detailed(" no old info");
53034 memset(real_packet, 0, sizeof(*real_packet));
53035 }
53036
53037 if (BV_ISSET(fields, 0)) {
53038 log_packet_detailed(" got field 'type'");
53039 #ifdef FREECIV_JSON_CONNECTION
53040 field_addr.name = "type";
53041 #endif /* FREECIV_JSON_CONNECTION */
53042 {
53043 int readin;
53044
53045 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
53046 RECEIVE_PACKET_FIELD_ERROR(type);
53047 }
53048 real_packet->type = readin;
53049 }
53050 }
53051 if (BV_ISSET(fields, 1)) {
53052 log_packet_detailed(" got field 'num'");
53053 #ifdef FREECIV_JSON_CONNECTION
53054 field_addr.name = "num";
53055 #endif /* FREECIV_JSON_CONNECTION */
53056 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num)) {
53057 RECEIVE_PACKET_FIELD_ERROR(num);
53058 }
53059 }
53060
53061 if (NULL == old) {
53062 old = fc_malloc(sizeof(*old));
53063 *old = *real_packet;
53064 genhash_insert(*hash, old, old);
53065 } else {
53066 *old = *real_packet;
53067 }
53068
53069#endif /* FREECIV_DELTA_PROTOCOL */
53070 RECEIVE_PACKET_END(real_packet);
53071}
53072
53073 static int send_packet_spaceship_place_100(struct connection *pc, const struct packet_spaceship_place *packet)
53074{
53075 const struct packet_spaceship_place *real_packet = packet;
53076#ifdef FREECIV_DELTA_PROTOCOL
53077 packet_spaceship_place_100_fields fields;
53078 struct packet_spaceship_place *old;
53079 bool differ;
53080 struct genhash **hash = pc->phs.sent + PACKET_SPACESHIP_PLACE;
53081#endif /* FREECIV_DELTA_PROTOCOL */
53082 SEND_PACKET_START(PACKET_SPACESHIP_PLACE);
53083#ifdef FREECIV_JSON_CONNECTION
53084 struct plocation field_addr;
53085 {
53086 struct plocation *field_addr_tmp = plocation_field_new(NULL);
53087 field_addr = *field_addr_tmp;
53088 FC_FREE(field_addr_tmp);
53089 }
53090#endif /* FREECIV_JSON_CONNECTION */
53091
53092 log_packet_detailed("packet_spaceship_place_100: sending info about ()");
53093
53094#ifdef FREECIV_DELTA_PROTOCOL
53095 if (NULL == *hash) {
53096 *hash = genhash_new_full(hash_packet_spaceship_place_100, cmp_packet_spaceship_place_100,
53097 NULL, NULL, NULL, free);
53098 }
53099 BV_CLR_ALL(fields);
53100
53101 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
53102 old = fc_malloc(sizeof(*old));
53103 *old = *real_packet;
53104 genhash_insert(*hash, old, old);
53105 memset(old, 0, sizeof(*old));
53106 }
53107 differ = (old->type != real_packet->type);
53108 if (differ) {
53109 BV_SET(fields, 0);
53110 }
53111
53112 differ = (old->num != real_packet->num);
53113 if (differ) {
53114 BV_SET(fields, 1);
53115 }
53116
53117
53118#ifdef FREECIV_JSON_CONNECTION
53119 field_addr.name = "fields";
53120#endif /* FREECIV_JSON_CONNECTION */
53121 DIO_BV_PUT(&dout, &field_addr, fields);
53122
53123 if (BV_ISSET(fields, 0)) {
53124 log_packet_detailed(" field 'type' has changed");
53125 #ifdef FREECIV_JSON_CONNECTION
53126 field_addr.name = "type";
53127#endif /* FREECIV_JSON_CONNECTION */
53128 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
53129 }
53130 if (BV_ISSET(fields, 1)) {
53131 log_packet_detailed(" field 'num' has changed");
53132 #ifdef FREECIV_JSON_CONNECTION
53133 field_addr.name = "num";
53134#endif /* FREECIV_JSON_CONNECTION */
53135 DIO_PUT(uint8, &dout, &field_addr, real_packet->num);
53136 }
53137
53138 *old = *real_packet;
53139#endif /* FREECIV_DELTA_PROTOCOL */
53140#ifndef FREECIV_DELTA_PROTOCOL
53141#ifdef FREECIV_JSON_CONNECTION
53142 field_addr.name = "type";
53143#endif /* FREECIV_JSON_CONNECTION */
53144 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
53145#ifdef FREECIV_JSON_CONNECTION
53146 field_addr.name = "num";
53147#endif /* FREECIV_JSON_CONNECTION */
53148 DIO_PUT(uint8, &dout, &field_addr, real_packet->num);
53149
53150#endif
53151 SEND_PACKET_END(PACKET_SPACESHIP_PLACE);
53152}
53153
53154 int send_packet_spaceship_place(struct connection *pc, const struct packet_spaceship_place *packet)
53155{
53156 if (!pc->used) {
53157 log_error("WARNING: trying to send data to the closed connection %s",
53158 conn_description(pc));
53159 return -1;
53160 }
53161 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SPACESHIP_PLACE].packet != NULL, -1,
53162 "Handler for PACKET_SPACESHIP_PLACE not installed");
53163 return pc->phs.handlers->send[PACKET_SPACESHIP_PLACE].packet(pc, packet);
53164}
53165
53166 int dsend_packet_spaceship_place(struct connection *pc, enum spaceship_place_type type, int num)
53167{
53168 struct packet_spaceship_place packet, *real_packet = &packet;
53169
53170 real_packet->type = type;
53171 real_packet->num = num;
53172
53173 return send_packet_spaceship_place(pc, real_packet);
53174}
53175
53176#ifdef FREECIV_DELTA_PROTOCOL
53177static genhash_val_t hash_packet_spaceship_info_100(const void *vkey)
53178{
53179 const struct packet_spaceship_info *key = (const struct packet_spaceship_info *) vkey;
53180
53181 return key->player_num;
53182}
53183
53184static bool cmp_packet_spaceship_info_100(const void *vkey1, const void *vkey2)
53185{
53186 const struct packet_spaceship_info *key1 = (const struct packet_spaceship_info *) vkey1;
53187 const struct packet_spaceship_info *key2 = (const struct packet_spaceship_info *) vkey2;
53188
53189 return key1->player_num == key2->player_num;
53190}
53191 BV_DEFINE(packet_spaceship_info_100_fields, 17);
53192#endif /* FREECIV_DELTA_PROTOCOL */
53193
53194 static struct packet_spaceship_info *receive_packet_spaceship_info_100(struct connection *pc)
53195{
53196#ifdef FREECIV_DELTA_PROTOCOL
53197 packet_spaceship_info_100_fields fields;
53198 struct packet_spaceship_info *old;
53199 struct genhash **hash = pc->phs.received + PACKET_SPACESHIP_INFO;
53200#endif /* FREECIV_DELTA_PROTOCOL */
53201 RECEIVE_PACKET_START(packet_spaceship_info, real_packet);
53202#ifdef FREECIV_JSON_CONNECTION
53203 struct plocation field_addr;
53204 {
53205 struct plocation *field_addr_tmp = plocation_field_new(NULL);
53206 field_addr = *field_addr_tmp;
53207 FC_FREE(field_addr_tmp);
53208 }
53209#endif /* FREECIV_JSON_CONNECTION */
53210
53211#ifdef FREECIV_DELTA_PROTOCOL
53212#ifdef FREECIV_JSON_CONNECTION
53213 field_addr.name = "fields";
53214#endif /* FREECIV_JSON_CONNECTION */
53215 DIO_BV_GET(&din, &field_addr, fields);
53216 #ifdef FREECIV_JSON_CONNECTION
53217 field_addr.name = "player_num";
53218 #endif /* FREECIV_JSON_CONNECTION */
53219 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_num)) {
53220 RECEIVE_PACKET_FIELD_ERROR(player_num);
53221 }
53222
53223#else /* FREECIV_DELTA_PROTOCOL */
53224 #ifdef FREECIV_JSON_CONNECTION
53225 field_addr.name = "player_num";
53226 #endif /* FREECIV_JSON_CONNECTION */
53227 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_num)) {
53228 RECEIVE_PACKET_FIELD_ERROR(player_num);
53229 }
53230 #ifdef FREECIV_JSON_CONNECTION
53231 field_addr.name = "sship_state";
53232 #endif /* FREECIV_JSON_CONNECTION */
53233 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sship_state)) {
53234 RECEIVE_PACKET_FIELD_ERROR(sship_state);
53235 }
53236 #ifdef FREECIV_JSON_CONNECTION
53237 field_addr.name = "structurals";
53238 #endif /* FREECIV_JSON_CONNECTION */
53239 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->structurals)) {
53240 RECEIVE_PACKET_FIELD_ERROR(structurals);
53241 }
53242 #ifdef FREECIV_JSON_CONNECTION
53243 field_addr.name = "components";
53244 #endif /* FREECIV_JSON_CONNECTION */
53245 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->components)) {
53246 RECEIVE_PACKET_FIELD_ERROR(components);
53247 }
53248 #ifdef FREECIV_JSON_CONNECTION
53249 field_addr.name = "modules";
53250 #endif /* FREECIV_JSON_CONNECTION */
53251 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->modules)) {
53252 RECEIVE_PACKET_FIELD_ERROR(modules);
53253 }
53254 #ifdef FREECIV_JSON_CONNECTION
53255 field_addr.name = "fuel";
53256 #endif /* FREECIV_JSON_CONNECTION */
53257 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
53258 RECEIVE_PACKET_FIELD_ERROR(fuel);
53259 }
53260 #ifdef FREECIV_JSON_CONNECTION
53261 field_addr.name = "propulsion";
53262 #endif /* FREECIV_JSON_CONNECTION */
53263 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->propulsion)) {
53264 RECEIVE_PACKET_FIELD_ERROR(propulsion);
53265 }
53266 #ifdef FREECIV_JSON_CONNECTION
53267 field_addr.name = "habitation";
53268 #endif /* FREECIV_JSON_CONNECTION */
53269 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->habitation)) {
53270 RECEIVE_PACKET_FIELD_ERROR(habitation);
53271 }
53272 #ifdef FREECIV_JSON_CONNECTION
53273 field_addr.name = "life_support";
53274 #endif /* FREECIV_JSON_CONNECTION */
53275 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->life_support)) {
53276 RECEIVE_PACKET_FIELD_ERROR(life_support);
53277 }
53278 #ifdef FREECIV_JSON_CONNECTION
53279 field_addr.name = "solar_panels";
53280 #endif /* FREECIV_JSON_CONNECTION */
53281 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->solar_panels)) {
53282 RECEIVE_PACKET_FIELD_ERROR(solar_panels);
53283 }
53284 #ifdef FREECIV_JSON_CONNECTION
53285 field_addr.name = "launch_year";
53286 #endif /* FREECIV_JSON_CONNECTION */
53287 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->launch_year)) {
53288 RECEIVE_PACKET_FIELD_ERROR(launch_year);
53289 }
53290 #ifdef FREECIV_JSON_CONNECTION
53291 field_addr.name = "population";
53292 #endif /* FREECIV_JSON_CONNECTION */
53293 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->population)) {
53294 RECEIVE_PACKET_FIELD_ERROR(population);
53295 }
53296 #ifdef FREECIV_JSON_CONNECTION
53297 field_addr.name = "mass";
53298 #endif /* FREECIV_JSON_CONNECTION */
53299 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->mass)) {
53300 RECEIVE_PACKET_FIELD_ERROR(mass);
53301 }
53302 #ifdef FREECIV_JSON_CONNECTION
53303 field_addr.name = "structure";
53304 #endif /* FREECIV_JSON_CONNECTION */
53305 if (!DIO_BV_GET(&din, &field_addr, real_packet->structure)) {
53306 RECEIVE_PACKET_FIELD_ERROR(structure);
53307 }
53308 #ifdef FREECIV_JSON_CONNECTION
53309 field_addr.name = "support_rate";
53310 #endif /* FREECIV_JSON_CONNECTION */
53311 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->support_rate, 10000)) {
53312 RECEIVE_PACKET_FIELD_ERROR(support_rate);
53313 }
53314 #ifdef FREECIV_JSON_CONNECTION
53315 field_addr.name = "energy_rate";
53316 #endif /* FREECIV_JSON_CONNECTION */
53317 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->energy_rate, 10000)) {
53318 RECEIVE_PACKET_FIELD_ERROR(energy_rate);
53319 }
53320 #ifdef FREECIV_JSON_CONNECTION
53321 field_addr.name = "success_rate";
53322 #endif /* FREECIV_JSON_CONNECTION */
53323 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->success_rate, 10000)) {
53324 RECEIVE_PACKET_FIELD_ERROR(success_rate);
53325 }
53326 #ifdef FREECIV_JSON_CONNECTION
53327 field_addr.name = "travel_time";
53328 #endif /* FREECIV_JSON_CONNECTION */
53329 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->travel_time, 10000)) {
53330 RECEIVE_PACKET_FIELD_ERROR(travel_time);
53331 }
53332
53333#endif
53334 log_packet_detailed("packet_spaceship_info_100: got info about (%d)",
53335 real_packet->player_num);
53336
53337#ifdef FREECIV_DELTA_PROTOCOL
53338 if (NULL == *hash) {
53339 *hash = genhash_new_full(hash_packet_spaceship_info_100, cmp_packet_spaceship_info_100,
53340 NULL, NULL, NULL, free);
53341 }
53342
53343 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
53344 *real_packet = *old;
53345 } else {
53346 int player_num = real_packet->player_num;
53347
53348 log_packet_detailed(" no old info");
53349 memset(real_packet, 0, sizeof(*real_packet));
53350
53351 real_packet->player_num = player_num;
53352 }
53353
53354 if (BV_ISSET(fields, 0)) {
53355 log_packet_detailed(" got field 'sship_state'");
53356 #ifdef FREECIV_JSON_CONNECTION
53357 field_addr.name = "sship_state";
53358 #endif /* FREECIV_JSON_CONNECTION */
53359 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sship_state)) {
53360 RECEIVE_PACKET_FIELD_ERROR(sship_state);
53361 }
53362 }
53363 if (BV_ISSET(fields, 1)) {
53364 log_packet_detailed(" got field 'structurals'");
53365 #ifdef FREECIV_JSON_CONNECTION
53366 field_addr.name = "structurals";
53367 #endif /* FREECIV_JSON_CONNECTION */
53368 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->structurals)) {
53369 RECEIVE_PACKET_FIELD_ERROR(structurals);
53370 }
53371 }
53372 if (BV_ISSET(fields, 2)) {
53373 log_packet_detailed(" got field 'components'");
53374 #ifdef FREECIV_JSON_CONNECTION
53375 field_addr.name = "components";
53376 #endif /* FREECIV_JSON_CONNECTION */
53377 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->components)) {
53378 RECEIVE_PACKET_FIELD_ERROR(components);
53379 }
53380 }
53381 if (BV_ISSET(fields, 3)) {
53382 log_packet_detailed(" got field 'modules'");
53383 #ifdef FREECIV_JSON_CONNECTION
53384 field_addr.name = "modules";
53385 #endif /* FREECIV_JSON_CONNECTION */
53386 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->modules)) {
53387 RECEIVE_PACKET_FIELD_ERROR(modules);
53388 }
53389 }
53390 if (BV_ISSET(fields, 4)) {
53391 log_packet_detailed(" got field 'fuel'");
53392 #ifdef FREECIV_JSON_CONNECTION
53393 field_addr.name = "fuel";
53394 #endif /* FREECIV_JSON_CONNECTION */
53395 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
53396 RECEIVE_PACKET_FIELD_ERROR(fuel);
53397 }
53398 }
53399 if (BV_ISSET(fields, 5)) {
53400 log_packet_detailed(" got field 'propulsion'");
53401 #ifdef FREECIV_JSON_CONNECTION
53402 field_addr.name = "propulsion";
53403 #endif /* FREECIV_JSON_CONNECTION */
53404 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->propulsion)) {
53405 RECEIVE_PACKET_FIELD_ERROR(propulsion);
53406 }
53407 }
53408 if (BV_ISSET(fields, 6)) {
53409 log_packet_detailed(" got field 'habitation'");
53410 #ifdef FREECIV_JSON_CONNECTION
53411 field_addr.name = "habitation";
53412 #endif /* FREECIV_JSON_CONNECTION */
53413 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->habitation)) {
53414 RECEIVE_PACKET_FIELD_ERROR(habitation);
53415 }
53416 }
53417 if (BV_ISSET(fields, 7)) {
53418 log_packet_detailed(" got field 'life_support'");
53419 #ifdef FREECIV_JSON_CONNECTION
53420 field_addr.name = "life_support";
53421 #endif /* FREECIV_JSON_CONNECTION */
53422 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->life_support)) {
53423 RECEIVE_PACKET_FIELD_ERROR(life_support);
53424 }
53425 }
53426 if (BV_ISSET(fields, 8)) {
53427 log_packet_detailed(" got field 'solar_panels'");
53428 #ifdef FREECIV_JSON_CONNECTION
53429 field_addr.name = "solar_panels";
53430 #endif /* FREECIV_JSON_CONNECTION */
53431 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->solar_panels)) {
53432 RECEIVE_PACKET_FIELD_ERROR(solar_panels);
53433 }
53434 }
53435 if (BV_ISSET(fields, 9)) {
53436 log_packet_detailed(" got field 'launch_year'");
53437 #ifdef FREECIV_JSON_CONNECTION
53438 field_addr.name = "launch_year";
53439 #endif /* FREECIV_JSON_CONNECTION */
53440 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->launch_year)) {
53441 RECEIVE_PACKET_FIELD_ERROR(launch_year);
53442 }
53443 }
53444 if (BV_ISSET(fields, 10)) {
53445 log_packet_detailed(" got field 'population'");
53446 #ifdef FREECIV_JSON_CONNECTION
53447 field_addr.name = "population";
53448 #endif /* FREECIV_JSON_CONNECTION */
53449 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->population)) {
53450 RECEIVE_PACKET_FIELD_ERROR(population);
53451 }
53452 }
53453 if (BV_ISSET(fields, 11)) {
53454 log_packet_detailed(" got field 'mass'");
53455 #ifdef FREECIV_JSON_CONNECTION
53456 field_addr.name = "mass";
53457 #endif /* FREECIV_JSON_CONNECTION */
53458 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->mass)) {
53459 RECEIVE_PACKET_FIELD_ERROR(mass);
53460 }
53461 }
53462 if (BV_ISSET(fields, 12)) {
53463 log_packet_detailed(" got field 'structure'");
53464 #ifdef FREECIV_JSON_CONNECTION
53465 field_addr.name = "structure";
53466 #endif /* FREECIV_JSON_CONNECTION */
53467 if (!DIO_BV_GET(&din, &field_addr, real_packet->structure)) {
53468 RECEIVE_PACKET_FIELD_ERROR(structure);
53469 }
53470 }
53471 if (BV_ISSET(fields, 13)) {
53472 log_packet_detailed(" got field 'support_rate'");
53473 #ifdef FREECIV_JSON_CONNECTION
53474 field_addr.name = "support_rate";
53475 #endif /* FREECIV_JSON_CONNECTION */
53476 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->support_rate, 10000)) {
53477 RECEIVE_PACKET_FIELD_ERROR(support_rate);
53478 }
53479 }
53480 if (BV_ISSET(fields, 14)) {
53481 log_packet_detailed(" got field 'energy_rate'");
53482 #ifdef FREECIV_JSON_CONNECTION
53483 field_addr.name = "energy_rate";
53484 #endif /* FREECIV_JSON_CONNECTION */
53485 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->energy_rate, 10000)) {
53486 RECEIVE_PACKET_FIELD_ERROR(energy_rate);
53487 }
53488 }
53489 if (BV_ISSET(fields, 15)) {
53490 log_packet_detailed(" got field 'success_rate'");
53491 #ifdef FREECIV_JSON_CONNECTION
53492 field_addr.name = "success_rate";
53493 #endif /* FREECIV_JSON_CONNECTION */
53494 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->success_rate, 10000)) {
53495 RECEIVE_PACKET_FIELD_ERROR(success_rate);
53496 }
53497 }
53498 if (BV_ISSET(fields, 16)) {
53499 log_packet_detailed(" got field 'travel_time'");
53500 #ifdef FREECIV_JSON_CONNECTION
53501 field_addr.name = "travel_time";
53502 #endif /* FREECIV_JSON_CONNECTION */
53503 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->travel_time, 10000)) {
53504 RECEIVE_PACKET_FIELD_ERROR(travel_time);
53505 }
53506 }
53507
53508 if (NULL == old) {
53509 old = fc_malloc(sizeof(*old));
53510 *old = *real_packet;
53511 genhash_insert(*hash, old, old);
53512 } else {
53513 *old = *real_packet;
53514 }
53515
53516#endif /* FREECIV_DELTA_PROTOCOL */
53517 RECEIVE_PACKET_END(real_packet);
53518}
53519
53520 static int send_packet_spaceship_info_100(struct connection *pc, const struct packet_spaceship_info *packet)
53521{
53522 const struct packet_spaceship_info *real_packet = packet;
53523#ifdef FREECIV_DELTA_PROTOCOL
53524 packet_spaceship_info_100_fields fields;
53525 struct packet_spaceship_info *old;
53526 bool differ;
53527 struct genhash **hash = pc->phs.sent + PACKET_SPACESHIP_INFO;
53528 int different = 0;
53529#endif /* FREECIV_DELTA_PROTOCOL */
53530 SEND_PACKET_START(PACKET_SPACESHIP_INFO);
53531#ifdef FREECIV_JSON_CONNECTION
53532 struct plocation field_addr;
53533 {
53534 struct plocation *field_addr_tmp = plocation_field_new(NULL);
53535 field_addr = *field_addr_tmp;
53536 FC_FREE(field_addr_tmp);
53537 }
53538#endif /* FREECIV_JSON_CONNECTION */
53539
53540 log_packet_detailed("packet_spaceship_info_100: sending info about (%d)",
53541 real_packet->player_num);
53542
53543#ifdef FREECIV_DELTA_PROTOCOL
53544 if (NULL == *hash) {
53545 *hash = genhash_new_full(hash_packet_spaceship_info_100, cmp_packet_spaceship_info_100,
53546 NULL, NULL, NULL, free);
53547 }
53548 BV_CLR_ALL(fields);
53549
53550 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
53551 old = fc_malloc(sizeof(*old));
53552 *old = *real_packet;
53553 genhash_insert(*hash, old, old);
53554 memset(old, 0, sizeof(*old));
53555 different = 1; /* Force to send. */
53556 }
53557 differ = (old->sship_state != real_packet->sship_state);
53558 if (differ) {
53559 different++;
53560 BV_SET(fields, 0);
53561 }
53562
53563 differ = (old->structurals != real_packet->structurals);
53564 if (differ) {
53565 different++;
53566 BV_SET(fields, 1);
53567 }
53568
53569 differ = (old->components != real_packet->components);
53570 if (differ) {
53571 different++;
53572 BV_SET(fields, 2);
53573 }
53574
53575 differ = (old->modules != real_packet->modules);
53576 if (differ) {
53577 different++;
53578 BV_SET(fields, 3);
53579 }
53580
53581 differ = (old->fuel != real_packet->fuel);
53582 if (differ) {
53583 different++;
53584 BV_SET(fields, 4);
53585 }
53586
53587 differ = (old->propulsion != real_packet->propulsion);
53588 if (differ) {
53589 different++;
53590 BV_SET(fields, 5);
53591 }
53592
53593 differ = (old->habitation != real_packet->habitation);
53594 if (differ) {
53595 different++;
53596 BV_SET(fields, 6);
53597 }
53598
53599 differ = (old->life_support != real_packet->life_support);
53600 if (differ) {
53601 different++;
53602 BV_SET(fields, 7);
53603 }
53604
53605 differ = (old->solar_panels != real_packet->solar_panels);
53606 if (differ) {
53607 different++;
53608 BV_SET(fields, 8);
53609 }
53610
53611 differ = (old->launch_year != real_packet->launch_year);
53612 if (differ) {
53613 different++;
53614 BV_SET(fields, 9);
53615 }
53616
53617 differ = (old->population != real_packet->population);
53618 if (differ) {
53619 different++;
53620 BV_SET(fields, 10);
53621 }
53622
53623 differ = (old->mass != real_packet->mass);
53624 if (differ) {
53625 different++;
53626 BV_SET(fields, 11);
53627 }
53628
53629 differ = !BV_ARE_EQUAL(old->structure, real_packet->structure);
53630 if (differ) {
53631 different++;
53632 BV_SET(fields, 12);
53633 }
53634
53635 differ = (old->support_rate != real_packet->support_rate);
53636 if (differ) {
53637 different++;
53638 BV_SET(fields, 13);
53639 }
53640
53641 differ = (old->energy_rate != real_packet->energy_rate);
53642 if (differ) {
53643 different++;
53644 BV_SET(fields, 14);
53645 }
53646
53647 differ = (old->success_rate != real_packet->success_rate);
53648 if (differ) {
53649 different++;
53650 BV_SET(fields, 15);
53651 }
53652
53653 differ = (old->travel_time != real_packet->travel_time);
53654 if (differ) {
53655 different++;
53656 BV_SET(fields, 16);
53657 }
53658
53659
53660 if (different == 0) {
53661 log_packet_detailed(" no change -> discard");
53662 return 0;
53663 }
53664
53665#ifdef FREECIV_JSON_CONNECTION
53666 field_addr.name = "fields";
53667#endif /* FREECIV_JSON_CONNECTION */
53668 DIO_BV_PUT(&dout, &field_addr, fields);
53669#ifdef FREECIV_JSON_CONNECTION
53670 field_addr.name = "player_num";
53671#endif /* FREECIV_JSON_CONNECTION */
53672 DIO_PUT(uint16, &dout, &field_addr, real_packet->player_num);
53673
53674 if (BV_ISSET(fields, 0)) {
53675 log_packet_detailed(" field 'sship_state' has changed");
53676 #ifdef FREECIV_JSON_CONNECTION
53677 field_addr.name = "sship_state";
53678#endif /* FREECIV_JSON_CONNECTION */
53679 DIO_PUT(uint8, &dout, &field_addr, real_packet->sship_state);
53680 }
53681 if (BV_ISSET(fields, 1)) {
53682 log_packet_detailed(" field 'structurals' has changed");
53683 #ifdef FREECIV_JSON_CONNECTION
53684 field_addr.name = "structurals";
53685#endif /* FREECIV_JSON_CONNECTION */
53686 DIO_PUT(uint8, &dout, &field_addr, real_packet->structurals);
53687 }
53688 if (BV_ISSET(fields, 2)) {
53689 log_packet_detailed(" field 'components' has changed");
53690 #ifdef FREECIV_JSON_CONNECTION
53691 field_addr.name = "components";
53692#endif /* FREECIV_JSON_CONNECTION */
53693 DIO_PUT(uint8, &dout, &field_addr, real_packet->components);
53694 }
53695 if (BV_ISSET(fields, 3)) {
53696 log_packet_detailed(" field 'modules' has changed");
53697 #ifdef FREECIV_JSON_CONNECTION
53698 field_addr.name = "modules";
53699#endif /* FREECIV_JSON_CONNECTION */
53700 DIO_PUT(uint8, &dout, &field_addr, real_packet->modules);
53701 }
53702 if (BV_ISSET(fields, 4)) {
53703 log_packet_detailed(" field 'fuel' has changed");
53704 #ifdef FREECIV_JSON_CONNECTION
53705 field_addr.name = "fuel";
53706#endif /* FREECIV_JSON_CONNECTION */
53707 DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
53708 }
53709 if (BV_ISSET(fields, 5)) {
53710 log_packet_detailed(" field 'propulsion' has changed");
53711 #ifdef FREECIV_JSON_CONNECTION
53712 field_addr.name = "propulsion";
53713#endif /* FREECIV_JSON_CONNECTION */
53714 DIO_PUT(uint8, &dout, &field_addr, real_packet->propulsion);
53715 }
53716 if (BV_ISSET(fields, 6)) {
53717 log_packet_detailed(" field 'habitation' has changed");
53718 #ifdef FREECIV_JSON_CONNECTION
53719 field_addr.name = "habitation";
53720#endif /* FREECIV_JSON_CONNECTION */
53721 DIO_PUT(uint8, &dout, &field_addr, real_packet->habitation);
53722 }
53723 if (BV_ISSET(fields, 7)) {
53724 log_packet_detailed(" field 'life_support' has changed");
53725 #ifdef FREECIV_JSON_CONNECTION
53726 field_addr.name = "life_support";
53727#endif /* FREECIV_JSON_CONNECTION */
53728 DIO_PUT(uint8, &dout, &field_addr, real_packet->life_support);
53729 }
53730 if (BV_ISSET(fields, 8)) {
53731 log_packet_detailed(" field 'solar_panels' has changed");
53732 #ifdef FREECIV_JSON_CONNECTION
53733 field_addr.name = "solar_panels";
53734#endif /* FREECIV_JSON_CONNECTION */
53735 DIO_PUT(uint8, &dout, &field_addr, real_packet->solar_panels);
53736 }
53737 if (BV_ISSET(fields, 9)) {
53738 log_packet_detailed(" field 'launch_year' has changed");
53739 #ifdef FREECIV_JSON_CONNECTION
53740 field_addr.name = "launch_year";
53741#endif /* FREECIV_JSON_CONNECTION */
53742 DIO_PUT(sint32, &dout, &field_addr, real_packet->launch_year);
53743 }
53744 if (BV_ISSET(fields, 10)) {
53745 log_packet_detailed(" field 'population' has changed");
53746 #ifdef FREECIV_JSON_CONNECTION
53747 field_addr.name = "population";
53748#endif /* FREECIV_JSON_CONNECTION */
53749 DIO_PUT(uint32, &dout, &field_addr, real_packet->population);
53750 }
53751 if (BV_ISSET(fields, 11)) {
53752 log_packet_detailed(" field 'mass' has changed");
53753 #ifdef FREECIV_JSON_CONNECTION
53754 field_addr.name = "mass";
53755#endif /* FREECIV_JSON_CONNECTION */
53756 DIO_PUT(uint32, &dout, &field_addr, real_packet->mass);
53757 }
53758 if (BV_ISSET(fields, 12)) {
53759 log_packet_detailed(" field 'structure' has changed");
53760 #ifdef FREECIV_JSON_CONNECTION
53761 field_addr.name = "structure";
53762#endif /* FREECIV_JSON_CONNECTION */
53763 DIO_BV_PUT(&dout, &field_addr, packet->structure);
53764 }
53765 if (BV_ISSET(fields, 13)) {
53766 log_packet_detailed(" field 'support_rate' has changed");
53767 #ifdef FREECIV_JSON_CONNECTION
53768 field_addr.name = "support_rate";
53769#endif /* FREECIV_JSON_CONNECTION */
53770 DIO_PUT(ufloat, &dout, &field_addr, real_packet->support_rate, 10000);
53771 }
53772 if (BV_ISSET(fields, 14)) {
53773 log_packet_detailed(" field 'energy_rate' has changed");
53774 #ifdef FREECIV_JSON_CONNECTION
53775 field_addr.name = "energy_rate";
53776#endif /* FREECIV_JSON_CONNECTION */
53777 DIO_PUT(ufloat, &dout, &field_addr, real_packet->energy_rate, 10000);
53778 }
53779 if (BV_ISSET(fields, 15)) {
53780 log_packet_detailed(" field 'success_rate' has changed");
53781 #ifdef FREECIV_JSON_CONNECTION
53782 field_addr.name = "success_rate";
53783#endif /* FREECIV_JSON_CONNECTION */
53784 DIO_PUT(ufloat, &dout, &field_addr, real_packet->success_rate, 10000);
53785 }
53786 if (BV_ISSET(fields, 16)) {
53787 log_packet_detailed(" field 'travel_time' has changed");
53788 #ifdef FREECIV_JSON_CONNECTION
53789 field_addr.name = "travel_time";
53790#endif /* FREECIV_JSON_CONNECTION */
53791 DIO_PUT(ufloat, &dout, &field_addr, real_packet->travel_time, 10000);
53792 }
53793
53794 *old = *real_packet;
53795#endif /* FREECIV_DELTA_PROTOCOL */
53796#ifndef FREECIV_DELTA_PROTOCOL
53797#ifdef FREECIV_JSON_CONNECTION
53798 field_addr.name = "player_num";
53799#endif /* FREECIV_JSON_CONNECTION */
53800 DIO_PUT(uint16, &dout, &field_addr, real_packet->player_num);
53801#ifdef FREECIV_JSON_CONNECTION
53802 field_addr.name = "sship_state";
53803#endif /* FREECIV_JSON_CONNECTION */
53804 DIO_PUT(uint8, &dout, &field_addr, real_packet->sship_state);
53805#ifdef FREECIV_JSON_CONNECTION
53806 field_addr.name = "structurals";
53807#endif /* FREECIV_JSON_CONNECTION */
53808 DIO_PUT(uint8, &dout, &field_addr, real_packet->structurals);
53809#ifdef FREECIV_JSON_CONNECTION
53810 field_addr.name = "components";
53811#endif /* FREECIV_JSON_CONNECTION */
53812 DIO_PUT(uint8, &dout, &field_addr, real_packet->components);
53813#ifdef FREECIV_JSON_CONNECTION
53814 field_addr.name = "modules";
53815#endif /* FREECIV_JSON_CONNECTION */
53816 DIO_PUT(uint8, &dout, &field_addr, real_packet->modules);
53817#ifdef FREECIV_JSON_CONNECTION
53818 field_addr.name = "fuel";
53819#endif /* FREECIV_JSON_CONNECTION */
53820 DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
53821#ifdef FREECIV_JSON_CONNECTION
53822 field_addr.name = "propulsion";
53823#endif /* FREECIV_JSON_CONNECTION */
53824 DIO_PUT(uint8, &dout, &field_addr, real_packet->propulsion);
53825#ifdef FREECIV_JSON_CONNECTION
53826 field_addr.name = "habitation";
53827#endif /* FREECIV_JSON_CONNECTION */
53828 DIO_PUT(uint8, &dout, &field_addr, real_packet->habitation);
53829#ifdef FREECIV_JSON_CONNECTION
53830 field_addr.name = "life_support";
53831#endif /* FREECIV_JSON_CONNECTION */
53832 DIO_PUT(uint8, &dout, &field_addr, real_packet->life_support);
53833#ifdef FREECIV_JSON_CONNECTION
53834 field_addr.name = "solar_panels";
53835#endif /* FREECIV_JSON_CONNECTION */
53836 DIO_PUT(uint8, &dout, &field_addr, real_packet->solar_panels);
53837#ifdef FREECIV_JSON_CONNECTION
53838 field_addr.name = "launch_year";
53839#endif /* FREECIV_JSON_CONNECTION */
53840 DIO_PUT(sint32, &dout, &field_addr, real_packet->launch_year);
53841#ifdef FREECIV_JSON_CONNECTION
53842 field_addr.name = "population";
53843#endif /* FREECIV_JSON_CONNECTION */
53844 DIO_PUT(uint32, &dout, &field_addr, real_packet->population);
53845#ifdef FREECIV_JSON_CONNECTION
53846 field_addr.name = "mass";
53847#endif /* FREECIV_JSON_CONNECTION */
53848 DIO_PUT(uint32, &dout, &field_addr, real_packet->mass);
53849#ifdef FREECIV_JSON_CONNECTION
53850 field_addr.name = "structure";
53851#endif /* FREECIV_JSON_CONNECTION */
53852 DIO_BV_PUT(&dout, &field_addr, packet->structure);
53853#ifdef FREECIV_JSON_CONNECTION
53854 field_addr.name = "support_rate";
53855#endif /* FREECIV_JSON_CONNECTION */
53856 DIO_PUT(ufloat, &dout, &field_addr, real_packet->support_rate, 10000);
53857#ifdef FREECIV_JSON_CONNECTION
53858 field_addr.name = "energy_rate";
53859#endif /* FREECIV_JSON_CONNECTION */
53860 DIO_PUT(ufloat, &dout, &field_addr, real_packet->energy_rate, 10000);
53861#ifdef FREECIV_JSON_CONNECTION
53862 field_addr.name = "success_rate";
53863#endif /* FREECIV_JSON_CONNECTION */
53864 DIO_PUT(ufloat, &dout, &field_addr, real_packet->success_rate, 10000);
53865#ifdef FREECIV_JSON_CONNECTION
53866 field_addr.name = "travel_time";
53867#endif /* FREECIV_JSON_CONNECTION */
53868 DIO_PUT(ufloat, &dout, &field_addr, real_packet->travel_time, 10000);
53869
53870#endif
53871 SEND_PACKET_END(PACKET_SPACESHIP_INFO);
53872}
53873
53874 int send_packet_spaceship_info(struct connection *pc, const struct packet_spaceship_info *packet)
53875{
53876 if (!pc->used) {
53877 log_error("WARNING: trying to send data to the closed connection %s",
53878 conn_description(pc));
53879 return -1;
53880 }
53881 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SPACESHIP_INFO].packet != NULL, -1,
53882 "Handler for PACKET_SPACESHIP_INFO not installed");
53883 return pc->phs.handlers->send[PACKET_SPACESHIP_INFO].packet(pc, packet);
53884}
53885
53886 void lsend_packet_spaceship_info(struct conn_list *dest, const struct packet_spaceship_info *packet)
53887{
53888 conn_list_iterate(dest, pconn) {
53889 send_packet_spaceship_info(pconn, packet);
53890 } conn_list_iterate_end;
53891}
53892
53893#ifdef FREECIV_DELTA_PROTOCOL
53894#define hash_packet_ruleset_unit_100 hash_const
53895
53896#define cmp_packet_ruleset_unit_100 cmp_const
53897
53898 BV_DEFINE(packet_ruleset_unit_100_fields, 48);
53899#endif /* FREECIV_DELTA_PROTOCOL */
53900
53901 static struct packet_ruleset_unit *receive_packet_ruleset_unit_100(struct connection *pc)
53902{
53903#ifdef FREECIV_DELTA_PROTOCOL
53904 packet_ruleset_unit_100_fields fields;
53905 struct packet_ruleset_unit *old;
53906 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT;
53907#endif /* FREECIV_DELTA_PROTOCOL */
53908 RECEIVE_PACKET_START(packet_ruleset_unit, real_packet);
53909#ifdef FREECIV_JSON_CONNECTION
53910 struct plocation field_addr;
53911 {
53912 struct plocation *field_addr_tmp = plocation_field_new(NULL);
53913 field_addr = *field_addr_tmp;
53914 FC_FREE(field_addr_tmp);
53915 }
53916#endif /* FREECIV_JSON_CONNECTION */
53917
53918#ifdef FREECIV_DELTA_PROTOCOL
53919#ifdef FREECIV_JSON_CONNECTION
53920 field_addr.name = "fields";
53921#endif /* FREECIV_JSON_CONNECTION */
53922 DIO_BV_GET(&din, &field_addr, fields);
53923
53924#else /* FREECIV_DELTA_PROTOCOL */
53925 #ifdef FREECIV_JSON_CONNECTION
53926 field_addr.name = "id";
53927 #endif /* FREECIV_JSON_CONNECTION */
53928 {
53929 int readin;
53930
53931 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
53932 RECEIVE_PACKET_FIELD_ERROR(id);
53933 }
53934 real_packet->id = readin;
53935 }
53936 #ifdef FREECIV_JSON_CONNECTION
53937 field_addr.name = "name";
53938 #endif /* FREECIV_JSON_CONNECTION */
53939 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
53940 RECEIVE_PACKET_FIELD_ERROR(name);
53941 }
53942 #ifdef FREECIV_JSON_CONNECTION
53943 field_addr.name = "rule_name";
53944 #endif /* FREECIV_JSON_CONNECTION */
53945 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
53946 RECEIVE_PACKET_FIELD_ERROR(rule_name);
53947 }
53948 #ifdef FREECIV_JSON_CONNECTION
53949 field_addr.name = "graphic_str";
53950 #endif /* FREECIV_JSON_CONNECTION */
53951 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
53952 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
53953 }
53954 #ifdef FREECIV_JSON_CONNECTION
53955 field_addr.name = "graphic_alt";
53956 #endif /* FREECIV_JSON_CONNECTION */
53957 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
53958 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
53959 }
53960 #ifdef FREECIV_JSON_CONNECTION
53961 field_addr.name = "sound_move";
53962 #endif /* FREECIV_JSON_CONNECTION */
53963 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_move, sizeof(real_packet->sound_move))) {
53964 RECEIVE_PACKET_FIELD_ERROR(sound_move);
53965 }
53966 #ifdef FREECIV_JSON_CONNECTION
53967 field_addr.name = "sound_move_alt";
53968 #endif /* FREECIV_JSON_CONNECTION */
53969 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_move_alt, sizeof(real_packet->sound_move_alt))) {
53970 RECEIVE_PACKET_FIELD_ERROR(sound_move_alt);
53971 }
53972 #ifdef FREECIV_JSON_CONNECTION
53973 field_addr.name = "sound_fight";
53974 #endif /* FREECIV_JSON_CONNECTION */
53975 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_fight, sizeof(real_packet->sound_fight))) {
53976 RECEIVE_PACKET_FIELD_ERROR(sound_fight);
53977 }
53978 #ifdef FREECIV_JSON_CONNECTION
53979 field_addr.name = "sound_fight_alt";
53980 #endif /* FREECIV_JSON_CONNECTION */
53981 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_fight_alt, sizeof(real_packet->sound_fight_alt))) {
53982 RECEIVE_PACKET_FIELD_ERROR(sound_fight_alt);
53983 }
53984 #ifdef FREECIV_JSON_CONNECTION
53985 field_addr.name = "unit_class_id";
53986 #endif /* FREECIV_JSON_CONNECTION */
53987 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->unit_class_id)) {
53988 RECEIVE_PACKET_FIELD_ERROR(unit_class_id);
53989 }
53990 #ifdef FREECIV_JSON_CONNECTION
53991 field_addr.name = "build_cost";
53992 #endif /* FREECIV_JSON_CONNECTION */
53993 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->build_cost)) {
53994 RECEIVE_PACKET_FIELD_ERROR(build_cost);
53995 }
53996 #ifdef FREECIV_JSON_CONNECTION
53997 field_addr.name = "pop_cost";
53998 #endif /* FREECIV_JSON_CONNECTION */
53999 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pop_cost)) {
54000 RECEIVE_PACKET_FIELD_ERROR(pop_cost);
54001 }
54002 #ifdef FREECIV_JSON_CONNECTION
54003 field_addr.name = "attack_strength";
54004 #endif /* FREECIV_JSON_CONNECTION */
54005 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->attack_strength)) {
54006 RECEIVE_PACKET_FIELD_ERROR(attack_strength);
54007 }
54008 #ifdef FREECIV_JSON_CONNECTION
54009 field_addr.name = "defense_strength";
54010 #endif /* FREECIV_JSON_CONNECTION */
54011 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defense_strength)) {
54012 RECEIVE_PACKET_FIELD_ERROR(defense_strength);
54013 }
54014 #ifdef FREECIV_JSON_CONNECTION
54015 field_addr.name = "move_rate";
54016 #endif /* FREECIV_JSON_CONNECTION */
54017 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_rate)) {
54018 RECEIVE_PACKET_FIELD_ERROR(move_rate);
54019 }
54020 #ifdef FREECIV_JSON_CONNECTION
54021 field_addr.name = "tech_requirement";
54022 #endif /* FREECIV_JSON_CONNECTION */
54023 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tech_requirement)) {
54024 RECEIVE_PACKET_FIELD_ERROR(tech_requirement);
54025 }
54026 #ifdef FREECIV_JSON_CONNECTION
54027 field_addr.name = "build_reqs_count";
54028 #endif /* FREECIV_JSON_CONNECTION */
54029 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_reqs_count)) {
54030 RECEIVE_PACKET_FIELD_ERROR(build_reqs_count);
54031 }
54032 #ifdef FREECIV_JSON_CONNECTION
54033 field_addr.name = "build_reqs";
54034 #endif /* FREECIV_JSON_CONNECTION */
54035
54036 {
54037 int i;
54038
54039 #ifdef FREECIV_JSON_CONNECTION
54040 /* Enter array. */
54041 field_addr.sub_location = plocation_elem_new(0);
54042 #endif /* FREECIV_JSON_CONNECTION */
54043
54044 if (real_packet->build_reqs_count > MAX_NUM_REQS) {
54045 RECEIVE_PACKET_FIELD_ERROR(build_reqs, ": truncation array");
54046 }
54047 for (i = 0; i < real_packet->build_reqs_count; i++) {
54048 #ifdef FREECIV_JSON_CONNECTION
54049 field_addr.sub_location->number = i;
54050 #endif /* FREECIV_JSON_CONNECTION */
54051 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->build_reqs[i])) {
54052 RECEIVE_PACKET_FIELD_ERROR(build_reqs);
54053 }
54054 }
54055
54056 #ifdef FREECIV_JSON_CONNECTION
54057 /* Exit array. */
54058 free(field_addr.sub_location);
54059 field_addr.sub_location = NULL;
54060 #endif /* FREECIV_JSON_CONNECTION */
54061 }
54062 #ifdef FREECIV_JSON_CONNECTION
54063 field_addr.name = "vision_radius_sq";
54064 #endif /* FREECIV_JSON_CONNECTION */
54065 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->vision_radius_sq)) {
54066 RECEIVE_PACKET_FIELD_ERROR(vision_radius_sq);
54067 }
54068 #ifdef FREECIV_JSON_CONNECTION
54069 field_addr.name = "transport_capacity";
54070 #endif /* FREECIV_JSON_CONNECTION */
54071 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->transport_capacity)) {
54072 RECEIVE_PACKET_FIELD_ERROR(transport_capacity);
54073 }
54074 #ifdef FREECIV_JSON_CONNECTION
54075 field_addr.name = "hp";
54076 #endif /* FREECIV_JSON_CONNECTION */
54077 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
54078 RECEIVE_PACKET_FIELD_ERROR(hp);
54079 }
54080 #ifdef FREECIV_JSON_CONNECTION
54081 field_addr.name = "firepower";
54082 #endif /* FREECIV_JSON_CONNECTION */
54083 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->firepower)) {
54084 RECEIVE_PACKET_FIELD_ERROR(firepower);
54085 }
54086 #ifdef FREECIV_JSON_CONNECTION
54087 field_addr.name = "obsoleted_by";
54088 #endif /* FREECIV_JSON_CONNECTION */
54089 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->obsoleted_by)) {
54090 RECEIVE_PACKET_FIELD_ERROR(obsoleted_by);
54091 }
54092 #ifdef FREECIV_JSON_CONNECTION
54093 field_addr.name = "converted_to";
54094 #endif /* FREECIV_JSON_CONNECTION */
54095 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->converted_to)) {
54096 RECEIVE_PACKET_FIELD_ERROR(converted_to);
54097 }
54098 #ifdef FREECIV_JSON_CONNECTION
54099 field_addr.name = "convert_time";
54100 #endif /* FREECIV_JSON_CONNECTION */
54101 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->convert_time)) {
54102 RECEIVE_PACKET_FIELD_ERROR(convert_time);
54103 }
54104 #ifdef FREECIV_JSON_CONNECTION
54105 field_addr.name = "fuel";
54106 #endif /* FREECIV_JSON_CONNECTION */
54107 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
54108 RECEIVE_PACKET_FIELD_ERROR(fuel);
54109 }
54110 #ifdef FREECIV_JSON_CONNECTION
54111 field_addr.name = "happy_cost";
54112 #endif /* FREECIV_JSON_CONNECTION */
54113 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->happy_cost)) {
54114 RECEIVE_PACKET_FIELD_ERROR(happy_cost);
54115 }
54116 #ifdef FREECIV_JSON_CONNECTION
54117 field_addr.name = "upkeep";
54118 #endif /* FREECIV_JSON_CONNECTION */
54119
54120 {
54121 int i;
54122
54123 #ifdef FREECIV_JSON_CONNECTION
54124 /* Enter array. */
54125 field_addr.sub_location = plocation_elem_new(0);
54126 #endif /* FREECIV_JSON_CONNECTION */
54127
54128 for (i = 0; i < O_LAST; i++) {
54129 #ifdef FREECIV_JSON_CONNECTION
54130 field_addr.sub_location->number = i;
54131 #endif /* FREECIV_JSON_CONNECTION */
54132 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep[i])) {
54133 RECEIVE_PACKET_FIELD_ERROR(upkeep);
54134 }
54135 }
54136
54137 #ifdef FREECIV_JSON_CONNECTION
54138 /* Exit array. */
54139 free(field_addr.sub_location);
54140 field_addr.sub_location = NULL;
54141 #endif /* FREECIV_JSON_CONNECTION */
54142 }
54143 #ifdef FREECIV_JSON_CONNECTION
54144 field_addr.name = "paratroopers_range";
54145 #endif /* FREECIV_JSON_CONNECTION */
54146 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->paratroopers_range)) {
54147 RECEIVE_PACKET_FIELD_ERROR(paratroopers_range);
54148 }
54149 #ifdef FREECIV_JSON_CONNECTION
54150 field_addr.name = "veteran_levels";
54151 #endif /* FREECIV_JSON_CONNECTION */
54152 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran_levels)) {
54153 RECEIVE_PACKET_FIELD_ERROR(veteran_levels);
54154 }
54155 #ifdef FREECIV_JSON_CONNECTION
54156 field_addr.name = "veteran_name";
54157 #endif /* FREECIV_JSON_CONNECTION */
54158
54159 {
54160 int i;
54161
54162 #ifdef FREECIV_JSON_CONNECTION
54163 /* Enter array. */
54164 field_addr.sub_location = plocation_elem_new(0);
54165 #endif /* FREECIV_JSON_CONNECTION */
54166
54167 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
54168 RECEIVE_PACKET_FIELD_ERROR(veteran_name, ": truncation array");
54169 }
54170 for (i = 0; i < real_packet->veteran_levels; i++) {
54171 #ifdef FREECIV_JSON_CONNECTION
54172 field_addr.sub_location->number = i;
54173 #endif /* FREECIV_JSON_CONNECTION */
54174 if (!DIO_GET(string, &din, &field_addr, real_packet->veteran_name[i], sizeof(real_packet->veteran_name[i]))) {
54175 RECEIVE_PACKET_FIELD_ERROR(veteran_name);
54176 }
54177 }
54178
54179 #ifdef FREECIV_JSON_CONNECTION
54180 /* Exit array. */
54181 free(field_addr.sub_location);
54182 field_addr.sub_location = NULL;
54183 #endif /* FREECIV_JSON_CONNECTION */
54184 }
54185 #ifdef FREECIV_JSON_CONNECTION
54186 field_addr.name = "power_fact";
54187 #endif /* FREECIV_JSON_CONNECTION */
54188
54189 {
54190 int i;
54191
54192 #ifdef FREECIV_JSON_CONNECTION
54193 /* Enter array. */
54194 field_addr.sub_location = plocation_elem_new(0);
54195 #endif /* FREECIV_JSON_CONNECTION */
54196
54197 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
54198 RECEIVE_PACKET_FIELD_ERROR(power_fact, ": truncation array");
54199 }
54200 for (i = 0; i < real_packet->veteran_levels; i++) {
54201 #ifdef FREECIV_JSON_CONNECTION
54202 field_addr.sub_location->number = i;
54203 #endif /* FREECIV_JSON_CONNECTION */
54204 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->power_fact[i])) {
54205 RECEIVE_PACKET_FIELD_ERROR(power_fact);
54206 }
54207 }
54208
54209 #ifdef FREECIV_JSON_CONNECTION
54210 /* Exit array. */
54211 free(field_addr.sub_location);
54212 field_addr.sub_location = NULL;
54213 #endif /* FREECIV_JSON_CONNECTION */
54214 }
54215 #ifdef FREECIV_JSON_CONNECTION
54216 field_addr.name = "move_bonus";
54217 #endif /* FREECIV_JSON_CONNECTION */
54218
54219 {
54220 int i;
54221
54222 #ifdef FREECIV_JSON_CONNECTION
54223 /* Enter array. */
54224 field_addr.sub_location = plocation_elem_new(0);
54225 #endif /* FREECIV_JSON_CONNECTION */
54226
54227 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
54228 RECEIVE_PACKET_FIELD_ERROR(move_bonus, ": truncation array");
54229 }
54230 for (i = 0; i < real_packet->veteran_levels; i++) {
54231 #ifdef FREECIV_JSON_CONNECTION
54232 field_addr.sub_location->number = i;
54233 #endif /* FREECIV_JSON_CONNECTION */
54234 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_bonus[i])) {
54235 RECEIVE_PACKET_FIELD_ERROR(move_bonus);
54236 }
54237 }
54238
54239 #ifdef FREECIV_JSON_CONNECTION
54240 /* Exit array. */
54241 free(field_addr.sub_location);
54242 field_addr.sub_location = NULL;
54243 #endif /* FREECIV_JSON_CONNECTION */
54244 }
54245 #ifdef FREECIV_JSON_CONNECTION
54246 field_addr.name = "base_raise_chance";
54247 #endif /* FREECIV_JSON_CONNECTION */
54248
54249 {
54250 int i;
54251
54252 #ifdef FREECIV_JSON_CONNECTION
54253 /* Enter array. */
54254 field_addr.sub_location = plocation_elem_new(0);
54255 #endif /* FREECIV_JSON_CONNECTION */
54256
54257 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
54258 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance, ": truncation array");
54259 }
54260 for (i = 0; i < real_packet->veteran_levels; i++) {
54261 #ifdef FREECIV_JSON_CONNECTION
54262 field_addr.sub_location->number = i;
54263 #endif /* FREECIV_JSON_CONNECTION */
54264 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_raise_chance[i])) {
54265 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance);
54266 }
54267 }
54268
54269 #ifdef FREECIV_JSON_CONNECTION
54270 /* Exit array. */
54271 free(field_addr.sub_location);
54272 field_addr.sub_location = NULL;
54273 #endif /* FREECIV_JSON_CONNECTION */
54274 }
54275 #ifdef FREECIV_JSON_CONNECTION
54276 field_addr.name = "work_raise_chance";
54277 #endif /* FREECIV_JSON_CONNECTION */
54278
54279 {
54280 int i;
54281
54282 #ifdef FREECIV_JSON_CONNECTION
54283 /* Enter array. */
54284 field_addr.sub_location = plocation_elem_new(0);
54285 #endif /* FREECIV_JSON_CONNECTION */
54286
54287 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
54288 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance, ": truncation array");
54289 }
54290 for (i = 0; i < real_packet->veteran_levels; i++) {
54291 #ifdef FREECIV_JSON_CONNECTION
54292 field_addr.sub_location->number = i;
54293 #endif /* FREECIV_JSON_CONNECTION */
54294 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->work_raise_chance[i])) {
54295 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance);
54296 }
54297 }
54298
54299 #ifdef FREECIV_JSON_CONNECTION
54300 /* Exit array. */
54301 free(field_addr.sub_location);
54302 field_addr.sub_location = NULL;
54303 #endif /* FREECIV_JSON_CONNECTION */
54304 }
54305 #ifdef FREECIV_JSON_CONNECTION
54306 field_addr.name = "bombard_rate";
54307 #endif /* FREECIV_JSON_CONNECTION */
54308 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->bombard_rate)) {
54309 RECEIVE_PACKET_FIELD_ERROR(bombard_rate);
54310 }
54311 #ifdef FREECIV_JSON_CONNECTION
54312 field_addr.name = "city_size";
54313 #endif /* FREECIV_JSON_CONNECTION */
54314 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_size)) {
54315 RECEIVE_PACKET_FIELD_ERROR(city_size);
54316 }
54317 #ifdef FREECIV_JSON_CONNECTION
54318 field_addr.name = "city_slots";
54319 #endif /* FREECIV_JSON_CONNECTION */
54320 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_slots)) {
54321 RECEIVE_PACKET_FIELD_ERROR(city_slots);
54322 }
54323 #ifdef FREECIV_JSON_CONNECTION
54324 field_addr.name = "tp_defense";
54325 #endif /* FREECIV_JSON_CONNECTION */
54326 {
54327 int readin;
54328
54329 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
54330 RECEIVE_PACKET_FIELD_ERROR(tp_defense);
54331 }
54332 real_packet->tp_defense = readin;
54333 }
54334 #ifdef FREECIV_JSON_CONNECTION
54335 field_addr.name = "cargo";
54336 #endif /* FREECIV_JSON_CONNECTION */
54337 if (!DIO_BV_GET(&din, &field_addr, real_packet->cargo)) {
54338 RECEIVE_PACKET_FIELD_ERROR(cargo);
54339 }
54340 #ifdef FREECIV_JSON_CONNECTION
54341 field_addr.name = "targets";
54342 #endif /* FREECIV_JSON_CONNECTION */
54343 if (!DIO_BV_GET(&din, &field_addr, real_packet->targets)) {
54344 RECEIVE_PACKET_FIELD_ERROR(targets);
54345 }
54346 #ifdef FREECIV_JSON_CONNECTION
54347 field_addr.name = "embarks";
54348 #endif /* FREECIV_JSON_CONNECTION */
54349 if (!DIO_BV_GET(&din, &field_addr, real_packet->embarks)) {
54350 RECEIVE_PACKET_FIELD_ERROR(embarks);
54351 }
54352 #ifdef FREECIV_JSON_CONNECTION
54353 field_addr.name = "disembarks";
54354 #endif /* FREECIV_JSON_CONNECTION */
54355 if (!DIO_BV_GET(&din, &field_addr, real_packet->disembarks)) {
54356 RECEIVE_PACKET_FIELD_ERROR(disembarks);
54357 }
54358 #ifdef FREECIV_JSON_CONNECTION
54359 field_addr.name = "vlayer";
54360 #endif /* FREECIV_JSON_CONNECTION */
54361 {
54362 int readin;
54363
54364 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
54365 RECEIVE_PACKET_FIELD_ERROR(vlayer);
54366 }
54367 real_packet->vlayer = readin;
54368 }
54369 #ifdef FREECIV_JSON_CONNECTION
54370 field_addr.name = "helptext";
54371 #endif /* FREECIV_JSON_CONNECTION */
54372 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
54373 RECEIVE_PACKET_FIELD_ERROR(helptext);
54374 }
54375 #ifdef FREECIV_JSON_CONNECTION
54376 field_addr.name = "flags";
54377 #endif /* FREECIV_JSON_CONNECTION */
54378 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
54379 RECEIVE_PACKET_FIELD_ERROR(flags);
54380 }
54381 #ifdef FREECIV_JSON_CONNECTION
54382 field_addr.name = "roles";
54383 #endif /* FREECIV_JSON_CONNECTION */
54384 if (!DIO_BV_GET(&din, &field_addr, real_packet->roles)) {
54385 RECEIVE_PACKET_FIELD_ERROR(roles);
54386 }
54387 #ifdef FREECIV_JSON_CONNECTION
54388 field_addr.name = "worker";
54389 #endif /* FREECIV_JSON_CONNECTION */
54390 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->worker)) {
54391 RECEIVE_PACKET_FIELD_ERROR(worker);
54392 }
54393
54394#endif
54395 log_packet_detailed("packet_ruleset_unit_100: got info about ()");
54396
54397#ifdef FREECIV_DELTA_PROTOCOL
54398 if (NULL == *hash) {
54399 *hash = genhash_new_full(hash_packet_ruleset_unit_100, cmp_packet_ruleset_unit_100,
54400 NULL, NULL, NULL, free);
54401 }
54402
54403 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
54404 *real_packet = *old;
54405 } else {
54406 log_packet_detailed(" no old info");
54407 memset(real_packet, 0, sizeof(*real_packet));
54408 }
54409
54410 if (BV_ISSET(fields, 0)) {
54411 log_packet_detailed(" got field 'id'");
54412 #ifdef FREECIV_JSON_CONNECTION
54413 field_addr.name = "id";
54414 #endif /* FREECIV_JSON_CONNECTION */
54415 {
54416 int readin;
54417
54418 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
54419 RECEIVE_PACKET_FIELD_ERROR(id);
54420 }
54421 real_packet->id = readin;
54422 }
54423 }
54424 if (BV_ISSET(fields, 1)) {
54425 log_packet_detailed(" got field 'name'");
54426 #ifdef FREECIV_JSON_CONNECTION
54427 field_addr.name = "name";
54428 #endif /* FREECIV_JSON_CONNECTION */
54429 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
54430 RECEIVE_PACKET_FIELD_ERROR(name);
54431 }
54432 }
54433 if (BV_ISSET(fields, 2)) {
54434 log_packet_detailed(" got field 'rule_name'");
54435 #ifdef FREECIV_JSON_CONNECTION
54436 field_addr.name = "rule_name";
54437 #endif /* FREECIV_JSON_CONNECTION */
54438 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
54439 RECEIVE_PACKET_FIELD_ERROR(rule_name);
54440 }
54441 }
54442 if (BV_ISSET(fields, 3)) {
54443 log_packet_detailed(" got field 'graphic_str'");
54444 #ifdef FREECIV_JSON_CONNECTION
54445 field_addr.name = "graphic_str";
54446 #endif /* FREECIV_JSON_CONNECTION */
54447 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
54448 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
54449 }
54450 }
54451 if (BV_ISSET(fields, 4)) {
54452 log_packet_detailed(" got field 'graphic_alt'");
54453 #ifdef FREECIV_JSON_CONNECTION
54454 field_addr.name = "graphic_alt";
54455 #endif /* FREECIV_JSON_CONNECTION */
54456 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
54457 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
54458 }
54459 }
54460 if (BV_ISSET(fields, 5)) {
54461 log_packet_detailed(" got field 'sound_move'");
54462 #ifdef FREECIV_JSON_CONNECTION
54463 field_addr.name = "sound_move";
54464 #endif /* FREECIV_JSON_CONNECTION */
54465 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_move, sizeof(real_packet->sound_move))) {
54466 RECEIVE_PACKET_FIELD_ERROR(sound_move);
54467 }
54468 }
54469 if (BV_ISSET(fields, 6)) {
54470 log_packet_detailed(" got field 'sound_move_alt'");
54471 #ifdef FREECIV_JSON_CONNECTION
54472 field_addr.name = "sound_move_alt";
54473 #endif /* FREECIV_JSON_CONNECTION */
54474 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_move_alt, sizeof(real_packet->sound_move_alt))) {
54475 RECEIVE_PACKET_FIELD_ERROR(sound_move_alt);
54476 }
54477 }
54478 if (BV_ISSET(fields, 7)) {
54479 log_packet_detailed(" got field 'sound_fight'");
54480 #ifdef FREECIV_JSON_CONNECTION
54481 field_addr.name = "sound_fight";
54482 #endif /* FREECIV_JSON_CONNECTION */
54483 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_fight, sizeof(real_packet->sound_fight))) {
54484 RECEIVE_PACKET_FIELD_ERROR(sound_fight);
54485 }
54486 }
54487 if (BV_ISSET(fields, 8)) {
54488 log_packet_detailed(" got field 'sound_fight_alt'");
54489 #ifdef FREECIV_JSON_CONNECTION
54490 field_addr.name = "sound_fight_alt";
54491 #endif /* FREECIV_JSON_CONNECTION */
54492 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_fight_alt, sizeof(real_packet->sound_fight_alt))) {
54493 RECEIVE_PACKET_FIELD_ERROR(sound_fight_alt);
54494 }
54495 }
54496 if (BV_ISSET(fields, 9)) {
54497 log_packet_detailed(" got field 'unit_class_id'");
54498 #ifdef FREECIV_JSON_CONNECTION
54499 field_addr.name = "unit_class_id";
54500 #endif /* FREECIV_JSON_CONNECTION */
54501 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->unit_class_id)) {
54502 RECEIVE_PACKET_FIELD_ERROR(unit_class_id);
54503 }
54504 }
54505 if (BV_ISSET(fields, 10)) {
54506 log_packet_detailed(" got field 'build_cost'");
54507 #ifdef FREECIV_JSON_CONNECTION
54508 field_addr.name = "build_cost";
54509 #endif /* FREECIV_JSON_CONNECTION */
54510 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->build_cost)) {
54511 RECEIVE_PACKET_FIELD_ERROR(build_cost);
54512 }
54513 }
54514 if (BV_ISSET(fields, 11)) {
54515 log_packet_detailed(" got field 'pop_cost'");
54516 #ifdef FREECIV_JSON_CONNECTION
54517 field_addr.name = "pop_cost";
54518 #endif /* FREECIV_JSON_CONNECTION */
54519 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pop_cost)) {
54520 RECEIVE_PACKET_FIELD_ERROR(pop_cost);
54521 }
54522 }
54523 if (BV_ISSET(fields, 12)) {
54524 log_packet_detailed(" got field 'attack_strength'");
54525 #ifdef FREECIV_JSON_CONNECTION
54526 field_addr.name = "attack_strength";
54527 #endif /* FREECIV_JSON_CONNECTION */
54528 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->attack_strength)) {
54529 RECEIVE_PACKET_FIELD_ERROR(attack_strength);
54530 }
54531 }
54532 if (BV_ISSET(fields, 13)) {
54533 log_packet_detailed(" got field 'defense_strength'");
54534 #ifdef FREECIV_JSON_CONNECTION
54535 field_addr.name = "defense_strength";
54536 #endif /* FREECIV_JSON_CONNECTION */
54537 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defense_strength)) {
54538 RECEIVE_PACKET_FIELD_ERROR(defense_strength);
54539 }
54540 }
54541 if (BV_ISSET(fields, 14)) {
54542 log_packet_detailed(" got field 'move_rate'");
54543 #ifdef FREECIV_JSON_CONNECTION
54544 field_addr.name = "move_rate";
54545 #endif /* FREECIV_JSON_CONNECTION */
54546 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_rate)) {
54547 RECEIVE_PACKET_FIELD_ERROR(move_rate);
54548 }
54549 }
54550 if (BV_ISSET(fields, 15)) {
54551 log_packet_detailed(" got field 'tech_requirement'");
54552 #ifdef FREECIV_JSON_CONNECTION
54553 field_addr.name = "tech_requirement";
54554 #endif /* FREECIV_JSON_CONNECTION */
54555 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tech_requirement)) {
54556 RECEIVE_PACKET_FIELD_ERROR(tech_requirement);
54557 }
54558 }
54559 if (BV_ISSET(fields, 16)) {
54560 log_packet_detailed(" got field 'build_reqs_count'");
54561 #ifdef FREECIV_JSON_CONNECTION
54562 field_addr.name = "build_reqs_count";
54563 #endif /* FREECIV_JSON_CONNECTION */
54564 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_reqs_count)) {
54565 RECEIVE_PACKET_FIELD_ERROR(build_reqs_count);
54566 }
54567 }
54568 if (BV_ISSET(fields, 17)) {
54569 log_packet_detailed(" got field 'build_reqs'");
54570 #ifdef FREECIV_JSON_CONNECTION
54571 field_addr.name = "build_reqs";
54572 #endif /* FREECIV_JSON_CONNECTION */
54573
54574 {
54575 int i;
54576
54577 #ifdef FREECIV_JSON_CONNECTION
54578 /* Enter array. */
54579 field_addr.sub_location = plocation_elem_new(0);
54580 #endif /* FREECIV_JSON_CONNECTION */
54581
54582 if (real_packet->build_reqs_count > MAX_NUM_REQS) {
54583 RECEIVE_PACKET_FIELD_ERROR(build_reqs, ": truncation array");
54584 }
54585 for (i = 0; i < real_packet->build_reqs_count; i++) {
54586 #ifdef FREECIV_JSON_CONNECTION
54587 field_addr.sub_location->number = i;
54588 #endif /* FREECIV_JSON_CONNECTION */
54589 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->build_reqs[i])) {
54590 RECEIVE_PACKET_FIELD_ERROR(build_reqs);
54591 }
54592 }
54593
54594 #ifdef FREECIV_JSON_CONNECTION
54595 /* Exit array. */
54596 free(field_addr.sub_location);
54597 field_addr.sub_location = NULL;
54598 #endif /* FREECIV_JSON_CONNECTION */
54599 }
54600 }
54601 if (BV_ISSET(fields, 18)) {
54602 log_packet_detailed(" got field 'vision_radius_sq'");
54603 #ifdef FREECIV_JSON_CONNECTION
54604 field_addr.name = "vision_radius_sq";
54605 #endif /* FREECIV_JSON_CONNECTION */
54606 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->vision_radius_sq)) {
54607 RECEIVE_PACKET_FIELD_ERROR(vision_radius_sq);
54608 }
54609 }
54610 if (BV_ISSET(fields, 19)) {
54611 log_packet_detailed(" got field 'transport_capacity'");
54612 #ifdef FREECIV_JSON_CONNECTION
54613 field_addr.name = "transport_capacity";
54614 #endif /* FREECIV_JSON_CONNECTION */
54615 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->transport_capacity)) {
54616 RECEIVE_PACKET_FIELD_ERROR(transport_capacity);
54617 }
54618 }
54619 if (BV_ISSET(fields, 20)) {
54620 log_packet_detailed(" got field 'hp'");
54621 #ifdef FREECIV_JSON_CONNECTION
54622 field_addr.name = "hp";
54623 #endif /* FREECIV_JSON_CONNECTION */
54624 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
54625 RECEIVE_PACKET_FIELD_ERROR(hp);
54626 }
54627 }
54628 if (BV_ISSET(fields, 21)) {
54629 log_packet_detailed(" got field 'firepower'");
54630 #ifdef FREECIV_JSON_CONNECTION
54631 field_addr.name = "firepower";
54632 #endif /* FREECIV_JSON_CONNECTION */
54633 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->firepower)) {
54634 RECEIVE_PACKET_FIELD_ERROR(firepower);
54635 }
54636 }
54637 if (BV_ISSET(fields, 22)) {
54638 log_packet_detailed(" got field 'obsoleted_by'");
54639 #ifdef FREECIV_JSON_CONNECTION
54640 field_addr.name = "obsoleted_by";
54641 #endif /* FREECIV_JSON_CONNECTION */
54642 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->obsoleted_by)) {
54643 RECEIVE_PACKET_FIELD_ERROR(obsoleted_by);
54644 }
54645 }
54646 if (BV_ISSET(fields, 23)) {
54647 log_packet_detailed(" got field 'converted_to'");
54648 #ifdef FREECIV_JSON_CONNECTION
54649 field_addr.name = "converted_to";
54650 #endif /* FREECIV_JSON_CONNECTION */
54651 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->converted_to)) {
54652 RECEIVE_PACKET_FIELD_ERROR(converted_to);
54653 }
54654 }
54655 if (BV_ISSET(fields, 24)) {
54656 log_packet_detailed(" got field 'convert_time'");
54657 #ifdef FREECIV_JSON_CONNECTION
54658 field_addr.name = "convert_time";
54659 #endif /* FREECIV_JSON_CONNECTION */
54660 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->convert_time)) {
54661 RECEIVE_PACKET_FIELD_ERROR(convert_time);
54662 }
54663 }
54664 if (BV_ISSET(fields, 25)) {
54665 log_packet_detailed(" got field 'fuel'");
54666 #ifdef FREECIV_JSON_CONNECTION
54667 field_addr.name = "fuel";
54668 #endif /* FREECIV_JSON_CONNECTION */
54669 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
54670 RECEIVE_PACKET_FIELD_ERROR(fuel);
54671 }
54672 }
54673 if (BV_ISSET(fields, 26)) {
54674 log_packet_detailed(" got field 'happy_cost'");
54675 #ifdef FREECIV_JSON_CONNECTION
54676 field_addr.name = "happy_cost";
54677 #endif /* FREECIV_JSON_CONNECTION */
54678 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->happy_cost)) {
54679 RECEIVE_PACKET_FIELD_ERROR(happy_cost);
54680 }
54681 }
54682 if (BV_ISSET(fields, 27)) {
54683 log_packet_detailed(" got field 'upkeep'");
54684 #ifdef FREECIV_JSON_CONNECTION
54685 field_addr.name = "upkeep";
54686 #endif /* FREECIV_JSON_CONNECTION */
54687
54688 {
54689 int i;
54690
54691 #ifdef FREECIV_JSON_CONNECTION
54692 /* Enter array. */
54693 field_addr.sub_location = plocation_elem_new(0);
54694 #endif /* FREECIV_JSON_CONNECTION */
54695
54696 for (i = 0; i < O_LAST; i++) {
54697 #ifdef FREECIV_JSON_CONNECTION
54698 field_addr.sub_location->number = i;
54699 #endif /* FREECIV_JSON_CONNECTION */
54700 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep[i])) {
54701 RECEIVE_PACKET_FIELD_ERROR(upkeep);
54702 }
54703 }
54704
54705 #ifdef FREECIV_JSON_CONNECTION
54706 /* Exit array. */
54707 free(field_addr.sub_location);
54708 field_addr.sub_location = NULL;
54709 #endif /* FREECIV_JSON_CONNECTION */
54710 }
54711 }
54712 if (BV_ISSET(fields, 28)) {
54713 log_packet_detailed(" got field 'paratroopers_range'");
54714 #ifdef FREECIV_JSON_CONNECTION
54715 field_addr.name = "paratroopers_range";
54716 #endif /* FREECIV_JSON_CONNECTION */
54717 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->paratroopers_range)) {
54718 RECEIVE_PACKET_FIELD_ERROR(paratroopers_range);
54719 }
54720 }
54721 if (BV_ISSET(fields, 29)) {
54722 log_packet_detailed(" got field 'veteran_levels'");
54723 #ifdef FREECIV_JSON_CONNECTION
54724 field_addr.name = "veteran_levels";
54725 #endif /* FREECIV_JSON_CONNECTION */
54726 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran_levels)) {
54727 RECEIVE_PACKET_FIELD_ERROR(veteran_levels);
54728 }
54729 }
54730 if (BV_ISSET(fields, 30)) {
54731 log_packet_detailed(" got field 'veteran_name'");
54732 #ifdef FREECIV_JSON_CONNECTION
54733 field_addr.name = "veteran_name";
54734 #endif /* FREECIV_JSON_CONNECTION */
54735
54736 {
54737 int i;
54738
54739 #ifdef FREECIV_JSON_CONNECTION
54740 /* Enter array. */
54741 field_addr.sub_location = plocation_elem_new(0);
54742 #endif /* FREECIV_JSON_CONNECTION */
54743
54744 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
54745 RECEIVE_PACKET_FIELD_ERROR(veteran_name, ": truncation array");
54746 }
54747 for (i = 0; i < real_packet->veteran_levels; i++) {
54748 #ifdef FREECIV_JSON_CONNECTION
54749 field_addr.sub_location->number = i;
54750 #endif /* FREECIV_JSON_CONNECTION */
54751 if (!DIO_GET(string, &din, &field_addr, real_packet->veteran_name[i], sizeof(real_packet->veteran_name[i]))) {
54752 RECEIVE_PACKET_FIELD_ERROR(veteran_name);
54753 }
54754 }
54755
54756 #ifdef FREECIV_JSON_CONNECTION
54757 /* Exit array. */
54758 free(field_addr.sub_location);
54759 field_addr.sub_location = NULL;
54760 #endif /* FREECIV_JSON_CONNECTION */
54761 }
54762 }
54763 if (BV_ISSET(fields, 31)) {
54764 log_packet_detailed(" got field 'power_fact'");
54765 #ifdef FREECIV_JSON_CONNECTION
54766 field_addr.name = "power_fact";
54767 #endif /* FREECIV_JSON_CONNECTION */
54768
54769 {
54770 int i;
54771
54772 #ifdef FREECIV_JSON_CONNECTION
54773 /* Enter array. */
54774 field_addr.sub_location = plocation_elem_new(0);
54775 #endif /* FREECIV_JSON_CONNECTION */
54776
54777 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
54778 RECEIVE_PACKET_FIELD_ERROR(power_fact, ": truncation array");
54779 }
54780 for (i = 0; i < real_packet->veteran_levels; i++) {
54781 #ifdef FREECIV_JSON_CONNECTION
54782 field_addr.sub_location->number = i;
54783 #endif /* FREECIV_JSON_CONNECTION */
54784 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->power_fact[i])) {
54785 RECEIVE_PACKET_FIELD_ERROR(power_fact);
54786 }
54787 }
54788
54789 #ifdef FREECIV_JSON_CONNECTION
54790 /* Exit array. */
54791 free(field_addr.sub_location);
54792 field_addr.sub_location = NULL;
54793 #endif /* FREECIV_JSON_CONNECTION */
54794 }
54795 }
54796 if (BV_ISSET(fields, 32)) {
54797 log_packet_detailed(" got field 'move_bonus'");
54798 #ifdef FREECIV_JSON_CONNECTION
54799 field_addr.name = "move_bonus";
54800 #endif /* FREECIV_JSON_CONNECTION */
54801
54802 {
54803 int i;
54804
54805 #ifdef FREECIV_JSON_CONNECTION
54806 /* Enter array. */
54807 field_addr.sub_location = plocation_elem_new(0);
54808 #endif /* FREECIV_JSON_CONNECTION */
54809
54810 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
54811 RECEIVE_PACKET_FIELD_ERROR(move_bonus, ": truncation array");
54812 }
54813 for (i = 0; i < real_packet->veteran_levels; i++) {
54814 #ifdef FREECIV_JSON_CONNECTION
54815 field_addr.sub_location->number = i;
54816 #endif /* FREECIV_JSON_CONNECTION */
54817 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_bonus[i])) {
54818 RECEIVE_PACKET_FIELD_ERROR(move_bonus);
54819 }
54820 }
54821
54822 #ifdef FREECIV_JSON_CONNECTION
54823 /* Exit array. */
54824 free(field_addr.sub_location);
54825 field_addr.sub_location = NULL;
54826 #endif /* FREECIV_JSON_CONNECTION */
54827 }
54828 }
54829 if (BV_ISSET(fields, 33)) {
54830 log_packet_detailed(" got field 'base_raise_chance'");
54831 #ifdef FREECIV_JSON_CONNECTION
54832 field_addr.name = "base_raise_chance";
54833 #endif /* FREECIV_JSON_CONNECTION */
54834
54835 {
54836 int i;
54837
54838 #ifdef FREECIV_JSON_CONNECTION
54839 /* Enter array. */
54840 field_addr.sub_location = plocation_elem_new(0);
54841 #endif /* FREECIV_JSON_CONNECTION */
54842
54843 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
54844 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance, ": truncation array");
54845 }
54846 for (i = 0; i < real_packet->veteran_levels; i++) {
54847 #ifdef FREECIV_JSON_CONNECTION
54848 field_addr.sub_location->number = i;
54849 #endif /* FREECIV_JSON_CONNECTION */
54850 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_raise_chance[i])) {
54851 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance);
54852 }
54853 }
54854
54855 #ifdef FREECIV_JSON_CONNECTION
54856 /* Exit array. */
54857 free(field_addr.sub_location);
54858 field_addr.sub_location = NULL;
54859 #endif /* FREECIV_JSON_CONNECTION */
54860 }
54861 }
54862 if (BV_ISSET(fields, 34)) {
54863 log_packet_detailed(" got field 'work_raise_chance'");
54864 #ifdef FREECIV_JSON_CONNECTION
54865 field_addr.name = "work_raise_chance";
54866 #endif /* FREECIV_JSON_CONNECTION */
54867
54868 {
54869 int i;
54870
54871 #ifdef FREECIV_JSON_CONNECTION
54872 /* Enter array. */
54873 field_addr.sub_location = plocation_elem_new(0);
54874 #endif /* FREECIV_JSON_CONNECTION */
54875
54876 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
54877 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance, ": truncation array");
54878 }
54879 for (i = 0; i < real_packet->veteran_levels; i++) {
54880 #ifdef FREECIV_JSON_CONNECTION
54881 field_addr.sub_location->number = i;
54882 #endif /* FREECIV_JSON_CONNECTION */
54883 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->work_raise_chance[i])) {
54884 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance);
54885 }
54886 }
54887
54888 #ifdef FREECIV_JSON_CONNECTION
54889 /* Exit array. */
54890 free(field_addr.sub_location);
54891 field_addr.sub_location = NULL;
54892 #endif /* FREECIV_JSON_CONNECTION */
54893 }
54894 }
54895 if (BV_ISSET(fields, 35)) {
54896 log_packet_detailed(" got field 'bombard_rate'");
54897 #ifdef FREECIV_JSON_CONNECTION
54898 field_addr.name = "bombard_rate";
54899 #endif /* FREECIV_JSON_CONNECTION */
54900 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->bombard_rate)) {
54901 RECEIVE_PACKET_FIELD_ERROR(bombard_rate);
54902 }
54903 }
54904 if (BV_ISSET(fields, 36)) {
54905 log_packet_detailed(" got field 'city_size'");
54906 #ifdef FREECIV_JSON_CONNECTION
54907 field_addr.name = "city_size";
54908 #endif /* FREECIV_JSON_CONNECTION */
54909 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_size)) {
54910 RECEIVE_PACKET_FIELD_ERROR(city_size);
54911 }
54912 }
54913 if (BV_ISSET(fields, 37)) {
54914 log_packet_detailed(" got field 'city_slots'");
54915 #ifdef FREECIV_JSON_CONNECTION
54916 field_addr.name = "city_slots";
54917 #endif /* FREECIV_JSON_CONNECTION */
54918 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_slots)) {
54919 RECEIVE_PACKET_FIELD_ERROR(city_slots);
54920 }
54921 }
54922 if (BV_ISSET(fields, 38)) {
54923 log_packet_detailed(" got field 'tp_defense'");
54924 #ifdef FREECIV_JSON_CONNECTION
54925 field_addr.name = "tp_defense";
54926 #endif /* FREECIV_JSON_CONNECTION */
54927 {
54928 int readin;
54929
54930 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
54931 RECEIVE_PACKET_FIELD_ERROR(tp_defense);
54932 }
54933 real_packet->tp_defense = readin;
54934 }
54935 }
54936 if (BV_ISSET(fields, 39)) {
54937 log_packet_detailed(" got field 'cargo'");
54938 #ifdef FREECIV_JSON_CONNECTION
54939 field_addr.name = "cargo";
54940 #endif /* FREECIV_JSON_CONNECTION */
54941 if (!DIO_BV_GET(&din, &field_addr, real_packet->cargo)) {
54942 RECEIVE_PACKET_FIELD_ERROR(cargo);
54943 }
54944 }
54945 if (BV_ISSET(fields, 40)) {
54946 log_packet_detailed(" got field 'targets'");
54947 #ifdef FREECIV_JSON_CONNECTION
54948 field_addr.name = "targets";
54949 #endif /* FREECIV_JSON_CONNECTION */
54950 if (!DIO_BV_GET(&din, &field_addr, real_packet->targets)) {
54951 RECEIVE_PACKET_FIELD_ERROR(targets);
54952 }
54953 }
54954 if (BV_ISSET(fields, 41)) {
54955 log_packet_detailed(" got field 'embarks'");
54956 #ifdef FREECIV_JSON_CONNECTION
54957 field_addr.name = "embarks";
54958 #endif /* FREECIV_JSON_CONNECTION */
54959 if (!DIO_BV_GET(&din, &field_addr, real_packet->embarks)) {
54960 RECEIVE_PACKET_FIELD_ERROR(embarks);
54961 }
54962 }
54963 if (BV_ISSET(fields, 42)) {
54964 log_packet_detailed(" got field 'disembarks'");
54965 #ifdef FREECIV_JSON_CONNECTION
54966 field_addr.name = "disembarks";
54967 #endif /* FREECIV_JSON_CONNECTION */
54968 if (!DIO_BV_GET(&din, &field_addr, real_packet->disembarks)) {
54969 RECEIVE_PACKET_FIELD_ERROR(disembarks);
54970 }
54971 }
54972 if (BV_ISSET(fields, 43)) {
54973 log_packet_detailed(" got field 'vlayer'");
54974 #ifdef FREECIV_JSON_CONNECTION
54975 field_addr.name = "vlayer";
54976 #endif /* FREECIV_JSON_CONNECTION */
54977 {
54978 int readin;
54979
54980 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
54981 RECEIVE_PACKET_FIELD_ERROR(vlayer);
54982 }
54983 real_packet->vlayer = readin;
54984 }
54985 }
54986 if (BV_ISSET(fields, 44)) {
54987 log_packet_detailed(" got field 'helptext'");
54988 #ifdef FREECIV_JSON_CONNECTION
54989 field_addr.name = "helptext";
54990 #endif /* FREECIV_JSON_CONNECTION */
54991 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
54992 RECEIVE_PACKET_FIELD_ERROR(helptext);
54993 }
54994 }
54995 if (BV_ISSET(fields, 45)) {
54996 log_packet_detailed(" got field 'flags'");
54997 #ifdef FREECIV_JSON_CONNECTION
54998 field_addr.name = "flags";
54999 #endif /* FREECIV_JSON_CONNECTION */
55000 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
55001 RECEIVE_PACKET_FIELD_ERROR(flags);
55002 }
55003 }
55004 if (BV_ISSET(fields, 46)) {
55005 log_packet_detailed(" got field 'roles'");
55006 #ifdef FREECIV_JSON_CONNECTION
55007 field_addr.name = "roles";
55008 #endif /* FREECIV_JSON_CONNECTION */
55009 if (!DIO_BV_GET(&din, &field_addr, real_packet->roles)) {
55010 RECEIVE_PACKET_FIELD_ERROR(roles);
55011 }
55012 }
55013 real_packet->worker = BV_ISSET(fields, 47);
55014
55015 if (NULL == old) {
55016 old = fc_malloc(sizeof(*old));
55017 *old = *real_packet;
55018 genhash_insert(*hash, old, old);
55019 } else {
55020 *old = *real_packet;
55021 }
55022
55023#endif /* FREECIV_DELTA_PROTOCOL */
55024 RECEIVE_PACKET_END(real_packet);
55025}
55026
55027 static int send_packet_ruleset_unit_100(struct connection *pc, const struct packet_ruleset_unit *packet)
55028{
55029 const struct packet_ruleset_unit *real_packet = packet;
55030#ifdef FREECIV_DELTA_PROTOCOL
55031 packet_ruleset_unit_100_fields fields;
55032 struct packet_ruleset_unit *old;
55033 bool differ;
55034 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT;
55035#endif /* FREECIV_DELTA_PROTOCOL */
55036 SEND_PACKET_START(PACKET_RULESET_UNIT);
55037#ifdef FREECIV_JSON_CONNECTION
55038 struct plocation field_addr;
55039 {
55040 struct plocation *field_addr_tmp = plocation_field_new(NULL);
55041 field_addr = *field_addr_tmp;
55042 FC_FREE(field_addr_tmp);
55043 }
55044#endif /* FREECIV_JSON_CONNECTION */
55045
55046 log_packet_detailed("packet_ruleset_unit_100: sending info about ()");
55047
55048#ifdef FREECIV_DELTA_PROTOCOL
55049 if (NULL == *hash) {
55050 *hash = genhash_new_full(hash_packet_ruleset_unit_100, cmp_packet_ruleset_unit_100,
55051 NULL, NULL, NULL, free);
55052 }
55053 BV_CLR_ALL(fields);
55054
55055 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
55056 old = fc_malloc(sizeof(*old));
55057 *old = *real_packet;
55058 genhash_insert(*hash, old, old);
55059 memset(old, 0, sizeof(*old));
55060 }
55061 differ = (old->id != real_packet->id);
55062 if (differ) {
55063 BV_SET(fields, 0);
55064 }
55065
55066 differ = (strcmp(old->name, real_packet->name) != 0);
55067 if (differ) {
55068 BV_SET(fields, 1);
55069 }
55070
55071 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
55072 if (differ) {
55073 BV_SET(fields, 2);
55074 }
55075
55076 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
55077 if (differ) {
55078 BV_SET(fields, 3);
55079 }
55080
55081 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
55082 if (differ) {
55083 BV_SET(fields, 4);
55084 }
55085
55086 differ = (strcmp(old->sound_move, real_packet->sound_move) != 0);
55087 if (differ) {
55088 BV_SET(fields, 5);
55089 }
55090
55091 differ = (strcmp(old->sound_move_alt, real_packet->sound_move_alt) != 0);
55092 if (differ) {
55093 BV_SET(fields, 6);
55094 }
55095
55096 differ = (strcmp(old->sound_fight, real_packet->sound_fight) != 0);
55097 if (differ) {
55098 BV_SET(fields, 7);
55099 }
55100
55101 differ = (strcmp(old->sound_fight_alt, real_packet->sound_fight_alt) != 0);
55102 if (differ) {
55103 BV_SET(fields, 8);
55104 }
55105
55106 differ = (old->unit_class_id != real_packet->unit_class_id);
55107 if (differ) {
55108 BV_SET(fields, 9);
55109 }
55110
55111 differ = (old->build_cost != real_packet->build_cost);
55112 if (differ) {
55113 BV_SET(fields, 10);
55114 }
55115
55116 differ = (old->pop_cost != real_packet->pop_cost);
55117 if (differ) {
55118 BV_SET(fields, 11);
55119 }
55120
55121 differ = (old->attack_strength != real_packet->attack_strength);
55122 if (differ) {
55123 BV_SET(fields, 12);
55124 }
55125
55126 differ = (old->defense_strength != real_packet->defense_strength);
55127 if (differ) {
55128 BV_SET(fields, 13);
55129 }
55130
55131 differ = (old->move_rate != real_packet->move_rate);
55132 if (differ) {
55133 BV_SET(fields, 14);
55134 }
55135
55136 differ = (old->tech_requirement != real_packet->tech_requirement);
55137 if (differ) {
55138 BV_SET(fields, 15);
55139 }
55140
55141 differ = (old->build_reqs_count != real_packet->build_reqs_count);
55142 if (differ) {
55143 BV_SET(fields, 16);
55144 }
55145
55146
55147 {
55148 differ = (old->build_reqs_count != real_packet->build_reqs_count);
55149 if (!differ) {
55150 int i;
55151
55152 for (i = 0; i < real_packet->build_reqs_count; i++) {
55153 if (!are_requirements_equal(&old->build_reqs[i], &real_packet->build_reqs[i])) {
55154 differ = TRUE;
55155 break;
55156 }
55157 }
55158 }
55159 }
55160 if (differ) {
55161 BV_SET(fields, 17);
55162 }
55163
55164 differ = (old->vision_radius_sq != real_packet->vision_radius_sq);
55165 if (differ) {
55166 BV_SET(fields, 18);
55167 }
55168
55169 differ = (old->transport_capacity != real_packet->transport_capacity);
55170 if (differ) {
55171 BV_SET(fields, 19);
55172 }
55173
55174 differ = (old->hp != real_packet->hp);
55175 if (differ) {
55176 BV_SET(fields, 20);
55177 }
55178
55179 differ = (old->firepower != real_packet->firepower);
55180 if (differ) {
55181 BV_SET(fields, 21);
55182 }
55183
55184 differ = (old->obsoleted_by != real_packet->obsoleted_by);
55185 if (differ) {
55186 BV_SET(fields, 22);
55187 }
55188
55189 differ = (old->converted_to != real_packet->converted_to);
55190 if (differ) {
55191 BV_SET(fields, 23);
55192 }
55193
55194 differ = (old->convert_time != real_packet->convert_time);
55195 if (differ) {
55196 BV_SET(fields, 24);
55197 }
55198
55199 differ = (old->fuel != real_packet->fuel);
55200 if (differ) {
55201 BV_SET(fields, 25);
55202 }
55203
55204 differ = (old->happy_cost != real_packet->happy_cost);
55205 if (differ) {
55206 BV_SET(fields, 26);
55207 }
55208
55209
55210 {
55211 differ = FALSE;
55212 {
55213 int i;
55214
55215 for (i = 0; i < O_LAST; i++) {
55216 if (old->upkeep[i] != real_packet->upkeep[i]) {
55217 differ = TRUE;
55218 break;
55219 }
55220 }
55221 }
55222 }
55223 if (differ) {
55224 BV_SET(fields, 27);
55225 }
55226
55227 differ = (old->paratroopers_range != real_packet->paratroopers_range);
55228 if (differ) {
55229 BV_SET(fields, 28);
55230 }
55231
55232 differ = (old->veteran_levels != real_packet->veteran_levels);
55233 if (differ) {
55234 BV_SET(fields, 29);
55235 }
55236
55237
55238 {
55239 differ = (old->veteran_levels != real_packet->veteran_levels);
55240 if (!differ) {
55241 int i;
55242
55243 for (i = 0; i < real_packet->veteran_levels; i++) {
55244 if (strcmp(old->veteran_name[i], real_packet->veteran_name[i]) != 0) {
55245 differ = TRUE;
55246 break;
55247 }
55248 }
55249 }
55250 }
55251 if (differ) {
55252 BV_SET(fields, 30);
55253 }
55254
55255
55256 {
55257 differ = (old->veteran_levels != real_packet->veteran_levels);
55258 if (!differ) {
55259 int i;
55260
55261 for (i = 0; i < real_packet->veteran_levels; i++) {
55262 if (old->power_fact[i] != real_packet->power_fact[i]) {
55263 differ = TRUE;
55264 break;
55265 }
55266 }
55267 }
55268 }
55269 if (differ) {
55270 BV_SET(fields, 31);
55271 }
55272
55273
55274 {
55275 differ = (old->veteran_levels != real_packet->veteran_levels);
55276 if (!differ) {
55277 int i;
55278
55279 for (i = 0; i < real_packet->veteran_levels; i++) {
55280 if (old->move_bonus[i] != real_packet->move_bonus[i]) {
55281 differ = TRUE;
55282 break;
55283 }
55284 }
55285 }
55286 }
55287 if (differ) {
55288 BV_SET(fields, 32);
55289 }
55290
55291
55292 {
55293 differ = (old->veteran_levels != real_packet->veteran_levels);
55294 if (!differ) {
55295 int i;
55296
55297 for (i = 0; i < real_packet->veteran_levels; i++) {
55298 if (old->base_raise_chance[i] != real_packet->base_raise_chance[i]) {
55299 differ = TRUE;
55300 break;
55301 }
55302 }
55303 }
55304 }
55305 if (differ) {
55306 BV_SET(fields, 33);
55307 }
55308
55309
55310 {
55311 differ = (old->veteran_levels != real_packet->veteran_levels);
55312 if (!differ) {
55313 int i;
55314
55315 for (i = 0; i < real_packet->veteran_levels; i++) {
55316 if (old->work_raise_chance[i] != real_packet->work_raise_chance[i]) {
55317 differ = TRUE;
55318 break;
55319 }
55320 }
55321 }
55322 }
55323 if (differ) {
55324 BV_SET(fields, 34);
55325 }
55326
55327 differ = (old->bombard_rate != real_packet->bombard_rate);
55328 if (differ) {
55329 BV_SET(fields, 35);
55330 }
55331
55332 differ = (old->city_size != real_packet->city_size);
55333 if (differ) {
55334 BV_SET(fields, 36);
55335 }
55336
55337 differ = (old->city_slots != real_packet->city_slots);
55338 if (differ) {
55339 BV_SET(fields, 37);
55340 }
55341
55342 differ = (old->tp_defense != real_packet->tp_defense);
55343 if (differ) {
55344 BV_SET(fields, 38);
55345 }
55346
55347 differ = !BV_ARE_EQUAL(old->cargo, real_packet->cargo);
55348 if (differ) {
55349 BV_SET(fields, 39);
55350 }
55351
55352 differ = !BV_ARE_EQUAL(old->targets, real_packet->targets);
55353 if (differ) {
55354 BV_SET(fields, 40);
55355 }
55356
55357 differ = !BV_ARE_EQUAL(old->embarks, real_packet->embarks);
55358 if (differ) {
55359 BV_SET(fields, 41);
55360 }
55361
55362 differ = !BV_ARE_EQUAL(old->disembarks, real_packet->disembarks);
55363 if (differ) {
55364 BV_SET(fields, 42);
55365 }
55366
55367 differ = (old->vlayer != real_packet->vlayer);
55368 if (differ) {
55369 BV_SET(fields, 43);
55370 }
55371
55372 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
55373 if (differ) {
55374 BV_SET(fields, 44);
55375 }
55376
55377 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
55378 if (differ) {
55379 BV_SET(fields, 45);
55380 }
55381
55382 differ = !BV_ARE_EQUAL(old->roles, real_packet->roles);
55383 if (differ) {
55384 BV_SET(fields, 46);
55385 }
55386
55387 if (packet->worker) {
55388 BV_SET(fields, 47);
55389 }
55390
55391
55392#ifdef FREECIV_JSON_CONNECTION
55393 field_addr.name = "fields";
55394#endif /* FREECIV_JSON_CONNECTION */
55395 DIO_BV_PUT(&dout, &field_addr, fields);
55396
55397 if (BV_ISSET(fields, 0)) {
55398 log_packet_detailed(" field 'id' has changed");
55399 #ifdef FREECIV_JSON_CONNECTION
55400 field_addr.name = "id";
55401#endif /* FREECIV_JSON_CONNECTION */
55402 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
55403 }
55404 if (BV_ISSET(fields, 1)) {
55405 log_packet_detailed(" field 'name' has changed");
55406 #ifdef FREECIV_JSON_CONNECTION
55407 field_addr.name = "name";
55408#endif /* FREECIV_JSON_CONNECTION */
55409 DIO_PUT(string, &dout, &field_addr, real_packet->name);
55410 }
55411 if (BV_ISSET(fields, 2)) {
55412 log_packet_detailed(" field 'rule_name' has changed");
55413 #ifdef FREECIV_JSON_CONNECTION
55414 field_addr.name = "rule_name";
55415#endif /* FREECIV_JSON_CONNECTION */
55416 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
55417 }
55418 if (BV_ISSET(fields, 3)) {
55419 log_packet_detailed(" field 'graphic_str' has changed");
55420 #ifdef FREECIV_JSON_CONNECTION
55421 field_addr.name = "graphic_str";
55422#endif /* FREECIV_JSON_CONNECTION */
55423 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
55424 }
55425 if (BV_ISSET(fields, 4)) {
55426 log_packet_detailed(" field 'graphic_alt' has changed");
55427 #ifdef FREECIV_JSON_CONNECTION
55428 field_addr.name = "graphic_alt";
55429#endif /* FREECIV_JSON_CONNECTION */
55430 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
55431 }
55432 if (BV_ISSET(fields, 5)) {
55433 log_packet_detailed(" field 'sound_move' has changed");
55434 #ifdef FREECIV_JSON_CONNECTION
55435 field_addr.name = "sound_move";
55436#endif /* FREECIV_JSON_CONNECTION */
55437 DIO_PUT(string, &dout, &field_addr, real_packet->sound_move);
55438 }
55439 if (BV_ISSET(fields, 6)) {
55440 log_packet_detailed(" field 'sound_move_alt' has changed");
55441 #ifdef FREECIV_JSON_CONNECTION
55442 field_addr.name = "sound_move_alt";
55443#endif /* FREECIV_JSON_CONNECTION */
55444 DIO_PUT(string, &dout, &field_addr, real_packet->sound_move_alt);
55445 }
55446 if (BV_ISSET(fields, 7)) {
55447 log_packet_detailed(" field 'sound_fight' has changed");
55448 #ifdef FREECIV_JSON_CONNECTION
55449 field_addr.name = "sound_fight";
55450#endif /* FREECIV_JSON_CONNECTION */
55451 DIO_PUT(string, &dout, &field_addr, real_packet->sound_fight);
55452 }
55453 if (BV_ISSET(fields, 8)) {
55454 log_packet_detailed(" field 'sound_fight_alt' has changed");
55455 #ifdef FREECIV_JSON_CONNECTION
55456 field_addr.name = "sound_fight_alt";
55457#endif /* FREECIV_JSON_CONNECTION */
55458 DIO_PUT(string, &dout, &field_addr, real_packet->sound_fight_alt);
55459 }
55460 if (BV_ISSET(fields, 9)) {
55461 log_packet_detailed(" field 'unit_class_id' has changed");
55462 #ifdef FREECIV_JSON_CONNECTION
55463 field_addr.name = "unit_class_id";
55464#endif /* FREECIV_JSON_CONNECTION */
55465 DIO_PUT(uint8, &dout, &field_addr, real_packet->unit_class_id);
55466 }
55467 if (BV_ISSET(fields, 10)) {
55468 log_packet_detailed(" field 'build_cost' has changed");
55469 #ifdef FREECIV_JSON_CONNECTION
55470 field_addr.name = "build_cost";
55471#endif /* FREECIV_JSON_CONNECTION */
55472 DIO_PUT(uint16, &dout, &field_addr, real_packet->build_cost);
55473 }
55474 if (BV_ISSET(fields, 11)) {
55475 log_packet_detailed(" field 'pop_cost' has changed");
55476 #ifdef FREECIV_JSON_CONNECTION
55477 field_addr.name = "pop_cost";
55478#endif /* FREECIV_JSON_CONNECTION */
55479 DIO_PUT(uint8, &dout, &field_addr, real_packet->pop_cost);
55480 }
55481 if (BV_ISSET(fields, 12)) {
55482 log_packet_detailed(" field 'attack_strength' has changed");
55483 #ifdef FREECIV_JSON_CONNECTION
55484 field_addr.name = "attack_strength";
55485#endif /* FREECIV_JSON_CONNECTION */
55486 DIO_PUT(uint8, &dout, &field_addr, real_packet->attack_strength);
55487 }
55488 if (BV_ISSET(fields, 13)) {
55489 log_packet_detailed(" field 'defense_strength' has changed");
55490 #ifdef FREECIV_JSON_CONNECTION
55491 field_addr.name = "defense_strength";
55492#endif /* FREECIV_JSON_CONNECTION */
55493 DIO_PUT(uint8, &dout, &field_addr, real_packet->defense_strength);
55494 }
55495 if (BV_ISSET(fields, 14)) {
55496 log_packet_detailed(" field 'move_rate' has changed");
55497 #ifdef FREECIV_JSON_CONNECTION
55498 field_addr.name = "move_rate";
55499#endif /* FREECIV_JSON_CONNECTION */
55500 DIO_PUT(uint32, &dout, &field_addr, real_packet->move_rate);
55501 }
55502 if (BV_ISSET(fields, 15)) {
55503 log_packet_detailed(" field 'tech_requirement' has changed");
55504 #ifdef FREECIV_JSON_CONNECTION
55505 field_addr.name = "tech_requirement";
55506#endif /* FREECIV_JSON_CONNECTION */
55507 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_requirement);
55508 }
55509 if (BV_ISSET(fields, 16)) {
55510 log_packet_detailed(" field 'build_reqs_count' has changed");
55511 #ifdef FREECIV_JSON_CONNECTION
55512 field_addr.name = "build_reqs_count";
55513#endif /* FREECIV_JSON_CONNECTION */
55514 DIO_PUT(uint8, &dout, &field_addr, real_packet->build_reqs_count);
55515 }
55516 if (BV_ISSET(fields, 17)) {
55517 log_packet_detailed(" field 'build_reqs' has changed");
55518 #ifdef FREECIV_JSON_CONNECTION
55519 field_addr.name = "build_reqs";
55520#endif /* FREECIV_JSON_CONNECTION */
55521
55522 {
55523 int i;
55524
55525#ifdef FREECIV_JSON_CONNECTION
55526 /* Create the array. */
55527 DIO_PUT(farray, &dout, &field_addr, real_packet->build_reqs_count);
55528
55529 /* Enter the array. */
55530 field_addr.sub_location = plocation_elem_new(0);
55531#endif /* FREECIV_JSON_CONNECTION */
55532
55533 for (i = 0; i < real_packet->build_reqs_count; i++) {
55534#ifdef FREECIV_JSON_CONNECTION
55535 /* Next array element. */
55536 field_addr.sub_location->number = i;
55537#endif /* FREECIV_JSON_CONNECTION */
55538 DIO_PUT(requirement, &dout, &field_addr, &real_packet->build_reqs[i]);
55539 }
55540
55541#ifdef FREECIV_JSON_CONNECTION
55542 /* Exit array. */
55543 free(field_addr.sub_location);
55544 field_addr.sub_location = NULL;
55545#endif /* FREECIV_JSON_CONNECTION */
55546 }
55547 }
55548 if (BV_ISSET(fields, 18)) {
55549 log_packet_detailed(" field 'vision_radius_sq' has changed");
55550 #ifdef FREECIV_JSON_CONNECTION
55551 field_addr.name = "vision_radius_sq";
55552#endif /* FREECIV_JSON_CONNECTION */
55553 DIO_PUT(uint16, &dout, &field_addr, real_packet->vision_radius_sq);
55554 }
55555 if (BV_ISSET(fields, 19)) {
55556 log_packet_detailed(" field 'transport_capacity' has changed");
55557 #ifdef FREECIV_JSON_CONNECTION
55558 field_addr.name = "transport_capacity";
55559#endif /* FREECIV_JSON_CONNECTION */
55560 DIO_PUT(uint8, &dout, &field_addr, real_packet->transport_capacity);
55561 }
55562 if (BV_ISSET(fields, 20)) {
55563 log_packet_detailed(" field 'hp' has changed");
55564 #ifdef FREECIV_JSON_CONNECTION
55565 field_addr.name = "hp";
55566#endif /* FREECIV_JSON_CONNECTION */
55567 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
55568 }
55569 if (BV_ISSET(fields, 21)) {
55570 log_packet_detailed(" field 'firepower' has changed");
55571 #ifdef FREECIV_JSON_CONNECTION
55572 field_addr.name = "firepower";
55573#endif /* FREECIV_JSON_CONNECTION */
55574 DIO_PUT(uint8, &dout, &field_addr, real_packet->firepower);
55575 }
55576 if (BV_ISSET(fields, 22)) {
55577 log_packet_detailed(" field 'obsoleted_by' has changed");
55578 #ifdef FREECIV_JSON_CONNECTION
55579 field_addr.name = "obsoleted_by";
55580#endif /* FREECIV_JSON_CONNECTION */
55581 DIO_PUT(uint8, &dout, &field_addr, real_packet->obsoleted_by);
55582 }
55583 if (BV_ISSET(fields, 23)) {
55584 log_packet_detailed(" field 'converted_to' has changed");
55585 #ifdef FREECIV_JSON_CONNECTION
55586 field_addr.name = "converted_to";
55587#endif /* FREECIV_JSON_CONNECTION */
55588 DIO_PUT(uint8, &dout, &field_addr, real_packet->converted_to);
55589 }
55590 if (BV_ISSET(fields, 24)) {
55591 log_packet_detailed(" field 'convert_time' has changed");
55592 #ifdef FREECIV_JSON_CONNECTION
55593 field_addr.name = "convert_time";
55594#endif /* FREECIV_JSON_CONNECTION */
55595 DIO_PUT(uint8, &dout, &field_addr, real_packet->convert_time);
55596 }
55597 if (BV_ISSET(fields, 25)) {
55598 log_packet_detailed(" field 'fuel' has changed");
55599 #ifdef FREECIV_JSON_CONNECTION
55600 field_addr.name = "fuel";
55601#endif /* FREECIV_JSON_CONNECTION */
55602 DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
55603 }
55604 if (BV_ISSET(fields, 26)) {
55605 log_packet_detailed(" field 'happy_cost' has changed");
55606 #ifdef FREECIV_JSON_CONNECTION
55607 field_addr.name = "happy_cost";
55608#endif /* FREECIV_JSON_CONNECTION */
55609 DIO_PUT(uint8, &dout, &field_addr, real_packet->happy_cost);
55610 }
55611 if (BV_ISSET(fields, 27)) {
55612 log_packet_detailed(" field 'upkeep' has changed");
55613 #ifdef FREECIV_JSON_CONNECTION
55614 field_addr.name = "upkeep";
55615#endif /* FREECIV_JSON_CONNECTION */
55616
55617 {
55618 int i;
55619
55620#ifdef FREECIV_JSON_CONNECTION
55621 /* Create the array. */
55622 DIO_PUT(farray, &dout, &field_addr, O_LAST);
55623
55624 /* Enter the array. */
55625 field_addr.sub_location = plocation_elem_new(0);
55626#endif /* FREECIV_JSON_CONNECTION */
55627
55628 for (i = 0; i < O_LAST; i++) {
55629#ifdef FREECIV_JSON_CONNECTION
55630 /* Next array element. */
55631 field_addr.sub_location->number = i;
55632#endif /* FREECIV_JSON_CONNECTION */
55633 DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep[i]);
55634 }
55635
55636#ifdef FREECIV_JSON_CONNECTION
55637 /* Exit array. */
55638 free(field_addr.sub_location);
55639 field_addr.sub_location = NULL;
55640#endif /* FREECIV_JSON_CONNECTION */
55641 }
55642 }
55643 if (BV_ISSET(fields, 28)) {
55644 log_packet_detailed(" field 'paratroopers_range' has changed");
55645 #ifdef FREECIV_JSON_CONNECTION
55646 field_addr.name = "paratroopers_range";
55647#endif /* FREECIV_JSON_CONNECTION */
55648 DIO_PUT(uint16, &dout, &field_addr, real_packet->paratroopers_range);
55649 }
55650 if (BV_ISSET(fields, 29)) {
55651 log_packet_detailed(" field 'veteran_levels' has changed");
55652 #ifdef FREECIV_JSON_CONNECTION
55653 field_addr.name = "veteran_levels";
55654#endif /* FREECIV_JSON_CONNECTION */
55655 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran_levels);
55656 }
55657 if (BV_ISSET(fields, 30)) {
55658 log_packet_detailed(" field 'veteran_name' has changed");
55659 #ifdef FREECIV_JSON_CONNECTION
55660 field_addr.name = "veteran_name";
55661#endif /* FREECIV_JSON_CONNECTION */
55662
55663 {
55664 int i;
55665
55666#ifdef FREECIV_JSON_CONNECTION
55667 /* Create the array. */
55668 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
55669
55670 /* Enter the array. */
55671 field_addr.sub_location = plocation_elem_new(0);
55672#endif /* FREECIV_JSON_CONNECTION */
55673
55674 for (i = 0; i < real_packet->veteran_levels; i++) {
55675#ifdef FREECIV_JSON_CONNECTION
55676 /* Next array element. */
55677 field_addr.sub_location->number = i;
55678#endif /* FREECIV_JSON_CONNECTION */
55679 DIO_PUT(string, &dout, &field_addr, real_packet->veteran_name[i]);
55680 }
55681
55682#ifdef FREECIV_JSON_CONNECTION
55683 /* Exit array. */
55684 free(field_addr.sub_location);
55685 field_addr.sub_location = NULL;
55686#endif /* FREECIV_JSON_CONNECTION */
55687 }
55688 }
55689 if (BV_ISSET(fields, 31)) {
55690 log_packet_detailed(" field 'power_fact' has changed");
55691 #ifdef FREECIV_JSON_CONNECTION
55692 field_addr.name = "power_fact";
55693#endif /* FREECIV_JSON_CONNECTION */
55694
55695 {
55696 int i;
55697
55698#ifdef FREECIV_JSON_CONNECTION
55699 /* Create the array. */
55700 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
55701
55702 /* Enter the array. */
55703 field_addr.sub_location = plocation_elem_new(0);
55704#endif /* FREECIV_JSON_CONNECTION */
55705
55706 for (i = 0; i < real_packet->veteran_levels; i++) {
55707#ifdef FREECIV_JSON_CONNECTION
55708 /* Next array element. */
55709 field_addr.sub_location->number = i;
55710#endif /* FREECIV_JSON_CONNECTION */
55711 DIO_PUT(uint16, &dout, &field_addr, real_packet->power_fact[i]);
55712 }
55713
55714#ifdef FREECIV_JSON_CONNECTION
55715 /* Exit array. */
55716 free(field_addr.sub_location);
55717 field_addr.sub_location = NULL;
55718#endif /* FREECIV_JSON_CONNECTION */
55719 }
55720 }
55721 if (BV_ISSET(fields, 32)) {
55722 log_packet_detailed(" field 'move_bonus' has changed");
55723 #ifdef FREECIV_JSON_CONNECTION
55724 field_addr.name = "move_bonus";
55725#endif /* FREECIV_JSON_CONNECTION */
55726
55727 {
55728 int i;
55729
55730#ifdef FREECIV_JSON_CONNECTION
55731 /* Create the array. */
55732 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
55733
55734 /* Enter the array. */
55735 field_addr.sub_location = plocation_elem_new(0);
55736#endif /* FREECIV_JSON_CONNECTION */
55737
55738 for (i = 0; i < real_packet->veteran_levels; i++) {
55739#ifdef FREECIV_JSON_CONNECTION
55740 /* Next array element. */
55741 field_addr.sub_location->number = i;
55742#endif /* FREECIV_JSON_CONNECTION */
55743 DIO_PUT(uint32, &dout, &field_addr, real_packet->move_bonus[i]);
55744 }
55745
55746#ifdef FREECIV_JSON_CONNECTION
55747 /* Exit array. */
55748 free(field_addr.sub_location);
55749 field_addr.sub_location = NULL;
55750#endif /* FREECIV_JSON_CONNECTION */
55751 }
55752 }
55753 if (BV_ISSET(fields, 33)) {
55754 log_packet_detailed(" field 'base_raise_chance' has changed");
55755 #ifdef FREECIV_JSON_CONNECTION
55756 field_addr.name = "base_raise_chance";
55757#endif /* FREECIV_JSON_CONNECTION */
55758
55759 {
55760 int i;
55761
55762#ifdef FREECIV_JSON_CONNECTION
55763 /* Create the array. */
55764 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
55765
55766 /* Enter the array. */
55767 field_addr.sub_location = plocation_elem_new(0);
55768#endif /* FREECIV_JSON_CONNECTION */
55769
55770 for (i = 0; i < real_packet->veteran_levels; i++) {
55771#ifdef FREECIV_JSON_CONNECTION
55772 /* Next array element. */
55773 field_addr.sub_location->number = i;
55774#endif /* FREECIV_JSON_CONNECTION */
55775 DIO_PUT(uint8, &dout, &field_addr, real_packet->base_raise_chance[i]);
55776 }
55777
55778#ifdef FREECIV_JSON_CONNECTION
55779 /* Exit array. */
55780 free(field_addr.sub_location);
55781 field_addr.sub_location = NULL;
55782#endif /* FREECIV_JSON_CONNECTION */
55783 }
55784 }
55785 if (BV_ISSET(fields, 34)) {
55786 log_packet_detailed(" field 'work_raise_chance' has changed");
55787 #ifdef FREECIV_JSON_CONNECTION
55788 field_addr.name = "work_raise_chance";
55789#endif /* FREECIV_JSON_CONNECTION */
55790
55791 {
55792 int i;
55793
55794#ifdef FREECIV_JSON_CONNECTION
55795 /* Create the array. */
55796 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
55797
55798 /* Enter the array. */
55799 field_addr.sub_location = plocation_elem_new(0);
55800#endif /* FREECIV_JSON_CONNECTION */
55801
55802 for (i = 0; i < real_packet->veteran_levels; i++) {
55803#ifdef FREECIV_JSON_CONNECTION
55804 /* Next array element. */
55805 field_addr.sub_location->number = i;
55806#endif /* FREECIV_JSON_CONNECTION */
55807 DIO_PUT(uint8, &dout, &field_addr, real_packet->work_raise_chance[i]);
55808 }
55809
55810#ifdef FREECIV_JSON_CONNECTION
55811 /* Exit array. */
55812 free(field_addr.sub_location);
55813 field_addr.sub_location = NULL;
55814#endif /* FREECIV_JSON_CONNECTION */
55815 }
55816 }
55817 if (BV_ISSET(fields, 35)) {
55818 log_packet_detailed(" field 'bombard_rate' has changed");
55819 #ifdef FREECIV_JSON_CONNECTION
55820 field_addr.name = "bombard_rate";
55821#endif /* FREECIV_JSON_CONNECTION */
55822 DIO_PUT(uint8, &dout, &field_addr, real_packet->bombard_rate);
55823 }
55824 if (BV_ISSET(fields, 36)) {
55825 log_packet_detailed(" field 'city_size' has changed");
55826 #ifdef FREECIV_JSON_CONNECTION
55827 field_addr.name = "city_size";
55828#endif /* FREECIV_JSON_CONNECTION */
55829 DIO_PUT(uint8, &dout, &field_addr, real_packet->city_size);
55830 }
55831 if (BV_ISSET(fields, 37)) {
55832 log_packet_detailed(" field 'city_slots' has changed");
55833 #ifdef FREECIV_JSON_CONNECTION
55834 field_addr.name = "city_slots";
55835#endif /* FREECIV_JSON_CONNECTION */
55836 DIO_PUT(uint8, &dout, &field_addr, real_packet->city_slots);
55837 }
55838 if (BV_ISSET(fields, 38)) {
55839 log_packet_detailed(" field 'tp_defense' has changed");
55840 #ifdef FREECIV_JSON_CONNECTION
55841 field_addr.name = "tp_defense";
55842#endif /* FREECIV_JSON_CONNECTION */
55843 DIO_PUT(uint8, &dout, &field_addr, real_packet->tp_defense);
55844 }
55845 if (BV_ISSET(fields, 39)) {
55846 log_packet_detailed(" field 'cargo' has changed");
55847 #ifdef FREECIV_JSON_CONNECTION
55848 field_addr.name = "cargo";
55849#endif /* FREECIV_JSON_CONNECTION */
55850 DIO_BV_PUT(&dout, &field_addr, packet->cargo);
55851 }
55852 if (BV_ISSET(fields, 40)) {
55853 log_packet_detailed(" field 'targets' has changed");
55854 #ifdef FREECIV_JSON_CONNECTION
55855 field_addr.name = "targets";
55856#endif /* FREECIV_JSON_CONNECTION */
55857 DIO_BV_PUT(&dout, &field_addr, packet->targets);
55858 }
55859 if (BV_ISSET(fields, 41)) {
55860 log_packet_detailed(" field 'embarks' has changed");
55861 #ifdef FREECIV_JSON_CONNECTION
55862 field_addr.name = "embarks";
55863#endif /* FREECIV_JSON_CONNECTION */
55864 DIO_BV_PUT(&dout, &field_addr, packet->embarks);
55865 }
55866 if (BV_ISSET(fields, 42)) {
55867 log_packet_detailed(" field 'disembarks' has changed");
55868 #ifdef FREECIV_JSON_CONNECTION
55869 field_addr.name = "disembarks";
55870#endif /* FREECIV_JSON_CONNECTION */
55871 DIO_BV_PUT(&dout, &field_addr, packet->disembarks);
55872 }
55873 if (BV_ISSET(fields, 43)) {
55874 log_packet_detailed(" field 'vlayer' has changed");
55875 #ifdef FREECIV_JSON_CONNECTION
55876 field_addr.name = "vlayer";
55877#endif /* FREECIV_JSON_CONNECTION */
55878 DIO_PUT(uint8, &dout, &field_addr, real_packet->vlayer);
55879 }
55880 if (BV_ISSET(fields, 44)) {
55881 log_packet_detailed(" field 'helptext' has changed");
55882 #ifdef FREECIV_JSON_CONNECTION
55883 field_addr.name = "helptext";
55884#endif /* FREECIV_JSON_CONNECTION */
55885 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
55886 }
55887 if (BV_ISSET(fields, 45)) {
55888 log_packet_detailed(" field 'flags' has changed");
55889 #ifdef FREECIV_JSON_CONNECTION
55890 field_addr.name = "flags";
55891#endif /* FREECIV_JSON_CONNECTION */
55892 DIO_BV_PUT(&dout, &field_addr, packet->flags);
55893 }
55894 if (BV_ISSET(fields, 46)) {
55895 log_packet_detailed(" field 'roles' has changed");
55896 #ifdef FREECIV_JSON_CONNECTION
55897 field_addr.name = "roles";
55898#endif /* FREECIV_JSON_CONNECTION */
55899 DIO_BV_PUT(&dout, &field_addr, packet->roles);
55900 }
55901 /* field 47 is folded into the header */
55902
55903 *old = *real_packet;
55904#endif /* FREECIV_DELTA_PROTOCOL */
55905#ifndef FREECIV_DELTA_PROTOCOL
55906#ifdef FREECIV_JSON_CONNECTION
55907 field_addr.name = "id";
55908#endif /* FREECIV_JSON_CONNECTION */
55909 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
55910#ifdef FREECIV_JSON_CONNECTION
55911 field_addr.name = "name";
55912#endif /* FREECIV_JSON_CONNECTION */
55913 DIO_PUT(string, &dout, &field_addr, real_packet->name);
55914#ifdef FREECIV_JSON_CONNECTION
55915 field_addr.name = "rule_name";
55916#endif /* FREECIV_JSON_CONNECTION */
55917 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
55918#ifdef FREECIV_JSON_CONNECTION
55919 field_addr.name = "graphic_str";
55920#endif /* FREECIV_JSON_CONNECTION */
55921 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
55922#ifdef FREECIV_JSON_CONNECTION
55923 field_addr.name = "graphic_alt";
55924#endif /* FREECIV_JSON_CONNECTION */
55925 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
55926#ifdef FREECIV_JSON_CONNECTION
55927 field_addr.name = "sound_move";
55928#endif /* FREECIV_JSON_CONNECTION */
55929 DIO_PUT(string, &dout, &field_addr, real_packet->sound_move);
55930#ifdef FREECIV_JSON_CONNECTION
55931 field_addr.name = "sound_move_alt";
55932#endif /* FREECIV_JSON_CONNECTION */
55933 DIO_PUT(string, &dout, &field_addr, real_packet->sound_move_alt);
55934#ifdef FREECIV_JSON_CONNECTION
55935 field_addr.name = "sound_fight";
55936#endif /* FREECIV_JSON_CONNECTION */
55937 DIO_PUT(string, &dout, &field_addr, real_packet->sound_fight);
55938#ifdef FREECIV_JSON_CONNECTION
55939 field_addr.name = "sound_fight_alt";
55940#endif /* FREECIV_JSON_CONNECTION */
55941 DIO_PUT(string, &dout, &field_addr, real_packet->sound_fight_alt);
55942#ifdef FREECIV_JSON_CONNECTION
55943 field_addr.name = "unit_class_id";
55944#endif /* FREECIV_JSON_CONNECTION */
55945 DIO_PUT(uint8, &dout, &field_addr, real_packet->unit_class_id);
55946#ifdef FREECIV_JSON_CONNECTION
55947 field_addr.name = "build_cost";
55948#endif /* FREECIV_JSON_CONNECTION */
55949 DIO_PUT(uint16, &dout, &field_addr, real_packet->build_cost);
55950#ifdef FREECIV_JSON_CONNECTION
55951 field_addr.name = "pop_cost";
55952#endif /* FREECIV_JSON_CONNECTION */
55953 DIO_PUT(uint8, &dout, &field_addr, real_packet->pop_cost);
55954#ifdef FREECIV_JSON_CONNECTION
55955 field_addr.name = "attack_strength";
55956#endif /* FREECIV_JSON_CONNECTION */
55957 DIO_PUT(uint8, &dout, &field_addr, real_packet->attack_strength);
55958#ifdef FREECIV_JSON_CONNECTION
55959 field_addr.name = "defense_strength";
55960#endif /* FREECIV_JSON_CONNECTION */
55961 DIO_PUT(uint8, &dout, &field_addr, real_packet->defense_strength);
55962#ifdef FREECIV_JSON_CONNECTION
55963 field_addr.name = "move_rate";
55964#endif /* FREECIV_JSON_CONNECTION */
55965 DIO_PUT(uint32, &dout, &field_addr, real_packet->move_rate);
55966#ifdef FREECIV_JSON_CONNECTION
55967 field_addr.name = "tech_requirement";
55968#endif /* FREECIV_JSON_CONNECTION */
55969 DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_requirement);
55970#ifdef FREECIV_JSON_CONNECTION
55971 field_addr.name = "build_reqs_count";
55972#endif /* FREECIV_JSON_CONNECTION */
55973 DIO_PUT(uint8, &dout, &field_addr, real_packet->build_reqs_count);
55974#ifdef FREECIV_JSON_CONNECTION
55975 field_addr.name = "build_reqs";
55976#endif /* FREECIV_JSON_CONNECTION */
55977
55978 {
55979 int i;
55980
55981#ifdef FREECIV_JSON_CONNECTION
55982 /* Create the array. */
55983 DIO_PUT(farray, &dout, &field_addr, real_packet->build_reqs_count);
55984
55985 /* Enter the array. */
55986 field_addr.sub_location = plocation_elem_new(0);
55987#endif /* FREECIV_JSON_CONNECTION */
55988
55989 for (i = 0; i < real_packet->build_reqs_count; i++) {
55990#ifdef FREECIV_JSON_CONNECTION
55991 /* Next array element. */
55992 field_addr.sub_location->number = i;
55993#endif /* FREECIV_JSON_CONNECTION */
55994 DIO_PUT(requirement, &dout, &field_addr, &real_packet->build_reqs[i]);
55995 }
55996
55997#ifdef FREECIV_JSON_CONNECTION
55998 /* Exit array. */
55999 free(field_addr.sub_location);
56000 field_addr.sub_location = NULL;
56001#endif /* FREECIV_JSON_CONNECTION */
56002 }
56003#ifdef FREECIV_JSON_CONNECTION
56004 field_addr.name = "vision_radius_sq";
56005#endif /* FREECIV_JSON_CONNECTION */
56006 DIO_PUT(uint16, &dout, &field_addr, real_packet->vision_radius_sq);
56007#ifdef FREECIV_JSON_CONNECTION
56008 field_addr.name = "transport_capacity";
56009#endif /* FREECIV_JSON_CONNECTION */
56010 DIO_PUT(uint8, &dout, &field_addr, real_packet->transport_capacity);
56011#ifdef FREECIV_JSON_CONNECTION
56012 field_addr.name = "hp";
56013#endif /* FREECIV_JSON_CONNECTION */
56014 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
56015#ifdef FREECIV_JSON_CONNECTION
56016 field_addr.name = "firepower";
56017#endif /* FREECIV_JSON_CONNECTION */
56018 DIO_PUT(uint8, &dout, &field_addr, real_packet->firepower);
56019#ifdef FREECIV_JSON_CONNECTION
56020 field_addr.name = "obsoleted_by";
56021#endif /* FREECIV_JSON_CONNECTION */
56022 DIO_PUT(uint8, &dout, &field_addr, real_packet->obsoleted_by);
56023#ifdef FREECIV_JSON_CONNECTION
56024 field_addr.name = "converted_to";
56025#endif /* FREECIV_JSON_CONNECTION */
56026 DIO_PUT(uint8, &dout, &field_addr, real_packet->converted_to);
56027#ifdef FREECIV_JSON_CONNECTION
56028 field_addr.name = "convert_time";
56029#endif /* FREECIV_JSON_CONNECTION */
56030 DIO_PUT(uint8, &dout, &field_addr, real_packet->convert_time);
56031#ifdef FREECIV_JSON_CONNECTION
56032 field_addr.name = "fuel";
56033#endif /* FREECIV_JSON_CONNECTION */
56034 DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
56035#ifdef FREECIV_JSON_CONNECTION
56036 field_addr.name = "happy_cost";
56037#endif /* FREECIV_JSON_CONNECTION */
56038 DIO_PUT(uint8, &dout, &field_addr, real_packet->happy_cost);
56039#ifdef FREECIV_JSON_CONNECTION
56040 field_addr.name = "upkeep";
56041#endif /* FREECIV_JSON_CONNECTION */
56042
56043 {
56044 int i;
56045
56046#ifdef FREECIV_JSON_CONNECTION
56047 /* Create the array. */
56048 DIO_PUT(farray, &dout, &field_addr, O_LAST);
56049
56050 /* Enter the array. */
56051 field_addr.sub_location = plocation_elem_new(0);
56052#endif /* FREECIV_JSON_CONNECTION */
56053
56054 for (i = 0; i < O_LAST; i++) {
56055#ifdef FREECIV_JSON_CONNECTION
56056 /* Next array element. */
56057 field_addr.sub_location->number = i;
56058#endif /* FREECIV_JSON_CONNECTION */
56059 DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep[i]);
56060 }
56061
56062#ifdef FREECIV_JSON_CONNECTION
56063 /* Exit array. */
56064 free(field_addr.sub_location);
56065 field_addr.sub_location = NULL;
56066#endif /* FREECIV_JSON_CONNECTION */
56067 }
56068#ifdef FREECIV_JSON_CONNECTION
56069 field_addr.name = "paratroopers_range";
56070#endif /* FREECIV_JSON_CONNECTION */
56071 DIO_PUT(uint16, &dout, &field_addr, real_packet->paratroopers_range);
56072#ifdef FREECIV_JSON_CONNECTION
56073 field_addr.name = "veteran_levels";
56074#endif /* FREECIV_JSON_CONNECTION */
56075 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran_levels);
56076#ifdef FREECIV_JSON_CONNECTION
56077 field_addr.name = "veteran_name";
56078#endif /* FREECIV_JSON_CONNECTION */
56079
56080 {
56081 int i;
56082
56083#ifdef FREECIV_JSON_CONNECTION
56084 /* Create the array. */
56085 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
56086
56087 /* Enter the array. */
56088 field_addr.sub_location = plocation_elem_new(0);
56089#endif /* FREECIV_JSON_CONNECTION */
56090
56091 for (i = 0; i < real_packet->veteran_levels; i++) {
56092#ifdef FREECIV_JSON_CONNECTION
56093 /* Next array element. */
56094 field_addr.sub_location->number = i;
56095#endif /* FREECIV_JSON_CONNECTION */
56096 DIO_PUT(string, &dout, &field_addr, real_packet->veteran_name[i]);
56097 }
56098
56099#ifdef FREECIV_JSON_CONNECTION
56100 /* Exit array. */
56101 free(field_addr.sub_location);
56102 field_addr.sub_location = NULL;
56103#endif /* FREECIV_JSON_CONNECTION */
56104 }
56105#ifdef FREECIV_JSON_CONNECTION
56106 field_addr.name = "power_fact";
56107#endif /* FREECIV_JSON_CONNECTION */
56108
56109 {
56110 int i;
56111
56112#ifdef FREECIV_JSON_CONNECTION
56113 /* Create the array. */
56114 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
56115
56116 /* Enter the array. */
56117 field_addr.sub_location = plocation_elem_new(0);
56118#endif /* FREECIV_JSON_CONNECTION */
56119
56120 for (i = 0; i < real_packet->veteran_levels; i++) {
56121#ifdef FREECIV_JSON_CONNECTION
56122 /* Next array element. */
56123 field_addr.sub_location->number = i;
56124#endif /* FREECIV_JSON_CONNECTION */
56125 DIO_PUT(uint16, &dout, &field_addr, real_packet->power_fact[i]);
56126 }
56127
56128#ifdef FREECIV_JSON_CONNECTION
56129 /* Exit array. */
56130 free(field_addr.sub_location);
56131 field_addr.sub_location = NULL;
56132#endif /* FREECIV_JSON_CONNECTION */
56133 }
56134#ifdef FREECIV_JSON_CONNECTION
56135 field_addr.name = "move_bonus";
56136#endif /* FREECIV_JSON_CONNECTION */
56137
56138 {
56139 int i;
56140
56141#ifdef FREECIV_JSON_CONNECTION
56142 /* Create the array. */
56143 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
56144
56145 /* Enter the array. */
56146 field_addr.sub_location = plocation_elem_new(0);
56147#endif /* FREECIV_JSON_CONNECTION */
56148
56149 for (i = 0; i < real_packet->veteran_levels; i++) {
56150#ifdef FREECIV_JSON_CONNECTION
56151 /* Next array element. */
56152 field_addr.sub_location->number = i;
56153#endif /* FREECIV_JSON_CONNECTION */
56154 DIO_PUT(uint32, &dout, &field_addr, real_packet->move_bonus[i]);
56155 }
56156
56157#ifdef FREECIV_JSON_CONNECTION
56158 /* Exit array. */
56159 free(field_addr.sub_location);
56160 field_addr.sub_location = NULL;
56161#endif /* FREECIV_JSON_CONNECTION */
56162 }
56163#ifdef FREECIV_JSON_CONNECTION
56164 field_addr.name = "base_raise_chance";
56165#endif /* FREECIV_JSON_CONNECTION */
56166
56167 {
56168 int i;
56169
56170#ifdef FREECIV_JSON_CONNECTION
56171 /* Create the array. */
56172 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
56173
56174 /* Enter the array. */
56175 field_addr.sub_location = plocation_elem_new(0);
56176#endif /* FREECIV_JSON_CONNECTION */
56177
56178 for (i = 0; i < real_packet->veteran_levels; i++) {
56179#ifdef FREECIV_JSON_CONNECTION
56180 /* Next array element. */
56181 field_addr.sub_location->number = i;
56182#endif /* FREECIV_JSON_CONNECTION */
56183 DIO_PUT(uint8, &dout, &field_addr, real_packet->base_raise_chance[i]);
56184 }
56185
56186#ifdef FREECIV_JSON_CONNECTION
56187 /* Exit array. */
56188 free(field_addr.sub_location);
56189 field_addr.sub_location = NULL;
56190#endif /* FREECIV_JSON_CONNECTION */
56191 }
56192#ifdef FREECIV_JSON_CONNECTION
56193 field_addr.name = "work_raise_chance";
56194#endif /* FREECIV_JSON_CONNECTION */
56195
56196 {
56197 int i;
56198
56199#ifdef FREECIV_JSON_CONNECTION
56200 /* Create the array. */
56201 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
56202
56203 /* Enter the array. */
56204 field_addr.sub_location = plocation_elem_new(0);
56205#endif /* FREECIV_JSON_CONNECTION */
56206
56207 for (i = 0; i < real_packet->veteran_levels; i++) {
56208#ifdef FREECIV_JSON_CONNECTION
56209 /* Next array element. */
56210 field_addr.sub_location->number = i;
56211#endif /* FREECIV_JSON_CONNECTION */
56212 DIO_PUT(uint8, &dout, &field_addr, real_packet->work_raise_chance[i]);
56213 }
56214
56215#ifdef FREECIV_JSON_CONNECTION
56216 /* Exit array. */
56217 free(field_addr.sub_location);
56218 field_addr.sub_location = NULL;
56219#endif /* FREECIV_JSON_CONNECTION */
56220 }
56221#ifdef FREECIV_JSON_CONNECTION
56222 field_addr.name = "bombard_rate";
56223#endif /* FREECIV_JSON_CONNECTION */
56224 DIO_PUT(uint8, &dout, &field_addr, real_packet->bombard_rate);
56225#ifdef FREECIV_JSON_CONNECTION
56226 field_addr.name = "city_size";
56227#endif /* FREECIV_JSON_CONNECTION */
56228 DIO_PUT(uint8, &dout, &field_addr, real_packet->city_size);
56229#ifdef FREECIV_JSON_CONNECTION
56230 field_addr.name = "city_slots";
56231#endif /* FREECIV_JSON_CONNECTION */
56232 DIO_PUT(uint8, &dout, &field_addr, real_packet->city_slots);
56233#ifdef FREECIV_JSON_CONNECTION
56234 field_addr.name = "tp_defense";
56235#endif /* FREECIV_JSON_CONNECTION */
56236 DIO_PUT(uint8, &dout, &field_addr, real_packet->tp_defense);
56237#ifdef FREECIV_JSON_CONNECTION
56238 field_addr.name = "cargo";
56239#endif /* FREECIV_JSON_CONNECTION */
56240 DIO_BV_PUT(&dout, &field_addr, packet->cargo);
56241#ifdef FREECIV_JSON_CONNECTION
56242 field_addr.name = "targets";
56243#endif /* FREECIV_JSON_CONNECTION */
56244 DIO_BV_PUT(&dout, &field_addr, packet->targets);
56245#ifdef FREECIV_JSON_CONNECTION
56246 field_addr.name = "embarks";
56247#endif /* FREECIV_JSON_CONNECTION */
56248 DIO_BV_PUT(&dout, &field_addr, packet->embarks);
56249#ifdef FREECIV_JSON_CONNECTION
56250 field_addr.name = "disembarks";
56251#endif /* FREECIV_JSON_CONNECTION */
56252 DIO_BV_PUT(&dout, &field_addr, packet->disembarks);
56253#ifdef FREECIV_JSON_CONNECTION
56254 field_addr.name = "vlayer";
56255#endif /* FREECIV_JSON_CONNECTION */
56256 DIO_PUT(uint8, &dout, &field_addr, real_packet->vlayer);
56257#ifdef FREECIV_JSON_CONNECTION
56258 field_addr.name = "helptext";
56259#endif /* FREECIV_JSON_CONNECTION */
56260 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
56261#ifdef FREECIV_JSON_CONNECTION
56262 field_addr.name = "flags";
56263#endif /* FREECIV_JSON_CONNECTION */
56264 DIO_BV_PUT(&dout, &field_addr, packet->flags);
56265#ifdef FREECIV_JSON_CONNECTION
56266 field_addr.name = "roles";
56267#endif /* FREECIV_JSON_CONNECTION */
56268 DIO_BV_PUT(&dout, &field_addr, packet->roles);
56269#ifdef FREECIV_JSON_CONNECTION
56270 field_addr.name = "worker";
56271#endif /* FREECIV_JSON_CONNECTION */
56272 DIO_PUT(bool8, &dout, &field_addr, real_packet->worker);
56273
56274#endif
56275 SEND_PACKET_END(PACKET_RULESET_UNIT);
56276}
56277
56278 int send_packet_ruleset_unit(struct connection *pc, const struct packet_ruleset_unit *packet)
56279{
56280 if (!pc->used) {
56281 log_error("WARNING: trying to send data to the closed connection %s",
56282 conn_description(pc));
56283 return -1;
56284 }
56285 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT].packet != NULL, -1,
56286 "Handler for PACKET_RULESET_UNIT not installed");
56287 return pc->phs.handlers->send[PACKET_RULESET_UNIT].packet(pc, packet);
56288}
56289
56290 void lsend_packet_ruleset_unit(struct conn_list *dest, const struct packet_ruleset_unit *packet)
56291{
56292 conn_list_iterate(dest, pconn) {
56293 send_packet_ruleset_unit(pconn, packet);
56294 } conn_list_iterate_end;
56295}
56296
56297#ifdef FREECIV_DELTA_PROTOCOL
56298#define hash_packet_ruleset_unit_bonus_100 hash_const
56299
56300#define cmp_packet_ruleset_unit_bonus_100 cmp_const
56301
56302 BV_DEFINE(packet_ruleset_unit_bonus_100_fields, 5);
56303#endif /* FREECIV_DELTA_PROTOCOL */
56304
56305 static struct packet_ruleset_unit_bonus *receive_packet_ruleset_unit_bonus_100(struct connection *pc)
56306{
56307#ifdef FREECIV_DELTA_PROTOCOL
56308 packet_ruleset_unit_bonus_100_fields fields;
56309 struct packet_ruleset_unit_bonus *old;
56310 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT_BONUS;
56311#endif /* FREECIV_DELTA_PROTOCOL */
56312 RECEIVE_PACKET_START(packet_ruleset_unit_bonus, real_packet);
56313#ifdef FREECIV_JSON_CONNECTION
56314 struct plocation field_addr;
56315 {
56316 struct plocation *field_addr_tmp = plocation_field_new(NULL);
56317 field_addr = *field_addr_tmp;
56318 FC_FREE(field_addr_tmp);
56319 }
56320#endif /* FREECIV_JSON_CONNECTION */
56321
56322#ifdef FREECIV_DELTA_PROTOCOL
56323#ifdef FREECIV_JSON_CONNECTION
56324 field_addr.name = "fields";
56325#endif /* FREECIV_JSON_CONNECTION */
56326 DIO_BV_GET(&din, &field_addr, fields);
56327
56328#else /* FREECIV_DELTA_PROTOCOL */
56329 #ifdef FREECIV_JSON_CONNECTION
56330 field_addr.name = "unit";
56331 #endif /* FREECIV_JSON_CONNECTION */
56332 {
56333 int readin;
56334
56335 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
56336 RECEIVE_PACKET_FIELD_ERROR(unit);
56337 }
56338 real_packet->unit = readin;
56339 }
56340 #ifdef FREECIV_JSON_CONNECTION
56341 field_addr.name = "flag";
56342 #endif /* FREECIV_JSON_CONNECTION */
56343 {
56344 int readin;
56345
56346 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
56347 RECEIVE_PACKET_FIELD_ERROR(flag);
56348 }
56349 real_packet->flag = readin;
56350 }
56351 #ifdef FREECIV_JSON_CONNECTION
56352 field_addr.name = "type";
56353 #endif /* FREECIV_JSON_CONNECTION */
56354 {
56355 int readin;
56356
56357 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
56358 RECEIVE_PACKET_FIELD_ERROR(type);
56359 }
56360 real_packet->type = readin;
56361 }
56362 #ifdef FREECIV_JSON_CONNECTION
56363 field_addr.name = "value";
56364 #endif /* FREECIV_JSON_CONNECTION */
56365 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->value)) {
56366 RECEIVE_PACKET_FIELD_ERROR(value);
56367 }
56368 #ifdef FREECIV_JSON_CONNECTION
56369 field_addr.name = "quiet";
56370 #endif /* FREECIV_JSON_CONNECTION */
56371 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->quiet)) {
56372 RECEIVE_PACKET_FIELD_ERROR(quiet);
56373 }
56374
56375#endif
56376 log_packet_detailed("packet_ruleset_unit_bonus_100: got info about ()");
56377
56378#ifdef FREECIV_DELTA_PROTOCOL
56379 if (NULL == *hash) {
56380 *hash = genhash_new_full(hash_packet_ruleset_unit_bonus_100, cmp_packet_ruleset_unit_bonus_100,
56381 NULL, NULL, NULL, free);
56382 }
56383
56384 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
56385 *real_packet = *old;
56386 } else {
56387 log_packet_detailed(" no old info");
56388 memset(real_packet, 0, sizeof(*real_packet));
56389 }
56390
56391 if (BV_ISSET(fields, 0)) {
56392 log_packet_detailed(" got field 'unit'");
56393 #ifdef FREECIV_JSON_CONNECTION
56394 field_addr.name = "unit";
56395 #endif /* FREECIV_JSON_CONNECTION */
56396 {
56397 int readin;
56398
56399 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
56400 RECEIVE_PACKET_FIELD_ERROR(unit);
56401 }
56402 real_packet->unit = readin;
56403 }
56404 }
56405 if (BV_ISSET(fields, 1)) {
56406 log_packet_detailed(" got field 'flag'");
56407 #ifdef FREECIV_JSON_CONNECTION
56408 field_addr.name = "flag";
56409 #endif /* FREECIV_JSON_CONNECTION */
56410 {
56411 int readin;
56412
56413 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
56414 RECEIVE_PACKET_FIELD_ERROR(flag);
56415 }
56416 real_packet->flag = readin;
56417 }
56418 }
56419 if (BV_ISSET(fields, 2)) {
56420 log_packet_detailed(" got field 'type'");
56421 #ifdef FREECIV_JSON_CONNECTION
56422 field_addr.name = "type";
56423 #endif /* FREECIV_JSON_CONNECTION */
56424 {
56425 int readin;
56426
56427 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
56428 RECEIVE_PACKET_FIELD_ERROR(type);
56429 }
56430 real_packet->type = readin;
56431 }
56432 }
56433 if (BV_ISSET(fields, 3)) {
56434 log_packet_detailed(" got field 'value'");
56435 #ifdef FREECIV_JSON_CONNECTION
56436 field_addr.name = "value";
56437 #endif /* FREECIV_JSON_CONNECTION */
56438 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->value)) {
56439 RECEIVE_PACKET_FIELD_ERROR(value);
56440 }
56441 }
56442 real_packet->quiet = BV_ISSET(fields, 4);
56443
56444 if (NULL == old) {
56445 old = fc_malloc(sizeof(*old));
56446 *old = *real_packet;
56447 genhash_insert(*hash, old, old);
56448 } else {
56449 *old = *real_packet;
56450 }
56451
56452#endif /* FREECIV_DELTA_PROTOCOL */
56453 RECEIVE_PACKET_END(real_packet);
56454}
56455
56456 static int send_packet_ruleset_unit_bonus_100(struct connection *pc, const struct packet_ruleset_unit_bonus *packet)
56457{
56458 const struct packet_ruleset_unit_bonus *real_packet = packet;
56459#ifdef FREECIV_DELTA_PROTOCOL
56460 packet_ruleset_unit_bonus_100_fields fields;
56461 struct packet_ruleset_unit_bonus *old;
56462 bool differ;
56463 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT_BONUS;
56464#endif /* FREECIV_DELTA_PROTOCOL */
56465 SEND_PACKET_START(PACKET_RULESET_UNIT_BONUS);
56466#ifdef FREECIV_JSON_CONNECTION
56467 struct plocation field_addr;
56468 {
56469 struct plocation *field_addr_tmp = plocation_field_new(NULL);
56470 field_addr = *field_addr_tmp;
56471 FC_FREE(field_addr_tmp);
56472 }
56473#endif /* FREECIV_JSON_CONNECTION */
56474
56475 log_packet_detailed("packet_ruleset_unit_bonus_100: sending info about ()");
56476
56477#ifdef FREECIV_DELTA_PROTOCOL
56478 if (NULL == *hash) {
56479 *hash = genhash_new_full(hash_packet_ruleset_unit_bonus_100, cmp_packet_ruleset_unit_bonus_100,
56480 NULL, NULL, NULL, free);
56481 }
56482 BV_CLR_ALL(fields);
56483
56484 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
56485 old = fc_malloc(sizeof(*old));
56486 *old = *real_packet;
56487 genhash_insert(*hash, old, old);
56488 memset(old, 0, sizeof(*old));
56489 }
56490 differ = (old->unit != real_packet->unit);
56491 if (differ) {
56492 BV_SET(fields, 0);
56493 }
56494
56495 differ = (old->flag != real_packet->flag);
56496 if (differ) {
56497 BV_SET(fields, 1);
56498 }
56499
56500 differ = (old->type != real_packet->type);
56501 if (differ) {
56502 BV_SET(fields, 2);
56503 }
56504
56505 differ = (old->value != real_packet->value);
56506 if (differ) {
56507 BV_SET(fields, 3);
56508 }
56509
56510 if (packet->quiet) {
56511 BV_SET(fields, 4);
56512 }
56513
56514
56515#ifdef FREECIV_JSON_CONNECTION
56516 field_addr.name = "fields";
56517#endif /* FREECIV_JSON_CONNECTION */
56518 DIO_BV_PUT(&dout, &field_addr, fields);
56519
56520 if (BV_ISSET(fields, 0)) {
56521 log_packet_detailed(" field 'unit' has changed");
56522 #ifdef FREECIV_JSON_CONNECTION
56523 field_addr.name = "unit";
56524#endif /* FREECIV_JSON_CONNECTION */
56525 DIO_PUT(uint8, &dout, &field_addr, real_packet->unit);
56526 }
56527 if (BV_ISSET(fields, 1)) {
56528 log_packet_detailed(" field 'flag' has changed");
56529 #ifdef FREECIV_JSON_CONNECTION
56530 field_addr.name = "flag";
56531#endif /* FREECIV_JSON_CONNECTION */
56532 DIO_PUT(uint8, &dout, &field_addr, real_packet->flag);
56533 }
56534 if (BV_ISSET(fields, 2)) {
56535 log_packet_detailed(" field 'type' has changed");
56536 #ifdef FREECIV_JSON_CONNECTION
56537 field_addr.name = "type";
56538#endif /* FREECIV_JSON_CONNECTION */
56539 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
56540 }
56541 if (BV_ISSET(fields, 3)) {
56542 log_packet_detailed(" field 'value' has changed");
56543 #ifdef FREECIV_JSON_CONNECTION
56544 field_addr.name = "value";
56545#endif /* FREECIV_JSON_CONNECTION */
56546 DIO_PUT(sint16, &dout, &field_addr, real_packet->value);
56547 }
56548 /* field 4 is folded into the header */
56549
56550 *old = *real_packet;
56551#endif /* FREECIV_DELTA_PROTOCOL */
56552#ifndef FREECIV_DELTA_PROTOCOL
56553#ifdef FREECIV_JSON_CONNECTION
56554 field_addr.name = "unit";
56555#endif /* FREECIV_JSON_CONNECTION */
56556 DIO_PUT(uint8, &dout, &field_addr, real_packet->unit);
56557#ifdef FREECIV_JSON_CONNECTION
56558 field_addr.name = "flag";
56559#endif /* FREECIV_JSON_CONNECTION */
56560 DIO_PUT(uint8, &dout, &field_addr, real_packet->flag);
56561#ifdef FREECIV_JSON_CONNECTION
56562 field_addr.name = "type";
56563#endif /* FREECIV_JSON_CONNECTION */
56564 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
56565#ifdef FREECIV_JSON_CONNECTION
56566 field_addr.name = "value";
56567#endif /* FREECIV_JSON_CONNECTION */
56568 DIO_PUT(sint16, &dout, &field_addr, real_packet->value);
56569#ifdef FREECIV_JSON_CONNECTION
56570 field_addr.name = "quiet";
56571#endif /* FREECIV_JSON_CONNECTION */
56572 DIO_PUT(bool8, &dout, &field_addr, real_packet->quiet);
56573
56574#endif
56575 SEND_PACKET_END(PACKET_RULESET_UNIT_BONUS);
56576}
56577
56578 int send_packet_ruleset_unit_bonus(struct connection *pc, const struct packet_ruleset_unit_bonus *packet)
56579{
56580 if (!pc->used) {
56581 log_error("WARNING: trying to send data to the closed connection %s",
56582 conn_description(pc));
56583 return -1;
56584 }
56585 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT_BONUS].packet != NULL, -1,
56586 "Handler for PACKET_RULESET_UNIT_BONUS not installed");
56587 return pc->phs.handlers->send[PACKET_RULESET_UNIT_BONUS].packet(pc, packet);
56588}
56589
56590 void lsend_packet_ruleset_unit_bonus(struct conn_list *dest, const struct packet_ruleset_unit_bonus *packet)
56591{
56592 conn_list_iterate(dest, pconn) {
56593 send_packet_ruleset_unit_bonus(pconn, packet);
56594 } conn_list_iterate_end;
56595}
56596
56597#ifdef FREECIV_DELTA_PROTOCOL
56598#define hash_packet_ruleset_unit_flag_100 hash_const
56599
56600#define cmp_packet_ruleset_unit_flag_100 cmp_const
56601
56602 BV_DEFINE(packet_ruleset_unit_flag_100_fields, 3);
56603#endif /* FREECIV_DELTA_PROTOCOL */
56604
56605 static struct packet_ruleset_unit_flag *receive_packet_ruleset_unit_flag_100(struct connection *pc)
56606{
56607#ifdef FREECIV_DELTA_PROTOCOL
56608 packet_ruleset_unit_flag_100_fields fields;
56609 struct packet_ruleset_unit_flag *old;
56610 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT_FLAG;
56611#endif /* FREECIV_DELTA_PROTOCOL */
56612 RECEIVE_PACKET_START(packet_ruleset_unit_flag, real_packet);
56613#ifdef FREECIV_JSON_CONNECTION
56614 struct plocation field_addr;
56615 {
56616 struct plocation *field_addr_tmp = plocation_field_new(NULL);
56617 field_addr = *field_addr_tmp;
56618 FC_FREE(field_addr_tmp);
56619 }
56620#endif /* FREECIV_JSON_CONNECTION */
56621
56622#ifdef FREECIV_DELTA_PROTOCOL
56623#ifdef FREECIV_JSON_CONNECTION
56624 field_addr.name = "fields";
56625#endif /* FREECIV_JSON_CONNECTION */
56626 DIO_BV_GET(&din, &field_addr, fields);
56627
56628#else /* FREECIV_DELTA_PROTOCOL */
56629 #ifdef FREECIV_JSON_CONNECTION
56630 field_addr.name = "id";
56631 #endif /* FREECIV_JSON_CONNECTION */
56632 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
56633 RECEIVE_PACKET_FIELD_ERROR(id);
56634 }
56635 #ifdef FREECIV_JSON_CONNECTION
56636 field_addr.name = "name";
56637 #endif /* FREECIV_JSON_CONNECTION */
56638 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
56639 RECEIVE_PACKET_FIELD_ERROR(name);
56640 }
56641 #ifdef FREECIV_JSON_CONNECTION
56642 field_addr.name = "helptxt";
56643 #endif /* FREECIV_JSON_CONNECTION */
56644 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
56645 RECEIVE_PACKET_FIELD_ERROR(helptxt);
56646 }
56647
56648#endif
56649 log_packet_detailed("packet_ruleset_unit_flag_100: got info about ()");
56650
56651#ifdef FREECIV_DELTA_PROTOCOL
56652 if (NULL == *hash) {
56653 *hash = genhash_new_full(hash_packet_ruleset_unit_flag_100, cmp_packet_ruleset_unit_flag_100,
56654 NULL, NULL, NULL, free);
56655 }
56656
56657 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
56658 *real_packet = *old;
56659 } else {
56660 log_packet_detailed(" no old info");
56661 memset(real_packet, 0, sizeof(*real_packet));
56662 }
56663
56664 if (BV_ISSET(fields, 0)) {
56665 log_packet_detailed(" got field 'id'");
56666 #ifdef FREECIV_JSON_CONNECTION
56667 field_addr.name = "id";
56668 #endif /* FREECIV_JSON_CONNECTION */
56669 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
56670 RECEIVE_PACKET_FIELD_ERROR(id);
56671 }
56672 }
56673 if (BV_ISSET(fields, 1)) {
56674 log_packet_detailed(" got field 'name'");
56675 #ifdef FREECIV_JSON_CONNECTION
56676 field_addr.name = "name";
56677 #endif /* FREECIV_JSON_CONNECTION */
56678 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
56679 RECEIVE_PACKET_FIELD_ERROR(name);
56680 }
56681 }
56682 if (BV_ISSET(fields, 2)) {
56683 log_packet_detailed(" got field 'helptxt'");
56684 #ifdef FREECIV_JSON_CONNECTION
56685 field_addr.name = "helptxt";
56686 #endif /* FREECIV_JSON_CONNECTION */
56687 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
56688 RECEIVE_PACKET_FIELD_ERROR(helptxt);
56689 }
56690 }
56691
56692 if (NULL == old) {
56693 old = fc_malloc(sizeof(*old));
56694 *old = *real_packet;
56695 genhash_insert(*hash, old, old);
56696 } else {
56697 *old = *real_packet;
56698 }
56699
56700#endif /* FREECIV_DELTA_PROTOCOL */
56701 RECEIVE_PACKET_END(real_packet);
56702}
56703
56704 static int send_packet_ruleset_unit_flag_100(struct connection *pc, const struct packet_ruleset_unit_flag *packet)
56705{
56706 const struct packet_ruleset_unit_flag *real_packet = packet;
56707#ifdef FREECIV_DELTA_PROTOCOL
56708 packet_ruleset_unit_flag_100_fields fields;
56709 struct packet_ruleset_unit_flag *old;
56710 bool differ;
56711 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT_FLAG;
56712#endif /* FREECIV_DELTA_PROTOCOL */
56713 SEND_PACKET_START(PACKET_RULESET_UNIT_FLAG);
56714#ifdef FREECIV_JSON_CONNECTION
56715 struct plocation field_addr;
56716 {
56717 struct plocation *field_addr_tmp = plocation_field_new(NULL);
56718 field_addr = *field_addr_tmp;
56719 FC_FREE(field_addr_tmp);
56720 }
56721#endif /* FREECIV_JSON_CONNECTION */
56722
56723 log_packet_detailed("packet_ruleset_unit_flag_100: sending info about ()");
56724
56725#ifdef FREECIV_DELTA_PROTOCOL
56726 if (NULL == *hash) {
56727 *hash = genhash_new_full(hash_packet_ruleset_unit_flag_100, cmp_packet_ruleset_unit_flag_100,
56728 NULL, NULL, NULL, free);
56729 }
56730 BV_CLR_ALL(fields);
56731
56732 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
56733 old = fc_malloc(sizeof(*old));
56734 *old = *real_packet;
56735 genhash_insert(*hash, old, old);
56736 memset(old, 0, sizeof(*old));
56737 }
56738 differ = (old->id != real_packet->id);
56739 if (differ) {
56740 BV_SET(fields, 0);
56741 }
56742
56743 differ = (strcmp(old->name, real_packet->name) != 0);
56744 if (differ) {
56745 BV_SET(fields, 1);
56746 }
56747
56748 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
56749 if (differ) {
56750 BV_SET(fields, 2);
56751 }
56752
56753
56754#ifdef FREECIV_JSON_CONNECTION
56755 field_addr.name = "fields";
56756#endif /* FREECIV_JSON_CONNECTION */
56757 DIO_BV_PUT(&dout, &field_addr, fields);
56758
56759 if (BV_ISSET(fields, 0)) {
56760 log_packet_detailed(" field 'id' has changed");
56761 #ifdef FREECIV_JSON_CONNECTION
56762 field_addr.name = "id";
56763#endif /* FREECIV_JSON_CONNECTION */
56764 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
56765 }
56766 if (BV_ISSET(fields, 1)) {
56767 log_packet_detailed(" field 'name' has changed");
56768 #ifdef FREECIV_JSON_CONNECTION
56769 field_addr.name = "name";
56770#endif /* FREECIV_JSON_CONNECTION */
56771 DIO_PUT(string, &dout, &field_addr, real_packet->name);
56772 }
56773 if (BV_ISSET(fields, 2)) {
56774 log_packet_detailed(" field 'helptxt' has changed");
56775 #ifdef FREECIV_JSON_CONNECTION
56776 field_addr.name = "helptxt";
56777#endif /* FREECIV_JSON_CONNECTION */
56778 DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
56779 }
56780
56781 *old = *real_packet;
56782#endif /* FREECIV_DELTA_PROTOCOL */
56783#ifndef FREECIV_DELTA_PROTOCOL
56784#ifdef FREECIV_JSON_CONNECTION
56785 field_addr.name = "id";
56786#endif /* FREECIV_JSON_CONNECTION */
56787 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
56788#ifdef FREECIV_JSON_CONNECTION
56789 field_addr.name = "name";
56790#endif /* FREECIV_JSON_CONNECTION */
56791 DIO_PUT(string, &dout, &field_addr, real_packet->name);
56792#ifdef FREECIV_JSON_CONNECTION
56793 field_addr.name = "helptxt";
56794#endif /* FREECIV_JSON_CONNECTION */
56795 DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
56796
56797#endif
56798 SEND_PACKET_END(PACKET_RULESET_UNIT_FLAG);
56799}
56800
56801 int send_packet_ruleset_unit_flag(struct connection *pc, const struct packet_ruleset_unit_flag *packet)
56802{
56803 if (!pc->used) {
56804 log_error("WARNING: trying to send data to the closed connection %s",
56805 conn_description(pc));
56806 return -1;
56807 }
56808 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT_FLAG].packet != NULL, -1,
56809 "Handler for PACKET_RULESET_UNIT_FLAG not installed");
56810 return pc->phs.handlers->send[PACKET_RULESET_UNIT_FLAG].packet(pc, packet);
56811}
56812
56813 void lsend_packet_ruleset_unit_flag(struct conn_list *dest, const struct packet_ruleset_unit_flag *packet)
56814{
56815 conn_list_iterate(dest, pconn) {
56816 send_packet_ruleset_unit_flag(pconn, packet);
56817 } conn_list_iterate_end;
56818}
56819
56820#ifdef FREECIV_DELTA_PROTOCOL
56821#define hash_packet_ruleset_unit_class_flag_100 hash_const
56822
56823#define cmp_packet_ruleset_unit_class_flag_100 cmp_const
56824
56825 BV_DEFINE(packet_ruleset_unit_class_flag_100_fields, 3);
56826#endif /* FREECIV_DELTA_PROTOCOL */
56827
56828 static struct packet_ruleset_unit_class_flag *receive_packet_ruleset_unit_class_flag_100(struct connection *pc)
56829{
56830#ifdef FREECIV_DELTA_PROTOCOL
56831 packet_ruleset_unit_class_flag_100_fields fields;
56832 struct packet_ruleset_unit_class_flag *old;
56833 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT_CLASS_FLAG;
56834#endif /* FREECIV_DELTA_PROTOCOL */
56835 RECEIVE_PACKET_START(packet_ruleset_unit_class_flag, real_packet);
56836#ifdef FREECIV_JSON_CONNECTION
56837 struct plocation field_addr;
56838 {
56839 struct plocation *field_addr_tmp = plocation_field_new(NULL);
56840 field_addr = *field_addr_tmp;
56841 FC_FREE(field_addr_tmp);
56842 }
56843#endif /* FREECIV_JSON_CONNECTION */
56844
56845#ifdef FREECIV_DELTA_PROTOCOL
56846#ifdef FREECIV_JSON_CONNECTION
56847 field_addr.name = "fields";
56848#endif /* FREECIV_JSON_CONNECTION */
56849 DIO_BV_GET(&din, &field_addr, fields);
56850
56851#else /* FREECIV_DELTA_PROTOCOL */
56852 #ifdef FREECIV_JSON_CONNECTION
56853 field_addr.name = "id";
56854 #endif /* FREECIV_JSON_CONNECTION */
56855 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
56856 RECEIVE_PACKET_FIELD_ERROR(id);
56857 }
56858 #ifdef FREECIV_JSON_CONNECTION
56859 field_addr.name = "name";
56860 #endif /* FREECIV_JSON_CONNECTION */
56861 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
56862 RECEIVE_PACKET_FIELD_ERROR(name);
56863 }
56864 #ifdef FREECIV_JSON_CONNECTION
56865 field_addr.name = "helptxt";
56866 #endif /* FREECIV_JSON_CONNECTION */
56867 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
56868 RECEIVE_PACKET_FIELD_ERROR(helptxt);
56869 }
56870
56871#endif
56872 log_packet_detailed("packet_ruleset_unit_class_flag_100: got info about ()");
56873
56874#ifdef FREECIV_DELTA_PROTOCOL
56875 if (NULL == *hash) {
56876 *hash = genhash_new_full(hash_packet_ruleset_unit_class_flag_100, cmp_packet_ruleset_unit_class_flag_100,
56877 NULL, NULL, NULL, free);
56878 }
56879
56880 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
56881 *real_packet = *old;
56882 } else {
56883 log_packet_detailed(" no old info");
56884 memset(real_packet, 0, sizeof(*real_packet));
56885 }
56886
56887 if (BV_ISSET(fields, 0)) {
56888 log_packet_detailed(" got field 'id'");
56889 #ifdef FREECIV_JSON_CONNECTION
56890 field_addr.name = "id";
56891 #endif /* FREECIV_JSON_CONNECTION */
56892 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
56893 RECEIVE_PACKET_FIELD_ERROR(id);
56894 }
56895 }
56896 if (BV_ISSET(fields, 1)) {
56897 log_packet_detailed(" got field 'name'");
56898 #ifdef FREECIV_JSON_CONNECTION
56899 field_addr.name = "name";
56900 #endif /* FREECIV_JSON_CONNECTION */
56901 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
56902 RECEIVE_PACKET_FIELD_ERROR(name);
56903 }
56904 }
56905 if (BV_ISSET(fields, 2)) {
56906 log_packet_detailed(" got field 'helptxt'");
56907 #ifdef FREECIV_JSON_CONNECTION
56908 field_addr.name = "helptxt";
56909 #endif /* FREECIV_JSON_CONNECTION */
56910 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
56911 RECEIVE_PACKET_FIELD_ERROR(helptxt);
56912 }
56913 }
56914
56915 if (NULL == old) {
56916 old = fc_malloc(sizeof(*old));
56917 *old = *real_packet;
56918 genhash_insert(*hash, old, old);
56919 } else {
56920 *old = *real_packet;
56921 }
56922
56923#endif /* FREECIV_DELTA_PROTOCOL */
56924 RECEIVE_PACKET_END(real_packet);
56925}
56926
56927 static int send_packet_ruleset_unit_class_flag_100(struct connection *pc, const struct packet_ruleset_unit_class_flag *packet)
56928{
56929 const struct packet_ruleset_unit_class_flag *real_packet = packet;
56930#ifdef FREECIV_DELTA_PROTOCOL
56931 packet_ruleset_unit_class_flag_100_fields fields;
56932 struct packet_ruleset_unit_class_flag *old;
56933 bool differ;
56934 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT_CLASS_FLAG;
56935#endif /* FREECIV_DELTA_PROTOCOL */
56936 SEND_PACKET_START(PACKET_RULESET_UNIT_CLASS_FLAG);
56937#ifdef FREECIV_JSON_CONNECTION
56938 struct plocation field_addr;
56939 {
56940 struct plocation *field_addr_tmp = plocation_field_new(NULL);
56941 field_addr = *field_addr_tmp;
56942 FC_FREE(field_addr_tmp);
56943 }
56944#endif /* FREECIV_JSON_CONNECTION */
56945
56946 log_packet_detailed("packet_ruleset_unit_class_flag_100: sending info about ()");
56947
56948#ifdef FREECIV_DELTA_PROTOCOL
56949 if (NULL == *hash) {
56950 *hash = genhash_new_full(hash_packet_ruleset_unit_class_flag_100, cmp_packet_ruleset_unit_class_flag_100,
56951 NULL, NULL, NULL, free);
56952 }
56953 BV_CLR_ALL(fields);
56954
56955 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
56956 old = fc_malloc(sizeof(*old));
56957 *old = *real_packet;
56958 genhash_insert(*hash, old, old);
56959 memset(old, 0, sizeof(*old));
56960 }
56961 differ = (old->id != real_packet->id);
56962 if (differ) {
56963 BV_SET(fields, 0);
56964 }
56965
56966 differ = (strcmp(old->name, real_packet->name) != 0);
56967 if (differ) {
56968 BV_SET(fields, 1);
56969 }
56970
56971 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
56972 if (differ) {
56973 BV_SET(fields, 2);
56974 }
56975
56976
56977#ifdef FREECIV_JSON_CONNECTION
56978 field_addr.name = "fields";
56979#endif /* FREECIV_JSON_CONNECTION */
56980 DIO_BV_PUT(&dout, &field_addr, fields);
56981
56982 if (BV_ISSET(fields, 0)) {
56983 log_packet_detailed(" field 'id' has changed");
56984 #ifdef FREECIV_JSON_CONNECTION
56985 field_addr.name = "id";
56986#endif /* FREECIV_JSON_CONNECTION */
56987 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
56988 }
56989 if (BV_ISSET(fields, 1)) {
56990 log_packet_detailed(" field 'name' has changed");
56991 #ifdef FREECIV_JSON_CONNECTION
56992 field_addr.name = "name";
56993#endif /* FREECIV_JSON_CONNECTION */
56994 DIO_PUT(string, &dout, &field_addr, real_packet->name);
56995 }
56996 if (BV_ISSET(fields, 2)) {
56997 log_packet_detailed(" field 'helptxt' has changed");
56998 #ifdef FREECIV_JSON_CONNECTION
56999 field_addr.name = "helptxt";
57000#endif /* FREECIV_JSON_CONNECTION */
57001 DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
57002 }
57003
57004 *old = *real_packet;
57005#endif /* FREECIV_DELTA_PROTOCOL */
57006#ifndef FREECIV_DELTA_PROTOCOL
57007#ifdef FREECIV_JSON_CONNECTION
57008 field_addr.name = "id";
57009#endif /* FREECIV_JSON_CONNECTION */
57010 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
57011#ifdef FREECIV_JSON_CONNECTION
57012 field_addr.name = "name";
57013#endif /* FREECIV_JSON_CONNECTION */
57014 DIO_PUT(string, &dout, &field_addr, real_packet->name);
57015#ifdef FREECIV_JSON_CONNECTION
57016 field_addr.name = "helptxt";
57017#endif /* FREECIV_JSON_CONNECTION */
57018 DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
57019
57020#endif
57021 SEND_PACKET_END(PACKET_RULESET_UNIT_CLASS_FLAG);
57022}
57023
57024 int send_packet_ruleset_unit_class_flag(struct connection *pc, const struct packet_ruleset_unit_class_flag *packet)
57025{
57026 if (!pc->used) {
57027 log_error("WARNING: trying to send data to the closed connection %s",
57028 conn_description(pc));
57029 return -1;
57030 }
57031 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT_CLASS_FLAG].packet != NULL, -1,
57032 "Handler for PACKET_RULESET_UNIT_CLASS_FLAG not installed");
57033 return pc->phs.handlers->send[PACKET_RULESET_UNIT_CLASS_FLAG].packet(pc, packet);
57034}
57035
57036 void lsend_packet_ruleset_unit_class_flag(struct conn_list *dest, const struct packet_ruleset_unit_class_flag *packet)
57037{
57038 conn_list_iterate(dest, pconn) {
57039 send_packet_ruleset_unit_class_flag(pconn, packet);
57040 } conn_list_iterate_end;
57041}
57042
57043#ifdef FREECIV_DELTA_PROTOCOL
57044#define hash_packet_ruleset_game_100 hash_const
57045
57046#define cmp_packet_ruleset_game_100 cmp_const
57047
57048 BV_DEFINE(packet_ruleset_game_100_fields, 14);
57049#endif /* FREECIV_DELTA_PROTOCOL */
57050
57051 static struct packet_ruleset_game *receive_packet_ruleset_game_100(struct connection *pc)
57052{
57053#ifdef FREECIV_DELTA_PROTOCOL
57054 packet_ruleset_game_100_fields fields;
57055 struct packet_ruleset_game *old;
57056 struct genhash **hash = pc->phs.received + PACKET_RULESET_GAME;
57057#endif /* FREECIV_DELTA_PROTOCOL */
57058 RECEIVE_PACKET_START(packet_ruleset_game, real_packet);
57059#ifdef FREECIV_JSON_CONNECTION
57060 struct plocation field_addr;
57061 {
57062 struct plocation *field_addr_tmp = plocation_field_new(NULL);
57063 field_addr = *field_addr_tmp;
57064 FC_FREE(field_addr_tmp);
57065 }
57066#endif /* FREECIV_JSON_CONNECTION */
57067
57068#ifdef FREECIV_DELTA_PROTOCOL
57069#ifdef FREECIV_JSON_CONNECTION
57070 field_addr.name = "fields";
57071#endif /* FREECIV_JSON_CONNECTION */
57072 DIO_BV_GET(&din, &field_addr, fields);
57073
57074#else /* FREECIV_DELTA_PROTOCOL */
57075 #ifdef FREECIV_JSON_CONNECTION
57076 field_addr.name = "default_specialist";
57077 #endif /* FREECIV_JSON_CONNECTION */
57078 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->default_specialist)) {
57079 RECEIVE_PACKET_FIELD_ERROR(default_specialist);
57080 }
57081 #ifdef FREECIV_JSON_CONNECTION
57082 field_addr.name = "global_init_techs_count";
57083 #endif /* FREECIV_JSON_CONNECTION */
57084 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->global_init_techs_count)) {
57085 RECEIVE_PACKET_FIELD_ERROR(global_init_techs_count);
57086 }
57087 #ifdef FREECIV_JSON_CONNECTION
57088 field_addr.name = "global_init_techs";
57089 #endif /* FREECIV_JSON_CONNECTION */
57090
57091 {
57092 int i;
57093
57094 #ifdef FREECIV_JSON_CONNECTION
57095 /* Enter array. */
57096 field_addr.sub_location = plocation_elem_new(0);
57097 #endif /* FREECIV_JSON_CONNECTION */
57098
57099 if (real_packet->global_init_techs_count > MAX_NUM_TECH_LIST) {
57100 RECEIVE_PACKET_FIELD_ERROR(global_init_techs, ": truncation array");
57101 }
57102 for (i = 0; i < real_packet->global_init_techs_count; i++) {
57103 #ifdef FREECIV_JSON_CONNECTION
57104 field_addr.sub_location->number = i;
57105 #endif /* FREECIV_JSON_CONNECTION */
57106 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->global_init_techs[i])) {
57107 RECEIVE_PACKET_FIELD_ERROR(global_init_techs);
57108 }
57109 }
57110
57111 #ifdef FREECIV_JSON_CONNECTION
57112 /* Exit array. */
57113 free(field_addr.sub_location);
57114 field_addr.sub_location = NULL;
57115 #endif /* FREECIV_JSON_CONNECTION */
57116 }
57117 #ifdef FREECIV_JSON_CONNECTION
57118 field_addr.name = "global_init_buildings_count";
57119 #endif /* FREECIV_JSON_CONNECTION */
57120 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->global_init_buildings_count)) {
57121 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings_count);
57122 }
57123 #ifdef FREECIV_JSON_CONNECTION
57124 field_addr.name = "global_init_buildings";
57125 #endif /* FREECIV_JSON_CONNECTION */
57126
57127 {
57128 int i;
57129
57130 #ifdef FREECIV_JSON_CONNECTION
57131 /* Enter array. */
57132 field_addr.sub_location = plocation_elem_new(0);
57133 #endif /* FREECIV_JSON_CONNECTION */
57134
57135 if (real_packet->global_init_buildings_count > MAX_NUM_BUILDING_LIST) {
57136 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings, ": truncation array");
57137 }
57138 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
57139 #ifdef FREECIV_JSON_CONNECTION
57140 field_addr.sub_location->number = i;
57141 #endif /* FREECIV_JSON_CONNECTION */
57142 {
57143 int readin;
57144
57145 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
57146 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings);
57147 }
57148 real_packet->global_init_buildings[i] = readin;
57149 }
57150 }
57151
57152 #ifdef FREECIV_JSON_CONNECTION
57153 /* Exit array. */
57154 free(field_addr.sub_location);
57155 field_addr.sub_location = NULL;
57156 #endif /* FREECIV_JSON_CONNECTION */
57157 }
57158 #ifdef FREECIV_JSON_CONNECTION
57159 field_addr.name = "veteran_levels";
57160 #endif /* FREECIV_JSON_CONNECTION */
57161 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran_levels)) {
57162 RECEIVE_PACKET_FIELD_ERROR(veteran_levels);
57163 }
57164 #ifdef FREECIV_JSON_CONNECTION
57165 field_addr.name = "veteran_name";
57166 #endif /* FREECIV_JSON_CONNECTION */
57167
57168 {
57169 int i;
57170
57171 #ifdef FREECIV_JSON_CONNECTION
57172 /* Enter array. */
57173 field_addr.sub_location = plocation_elem_new(0);
57174 #endif /* FREECIV_JSON_CONNECTION */
57175
57176 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
57177 RECEIVE_PACKET_FIELD_ERROR(veteran_name, ": truncation array");
57178 }
57179 for (i = 0; i < real_packet->veteran_levels; i++) {
57180 #ifdef FREECIV_JSON_CONNECTION
57181 field_addr.sub_location->number = i;
57182 #endif /* FREECIV_JSON_CONNECTION */
57183 if (!DIO_GET(string, &din, &field_addr, real_packet->veteran_name[i], sizeof(real_packet->veteran_name[i]))) {
57184 RECEIVE_PACKET_FIELD_ERROR(veteran_name);
57185 }
57186 }
57187
57188 #ifdef FREECIV_JSON_CONNECTION
57189 /* Exit array. */
57190 free(field_addr.sub_location);
57191 field_addr.sub_location = NULL;
57192 #endif /* FREECIV_JSON_CONNECTION */
57193 }
57194 #ifdef FREECIV_JSON_CONNECTION
57195 field_addr.name = "power_fact";
57196 #endif /* FREECIV_JSON_CONNECTION */
57197
57198 {
57199 int i;
57200
57201 #ifdef FREECIV_JSON_CONNECTION
57202 /* Enter array. */
57203 field_addr.sub_location = plocation_elem_new(0);
57204 #endif /* FREECIV_JSON_CONNECTION */
57205
57206 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
57207 RECEIVE_PACKET_FIELD_ERROR(power_fact, ": truncation array");
57208 }
57209 for (i = 0; i < real_packet->veteran_levels; i++) {
57210 #ifdef FREECIV_JSON_CONNECTION
57211 field_addr.sub_location->number = i;
57212 #endif /* FREECIV_JSON_CONNECTION */
57213 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->power_fact[i])) {
57214 RECEIVE_PACKET_FIELD_ERROR(power_fact);
57215 }
57216 }
57217
57218 #ifdef FREECIV_JSON_CONNECTION
57219 /* Exit array. */
57220 free(field_addr.sub_location);
57221 field_addr.sub_location = NULL;
57222 #endif /* FREECIV_JSON_CONNECTION */
57223 }
57224 #ifdef FREECIV_JSON_CONNECTION
57225 field_addr.name = "move_bonus";
57226 #endif /* FREECIV_JSON_CONNECTION */
57227
57228 {
57229 int i;
57230
57231 #ifdef FREECIV_JSON_CONNECTION
57232 /* Enter array. */
57233 field_addr.sub_location = plocation_elem_new(0);
57234 #endif /* FREECIV_JSON_CONNECTION */
57235
57236 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
57237 RECEIVE_PACKET_FIELD_ERROR(move_bonus, ": truncation array");
57238 }
57239 for (i = 0; i < real_packet->veteran_levels; i++) {
57240 #ifdef FREECIV_JSON_CONNECTION
57241 field_addr.sub_location->number = i;
57242 #endif /* FREECIV_JSON_CONNECTION */
57243 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_bonus[i])) {
57244 RECEIVE_PACKET_FIELD_ERROR(move_bonus);
57245 }
57246 }
57247
57248 #ifdef FREECIV_JSON_CONNECTION
57249 /* Exit array. */
57250 free(field_addr.sub_location);
57251 field_addr.sub_location = NULL;
57252 #endif /* FREECIV_JSON_CONNECTION */
57253 }
57254 #ifdef FREECIV_JSON_CONNECTION
57255 field_addr.name = "base_raise_chance";
57256 #endif /* FREECIV_JSON_CONNECTION */
57257
57258 {
57259 int i;
57260
57261 #ifdef FREECIV_JSON_CONNECTION
57262 /* Enter array. */
57263 field_addr.sub_location = plocation_elem_new(0);
57264 #endif /* FREECIV_JSON_CONNECTION */
57265
57266 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
57267 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance, ": truncation array");
57268 }
57269 for (i = 0; i < real_packet->veteran_levels; i++) {
57270 #ifdef FREECIV_JSON_CONNECTION
57271 field_addr.sub_location->number = i;
57272 #endif /* FREECIV_JSON_CONNECTION */
57273 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_raise_chance[i])) {
57274 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance);
57275 }
57276 }
57277
57278 #ifdef FREECIV_JSON_CONNECTION
57279 /* Exit array. */
57280 free(field_addr.sub_location);
57281 field_addr.sub_location = NULL;
57282 #endif /* FREECIV_JSON_CONNECTION */
57283 }
57284 #ifdef FREECIV_JSON_CONNECTION
57285 field_addr.name = "work_raise_chance";
57286 #endif /* FREECIV_JSON_CONNECTION */
57287
57288 {
57289 int i;
57290
57291 #ifdef FREECIV_JSON_CONNECTION
57292 /* Enter array. */
57293 field_addr.sub_location = plocation_elem_new(0);
57294 #endif /* FREECIV_JSON_CONNECTION */
57295
57296 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
57297 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance, ": truncation array");
57298 }
57299 for (i = 0; i < real_packet->veteran_levels; i++) {
57300 #ifdef FREECIV_JSON_CONNECTION
57301 field_addr.sub_location->number = i;
57302 #endif /* FREECIV_JSON_CONNECTION */
57303 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->work_raise_chance[i])) {
57304 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance);
57305 }
57306 }
57307
57308 #ifdef FREECIV_JSON_CONNECTION
57309 /* Exit array. */
57310 free(field_addr.sub_location);
57311 field_addr.sub_location = NULL;
57312 #endif /* FREECIV_JSON_CONNECTION */
57313 }
57314 #ifdef FREECIV_JSON_CONNECTION
57315 field_addr.name = "background_red";
57316 #endif /* FREECIV_JSON_CONNECTION */
57317 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_red)) {
57318 RECEIVE_PACKET_FIELD_ERROR(background_red);
57319 }
57320 #ifdef FREECIV_JSON_CONNECTION
57321 field_addr.name = "background_green";
57322 #endif /* FREECIV_JSON_CONNECTION */
57323 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_green)) {
57324 RECEIVE_PACKET_FIELD_ERROR(background_green);
57325 }
57326 #ifdef FREECIV_JSON_CONNECTION
57327 field_addr.name = "background_blue";
57328 #endif /* FREECIV_JSON_CONNECTION */
57329 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_blue)) {
57330 RECEIVE_PACKET_FIELD_ERROR(background_blue);
57331 }
57332
57333#endif
57334 log_packet_detailed("packet_ruleset_game_100: got info about ()");
57335
57336#ifdef FREECIV_DELTA_PROTOCOL
57337 if (NULL == *hash) {
57338 *hash = genhash_new_full(hash_packet_ruleset_game_100, cmp_packet_ruleset_game_100,
57339 NULL, NULL, NULL, free);
57340 }
57341
57342 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
57343 *real_packet = *old;
57344 } else {
57345 log_packet_detailed(" no old info");
57346 memset(real_packet, 0, sizeof(*real_packet));
57347 }
57348
57349 if (BV_ISSET(fields, 0)) {
57350 log_packet_detailed(" got field 'default_specialist'");
57351 #ifdef FREECIV_JSON_CONNECTION
57352 field_addr.name = "default_specialist";
57353 #endif /* FREECIV_JSON_CONNECTION */
57354 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->default_specialist)) {
57355 RECEIVE_PACKET_FIELD_ERROR(default_specialist);
57356 }
57357 }
57358 if (BV_ISSET(fields, 1)) {
57359 log_packet_detailed(" got field 'global_init_techs_count'");
57360 #ifdef FREECIV_JSON_CONNECTION
57361 field_addr.name = "global_init_techs_count";
57362 #endif /* FREECIV_JSON_CONNECTION */
57363 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->global_init_techs_count)) {
57364 RECEIVE_PACKET_FIELD_ERROR(global_init_techs_count);
57365 }
57366 }
57367 if (BV_ISSET(fields, 2)) {
57368 log_packet_detailed(" got field 'global_init_techs'");
57369 #ifdef FREECIV_JSON_CONNECTION
57370 field_addr.name = "global_init_techs";
57371 #endif /* FREECIV_JSON_CONNECTION */
57372
57373 {
57374 int i;
57375
57376 #ifdef FREECIV_JSON_CONNECTION
57377 /* Enter array. */
57378 field_addr.sub_location = plocation_elem_new(0);
57379 #endif /* FREECIV_JSON_CONNECTION */
57380
57381 if (real_packet->global_init_techs_count > MAX_NUM_TECH_LIST) {
57382 RECEIVE_PACKET_FIELD_ERROR(global_init_techs, ": truncation array");
57383 }
57384 for (i = 0; i < real_packet->global_init_techs_count; i++) {
57385 #ifdef FREECIV_JSON_CONNECTION
57386 field_addr.sub_location->number = i;
57387 #endif /* FREECIV_JSON_CONNECTION */
57388 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->global_init_techs[i])) {
57389 RECEIVE_PACKET_FIELD_ERROR(global_init_techs);
57390 }
57391 }
57392
57393 #ifdef FREECIV_JSON_CONNECTION
57394 /* Exit array. */
57395 free(field_addr.sub_location);
57396 field_addr.sub_location = NULL;
57397 #endif /* FREECIV_JSON_CONNECTION */
57398 }
57399 }
57400 if (BV_ISSET(fields, 3)) {
57401 log_packet_detailed(" got field 'global_init_buildings_count'");
57402 #ifdef FREECIV_JSON_CONNECTION
57403 field_addr.name = "global_init_buildings_count";
57404 #endif /* FREECIV_JSON_CONNECTION */
57405 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->global_init_buildings_count)) {
57406 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings_count);
57407 }
57408 }
57409 if (BV_ISSET(fields, 4)) {
57410 log_packet_detailed(" got field 'global_init_buildings'");
57411 #ifdef FREECIV_JSON_CONNECTION
57412 field_addr.name = "global_init_buildings";
57413 #endif /* FREECIV_JSON_CONNECTION */
57414
57415 {
57416 int i;
57417
57418 #ifdef FREECIV_JSON_CONNECTION
57419 /* Enter array. */
57420 field_addr.sub_location = plocation_elem_new(0);
57421 #endif /* FREECIV_JSON_CONNECTION */
57422
57423 if (real_packet->global_init_buildings_count > MAX_NUM_BUILDING_LIST) {
57424 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings, ": truncation array");
57425 }
57426 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
57427 #ifdef FREECIV_JSON_CONNECTION
57428 field_addr.sub_location->number = i;
57429 #endif /* FREECIV_JSON_CONNECTION */
57430 {
57431 int readin;
57432
57433 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
57434 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings);
57435 }
57436 real_packet->global_init_buildings[i] = readin;
57437 }
57438 }
57439
57440 #ifdef FREECIV_JSON_CONNECTION
57441 /* Exit array. */
57442 free(field_addr.sub_location);
57443 field_addr.sub_location = NULL;
57444 #endif /* FREECIV_JSON_CONNECTION */
57445 }
57446 }
57447 if (BV_ISSET(fields, 5)) {
57448 log_packet_detailed(" got field 'veteran_levels'");
57449 #ifdef FREECIV_JSON_CONNECTION
57450 field_addr.name = "veteran_levels";
57451 #endif /* FREECIV_JSON_CONNECTION */
57452 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran_levels)) {
57453 RECEIVE_PACKET_FIELD_ERROR(veteran_levels);
57454 }
57455 }
57456 if (BV_ISSET(fields, 6)) {
57457 log_packet_detailed(" got field 'veteran_name'");
57458 #ifdef FREECIV_JSON_CONNECTION
57459 field_addr.name = "veteran_name";
57460 #endif /* FREECIV_JSON_CONNECTION */
57461
57462 {
57463 int i;
57464
57465 #ifdef FREECIV_JSON_CONNECTION
57466 /* Enter array. */
57467 field_addr.sub_location = plocation_elem_new(0);
57468 #endif /* FREECIV_JSON_CONNECTION */
57469
57470 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
57471 RECEIVE_PACKET_FIELD_ERROR(veteran_name, ": truncation array");
57472 }
57473 for (i = 0; i < real_packet->veteran_levels; i++) {
57474 #ifdef FREECIV_JSON_CONNECTION
57475 field_addr.sub_location->number = i;
57476 #endif /* FREECIV_JSON_CONNECTION */
57477 if (!DIO_GET(string, &din, &field_addr, real_packet->veteran_name[i], sizeof(real_packet->veteran_name[i]))) {
57478 RECEIVE_PACKET_FIELD_ERROR(veteran_name);
57479 }
57480 }
57481
57482 #ifdef FREECIV_JSON_CONNECTION
57483 /* Exit array. */
57484 free(field_addr.sub_location);
57485 field_addr.sub_location = NULL;
57486 #endif /* FREECIV_JSON_CONNECTION */
57487 }
57488 }
57489 if (BV_ISSET(fields, 7)) {
57490 log_packet_detailed(" got field 'power_fact'");
57491 #ifdef FREECIV_JSON_CONNECTION
57492 field_addr.name = "power_fact";
57493 #endif /* FREECIV_JSON_CONNECTION */
57494
57495 {
57496 int i;
57497
57498 #ifdef FREECIV_JSON_CONNECTION
57499 /* Enter array. */
57500 field_addr.sub_location = plocation_elem_new(0);
57501 #endif /* FREECIV_JSON_CONNECTION */
57502
57503 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
57504 RECEIVE_PACKET_FIELD_ERROR(power_fact, ": truncation array");
57505 }
57506 for (i = 0; i < real_packet->veteran_levels; i++) {
57507 #ifdef FREECIV_JSON_CONNECTION
57508 field_addr.sub_location->number = i;
57509 #endif /* FREECIV_JSON_CONNECTION */
57510 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->power_fact[i])) {
57511 RECEIVE_PACKET_FIELD_ERROR(power_fact);
57512 }
57513 }
57514
57515 #ifdef FREECIV_JSON_CONNECTION
57516 /* Exit array. */
57517 free(field_addr.sub_location);
57518 field_addr.sub_location = NULL;
57519 #endif /* FREECIV_JSON_CONNECTION */
57520 }
57521 }
57522 if (BV_ISSET(fields, 8)) {
57523 log_packet_detailed(" got field 'move_bonus'");
57524 #ifdef FREECIV_JSON_CONNECTION
57525 field_addr.name = "move_bonus";
57526 #endif /* FREECIV_JSON_CONNECTION */
57527
57528 {
57529 int i;
57530
57531 #ifdef FREECIV_JSON_CONNECTION
57532 /* Enter array. */
57533 field_addr.sub_location = plocation_elem_new(0);
57534 #endif /* FREECIV_JSON_CONNECTION */
57535
57536 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
57537 RECEIVE_PACKET_FIELD_ERROR(move_bonus, ": truncation array");
57538 }
57539 for (i = 0; i < real_packet->veteran_levels; i++) {
57540 #ifdef FREECIV_JSON_CONNECTION
57541 field_addr.sub_location->number = i;
57542 #endif /* FREECIV_JSON_CONNECTION */
57543 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_bonus[i])) {
57544 RECEIVE_PACKET_FIELD_ERROR(move_bonus);
57545 }
57546 }
57547
57548 #ifdef FREECIV_JSON_CONNECTION
57549 /* Exit array. */
57550 free(field_addr.sub_location);
57551 field_addr.sub_location = NULL;
57552 #endif /* FREECIV_JSON_CONNECTION */
57553 }
57554 }
57555 if (BV_ISSET(fields, 9)) {
57556 log_packet_detailed(" got field 'base_raise_chance'");
57557 #ifdef FREECIV_JSON_CONNECTION
57558 field_addr.name = "base_raise_chance";
57559 #endif /* FREECIV_JSON_CONNECTION */
57560
57561 {
57562 int i;
57563
57564 #ifdef FREECIV_JSON_CONNECTION
57565 /* Enter array. */
57566 field_addr.sub_location = plocation_elem_new(0);
57567 #endif /* FREECIV_JSON_CONNECTION */
57568
57569 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
57570 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance, ": truncation array");
57571 }
57572 for (i = 0; i < real_packet->veteran_levels; i++) {
57573 #ifdef FREECIV_JSON_CONNECTION
57574 field_addr.sub_location->number = i;
57575 #endif /* FREECIV_JSON_CONNECTION */
57576 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_raise_chance[i])) {
57577 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance);
57578 }
57579 }
57580
57581 #ifdef FREECIV_JSON_CONNECTION
57582 /* Exit array. */
57583 free(field_addr.sub_location);
57584 field_addr.sub_location = NULL;
57585 #endif /* FREECIV_JSON_CONNECTION */
57586 }
57587 }
57588 if (BV_ISSET(fields, 10)) {
57589 log_packet_detailed(" got field 'work_raise_chance'");
57590 #ifdef FREECIV_JSON_CONNECTION
57591 field_addr.name = "work_raise_chance";
57592 #endif /* FREECIV_JSON_CONNECTION */
57593
57594 {
57595 int i;
57596
57597 #ifdef FREECIV_JSON_CONNECTION
57598 /* Enter array. */
57599 field_addr.sub_location = plocation_elem_new(0);
57600 #endif /* FREECIV_JSON_CONNECTION */
57601
57602 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
57603 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance, ": truncation array");
57604 }
57605 for (i = 0; i < real_packet->veteran_levels; i++) {
57606 #ifdef FREECIV_JSON_CONNECTION
57607 field_addr.sub_location->number = i;
57608 #endif /* FREECIV_JSON_CONNECTION */
57609 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->work_raise_chance[i])) {
57610 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance);
57611 }
57612 }
57613
57614 #ifdef FREECIV_JSON_CONNECTION
57615 /* Exit array. */
57616 free(field_addr.sub_location);
57617 field_addr.sub_location = NULL;
57618 #endif /* FREECIV_JSON_CONNECTION */
57619 }
57620 }
57621 if (BV_ISSET(fields, 11)) {
57622 log_packet_detailed(" got field 'background_red'");
57623 #ifdef FREECIV_JSON_CONNECTION
57624 field_addr.name = "background_red";
57625 #endif /* FREECIV_JSON_CONNECTION */
57626 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_red)) {
57627 RECEIVE_PACKET_FIELD_ERROR(background_red);
57628 }
57629 }
57630 if (BV_ISSET(fields, 12)) {
57631 log_packet_detailed(" got field 'background_green'");
57632 #ifdef FREECIV_JSON_CONNECTION
57633 field_addr.name = "background_green";
57634 #endif /* FREECIV_JSON_CONNECTION */
57635 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_green)) {
57636 RECEIVE_PACKET_FIELD_ERROR(background_green);
57637 }
57638 }
57639 if (BV_ISSET(fields, 13)) {
57640 log_packet_detailed(" got field 'background_blue'");
57641 #ifdef FREECIV_JSON_CONNECTION
57642 field_addr.name = "background_blue";
57643 #endif /* FREECIV_JSON_CONNECTION */
57644 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_blue)) {
57645 RECEIVE_PACKET_FIELD_ERROR(background_blue);
57646 }
57647 }
57648
57649 if (NULL == old) {
57650 old = fc_malloc(sizeof(*old));
57651 *old = *real_packet;
57652 genhash_insert(*hash, old, old);
57653 } else {
57654 *old = *real_packet;
57655 }
57656
57657#endif /* FREECIV_DELTA_PROTOCOL */
57658 RECEIVE_PACKET_END(real_packet);
57659}
57660
57661 static int send_packet_ruleset_game_100(struct connection *pc, const struct packet_ruleset_game *packet)
57662{
57663 const struct packet_ruleset_game *real_packet = packet;
57664#ifdef FREECIV_DELTA_PROTOCOL
57665 packet_ruleset_game_100_fields fields;
57666 struct packet_ruleset_game *old;
57667 bool differ;
57668 struct genhash **hash = pc->phs.sent + PACKET_RULESET_GAME;
57669#endif /* FREECIV_DELTA_PROTOCOL */
57670 SEND_PACKET_START(PACKET_RULESET_GAME);
57671#ifdef FREECIV_JSON_CONNECTION
57672 struct plocation field_addr;
57673 {
57674 struct plocation *field_addr_tmp = plocation_field_new(NULL);
57675 field_addr = *field_addr_tmp;
57676 FC_FREE(field_addr_tmp);
57677 }
57678#endif /* FREECIV_JSON_CONNECTION */
57679
57680 log_packet_detailed("packet_ruleset_game_100: sending info about ()");
57681
57682#ifdef FREECIV_DELTA_PROTOCOL
57683 if (NULL == *hash) {
57684 *hash = genhash_new_full(hash_packet_ruleset_game_100, cmp_packet_ruleset_game_100,
57685 NULL, NULL, NULL, free);
57686 }
57687 BV_CLR_ALL(fields);
57688
57689 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
57690 old = fc_malloc(sizeof(*old));
57691 *old = *real_packet;
57692 genhash_insert(*hash, old, old);
57693 memset(old, 0, sizeof(*old));
57694 }
57695 differ = (old->default_specialist != real_packet->default_specialist);
57696 if (differ) {
57697 BV_SET(fields, 0);
57698 }
57699
57700 differ = (old->global_init_techs_count != real_packet->global_init_techs_count);
57701 if (differ) {
57702 BV_SET(fields, 1);
57703 }
57704
57705
57706 {
57707 differ = (old->global_init_techs_count != real_packet->global_init_techs_count);
57708 if (!differ) {
57709 int i;
57710
57711 for (i = 0; i < real_packet->global_init_techs_count; i++) {
57712 if (old->global_init_techs[i] != real_packet->global_init_techs[i]) {
57713 differ = TRUE;
57714 break;
57715 }
57716 }
57717 }
57718 }
57719 if (differ) {
57720 BV_SET(fields, 2);
57721 }
57722
57723 differ = (old->global_init_buildings_count != real_packet->global_init_buildings_count);
57724 if (differ) {
57725 BV_SET(fields, 3);
57726 }
57727
57728
57729 {
57730 differ = (old->global_init_buildings_count != real_packet->global_init_buildings_count);
57731 if (!differ) {
57732 int i;
57733
57734 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
57735 if (old->global_init_buildings[i] != real_packet->global_init_buildings[i]) {
57736 differ = TRUE;
57737 break;
57738 }
57739 }
57740 }
57741 }
57742 if (differ) {
57743 BV_SET(fields, 4);
57744 }
57745
57746 differ = (old->veteran_levels != real_packet->veteran_levels);
57747 if (differ) {
57748 BV_SET(fields, 5);
57749 }
57750
57751
57752 {
57753 differ = (old->veteran_levels != real_packet->veteran_levels);
57754 if (!differ) {
57755 int i;
57756
57757 for (i = 0; i < real_packet->veteran_levels; i++) {
57758 if (strcmp(old->veteran_name[i], real_packet->veteran_name[i]) != 0) {
57759 differ = TRUE;
57760 break;
57761 }
57762 }
57763 }
57764 }
57765 if (differ) {
57766 BV_SET(fields, 6);
57767 }
57768
57769
57770 {
57771 differ = (old->veteran_levels != real_packet->veteran_levels);
57772 if (!differ) {
57773 int i;
57774
57775 for (i = 0; i < real_packet->veteran_levels; i++) {
57776 if (old->power_fact[i] != real_packet->power_fact[i]) {
57777 differ = TRUE;
57778 break;
57779 }
57780 }
57781 }
57782 }
57783 if (differ) {
57784 BV_SET(fields, 7);
57785 }
57786
57787
57788 {
57789 differ = (old->veteran_levels != real_packet->veteran_levels);
57790 if (!differ) {
57791 int i;
57792
57793 for (i = 0; i < real_packet->veteran_levels; i++) {
57794 if (old->move_bonus[i] != real_packet->move_bonus[i]) {
57795 differ = TRUE;
57796 break;
57797 }
57798 }
57799 }
57800 }
57801 if (differ) {
57802 BV_SET(fields, 8);
57803 }
57804
57805
57806 {
57807 differ = (old->veteran_levels != real_packet->veteran_levels);
57808 if (!differ) {
57809 int i;
57810
57811 for (i = 0; i < real_packet->veteran_levels; i++) {
57812 if (old->base_raise_chance[i] != real_packet->base_raise_chance[i]) {
57813 differ = TRUE;
57814 break;
57815 }
57816 }
57817 }
57818 }
57819 if (differ) {
57820 BV_SET(fields, 9);
57821 }
57822
57823
57824 {
57825 differ = (old->veteran_levels != real_packet->veteran_levels);
57826 if (!differ) {
57827 int i;
57828
57829 for (i = 0; i < real_packet->veteran_levels; i++) {
57830 if (old->work_raise_chance[i] != real_packet->work_raise_chance[i]) {
57831 differ = TRUE;
57832 break;
57833 }
57834 }
57835 }
57836 }
57837 if (differ) {
57838 BV_SET(fields, 10);
57839 }
57840
57841 differ = (old->background_red != real_packet->background_red);
57842 if (differ) {
57843 BV_SET(fields, 11);
57844 }
57845
57846 differ = (old->background_green != real_packet->background_green);
57847 if (differ) {
57848 BV_SET(fields, 12);
57849 }
57850
57851 differ = (old->background_blue != real_packet->background_blue);
57852 if (differ) {
57853 BV_SET(fields, 13);
57854 }
57855
57856
57857#ifdef FREECIV_JSON_CONNECTION
57858 field_addr.name = "fields";
57859#endif /* FREECIV_JSON_CONNECTION */
57860 DIO_BV_PUT(&dout, &field_addr, fields);
57861
57862 if (BV_ISSET(fields, 0)) {
57863 log_packet_detailed(" field 'default_specialist' has changed");
57864 #ifdef FREECIV_JSON_CONNECTION
57865 field_addr.name = "default_specialist";
57866#endif /* FREECIV_JSON_CONNECTION */
57867 DIO_PUT(uint8, &dout, &field_addr, real_packet->default_specialist);
57868 }
57869 if (BV_ISSET(fields, 1)) {
57870 log_packet_detailed(" field 'global_init_techs_count' has changed");
57871 #ifdef FREECIV_JSON_CONNECTION
57872 field_addr.name = "global_init_techs_count";
57873#endif /* FREECIV_JSON_CONNECTION */
57874 DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_techs_count);
57875 }
57876 if (BV_ISSET(fields, 2)) {
57877 log_packet_detailed(" field 'global_init_techs' has changed");
57878 #ifdef FREECIV_JSON_CONNECTION
57879 field_addr.name = "global_init_techs";
57880#endif /* FREECIV_JSON_CONNECTION */
57881
57882 {
57883 int i;
57884
57885#ifdef FREECIV_JSON_CONNECTION
57886 /* Create the array. */
57887 DIO_PUT(farray, &dout, &field_addr, real_packet->global_init_techs_count);
57888
57889 /* Enter the array. */
57890 field_addr.sub_location = plocation_elem_new(0);
57891#endif /* FREECIV_JSON_CONNECTION */
57892
57893 for (i = 0; i < real_packet->global_init_techs_count; i++) {
57894#ifdef FREECIV_JSON_CONNECTION
57895 /* Next array element. */
57896 field_addr.sub_location->number = i;
57897#endif /* FREECIV_JSON_CONNECTION */
57898 DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_techs[i]);
57899 }
57900
57901#ifdef FREECIV_JSON_CONNECTION
57902 /* Exit array. */
57903 free(field_addr.sub_location);
57904 field_addr.sub_location = NULL;
57905#endif /* FREECIV_JSON_CONNECTION */
57906 }
57907 }
57908 if (BV_ISSET(fields, 3)) {
57909 log_packet_detailed(" field 'global_init_buildings_count' has changed");
57910 #ifdef FREECIV_JSON_CONNECTION
57911 field_addr.name = "global_init_buildings_count";
57912#endif /* FREECIV_JSON_CONNECTION */
57913 DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_buildings_count);
57914 }
57915 if (BV_ISSET(fields, 4)) {
57916 log_packet_detailed(" field 'global_init_buildings' has changed");
57917 #ifdef FREECIV_JSON_CONNECTION
57918 field_addr.name = "global_init_buildings";
57919#endif /* FREECIV_JSON_CONNECTION */
57920
57921 {
57922 int i;
57923
57924#ifdef FREECIV_JSON_CONNECTION
57925 /* Create the array. */
57926 DIO_PUT(farray, &dout, &field_addr, real_packet->global_init_buildings_count);
57927
57928 /* Enter the array. */
57929 field_addr.sub_location = plocation_elem_new(0);
57930#endif /* FREECIV_JSON_CONNECTION */
57931
57932 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
57933#ifdef FREECIV_JSON_CONNECTION
57934 /* Next array element. */
57935 field_addr.sub_location->number = i;
57936#endif /* FREECIV_JSON_CONNECTION */
57937 DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_buildings[i]);
57938 }
57939
57940#ifdef FREECIV_JSON_CONNECTION
57941 /* Exit array. */
57942 free(field_addr.sub_location);
57943 field_addr.sub_location = NULL;
57944#endif /* FREECIV_JSON_CONNECTION */
57945 }
57946 }
57947 if (BV_ISSET(fields, 5)) {
57948 log_packet_detailed(" field 'veteran_levels' has changed");
57949 #ifdef FREECIV_JSON_CONNECTION
57950 field_addr.name = "veteran_levels";
57951#endif /* FREECIV_JSON_CONNECTION */
57952 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran_levels);
57953 }
57954 if (BV_ISSET(fields, 6)) {
57955 log_packet_detailed(" field 'veteran_name' has changed");
57956 #ifdef FREECIV_JSON_CONNECTION
57957 field_addr.name = "veteran_name";
57958#endif /* FREECIV_JSON_CONNECTION */
57959
57960 {
57961 int i;
57962
57963#ifdef FREECIV_JSON_CONNECTION
57964 /* Create the array. */
57965 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
57966
57967 /* Enter the array. */
57968 field_addr.sub_location = plocation_elem_new(0);
57969#endif /* FREECIV_JSON_CONNECTION */
57970
57971 for (i = 0; i < real_packet->veteran_levels; i++) {
57972#ifdef FREECIV_JSON_CONNECTION
57973 /* Next array element. */
57974 field_addr.sub_location->number = i;
57975#endif /* FREECIV_JSON_CONNECTION */
57976 DIO_PUT(string, &dout, &field_addr, real_packet->veteran_name[i]);
57977 }
57978
57979#ifdef FREECIV_JSON_CONNECTION
57980 /* Exit array. */
57981 free(field_addr.sub_location);
57982 field_addr.sub_location = NULL;
57983#endif /* FREECIV_JSON_CONNECTION */
57984 }
57985 }
57986 if (BV_ISSET(fields, 7)) {
57987 log_packet_detailed(" field 'power_fact' has changed");
57988 #ifdef FREECIV_JSON_CONNECTION
57989 field_addr.name = "power_fact";
57990#endif /* FREECIV_JSON_CONNECTION */
57991
57992 {
57993 int i;
57994
57995#ifdef FREECIV_JSON_CONNECTION
57996 /* Create the array. */
57997 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
57998
57999 /* Enter the array. */
58000 field_addr.sub_location = plocation_elem_new(0);
58001#endif /* FREECIV_JSON_CONNECTION */
58002
58003 for (i = 0; i < real_packet->veteran_levels; i++) {
58004#ifdef FREECIV_JSON_CONNECTION
58005 /* Next array element. */
58006 field_addr.sub_location->number = i;
58007#endif /* FREECIV_JSON_CONNECTION */
58008 DIO_PUT(uint16, &dout, &field_addr, real_packet->power_fact[i]);
58009 }
58010
58011#ifdef FREECIV_JSON_CONNECTION
58012 /* Exit array. */
58013 free(field_addr.sub_location);
58014 field_addr.sub_location = NULL;
58015#endif /* FREECIV_JSON_CONNECTION */
58016 }
58017 }
58018 if (BV_ISSET(fields, 8)) {
58019 log_packet_detailed(" field 'move_bonus' has changed");
58020 #ifdef FREECIV_JSON_CONNECTION
58021 field_addr.name = "move_bonus";
58022#endif /* FREECIV_JSON_CONNECTION */
58023
58024 {
58025 int i;
58026
58027#ifdef FREECIV_JSON_CONNECTION
58028 /* Create the array. */
58029 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
58030
58031 /* Enter the array. */
58032 field_addr.sub_location = plocation_elem_new(0);
58033#endif /* FREECIV_JSON_CONNECTION */
58034
58035 for (i = 0; i < real_packet->veteran_levels; i++) {
58036#ifdef FREECIV_JSON_CONNECTION
58037 /* Next array element. */
58038 field_addr.sub_location->number = i;
58039#endif /* FREECIV_JSON_CONNECTION */
58040 DIO_PUT(uint32, &dout, &field_addr, real_packet->move_bonus[i]);
58041 }
58042
58043#ifdef FREECIV_JSON_CONNECTION
58044 /* Exit array. */
58045 free(field_addr.sub_location);
58046 field_addr.sub_location = NULL;
58047#endif /* FREECIV_JSON_CONNECTION */
58048 }
58049 }
58050 if (BV_ISSET(fields, 9)) {
58051 log_packet_detailed(" field 'base_raise_chance' has changed");
58052 #ifdef FREECIV_JSON_CONNECTION
58053 field_addr.name = "base_raise_chance";
58054#endif /* FREECIV_JSON_CONNECTION */
58055
58056 {
58057 int i;
58058
58059#ifdef FREECIV_JSON_CONNECTION
58060 /* Create the array. */
58061 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
58062
58063 /* Enter the array. */
58064 field_addr.sub_location = plocation_elem_new(0);
58065#endif /* FREECIV_JSON_CONNECTION */
58066
58067 for (i = 0; i < real_packet->veteran_levels; i++) {
58068#ifdef FREECIV_JSON_CONNECTION
58069 /* Next array element. */
58070 field_addr.sub_location->number = i;
58071#endif /* FREECIV_JSON_CONNECTION */
58072 DIO_PUT(uint8, &dout, &field_addr, real_packet->base_raise_chance[i]);
58073 }
58074
58075#ifdef FREECIV_JSON_CONNECTION
58076 /* Exit array. */
58077 free(field_addr.sub_location);
58078 field_addr.sub_location = NULL;
58079#endif /* FREECIV_JSON_CONNECTION */
58080 }
58081 }
58082 if (BV_ISSET(fields, 10)) {
58083 log_packet_detailed(" field 'work_raise_chance' has changed");
58084 #ifdef FREECIV_JSON_CONNECTION
58085 field_addr.name = "work_raise_chance";
58086#endif /* FREECIV_JSON_CONNECTION */
58087
58088 {
58089 int i;
58090
58091#ifdef FREECIV_JSON_CONNECTION
58092 /* Create the array. */
58093 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
58094
58095 /* Enter the array. */
58096 field_addr.sub_location = plocation_elem_new(0);
58097#endif /* FREECIV_JSON_CONNECTION */
58098
58099 for (i = 0; i < real_packet->veteran_levels; i++) {
58100#ifdef FREECIV_JSON_CONNECTION
58101 /* Next array element. */
58102 field_addr.sub_location->number = i;
58103#endif /* FREECIV_JSON_CONNECTION */
58104 DIO_PUT(uint8, &dout, &field_addr, real_packet->work_raise_chance[i]);
58105 }
58106
58107#ifdef FREECIV_JSON_CONNECTION
58108 /* Exit array. */
58109 free(field_addr.sub_location);
58110 field_addr.sub_location = NULL;
58111#endif /* FREECIV_JSON_CONNECTION */
58112 }
58113 }
58114 if (BV_ISSET(fields, 11)) {
58115 log_packet_detailed(" field 'background_red' has changed");
58116 #ifdef FREECIV_JSON_CONNECTION
58117 field_addr.name = "background_red";
58118#endif /* FREECIV_JSON_CONNECTION */
58119 DIO_PUT(uint8, &dout, &field_addr, real_packet->background_red);
58120 }
58121 if (BV_ISSET(fields, 12)) {
58122 log_packet_detailed(" field 'background_green' has changed");
58123 #ifdef FREECIV_JSON_CONNECTION
58124 field_addr.name = "background_green";
58125#endif /* FREECIV_JSON_CONNECTION */
58126 DIO_PUT(uint8, &dout, &field_addr, real_packet->background_green);
58127 }
58128 if (BV_ISSET(fields, 13)) {
58129 log_packet_detailed(" field 'background_blue' has changed");
58130 #ifdef FREECIV_JSON_CONNECTION
58131 field_addr.name = "background_blue";
58132#endif /* FREECIV_JSON_CONNECTION */
58133 DIO_PUT(uint8, &dout, &field_addr, real_packet->background_blue);
58134 }
58135
58136 *old = *real_packet;
58137#endif /* FREECIV_DELTA_PROTOCOL */
58138#ifndef FREECIV_DELTA_PROTOCOL
58139#ifdef FREECIV_JSON_CONNECTION
58140 field_addr.name = "default_specialist";
58141#endif /* FREECIV_JSON_CONNECTION */
58142 DIO_PUT(uint8, &dout, &field_addr, real_packet->default_specialist);
58143#ifdef FREECIV_JSON_CONNECTION
58144 field_addr.name = "global_init_techs_count";
58145#endif /* FREECIV_JSON_CONNECTION */
58146 DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_techs_count);
58147#ifdef FREECIV_JSON_CONNECTION
58148 field_addr.name = "global_init_techs";
58149#endif /* FREECIV_JSON_CONNECTION */
58150
58151 {
58152 int i;
58153
58154#ifdef FREECIV_JSON_CONNECTION
58155 /* Create the array. */
58156 DIO_PUT(farray, &dout, &field_addr, real_packet->global_init_techs_count);
58157
58158 /* Enter the array. */
58159 field_addr.sub_location = plocation_elem_new(0);
58160#endif /* FREECIV_JSON_CONNECTION */
58161
58162 for (i = 0; i < real_packet->global_init_techs_count; i++) {
58163#ifdef FREECIV_JSON_CONNECTION
58164 /* Next array element. */
58165 field_addr.sub_location->number = i;
58166#endif /* FREECIV_JSON_CONNECTION */
58167 DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_techs[i]);
58168 }
58169
58170#ifdef FREECIV_JSON_CONNECTION
58171 /* Exit array. */
58172 free(field_addr.sub_location);
58173 field_addr.sub_location = NULL;
58174#endif /* FREECIV_JSON_CONNECTION */
58175 }
58176#ifdef FREECIV_JSON_CONNECTION
58177 field_addr.name = "global_init_buildings_count";
58178#endif /* FREECIV_JSON_CONNECTION */
58179 DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_buildings_count);
58180#ifdef FREECIV_JSON_CONNECTION
58181 field_addr.name = "global_init_buildings";
58182#endif /* FREECIV_JSON_CONNECTION */
58183
58184 {
58185 int i;
58186
58187#ifdef FREECIV_JSON_CONNECTION
58188 /* Create the array. */
58189 DIO_PUT(farray, &dout, &field_addr, real_packet->global_init_buildings_count);
58190
58191 /* Enter the array. */
58192 field_addr.sub_location = plocation_elem_new(0);
58193#endif /* FREECIV_JSON_CONNECTION */
58194
58195 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
58196#ifdef FREECIV_JSON_CONNECTION
58197 /* Next array element. */
58198 field_addr.sub_location->number = i;
58199#endif /* FREECIV_JSON_CONNECTION */
58200 DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_buildings[i]);
58201 }
58202
58203#ifdef FREECIV_JSON_CONNECTION
58204 /* Exit array. */
58205 free(field_addr.sub_location);
58206 field_addr.sub_location = NULL;
58207#endif /* FREECIV_JSON_CONNECTION */
58208 }
58209#ifdef FREECIV_JSON_CONNECTION
58210 field_addr.name = "veteran_levels";
58211#endif /* FREECIV_JSON_CONNECTION */
58212 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran_levels);
58213#ifdef FREECIV_JSON_CONNECTION
58214 field_addr.name = "veteran_name";
58215#endif /* FREECIV_JSON_CONNECTION */
58216
58217 {
58218 int i;
58219
58220#ifdef FREECIV_JSON_CONNECTION
58221 /* Create the array. */
58222 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
58223
58224 /* Enter the array. */
58225 field_addr.sub_location = plocation_elem_new(0);
58226#endif /* FREECIV_JSON_CONNECTION */
58227
58228 for (i = 0; i < real_packet->veteran_levels; i++) {
58229#ifdef FREECIV_JSON_CONNECTION
58230 /* Next array element. */
58231 field_addr.sub_location->number = i;
58232#endif /* FREECIV_JSON_CONNECTION */
58233 DIO_PUT(string, &dout, &field_addr, real_packet->veteran_name[i]);
58234 }
58235
58236#ifdef FREECIV_JSON_CONNECTION
58237 /* Exit array. */
58238 free(field_addr.sub_location);
58239 field_addr.sub_location = NULL;
58240#endif /* FREECIV_JSON_CONNECTION */
58241 }
58242#ifdef FREECIV_JSON_CONNECTION
58243 field_addr.name = "power_fact";
58244#endif /* FREECIV_JSON_CONNECTION */
58245
58246 {
58247 int i;
58248
58249#ifdef FREECIV_JSON_CONNECTION
58250 /* Create the array. */
58251 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
58252
58253 /* Enter the array. */
58254 field_addr.sub_location = plocation_elem_new(0);
58255#endif /* FREECIV_JSON_CONNECTION */
58256
58257 for (i = 0; i < real_packet->veteran_levels; i++) {
58258#ifdef FREECIV_JSON_CONNECTION
58259 /* Next array element. */
58260 field_addr.sub_location->number = i;
58261#endif /* FREECIV_JSON_CONNECTION */
58262 DIO_PUT(uint16, &dout, &field_addr, real_packet->power_fact[i]);
58263 }
58264
58265#ifdef FREECIV_JSON_CONNECTION
58266 /* Exit array. */
58267 free(field_addr.sub_location);
58268 field_addr.sub_location = NULL;
58269#endif /* FREECIV_JSON_CONNECTION */
58270 }
58271#ifdef FREECIV_JSON_CONNECTION
58272 field_addr.name = "move_bonus";
58273#endif /* FREECIV_JSON_CONNECTION */
58274
58275 {
58276 int i;
58277
58278#ifdef FREECIV_JSON_CONNECTION
58279 /* Create the array. */
58280 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
58281
58282 /* Enter the array. */
58283 field_addr.sub_location = plocation_elem_new(0);
58284#endif /* FREECIV_JSON_CONNECTION */
58285
58286 for (i = 0; i < real_packet->veteran_levels; i++) {
58287#ifdef FREECIV_JSON_CONNECTION
58288 /* Next array element. */
58289 field_addr.sub_location->number = i;
58290#endif /* FREECIV_JSON_CONNECTION */
58291 DIO_PUT(uint32, &dout, &field_addr, real_packet->move_bonus[i]);
58292 }
58293
58294#ifdef FREECIV_JSON_CONNECTION
58295 /* Exit array. */
58296 free(field_addr.sub_location);
58297 field_addr.sub_location = NULL;
58298#endif /* FREECIV_JSON_CONNECTION */
58299 }
58300#ifdef FREECIV_JSON_CONNECTION
58301 field_addr.name = "base_raise_chance";
58302#endif /* FREECIV_JSON_CONNECTION */
58303
58304 {
58305 int i;
58306
58307#ifdef FREECIV_JSON_CONNECTION
58308 /* Create the array. */
58309 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
58310
58311 /* Enter the array. */
58312 field_addr.sub_location = plocation_elem_new(0);
58313#endif /* FREECIV_JSON_CONNECTION */
58314
58315 for (i = 0; i < real_packet->veteran_levels; i++) {
58316#ifdef FREECIV_JSON_CONNECTION
58317 /* Next array element. */
58318 field_addr.sub_location->number = i;
58319#endif /* FREECIV_JSON_CONNECTION */
58320 DIO_PUT(uint8, &dout, &field_addr, real_packet->base_raise_chance[i]);
58321 }
58322
58323#ifdef FREECIV_JSON_CONNECTION
58324 /* Exit array. */
58325 free(field_addr.sub_location);
58326 field_addr.sub_location = NULL;
58327#endif /* FREECIV_JSON_CONNECTION */
58328 }
58329#ifdef FREECIV_JSON_CONNECTION
58330 field_addr.name = "work_raise_chance";
58331#endif /* FREECIV_JSON_CONNECTION */
58332
58333 {
58334 int i;
58335
58336#ifdef FREECIV_JSON_CONNECTION
58337 /* Create the array. */
58338 DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
58339
58340 /* Enter the array. */
58341 field_addr.sub_location = plocation_elem_new(0);
58342#endif /* FREECIV_JSON_CONNECTION */
58343
58344 for (i = 0; i < real_packet->veteran_levels; i++) {
58345#ifdef FREECIV_JSON_CONNECTION
58346 /* Next array element. */
58347 field_addr.sub_location->number = i;
58348#endif /* FREECIV_JSON_CONNECTION */
58349 DIO_PUT(uint8, &dout, &field_addr, real_packet->work_raise_chance[i]);
58350 }
58351
58352#ifdef FREECIV_JSON_CONNECTION
58353 /* Exit array. */
58354 free(field_addr.sub_location);
58355 field_addr.sub_location = NULL;
58356#endif /* FREECIV_JSON_CONNECTION */
58357 }
58358#ifdef FREECIV_JSON_CONNECTION
58359 field_addr.name = "background_red";
58360#endif /* FREECIV_JSON_CONNECTION */
58361 DIO_PUT(uint8, &dout, &field_addr, real_packet->background_red);
58362#ifdef FREECIV_JSON_CONNECTION
58363 field_addr.name = "background_green";
58364#endif /* FREECIV_JSON_CONNECTION */
58365 DIO_PUT(uint8, &dout, &field_addr, real_packet->background_green);
58366#ifdef FREECIV_JSON_CONNECTION
58367 field_addr.name = "background_blue";
58368#endif /* FREECIV_JSON_CONNECTION */
58369 DIO_PUT(uint8, &dout, &field_addr, real_packet->background_blue);
58370
58371#endif
58372 SEND_PACKET_END(PACKET_RULESET_GAME);
58373}
58374
58375 int send_packet_ruleset_game(struct connection *pc, const struct packet_ruleset_game *packet)
58376{
58377 if (!pc->used) {
58378 log_error("WARNING: trying to send data to the closed connection %s",
58379 conn_description(pc));
58380 return -1;
58381 }
58382 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_GAME].packet != NULL, -1,
58383 "Handler for PACKET_RULESET_GAME not installed");
58384 return pc->phs.handlers->send[PACKET_RULESET_GAME].packet(pc, packet);
58385}
58386
58387 void lsend_packet_ruleset_game(struct conn_list *dest, const struct packet_ruleset_game *packet)
58388{
58389 conn_list_iterate(dest, pconn) {
58390 send_packet_ruleset_game(pconn, packet);
58391 } conn_list_iterate_end;
58392}
58393
58394#ifdef FREECIV_DELTA_PROTOCOL
58395#define hash_packet_ruleset_specialist_100 hash_const
58396
58397#define cmp_packet_ruleset_specialist_100 cmp_const
58398
58399 BV_DEFINE(packet_ruleset_specialist_100_fields, 9);
58400#endif /* FREECIV_DELTA_PROTOCOL */
58401
58402 static struct packet_ruleset_specialist *receive_packet_ruleset_specialist_100(struct connection *pc)
58403{
58404#ifdef FREECIV_DELTA_PROTOCOL
58405 packet_ruleset_specialist_100_fields fields;
58406 struct packet_ruleset_specialist *old;
58407 struct genhash **hash = pc->phs.received + PACKET_RULESET_SPECIALIST;
58408#endif /* FREECIV_DELTA_PROTOCOL */
58409 RECEIVE_PACKET_START(packet_ruleset_specialist, real_packet);
58410#ifdef FREECIV_JSON_CONNECTION
58411 struct plocation field_addr;
58412 {
58413 struct plocation *field_addr_tmp = plocation_field_new(NULL);
58414 field_addr = *field_addr_tmp;
58415 FC_FREE(field_addr_tmp);
58416 }
58417#endif /* FREECIV_JSON_CONNECTION */
58418
58419#ifdef FREECIV_DELTA_PROTOCOL
58420#ifdef FREECIV_JSON_CONNECTION
58421 field_addr.name = "fields";
58422#endif /* FREECIV_JSON_CONNECTION */
58423 DIO_BV_GET(&din, &field_addr, fields);
58424
58425#else /* FREECIV_DELTA_PROTOCOL */
58426 #ifdef FREECIV_JSON_CONNECTION
58427 field_addr.name = "id";
58428 #endif /* FREECIV_JSON_CONNECTION */
58429 {
58430 int readin;
58431
58432 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
58433 RECEIVE_PACKET_FIELD_ERROR(id);
58434 }
58435 real_packet->id = readin;
58436 }
58437 #ifdef FREECIV_JSON_CONNECTION
58438 field_addr.name = "plural_name";
58439 #endif /* FREECIV_JSON_CONNECTION */
58440 if (!DIO_GET(string, &din, &field_addr, real_packet->plural_name, sizeof(real_packet->plural_name))) {
58441 RECEIVE_PACKET_FIELD_ERROR(plural_name);
58442 }
58443 #ifdef FREECIV_JSON_CONNECTION
58444 field_addr.name = "rule_name";
58445 #endif /* FREECIV_JSON_CONNECTION */
58446 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
58447 RECEIVE_PACKET_FIELD_ERROR(rule_name);
58448 }
58449 #ifdef FREECIV_JSON_CONNECTION
58450 field_addr.name = "short_name";
58451 #endif /* FREECIV_JSON_CONNECTION */
58452 if (!DIO_GET(string, &din, &field_addr, real_packet->short_name, sizeof(real_packet->short_name))) {
58453 RECEIVE_PACKET_FIELD_ERROR(short_name);
58454 }
58455 #ifdef FREECIV_JSON_CONNECTION
58456 field_addr.name = "graphic_str";
58457 #endif /* FREECIV_JSON_CONNECTION */
58458 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
58459 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
58460 }
58461 #ifdef FREECIV_JSON_CONNECTION
58462 field_addr.name = "graphic_alt";
58463 #endif /* FREECIV_JSON_CONNECTION */
58464 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
58465 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
58466 }
58467 #ifdef FREECIV_JSON_CONNECTION
58468 field_addr.name = "reqs_count";
58469 #endif /* FREECIV_JSON_CONNECTION */
58470 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
58471 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
58472 }
58473 #ifdef FREECIV_JSON_CONNECTION
58474 field_addr.name = "reqs";
58475 #endif /* FREECIV_JSON_CONNECTION */
58476
58477 {
58478 int i;
58479
58480 #ifdef FREECIV_JSON_CONNECTION
58481 /* Enter array. */
58482 field_addr.sub_location = plocation_elem_new(0);
58483 #endif /* FREECIV_JSON_CONNECTION */
58484
58485 if (real_packet->reqs_count > MAX_NUM_REQS) {
58486 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
58487 }
58488 for (i = 0; i < real_packet->reqs_count; i++) {
58489 #ifdef FREECIV_JSON_CONNECTION
58490 field_addr.sub_location->number = i;
58491 #endif /* FREECIV_JSON_CONNECTION */
58492 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
58493 RECEIVE_PACKET_FIELD_ERROR(reqs);
58494 }
58495 }
58496
58497 #ifdef FREECIV_JSON_CONNECTION
58498 /* Exit array. */
58499 free(field_addr.sub_location);
58500 field_addr.sub_location = NULL;
58501 #endif /* FREECIV_JSON_CONNECTION */
58502 }
58503 #ifdef FREECIV_JSON_CONNECTION
58504 field_addr.name = "helptext";
58505 #endif /* FREECIV_JSON_CONNECTION */
58506 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
58507 RECEIVE_PACKET_FIELD_ERROR(helptext);
58508 }
58509
58510#endif
58511 log_packet_detailed("packet_ruleset_specialist_100: got info about ()");
58512
58513#ifdef FREECIV_DELTA_PROTOCOL
58514 if (NULL == *hash) {
58515 *hash = genhash_new_full(hash_packet_ruleset_specialist_100, cmp_packet_ruleset_specialist_100,
58516 NULL, NULL, NULL, free);
58517 }
58518
58519 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
58520 *real_packet = *old;
58521 } else {
58522 log_packet_detailed(" no old info");
58523 memset(real_packet, 0, sizeof(*real_packet));
58524 }
58525
58526 if (BV_ISSET(fields, 0)) {
58527 log_packet_detailed(" got field 'id'");
58528 #ifdef FREECIV_JSON_CONNECTION
58529 field_addr.name = "id";
58530 #endif /* FREECIV_JSON_CONNECTION */
58531 {
58532 int readin;
58533
58534 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
58535 RECEIVE_PACKET_FIELD_ERROR(id);
58536 }
58537 real_packet->id = readin;
58538 }
58539 }
58540 if (BV_ISSET(fields, 1)) {
58541 log_packet_detailed(" got field 'plural_name'");
58542 #ifdef FREECIV_JSON_CONNECTION
58543 field_addr.name = "plural_name";
58544 #endif /* FREECIV_JSON_CONNECTION */
58545 if (!DIO_GET(string, &din, &field_addr, real_packet->plural_name, sizeof(real_packet->plural_name))) {
58546 RECEIVE_PACKET_FIELD_ERROR(plural_name);
58547 }
58548 }
58549 if (BV_ISSET(fields, 2)) {
58550 log_packet_detailed(" got field 'rule_name'");
58551 #ifdef FREECIV_JSON_CONNECTION
58552 field_addr.name = "rule_name";
58553 #endif /* FREECIV_JSON_CONNECTION */
58554 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
58555 RECEIVE_PACKET_FIELD_ERROR(rule_name);
58556 }
58557 }
58558 if (BV_ISSET(fields, 3)) {
58559 log_packet_detailed(" got field 'short_name'");
58560 #ifdef FREECIV_JSON_CONNECTION
58561 field_addr.name = "short_name";
58562 #endif /* FREECIV_JSON_CONNECTION */
58563 if (!DIO_GET(string, &din, &field_addr, real_packet->short_name, sizeof(real_packet->short_name))) {
58564 RECEIVE_PACKET_FIELD_ERROR(short_name);
58565 }
58566 }
58567 if (BV_ISSET(fields, 4)) {
58568 log_packet_detailed(" got field 'graphic_str'");
58569 #ifdef FREECIV_JSON_CONNECTION
58570 field_addr.name = "graphic_str";
58571 #endif /* FREECIV_JSON_CONNECTION */
58572 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
58573 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
58574 }
58575 }
58576 if (BV_ISSET(fields, 5)) {
58577 log_packet_detailed(" got field 'graphic_alt'");
58578 #ifdef FREECIV_JSON_CONNECTION
58579 field_addr.name = "graphic_alt";
58580 #endif /* FREECIV_JSON_CONNECTION */
58581 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
58582 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
58583 }
58584 }
58585 if (BV_ISSET(fields, 6)) {
58586 log_packet_detailed(" got field 'reqs_count'");
58587 #ifdef FREECIV_JSON_CONNECTION
58588 field_addr.name = "reqs_count";
58589 #endif /* FREECIV_JSON_CONNECTION */
58590 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
58591 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
58592 }
58593 }
58594 if (BV_ISSET(fields, 7)) {
58595 log_packet_detailed(" got field 'reqs'");
58596 #ifdef FREECIV_JSON_CONNECTION
58597 field_addr.name = "reqs";
58598 #endif /* FREECIV_JSON_CONNECTION */
58599
58600 {
58601 int i;
58602
58603 #ifdef FREECIV_JSON_CONNECTION
58604 /* Enter array. */
58605 field_addr.sub_location = plocation_elem_new(0);
58606 #endif /* FREECIV_JSON_CONNECTION */
58607
58608 if (real_packet->reqs_count > MAX_NUM_REQS) {
58609 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
58610 }
58611 for (i = 0; i < real_packet->reqs_count; i++) {
58612 #ifdef FREECIV_JSON_CONNECTION
58613 field_addr.sub_location->number = i;
58614 #endif /* FREECIV_JSON_CONNECTION */
58615 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
58616 RECEIVE_PACKET_FIELD_ERROR(reqs);
58617 }
58618 }
58619
58620 #ifdef FREECIV_JSON_CONNECTION
58621 /* Exit array. */
58622 free(field_addr.sub_location);
58623 field_addr.sub_location = NULL;
58624 #endif /* FREECIV_JSON_CONNECTION */
58625 }
58626 }
58627 if (BV_ISSET(fields, 8)) {
58628 log_packet_detailed(" got field 'helptext'");
58629 #ifdef FREECIV_JSON_CONNECTION
58630 field_addr.name = "helptext";
58631 #endif /* FREECIV_JSON_CONNECTION */
58632 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
58633 RECEIVE_PACKET_FIELD_ERROR(helptext);
58634 }
58635 }
58636
58637 if (NULL == old) {
58638 old = fc_malloc(sizeof(*old));
58639 *old = *real_packet;
58640 genhash_insert(*hash, old, old);
58641 } else {
58642 *old = *real_packet;
58643 }
58644
58645#endif /* FREECIV_DELTA_PROTOCOL */
58646 RECEIVE_PACKET_END(real_packet);
58647}
58648
58649 static int send_packet_ruleset_specialist_100(struct connection *pc, const struct packet_ruleset_specialist *packet)
58650{
58651 const struct packet_ruleset_specialist *real_packet = packet;
58652#ifdef FREECIV_DELTA_PROTOCOL
58653 packet_ruleset_specialist_100_fields fields;
58654 struct packet_ruleset_specialist *old;
58655 bool differ;
58656 struct genhash **hash = pc->phs.sent + PACKET_RULESET_SPECIALIST;
58657#endif /* FREECIV_DELTA_PROTOCOL */
58658 SEND_PACKET_START(PACKET_RULESET_SPECIALIST);
58659#ifdef FREECIV_JSON_CONNECTION
58660 struct plocation field_addr;
58661 {
58662 struct plocation *field_addr_tmp = plocation_field_new(NULL);
58663 field_addr = *field_addr_tmp;
58664 FC_FREE(field_addr_tmp);
58665 }
58666#endif /* FREECIV_JSON_CONNECTION */
58667
58668 log_packet_detailed("packet_ruleset_specialist_100: sending info about ()");
58669
58670#ifdef FREECIV_DELTA_PROTOCOL
58671 if (NULL == *hash) {
58672 *hash = genhash_new_full(hash_packet_ruleset_specialist_100, cmp_packet_ruleset_specialist_100,
58673 NULL, NULL, NULL, free);
58674 }
58675 BV_CLR_ALL(fields);
58676
58677 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
58678 old = fc_malloc(sizeof(*old));
58679 *old = *real_packet;
58680 genhash_insert(*hash, old, old);
58681 memset(old, 0, sizeof(*old));
58682 }
58683 differ = (old->id != real_packet->id);
58684 if (differ) {
58685 BV_SET(fields, 0);
58686 }
58687
58688 differ = (strcmp(old->plural_name, real_packet->plural_name) != 0);
58689 if (differ) {
58690 BV_SET(fields, 1);
58691 }
58692
58693 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
58694 if (differ) {
58695 BV_SET(fields, 2);
58696 }
58697
58698 differ = (strcmp(old->short_name, real_packet->short_name) != 0);
58699 if (differ) {
58700 BV_SET(fields, 3);
58701 }
58702
58703 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
58704 if (differ) {
58705 BV_SET(fields, 4);
58706 }
58707
58708 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
58709 if (differ) {
58710 BV_SET(fields, 5);
58711 }
58712
58713 differ = (old->reqs_count != real_packet->reqs_count);
58714 if (differ) {
58715 BV_SET(fields, 6);
58716 }
58717
58718
58719 {
58720 differ = (old->reqs_count != real_packet->reqs_count);
58721 if (!differ) {
58722 int i;
58723
58724 for (i = 0; i < real_packet->reqs_count; i++) {
58725 if (!are_requirements_equal(&old->reqs[i], &real_packet->reqs[i])) {
58726 differ = TRUE;
58727 break;
58728 }
58729 }
58730 }
58731 }
58732 if (differ) {
58733 BV_SET(fields, 7);
58734 }
58735
58736 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
58737 if (differ) {
58738 BV_SET(fields, 8);
58739 }
58740
58741
58742#ifdef FREECIV_JSON_CONNECTION
58743 field_addr.name = "fields";
58744#endif /* FREECIV_JSON_CONNECTION */
58745 DIO_BV_PUT(&dout, &field_addr, fields);
58746
58747 if (BV_ISSET(fields, 0)) {
58748 log_packet_detailed(" field 'id' has changed");
58749 #ifdef FREECIV_JSON_CONNECTION
58750 field_addr.name = "id";
58751#endif /* FREECIV_JSON_CONNECTION */
58752 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
58753 }
58754 if (BV_ISSET(fields, 1)) {
58755 log_packet_detailed(" field 'plural_name' has changed");
58756 #ifdef FREECIV_JSON_CONNECTION
58757 field_addr.name = "plural_name";
58758#endif /* FREECIV_JSON_CONNECTION */
58759 DIO_PUT(string, &dout, &field_addr, real_packet->plural_name);
58760 }
58761 if (BV_ISSET(fields, 2)) {
58762 log_packet_detailed(" field 'rule_name' has changed");
58763 #ifdef FREECIV_JSON_CONNECTION
58764 field_addr.name = "rule_name";
58765#endif /* FREECIV_JSON_CONNECTION */
58766 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
58767 }
58768 if (BV_ISSET(fields, 3)) {
58769 log_packet_detailed(" field 'short_name' has changed");
58770 #ifdef FREECIV_JSON_CONNECTION
58771 field_addr.name = "short_name";
58772#endif /* FREECIV_JSON_CONNECTION */
58773 DIO_PUT(string, &dout, &field_addr, real_packet->short_name);
58774 }
58775 if (BV_ISSET(fields, 4)) {
58776 log_packet_detailed(" field 'graphic_str' has changed");
58777 #ifdef FREECIV_JSON_CONNECTION
58778 field_addr.name = "graphic_str";
58779#endif /* FREECIV_JSON_CONNECTION */
58780 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
58781 }
58782 if (BV_ISSET(fields, 5)) {
58783 log_packet_detailed(" field 'graphic_alt' has changed");
58784 #ifdef FREECIV_JSON_CONNECTION
58785 field_addr.name = "graphic_alt";
58786#endif /* FREECIV_JSON_CONNECTION */
58787 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
58788 }
58789 if (BV_ISSET(fields, 6)) {
58790 log_packet_detailed(" field 'reqs_count' has changed");
58791 #ifdef FREECIV_JSON_CONNECTION
58792 field_addr.name = "reqs_count";
58793#endif /* FREECIV_JSON_CONNECTION */
58794 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
58795 }
58796 if (BV_ISSET(fields, 7)) {
58797 log_packet_detailed(" field 'reqs' has changed");
58798 #ifdef FREECIV_JSON_CONNECTION
58799 field_addr.name = "reqs";
58800#endif /* FREECIV_JSON_CONNECTION */
58801
58802 {
58803 int i;
58804
58805#ifdef FREECIV_JSON_CONNECTION
58806 /* Create the array. */
58807 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
58808
58809 /* Enter the array. */
58810 field_addr.sub_location = plocation_elem_new(0);
58811#endif /* FREECIV_JSON_CONNECTION */
58812
58813 for (i = 0; i < real_packet->reqs_count; i++) {
58814#ifdef FREECIV_JSON_CONNECTION
58815 /* Next array element. */
58816 field_addr.sub_location->number = i;
58817#endif /* FREECIV_JSON_CONNECTION */
58818 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
58819 }
58820
58821#ifdef FREECIV_JSON_CONNECTION
58822 /* Exit array. */
58823 free(field_addr.sub_location);
58824 field_addr.sub_location = NULL;
58825#endif /* FREECIV_JSON_CONNECTION */
58826 }
58827 }
58828 if (BV_ISSET(fields, 8)) {
58829 log_packet_detailed(" field 'helptext' has changed");
58830 #ifdef FREECIV_JSON_CONNECTION
58831 field_addr.name = "helptext";
58832#endif /* FREECIV_JSON_CONNECTION */
58833 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
58834 }
58835
58836 *old = *real_packet;
58837#endif /* FREECIV_DELTA_PROTOCOL */
58838#ifndef FREECIV_DELTA_PROTOCOL
58839#ifdef FREECIV_JSON_CONNECTION
58840 field_addr.name = "id";
58841#endif /* FREECIV_JSON_CONNECTION */
58842 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
58843#ifdef FREECIV_JSON_CONNECTION
58844 field_addr.name = "plural_name";
58845#endif /* FREECIV_JSON_CONNECTION */
58846 DIO_PUT(string, &dout, &field_addr, real_packet->plural_name);
58847#ifdef FREECIV_JSON_CONNECTION
58848 field_addr.name = "rule_name";
58849#endif /* FREECIV_JSON_CONNECTION */
58850 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
58851#ifdef FREECIV_JSON_CONNECTION
58852 field_addr.name = "short_name";
58853#endif /* FREECIV_JSON_CONNECTION */
58854 DIO_PUT(string, &dout, &field_addr, real_packet->short_name);
58855#ifdef FREECIV_JSON_CONNECTION
58856 field_addr.name = "graphic_str";
58857#endif /* FREECIV_JSON_CONNECTION */
58858 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
58859#ifdef FREECIV_JSON_CONNECTION
58860 field_addr.name = "graphic_alt";
58861#endif /* FREECIV_JSON_CONNECTION */
58862 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
58863#ifdef FREECIV_JSON_CONNECTION
58864 field_addr.name = "reqs_count";
58865#endif /* FREECIV_JSON_CONNECTION */
58866 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
58867#ifdef FREECIV_JSON_CONNECTION
58868 field_addr.name = "reqs";
58869#endif /* FREECIV_JSON_CONNECTION */
58870
58871 {
58872 int i;
58873
58874#ifdef FREECIV_JSON_CONNECTION
58875 /* Create the array. */
58876 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
58877
58878 /* Enter the array. */
58879 field_addr.sub_location = plocation_elem_new(0);
58880#endif /* FREECIV_JSON_CONNECTION */
58881
58882 for (i = 0; i < real_packet->reqs_count; i++) {
58883#ifdef FREECIV_JSON_CONNECTION
58884 /* Next array element. */
58885 field_addr.sub_location->number = i;
58886#endif /* FREECIV_JSON_CONNECTION */
58887 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
58888 }
58889
58890#ifdef FREECIV_JSON_CONNECTION
58891 /* Exit array. */
58892 free(field_addr.sub_location);
58893 field_addr.sub_location = NULL;
58894#endif /* FREECIV_JSON_CONNECTION */
58895 }
58896#ifdef FREECIV_JSON_CONNECTION
58897 field_addr.name = "helptext";
58898#endif /* FREECIV_JSON_CONNECTION */
58899 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
58900
58901#endif
58902 SEND_PACKET_END(PACKET_RULESET_SPECIALIST);
58903}
58904
58905 int send_packet_ruleset_specialist(struct connection *pc, const struct packet_ruleset_specialist *packet)
58906{
58907 if (!pc->used) {
58908 log_error("WARNING: trying to send data to the closed connection %s",
58909 conn_description(pc));
58910 return -1;
58911 }
58912 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_SPECIALIST].packet != NULL, -1,
58913 "Handler for PACKET_RULESET_SPECIALIST not installed");
58914 return pc->phs.handlers->send[PACKET_RULESET_SPECIALIST].packet(pc, packet);
58915}
58916
58917 void lsend_packet_ruleset_specialist(struct conn_list *dest, const struct packet_ruleset_specialist *packet)
58918{
58919 conn_list_iterate(dest, pconn) {
58920 send_packet_ruleset_specialist(pconn, packet);
58921 } conn_list_iterate_end;
58922}
58923
58924#ifdef FREECIV_DELTA_PROTOCOL
58925#define hash_packet_ruleset_government_ruler_title_100 hash_const
58926
58927#define cmp_packet_ruleset_government_ruler_title_100 cmp_const
58928
58929 BV_DEFINE(packet_ruleset_government_ruler_title_100_fields, 4);
58930#endif /* FREECIV_DELTA_PROTOCOL */
58931
58932 static struct packet_ruleset_government_ruler_title *receive_packet_ruleset_government_ruler_title_100(struct connection *pc)
58933{
58934#ifdef FREECIV_DELTA_PROTOCOL
58935 packet_ruleset_government_ruler_title_100_fields fields;
58936 struct packet_ruleset_government_ruler_title *old;
58937 struct genhash **hash = pc->phs.received + PACKET_RULESET_GOVERNMENT_RULER_TITLE;
58938#endif /* FREECIV_DELTA_PROTOCOL */
58939 RECEIVE_PACKET_START(packet_ruleset_government_ruler_title, real_packet);
58940#ifdef FREECIV_JSON_CONNECTION
58941 struct plocation field_addr;
58942 {
58943 struct plocation *field_addr_tmp = plocation_field_new(NULL);
58944 field_addr = *field_addr_tmp;
58945 FC_FREE(field_addr_tmp);
58946 }
58947#endif /* FREECIV_JSON_CONNECTION */
58948
58949#ifdef FREECIV_DELTA_PROTOCOL
58950#ifdef FREECIV_JSON_CONNECTION
58951 field_addr.name = "fields";
58952#endif /* FREECIV_JSON_CONNECTION */
58953 DIO_BV_GET(&din, &field_addr, fields);
58954
58955#else /* FREECIV_DELTA_PROTOCOL */
58956 #ifdef FREECIV_JSON_CONNECTION
58957 field_addr.name = "gov";
58958 #endif /* FREECIV_JSON_CONNECTION */
58959 {
58960 int readin;
58961
58962 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
58963 RECEIVE_PACKET_FIELD_ERROR(gov);
58964 }
58965 real_packet->gov = readin;
58966 }
58967 #ifdef FREECIV_JSON_CONNECTION
58968 field_addr.name = "nation";
58969 #endif /* FREECIV_JSON_CONNECTION */
58970 {
58971 int readin;
58972
58973 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
58974 RECEIVE_PACKET_FIELD_ERROR(nation);
58975 }
58976 real_packet->nation = readin;
58977 }
58978 #ifdef FREECIV_JSON_CONNECTION
58979 field_addr.name = "male_title";
58980 #endif /* FREECIV_JSON_CONNECTION */
58981 if (!DIO_GET(string, &din, &field_addr, real_packet->male_title, sizeof(real_packet->male_title))) {
58982 RECEIVE_PACKET_FIELD_ERROR(male_title);
58983 }
58984 #ifdef FREECIV_JSON_CONNECTION
58985 field_addr.name = "female_title";
58986 #endif /* FREECIV_JSON_CONNECTION */
58987 if (!DIO_GET(string, &din, &field_addr, real_packet->female_title, sizeof(real_packet->female_title))) {
58988 RECEIVE_PACKET_FIELD_ERROR(female_title);
58989 }
58990
58991#endif
58992 log_packet_detailed("packet_ruleset_government_ruler_title_100: got info about ()");
58993
58994#ifdef FREECIV_DELTA_PROTOCOL
58995 if (NULL == *hash) {
58996 *hash = genhash_new_full(hash_packet_ruleset_government_ruler_title_100, cmp_packet_ruleset_government_ruler_title_100,
58997 NULL, NULL, NULL, free);
58998 }
58999
59000 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
59001 *real_packet = *old;
59002 } else {
59003 log_packet_detailed(" no old info");
59004 memset(real_packet, 0, sizeof(*real_packet));
59005 }
59006
59007 if (BV_ISSET(fields, 0)) {
59008 log_packet_detailed(" got field 'gov'");
59009 #ifdef FREECIV_JSON_CONNECTION
59010 field_addr.name = "gov";
59011 #endif /* FREECIV_JSON_CONNECTION */
59012 {
59013 int readin;
59014
59015 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
59016 RECEIVE_PACKET_FIELD_ERROR(gov);
59017 }
59018 real_packet->gov = readin;
59019 }
59020 }
59021 if (BV_ISSET(fields, 1)) {
59022 log_packet_detailed(" got field 'nation'");
59023 #ifdef FREECIV_JSON_CONNECTION
59024 field_addr.name = "nation";
59025 #endif /* FREECIV_JSON_CONNECTION */
59026 {
59027 int readin;
59028
59029 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
59030 RECEIVE_PACKET_FIELD_ERROR(nation);
59031 }
59032 real_packet->nation = readin;
59033 }
59034 }
59035 if (BV_ISSET(fields, 2)) {
59036 log_packet_detailed(" got field 'male_title'");
59037 #ifdef FREECIV_JSON_CONNECTION
59038 field_addr.name = "male_title";
59039 #endif /* FREECIV_JSON_CONNECTION */
59040 if (!DIO_GET(string, &din, &field_addr, real_packet->male_title, sizeof(real_packet->male_title))) {
59041 RECEIVE_PACKET_FIELD_ERROR(male_title);
59042 }
59043 }
59044 if (BV_ISSET(fields, 3)) {
59045 log_packet_detailed(" got field 'female_title'");
59046 #ifdef FREECIV_JSON_CONNECTION
59047 field_addr.name = "female_title";
59048 #endif /* FREECIV_JSON_CONNECTION */
59049 if (!DIO_GET(string, &din, &field_addr, real_packet->female_title, sizeof(real_packet->female_title))) {
59050 RECEIVE_PACKET_FIELD_ERROR(female_title);
59051 }
59052 }
59053
59054 if (NULL == old) {
59055 old = fc_malloc(sizeof(*old));
59056 *old = *real_packet;
59057 genhash_insert(*hash, old, old);
59058 } else {
59059 *old = *real_packet;
59060 }
59061
59062#endif /* FREECIV_DELTA_PROTOCOL */
59063 RECEIVE_PACKET_END(real_packet);
59064}
59065
59066 static int send_packet_ruleset_government_ruler_title_100(struct connection *pc, const struct packet_ruleset_government_ruler_title *packet)
59067{
59068 const struct packet_ruleset_government_ruler_title *real_packet = packet;
59069#ifdef FREECIV_DELTA_PROTOCOL
59070 packet_ruleset_government_ruler_title_100_fields fields;
59071 struct packet_ruleset_government_ruler_title *old;
59072 bool differ;
59073 struct genhash **hash = pc->phs.sent + PACKET_RULESET_GOVERNMENT_RULER_TITLE;
59074#endif /* FREECIV_DELTA_PROTOCOL */
59075 SEND_PACKET_START(PACKET_RULESET_GOVERNMENT_RULER_TITLE);
59076#ifdef FREECIV_JSON_CONNECTION
59077 struct plocation field_addr;
59078 {
59079 struct plocation *field_addr_tmp = plocation_field_new(NULL);
59080 field_addr = *field_addr_tmp;
59081 FC_FREE(field_addr_tmp);
59082 }
59083#endif /* FREECIV_JSON_CONNECTION */
59084
59085 log_packet_detailed("packet_ruleset_government_ruler_title_100: sending info about ()");
59086
59087#ifdef FREECIV_DELTA_PROTOCOL
59088 if (NULL == *hash) {
59089 *hash = genhash_new_full(hash_packet_ruleset_government_ruler_title_100, cmp_packet_ruleset_government_ruler_title_100,
59090 NULL, NULL, NULL, free);
59091 }
59092 BV_CLR_ALL(fields);
59093
59094 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
59095 old = fc_malloc(sizeof(*old));
59096 *old = *real_packet;
59097 genhash_insert(*hash, old, old);
59098 memset(old, 0, sizeof(*old));
59099 }
59100 differ = (old->gov != real_packet->gov);
59101 if (differ) {
59102 BV_SET(fields, 0);
59103 }
59104
59105 differ = (old->nation != real_packet->nation);
59106 if (differ) {
59107 BV_SET(fields, 1);
59108 }
59109
59110 differ = (strcmp(old->male_title, real_packet->male_title) != 0);
59111 if (differ) {
59112 BV_SET(fields, 2);
59113 }
59114
59115 differ = (strcmp(old->female_title, real_packet->female_title) != 0);
59116 if (differ) {
59117 BV_SET(fields, 3);
59118 }
59119
59120
59121#ifdef FREECIV_JSON_CONNECTION
59122 field_addr.name = "fields";
59123#endif /* FREECIV_JSON_CONNECTION */
59124 DIO_BV_PUT(&dout, &field_addr, fields);
59125
59126 if (BV_ISSET(fields, 0)) {
59127 log_packet_detailed(" field 'gov' has changed");
59128 #ifdef FREECIV_JSON_CONNECTION
59129 field_addr.name = "gov";
59130#endif /* FREECIV_JSON_CONNECTION */
59131 DIO_PUT(sint8, &dout, &field_addr, real_packet->gov);
59132 }
59133 if (BV_ISSET(fields, 1)) {
59134 log_packet_detailed(" field 'nation' has changed");
59135 #ifdef FREECIV_JSON_CONNECTION
59136 field_addr.name = "nation";
59137#endif /* FREECIV_JSON_CONNECTION */
59138 DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
59139 }
59140 if (BV_ISSET(fields, 2)) {
59141 log_packet_detailed(" field 'male_title' has changed");
59142 #ifdef FREECIV_JSON_CONNECTION
59143 field_addr.name = "male_title";
59144#endif /* FREECIV_JSON_CONNECTION */
59145 DIO_PUT(string, &dout, &field_addr, real_packet->male_title);
59146 }
59147 if (BV_ISSET(fields, 3)) {
59148 log_packet_detailed(" field 'female_title' has changed");
59149 #ifdef FREECIV_JSON_CONNECTION
59150 field_addr.name = "female_title";
59151#endif /* FREECIV_JSON_CONNECTION */
59152 DIO_PUT(string, &dout, &field_addr, real_packet->female_title);
59153 }
59154
59155 *old = *real_packet;
59156#endif /* FREECIV_DELTA_PROTOCOL */
59157#ifndef FREECIV_DELTA_PROTOCOL
59158#ifdef FREECIV_JSON_CONNECTION
59159 field_addr.name = "gov";
59160#endif /* FREECIV_JSON_CONNECTION */
59161 DIO_PUT(sint8, &dout, &field_addr, real_packet->gov);
59162#ifdef FREECIV_JSON_CONNECTION
59163 field_addr.name = "nation";
59164#endif /* FREECIV_JSON_CONNECTION */
59165 DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
59166#ifdef FREECIV_JSON_CONNECTION
59167 field_addr.name = "male_title";
59168#endif /* FREECIV_JSON_CONNECTION */
59169 DIO_PUT(string, &dout, &field_addr, real_packet->male_title);
59170#ifdef FREECIV_JSON_CONNECTION
59171 field_addr.name = "female_title";
59172#endif /* FREECIV_JSON_CONNECTION */
59173 DIO_PUT(string, &dout, &field_addr, real_packet->female_title);
59174
59175#endif
59176 SEND_PACKET_END(PACKET_RULESET_GOVERNMENT_RULER_TITLE);
59177}
59178
59179 int send_packet_ruleset_government_ruler_title(struct connection *pc, const struct packet_ruleset_government_ruler_title *packet)
59180{
59181 if (!pc->used) {
59182 log_error("WARNING: trying to send data to the closed connection %s",
59183 conn_description(pc));
59184 return -1;
59185 }
59186 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_GOVERNMENT_RULER_TITLE].packet != NULL, -1,
59187 "Handler for PACKET_RULESET_GOVERNMENT_RULER_TITLE not installed");
59188 return pc->phs.handlers->send[PACKET_RULESET_GOVERNMENT_RULER_TITLE].packet(pc, packet);
59189}
59190
59191 void lsend_packet_ruleset_government_ruler_title(struct conn_list *dest, const struct packet_ruleset_government_ruler_title *packet)
59192{
59193 conn_list_iterate(dest, pconn) {
59194 send_packet_ruleset_government_ruler_title(pconn, packet);
59195 } conn_list_iterate_end;
59196}
59197
59198#ifdef FREECIV_DELTA_PROTOCOL
59199#define hash_packet_ruleset_tech_100 hash_const
59200
59201#define cmp_packet_ruleset_tech_100 cmp_const
59202
59203 BV_DEFINE(packet_ruleset_tech_100_fields, 14);
59204#endif /* FREECIV_DELTA_PROTOCOL */
59205
59206 static struct packet_ruleset_tech *receive_packet_ruleset_tech_100(struct connection *pc)
59207{
59208#ifdef FREECIV_DELTA_PROTOCOL
59209 packet_ruleset_tech_100_fields fields;
59210 struct packet_ruleset_tech *old;
59211 struct genhash **hash = pc->phs.received + PACKET_RULESET_TECH;
59212#endif /* FREECIV_DELTA_PROTOCOL */
59213 RECEIVE_PACKET_START(packet_ruleset_tech, real_packet);
59214#ifdef FREECIV_JSON_CONNECTION
59215 struct plocation field_addr;
59216 {
59217 struct plocation *field_addr_tmp = plocation_field_new(NULL);
59218 field_addr = *field_addr_tmp;
59219 FC_FREE(field_addr_tmp);
59220 }
59221#endif /* FREECIV_JSON_CONNECTION */
59222
59223#ifdef FREECIV_DELTA_PROTOCOL
59224#ifdef FREECIV_JSON_CONNECTION
59225 field_addr.name = "fields";
59226#endif /* FREECIV_JSON_CONNECTION */
59227 DIO_BV_GET(&din, &field_addr, fields);
59228
59229#else /* FREECIV_DELTA_PROTOCOL */
59230 #ifdef FREECIV_JSON_CONNECTION
59231 field_addr.name = "id";
59232 #endif /* FREECIV_JSON_CONNECTION */
59233 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
59234 RECEIVE_PACKET_FIELD_ERROR(id);
59235 }
59236 #ifdef FREECIV_JSON_CONNECTION
59237 field_addr.name = "root_req";
59238 #endif /* FREECIV_JSON_CONNECTION */
59239 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->root_req)) {
59240 RECEIVE_PACKET_FIELD_ERROR(root_req);
59241 }
59242 #ifdef FREECIV_JSON_CONNECTION
59243 field_addr.name = "research_reqs_count";
59244 #endif /* FREECIV_JSON_CONNECTION */
59245 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->research_reqs_count)) {
59246 RECEIVE_PACKET_FIELD_ERROR(research_reqs_count);
59247 }
59248 #ifdef FREECIV_JSON_CONNECTION
59249 field_addr.name = "research_reqs";
59250 #endif /* FREECIV_JSON_CONNECTION */
59251
59252 {
59253 int i;
59254
59255 #ifdef FREECIV_JSON_CONNECTION
59256 /* Enter array. */
59257 field_addr.sub_location = plocation_elem_new(0);
59258 #endif /* FREECIV_JSON_CONNECTION */
59259
59260 if (real_packet->research_reqs_count > MAX_NUM_REQS) {
59261 RECEIVE_PACKET_FIELD_ERROR(research_reqs, ": truncation array");
59262 }
59263 for (i = 0; i < real_packet->research_reqs_count; i++) {
59264 #ifdef FREECIV_JSON_CONNECTION
59265 field_addr.sub_location->number = i;
59266 #endif /* FREECIV_JSON_CONNECTION */
59267 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->research_reqs[i])) {
59268 RECEIVE_PACKET_FIELD_ERROR(research_reqs);
59269 }
59270 }
59271
59272 #ifdef FREECIV_JSON_CONNECTION
59273 /* Exit array. */
59274 free(field_addr.sub_location);
59275 field_addr.sub_location = NULL;
59276 #endif /* FREECIV_JSON_CONNECTION */
59277 }
59278 #ifdef FREECIV_JSON_CONNECTION
59279 field_addr.name = "tclass";
59280 #endif /* FREECIV_JSON_CONNECTION */
59281 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tclass)) {
59282 RECEIVE_PACKET_FIELD_ERROR(tclass);
59283 }
59284 #ifdef FREECIV_JSON_CONNECTION
59285 field_addr.name = "removed";
59286 #endif /* FREECIV_JSON_CONNECTION */
59287 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->removed)) {
59288 RECEIVE_PACKET_FIELD_ERROR(removed);
59289 }
59290 #ifdef FREECIV_JSON_CONNECTION
59291 field_addr.name = "flags";
59292 #endif /* FREECIV_JSON_CONNECTION */
59293 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
59294 RECEIVE_PACKET_FIELD_ERROR(flags);
59295 }
59296 #ifdef FREECIV_JSON_CONNECTION
59297 field_addr.name = "cost";
59298 #endif /* FREECIV_JSON_CONNECTION */
59299 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->cost, 100)) {
59300 RECEIVE_PACKET_FIELD_ERROR(cost);
59301 }
59302 #ifdef FREECIV_JSON_CONNECTION
59303 field_addr.name = "num_reqs";
59304 #endif /* FREECIV_JSON_CONNECTION */
59305 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->num_reqs)) {
59306 RECEIVE_PACKET_FIELD_ERROR(num_reqs);
59307 }
59308 #ifdef FREECIV_JSON_CONNECTION
59309 field_addr.name = "name";
59310 #endif /* FREECIV_JSON_CONNECTION */
59311 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
59312 RECEIVE_PACKET_FIELD_ERROR(name);
59313 }
59314 #ifdef FREECIV_JSON_CONNECTION
59315 field_addr.name = "rule_name";
59316 #endif /* FREECIV_JSON_CONNECTION */
59317 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
59318 RECEIVE_PACKET_FIELD_ERROR(rule_name);
59319 }
59320 #ifdef FREECIV_JSON_CONNECTION
59321 field_addr.name = "helptext";
59322 #endif /* FREECIV_JSON_CONNECTION */
59323 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
59324 RECEIVE_PACKET_FIELD_ERROR(helptext);
59325 }
59326 #ifdef FREECIV_JSON_CONNECTION
59327 field_addr.name = "graphic_str";
59328 #endif /* FREECIV_JSON_CONNECTION */
59329 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
59330 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
59331 }
59332 #ifdef FREECIV_JSON_CONNECTION
59333 field_addr.name = "graphic_alt";
59334 #endif /* FREECIV_JSON_CONNECTION */
59335 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
59336 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
59337 }
59338
59339#endif
59340 log_packet_detailed("packet_ruleset_tech_100: got info about ()");
59341
59342#ifdef FREECIV_DELTA_PROTOCOL
59343 if (NULL == *hash) {
59344 *hash = genhash_new_full(hash_packet_ruleset_tech_100, cmp_packet_ruleset_tech_100,
59345 NULL, NULL, NULL, free);
59346 }
59347
59348 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
59349 *real_packet = *old;
59350 } else {
59351 log_packet_detailed(" no old info");
59352 memset(real_packet, 0, sizeof(*real_packet));
59353 }
59354
59355 if (BV_ISSET(fields, 0)) {
59356 log_packet_detailed(" got field 'id'");
59357 #ifdef FREECIV_JSON_CONNECTION
59358 field_addr.name = "id";
59359 #endif /* FREECIV_JSON_CONNECTION */
59360 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
59361 RECEIVE_PACKET_FIELD_ERROR(id);
59362 }
59363 }
59364 if (BV_ISSET(fields, 1)) {
59365 log_packet_detailed(" got field 'root_req'");
59366 #ifdef FREECIV_JSON_CONNECTION
59367 field_addr.name = "root_req";
59368 #endif /* FREECIV_JSON_CONNECTION */
59369 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->root_req)) {
59370 RECEIVE_PACKET_FIELD_ERROR(root_req);
59371 }
59372 }
59373 if (BV_ISSET(fields, 2)) {
59374 log_packet_detailed(" got field 'research_reqs_count'");
59375 #ifdef FREECIV_JSON_CONNECTION
59376 field_addr.name = "research_reqs_count";
59377 #endif /* FREECIV_JSON_CONNECTION */
59378 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->research_reqs_count)) {
59379 RECEIVE_PACKET_FIELD_ERROR(research_reqs_count);
59380 }
59381 }
59382 if (BV_ISSET(fields, 3)) {
59383 log_packet_detailed(" got field 'research_reqs'");
59384 #ifdef FREECIV_JSON_CONNECTION
59385 field_addr.name = "research_reqs";
59386 #endif /* FREECIV_JSON_CONNECTION */
59387
59388 {
59389 int i;
59390
59391 #ifdef FREECIV_JSON_CONNECTION
59392 /* Enter array. */
59393 field_addr.sub_location = plocation_elem_new(0);
59394 #endif /* FREECIV_JSON_CONNECTION */
59395
59396 if (real_packet->research_reqs_count > MAX_NUM_REQS) {
59397 RECEIVE_PACKET_FIELD_ERROR(research_reqs, ": truncation array");
59398 }
59399 for (i = 0; i < real_packet->research_reqs_count; i++) {
59400 #ifdef FREECIV_JSON_CONNECTION
59401 field_addr.sub_location->number = i;
59402 #endif /* FREECIV_JSON_CONNECTION */
59403 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->research_reqs[i])) {
59404 RECEIVE_PACKET_FIELD_ERROR(research_reqs);
59405 }
59406 }
59407
59408 #ifdef FREECIV_JSON_CONNECTION
59409 /* Exit array. */
59410 free(field_addr.sub_location);
59411 field_addr.sub_location = NULL;
59412 #endif /* FREECIV_JSON_CONNECTION */
59413 }
59414 }
59415 if (BV_ISSET(fields, 4)) {
59416 log_packet_detailed(" got field 'tclass'");
59417 #ifdef FREECIV_JSON_CONNECTION
59418 field_addr.name = "tclass";
59419 #endif /* FREECIV_JSON_CONNECTION */
59420 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tclass)) {
59421 RECEIVE_PACKET_FIELD_ERROR(tclass);
59422 }
59423 }
59424 real_packet->removed = BV_ISSET(fields, 5);
59425 if (BV_ISSET(fields, 6)) {
59426 log_packet_detailed(" got field 'flags'");
59427 #ifdef FREECIV_JSON_CONNECTION
59428 field_addr.name = "flags";
59429 #endif /* FREECIV_JSON_CONNECTION */
59430 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
59431 RECEIVE_PACKET_FIELD_ERROR(flags);
59432 }
59433 }
59434 if (BV_ISSET(fields, 7)) {
59435 log_packet_detailed(" got field 'cost'");
59436 #ifdef FREECIV_JSON_CONNECTION
59437 field_addr.name = "cost";
59438 #endif /* FREECIV_JSON_CONNECTION */
59439 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->cost, 100)) {
59440 RECEIVE_PACKET_FIELD_ERROR(cost);
59441 }
59442 }
59443 if (BV_ISSET(fields, 8)) {
59444 log_packet_detailed(" got field 'num_reqs'");
59445 #ifdef FREECIV_JSON_CONNECTION
59446 field_addr.name = "num_reqs";
59447 #endif /* FREECIV_JSON_CONNECTION */
59448 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->num_reqs)) {
59449 RECEIVE_PACKET_FIELD_ERROR(num_reqs);
59450 }
59451 }
59452 if (BV_ISSET(fields, 9)) {
59453 log_packet_detailed(" got field 'name'");
59454 #ifdef FREECIV_JSON_CONNECTION
59455 field_addr.name = "name";
59456 #endif /* FREECIV_JSON_CONNECTION */
59457 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
59458 RECEIVE_PACKET_FIELD_ERROR(name);
59459 }
59460 }
59461 if (BV_ISSET(fields, 10)) {
59462 log_packet_detailed(" got field 'rule_name'");
59463 #ifdef FREECIV_JSON_CONNECTION
59464 field_addr.name = "rule_name";
59465 #endif /* FREECIV_JSON_CONNECTION */
59466 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
59467 RECEIVE_PACKET_FIELD_ERROR(rule_name);
59468 }
59469 }
59470 if (BV_ISSET(fields, 11)) {
59471 log_packet_detailed(" got field 'helptext'");
59472 #ifdef FREECIV_JSON_CONNECTION
59473 field_addr.name = "helptext";
59474 #endif /* FREECIV_JSON_CONNECTION */
59475 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
59476 RECEIVE_PACKET_FIELD_ERROR(helptext);
59477 }
59478 }
59479 if (BV_ISSET(fields, 12)) {
59480 log_packet_detailed(" got field 'graphic_str'");
59481 #ifdef FREECIV_JSON_CONNECTION
59482 field_addr.name = "graphic_str";
59483 #endif /* FREECIV_JSON_CONNECTION */
59484 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
59485 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
59486 }
59487 }
59488 if (BV_ISSET(fields, 13)) {
59489 log_packet_detailed(" got field 'graphic_alt'");
59490 #ifdef FREECIV_JSON_CONNECTION
59491 field_addr.name = "graphic_alt";
59492 #endif /* FREECIV_JSON_CONNECTION */
59493 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
59494 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
59495 }
59496 }
59497
59498 if (NULL == old) {
59499 old = fc_malloc(sizeof(*old));
59500 *old = *real_packet;
59501 genhash_insert(*hash, old, old);
59502 } else {
59503 *old = *real_packet;
59504 }
59505
59506#endif /* FREECIV_DELTA_PROTOCOL */
59507 RECEIVE_PACKET_END(real_packet);
59508}
59509
59510 static int send_packet_ruleset_tech_100(struct connection *pc, const struct packet_ruleset_tech *packet)
59511{
59512 const struct packet_ruleset_tech *real_packet = packet;
59513#ifdef FREECIV_DELTA_PROTOCOL
59514 packet_ruleset_tech_100_fields fields;
59515 struct packet_ruleset_tech *old;
59516 bool differ;
59517 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TECH;
59518#endif /* FREECIV_DELTA_PROTOCOL */
59519 SEND_PACKET_START(PACKET_RULESET_TECH);
59520#ifdef FREECIV_JSON_CONNECTION
59521 struct plocation field_addr;
59522 {
59523 struct plocation *field_addr_tmp = plocation_field_new(NULL);
59524 field_addr = *field_addr_tmp;
59525 FC_FREE(field_addr_tmp);
59526 }
59527#endif /* FREECIV_JSON_CONNECTION */
59528
59529 log_packet_detailed("packet_ruleset_tech_100: sending info about ()");
59530
59531#ifdef FREECIV_DELTA_PROTOCOL
59532 if (NULL == *hash) {
59533 *hash = genhash_new_full(hash_packet_ruleset_tech_100, cmp_packet_ruleset_tech_100,
59534 NULL, NULL, NULL, free);
59535 }
59536 BV_CLR_ALL(fields);
59537
59538 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
59539 old = fc_malloc(sizeof(*old));
59540 *old = *real_packet;
59541 genhash_insert(*hash, old, old);
59542 memset(old, 0, sizeof(*old));
59543 }
59544 differ = (old->id != real_packet->id);
59545 if (differ) {
59546 BV_SET(fields, 0);
59547 }
59548
59549 differ = (old->root_req != real_packet->root_req);
59550 if (differ) {
59551 BV_SET(fields, 1);
59552 }
59553
59554 differ = (old->research_reqs_count != real_packet->research_reqs_count);
59555 if (differ) {
59556 BV_SET(fields, 2);
59557 }
59558
59559
59560 {
59561 differ = (old->research_reqs_count != real_packet->research_reqs_count);
59562 if (!differ) {
59563 int i;
59564
59565 for (i = 0; i < real_packet->research_reqs_count; i++) {
59566 if (!are_requirements_equal(&old->research_reqs[i], &real_packet->research_reqs[i])) {
59567 differ = TRUE;
59568 break;
59569 }
59570 }
59571 }
59572 }
59573 if (differ) {
59574 BV_SET(fields, 3);
59575 }
59576
59577 differ = (old->tclass != real_packet->tclass);
59578 if (differ) {
59579 BV_SET(fields, 4);
59580 }
59581
59582 if (packet->removed) {
59583 BV_SET(fields, 5);
59584 }
59585
59586 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
59587 if (differ) {
59588 BV_SET(fields, 6);
59589 }
59590
59591 differ = (old->cost != real_packet->cost);
59592 if (differ) {
59593 BV_SET(fields, 7);
59594 }
59595
59596 differ = (old->num_reqs != real_packet->num_reqs);
59597 if (differ) {
59598 BV_SET(fields, 8);
59599 }
59600
59601 differ = (strcmp(old->name, real_packet->name) != 0);
59602 if (differ) {
59603 BV_SET(fields, 9);
59604 }
59605
59606 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
59607 if (differ) {
59608 BV_SET(fields, 10);
59609 }
59610
59611 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
59612 if (differ) {
59613 BV_SET(fields, 11);
59614 }
59615
59616 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
59617 if (differ) {
59618 BV_SET(fields, 12);
59619 }
59620
59621 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
59622 if (differ) {
59623 BV_SET(fields, 13);
59624 }
59625
59626
59627#ifdef FREECIV_JSON_CONNECTION
59628 field_addr.name = "fields";
59629#endif /* FREECIV_JSON_CONNECTION */
59630 DIO_BV_PUT(&dout, &field_addr, fields);
59631
59632 if (BV_ISSET(fields, 0)) {
59633 log_packet_detailed(" field 'id' has changed");
59634 #ifdef FREECIV_JSON_CONNECTION
59635 field_addr.name = "id";
59636#endif /* FREECIV_JSON_CONNECTION */
59637 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
59638 }
59639 if (BV_ISSET(fields, 1)) {
59640 log_packet_detailed(" field 'root_req' has changed");
59641 #ifdef FREECIV_JSON_CONNECTION
59642 field_addr.name = "root_req";
59643#endif /* FREECIV_JSON_CONNECTION */
59644 DIO_PUT(uint8, &dout, &field_addr, real_packet->root_req);
59645 }
59646 if (BV_ISSET(fields, 2)) {
59647 log_packet_detailed(" field 'research_reqs_count' has changed");
59648 #ifdef FREECIV_JSON_CONNECTION
59649 field_addr.name = "research_reqs_count";
59650#endif /* FREECIV_JSON_CONNECTION */
59651 DIO_PUT(uint8, &dout, &field_addr, real_packet->research_reqs_count);
59652 }
59653 if (BV_ISSET(fields, 3)) {
59654 log_packet_detailed(" field 'research_reqs' has changed");
59655 #ifdef FREECIV_JSON_CONNECTION
59656 field_addr.name = "research_reqs";
59657#endif /* FREECIV_JSON_CONNECTION */
59658
59659 {
59660 int i;
59661
59662#ifdef FREECIV_JSON_CONNECTION
59663 /* Create the array. */
59664 DIO_PUT(farray, &dout, &field_addr, real_packet->research_reqs_count);
59665
59666 /* Enter the array. */
59667 field_addr.sub_location = plocation_elem_new(0);
59668#endif /* FREECIV_JSON_CONNECTION */
59669
59670 for (i = 0; i < real_packet->research_reqs_count; i++) {
59671#ifdef FREECIV_JSON_CONNECTION
59672 /* Next array element. */
59673 field_addr.sub_location->number = i;
59674#endif /* FREECIV_JSON_CONNECTION */
59675 DIO_PUT(requirement, &dout, &field_addr, &real_packet->research_reqs[i]);
59676 }
59677
59678#ifdef FREECIV_JSON_CONNECTION
59679 /* Exit array. */
59680 free(field_addr.sub_location);
59681 field_addr.sub_location = NULL;
59682#endif /* FREECIV_JSON_CONNECTION */
59683 }
59684 }
59685 if (BV_ISSET(fields, 4)) {
59686 log_packet_detailed(" field 'tclass' has changed");
59687 #ifdef FREECIV_JSON_CONNECTION
59688 field_addr.name = "tclass";
59689#endif /* FREECIV_JSON_CONNECTION */
59690 DIO_PUT(uint8, &dout, &field_addr, real_packet->tclass);
59691 }
59692 /* field 5 is folded into the header */
59693 if (BV_ISSET(fields, 6)) {
59694 log_packet_detailed(" field 'flags' has changed");
59695 #ifdef FREECIV_JSON_CONNECTION
59696 field_addr.name = "flags";
59697#endif /* FREECIV_JSON_CONNECTION */
59698 DIO_BV_PUT(&dout, &field_addr, packet->flags);
59699 }
59700 if (BV_ISSET(fields, 7)) {
59701 log_packet_detailed(" field 'cost' has changed");
59702 #ifdef FREECIV_JSON_CONNECTION
59703 field_addr.name = "cost";
59704#endif /* FREECIV_JSON_CONNECTION */
59705 DIO_PUT(ufloat, &dout, &field_addr, real_packet->cost, 100);
59706 }
59707 if (BV_ISSET(fields, 8)) {
59708 log_packet_detailed(" field 'num_reqs' has changed");
59709 #ifdef FREECIV_JSON_CONNECTION
59710 field_addr.name = "num_reqs";
59711#endif /* FREECIV_JSON_CONNECTION */
59712 DIO_PUT(uint32, &dout, &field_addr, real_packet->num_reqs);
59713 }
59714 if (BV_ISSET(fields, 9)) {
59715 log_packet_detailed(" field 'name' has changed");
59716 #ifdef FREECIV_JSON_CONNECTION
59717 field_addr.name = "name";
59718#endif /* FREECIV_JSON_CONNECTION */
59719 DIO_PUT(string, &dout, &field_addr, real_packet->name);
59720 }
59721 if (BV_ISSET(fields, 10)) {
59722 log_packet_detailed(" field 'rule_name' has changed");
59723 #ifdef FREECIV_JSON_CONNECTION
59724 field_addr.name = "rule_name";
59725#endif /* FREECIV_JSON_CONNECTION */
59726 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
59727 }
59728 if (BV_ISSET(fields, 11)) {
59729 log_packet_detailed(" field 'helptext' has changed");
59730 #ifdef FREECIV_JSON_CONNECTION
59731 field_addr.name = "helptext";
59732#endif /* FREECIV_JSON_CONNECTION */
59733 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
59734 }
59735 if (BV_ISSET(fields, 12)) {
59736 log_packet_detailed(" field 'graphic_str' has changed");
59737 #ifdef FREECIV_JSON_CONNECTION
59738 field_addr.name = "graphic_str";
59739#endif /* FREECIV_JSON_CONNECTION */
59740 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
59741 }
59742 if (BV_ISSET(fields, 13)) {
59743 log_packet_detailed(" field 'graphic_alt' has changed");
59744 #ifdef FREECIV_JSON_CONNECTION
59745 field_addr.name = "graphic_alt";
59746#endif /* FREECIV_JSON_CONNECTION */
59747 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
59748 }
59749
59750 *old = *real_packet;
59751#endif /* FREECIV_DELTA_PROTOCOL */
59752#ifndef FREECIV_DELTA_PROTOCOL
59753#ifdef FREECIV_JSON_CONNECTION
59754 field_addr.name = "id";
59755#endif /* FREECIV_JSON_CONNECTION */
59756 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
59757#ifdef FREECIV_JSON_CONNECTION
59758 field_addr.name = "root_req";
59759#endif /* FREECIV_JSON_CONNECTION */
59760 DIO_PUT(uint8, &dout, &field_addr, real_packet->root_req);
59761#ifdef FREECIV_JSON_CONNECTION
59762 field_addr.name = "research_reqs_count";
59763#endif /* FREECIV_JSON_CONNECTION */
59764 DIO_PUT(uint8, &dout, &field_addr, real_packet->research_reqs_count);
59765#ifdef FREECIV_JSON_CONNECTION
59766 field_addr.name = "research_reqs";
59767#endif /* FREECIV_JSON_CONNECTION */
59768
59769 {
59770 int i;
59771
59772#ifdef FREECIV_JSON_CONNECTION
59773 /* Create the array. */
59774 DIO_PUT(farray, &dout, &field_addr, real_packet->research_reqs_count);
59775
59776 /* Enter the array. */
59777 field_addr.sub_location = plocation_elem_new(0);
59778#endif /* FREECIV_JSON_CONNECTION */
59779
59780 for (i = 0; i < real_packet->research_reqs_count; i++) {
59781#ifdef FREECIV_JSON_CONNECTION
59782 /* Next array element. */
59783 field_addr.sub_location->number = i;
59784#endif /* FREECIV_JSON_CONNECTION */
59785 DIO_PUT(requirement, &dout, &field_addr, &real_packet->research_reqs[i]);
59786 }
59787
59788#ifdef FREECIV_JSON_CONNECTION
59789 /* Exit array. */
59790 free(field_addr.sub_location);
59791 field_addr.sub_location = NULL;
59792#endif /* FREECIV_JSON_CONNECTION */
59793 }
59794#ifdef FREECIV_JSON_CONNECTION
59795 field_addr.name = "tclass";
59796#endif /* FREECIV_JSON_CONNECTION */
59797 DIO_PUT(uint8, &dout, &field_addr, real_packet->tclass);
59798#ifdef FREECIV_JSON_CONNECTION
59799 field_addr.name = "removed";
59800#endif /* FREECIV_JSON_CONNECTION */
59801 DIO_PUT(bool8, &dout, &field_addr, real_packet->removed);
59802#ifdef FREECIV_JSON_CONNECTION
59803 field_addr.name = "flags";
59804#endif /* FREECIV_JSON_CONNECTION */
59805 DIO_BV_PUT(&dout, &field_addr, packet->flags);
59806#ifdef FREECIV_JSON_CONNECTION
59807 field_addr.name = "cost";
59808#endif /* FREECIV_JSON_CONNECTION */
59809 DIO_PUT(ufloat, &dout, &field_addr, real_packet->cost, 100);
59810#ifdef FREECIV_JSON_CONNECTION
59811 field_addr.name = "num_reqs";
59812#endif /* FREECIV_JSON_CONNECTION */
59813 DIO_PUT(uint32, &dout, &field_addr, real_packet->num_reqs);
59814#ifdef FREECIV_JSON_CONNECTION
59815 field_addr.name = "name";
59816#endif /* FREECIV_JSON_CONNECTION */
59817 DIO_PUT(string, &dout, &field_addr, real_packet->name);
59818#ifdef FREECIV_JSON_CONNECTION
59819 field_addr.name = "rule_name";
59820#endif /* FREECIV_JSON_CONNECTION */
59821 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
59822#ifdef FREECIV_JSON_CONNECTION
59823 field_addr.name = "helptext";
59824#endif /* FREECIV_JSON_CONNECTION */
59825 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
59826#ifdef FREECIV_JSON_CONNECTION
59827 field_addr.name = "graphic_str";
59828#endif /* FREECIV_JSON_CONNECTION */
59829 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
59830#ifdef FREECIV_JSON_CONNECTION
59831 field_addr.name = "graphic_alt";
59832#endif /* FREECIV_JSON_CONNECTION */
59833 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
59834
59835#endif
59836 SEND_PACKET_END(PACKET_RULESET_TECH);
59837}
59838
59839 int send_packet_ruleset_tech(struct connection *pc, const struct packet_ruleset_tech *packet)
59840{
59841 if (!pc->used) {
59842 log_error("WARNING: trying to send data to the closed connection %s",
59843 conn_description(pc));
59844 return -1;
59845 }
59846 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TECH].packet != NULL, -1,
59847 "Handler for PACKET_RULESET_TECH not installed");
59848 return pc->phs.handlers->send[PACKET_RULESET_TECH].packet(pc, packet);
59849}
59850
59851 void lsend_packet_ruleset_tech(struct conn_list *dest, const struct packet_ruleset_tech *packet)
59852{
59853 conn_list_iterate(dest, pconn) {
59854 send_packet_ruleset_tech(pconn, packet);
59855 } conn_list_iterate_end;
59856}
59857
59858#ifdef FREECIV_DELTA_PROTOCOL
59859#define hash_packet_ruleset_tech_class_100 hash_const
59860
59861#define cmp_packet_ruleset_tech_class_100 cmp_const
59862
59863 BV_DEFINE(packet_ruleset_tech_class_100_fields, 4);
59864#endif /* FREECIV_DELTA_PROTOCOL */
59865
59866 static struct packet_ruleset_tech_class *receive_packet_ruleset_tech_class_100(struct connection *pc)
59867{
59868#ifdef FREECIV_DELTA_PROTOCOL
59869 packet_ruleset_tech_class_100_fields fields;
59870 struct packet_ruleset_tech_class *old;
59871 struct genhash **hash = pc->phs.received + PACKET_RULESET_TECH_CLASS;
59872#endif /* FREECIV_DELTA_PROTOCOL */
59873 RECEIVE_PACKET_START(packet_ruleset_tech_class, real_packet);
59874#ifdef FREECIV_JSON_CONNECTION
59875 struct plocation field_addr;
59876 {
59877 struct plocation *field_addr_tmp = plocation_field_new(NULL);
59878 field_addr = *field_addr_tmp;
59879 FC_FREE(field_addr_tmp);
59880 }
59881#endif /* FREECIV_JSON_CONNECTION */
59882
59883#ifdef FREECIV_DELTA_PROTOCOL
59884#ifdef FREECIV_JSON_CONNECTION
59885 field_addr.name = "fields";
59886#endif /* FREECIV_JSON_CONNECTION */
59887 DIO_BV_GET(&din, &field_addr, fields);
59888
59889#else /* FREECIV_DELTA_PROTOCOL */
59890 #ifdef FREECIV_JSON_CONNECTION
59891 field_addr.name = "id";
59892 #endif /* FREECIV_JSON_CONNECTION */
59893 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
59894 RECEIVE_PACKET_FIELD_ERROR(id);
59895 }
59896 #ifdef FREECIV_JSON_CONNECTION
59897 field_addr.name = "name";
59898 #endif /* FREECIV_JSON_CONNECTION */
59899 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
59900 RECEIVE_PACKET_FIELD_ERROR(name);
59901 }
59902 #ifdef FREECIV_JSON_CONNECTION
59903 field_addr.name = "rule_name";
59904 #endif /* FREECIV_JSON_CONNECTION */
59905 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
59906 RECEIVE_PACKET_FIELD_ERROR(rule_name);
59907 }
59908 #ifdef FREECIV_JSON_CONNECTION
59909 field_addr.name = "cost_pct";
59910 #endif /* FREECIV_JSON_CONNECTION */
59911 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->cost_pct)) {
59912 RECEIVE_PACKET_FIELD_ERROR(cost_pct);
59913 }
59914
59915#endif
59916 log_packet_detailed("packet_ruleset_tech_class_100: got info about ()");
59917
59918#ifdef FREECIV_DELTA_PROTOCOL
59919 if (NULL == *hash) {
59920 *hash = genhash_new_full(hash_packet_ruleset_tech_class_100, cmp_packet_ruleset_tech_class_100,
59921 NULL, NULL, NULL, free);
59922 }
59923
59924 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
59925 *real_packet = *old;
59926 } else {
59927 log_packet_detailed(" no old info");
59928 memset(real_packet, 0, sizeof(*real_packet));
59929 }
59930
59931 if (BV_ISSET(fields, 0)) {
59932 log_packet_detailed(" got field 'id'");
59933 #ifdef FREECIV_JSON_CONNECTION
59934 field_addr.name = "id";
59935 #endif /* FREECIV_JSON_CONNECTION */
59936 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
59937 RECEIVE_PACKET_FIELD_ERROR(id);
59938 }
59939 }
59940 if (BV_ISSET(fields, 1)) {
59941 log_packet_detailed(" got field 'name'");
59942 #ifdef FREECIV_JSON_CONNECTION
59943 field_addr.name = "name";
59944 #endif /* FREECIV_JSON_CONNECTION */
59945 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
59946 RECEIVE_PACKET_FIELD_ERROR(name);
59947 }
59948 }
59949 if (BV_ISSET(fields, 2)) {
59950 log_packet_detailed(" got field 'rule_name'");
59951 #ifdef FREECIV_JSON_CONNECTION
59952 field_addr.name = "rule_name";
59953 #endif /* FREECIV_JSON_CONNECTION */
59954 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
59955 RECEIVE_PACKET_FIELD_ERROR(rule_name);
59956 }
59957 }
59958 if (BV_ISSET(fields, 3)) {
59959 log_packet_detailed(" got field 'cost_pct'");
59960 #ifdef FREECIV_JSON_CONNECTION
59961 field_addr.name = "cost_pct";
59962 #endif /* FREECIV_JSON_CONNECTION */
59963 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->cost_pct)) {
59964 RECEIVE_PACKET_FIELD_ERROR(cost_pct);
59965 }
59966 }
59967
59968 if (NULL == old) {
59969 old = fc_malloc(sizeof(*old));
59970 *old = *real_packet;
59971 genhash_insert(*hash, old, old);
59972 } else {
59973 *old = *real_packet;
59974 }
59975
59976#endif /* FREECIV_DELTA_PROTOCOL */
59977 RECEIVE_PACKET_END(real_packet);
59978}
59979
59980 static int send_packet_ruleset_tech_class_100(struct connection *pc, const struct packet_ruleset_tech_class *packet)
59981{
59982 const struct packet_ruleset_tech_class *real_packet = packet;
59983#ifdef FREECIV_DELTA_PROTOCOL
59984 packet_ruleset_tech_class_100_fields fields;
59985 struct packet_ruleset_tech_class *old;
59986 bool differ;
59987 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TECH_CLASS;
59988#endif /* FREECIV_DELTA_PROTOCOL */
59989 SEND_PACKET_START(PACKET_RULESET_TECH_CLASS);
59990#ifdef FREECIV_JSON_CONNECTION
59991 struct plocation field_addr;
59992 {
59993 struct plocation *field_addr_tmp = plocation_field_new(NULL);
59994 field_addr = *field_addr_tmp;
59995 FC_FREE(field_addr_tmp);
59996 }
59997#endif /* FREECIV_JSON_CONNECTION */
59998
59999 log_packet_detailed("packet_ruleset_tech_class_100: sending info about ()");
60000
60001#ifdef FREECIV_DELTA_PROTOCOL
60002 if (NULL == *hash) {
60003 *hash = genhash_new_full(hash_packet_ruleset_tech_class_100, cmp_packet_ruleset_tech_class_100,
60004 NULL, NULL, NULL, free);
60005 }
60006 BV_CLR_ALL(fields);
60007
60008 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
60009 old = fc_malloc(sizeof(*old));
60010 *old = *real_packet;
60011 genhash_insert(*hash, old, old);
60012 memset(old, 0, sizeof(*old));
60013 }
60014 differ = (old->id != real_packet->id);
60015 if (differ) {
60016 BV_SET(fields, 0);
60017 }
60018
60019 differ = (strcmp(old->name, real_packet->name) != 0);
60020 if (differ) {
60021 BV_SET(fields, 1);
60022 }
60023
60024 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
60025 if (differ) {
60026 BV_SET(fields, 2);
60027 }
60028
60029 differ = (old->cost_pct != real_packet->cost_pct);
60030 if (differ) {
60031 BV_SET(fields, 3);
60032 }
60033
60034
60035#ifdef FREECIV_JSON_CONNECTION
60036 field_addr.name = "fields";
60037#endif /* FREECIV_JSON_CONNECTION */
60038 DIO_BV_PUT(&dout, &field_addr, fields);
60039
60040 if (BV_ISSET(fields, 0)) {
60041 log_packet_detailed(" field 'id' has changed");
60042 #ifdef FREECIV_JSON_CONNECTION
60043 field_addr.name = "id";
60044#endif /* FREECIV_JSON_CONNECTION */
60045 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
60046 }
60047 if (BV_ISSET(fields, 1)) {
60048 log_packet_detailed(" field 'name' has changed");
60049 #ifdef FREECIV_JSON_CONNECTION
60050 field_addr.name = "name";
60051#endif /* FREECIV_JSON_CONNECTION */
60052 DIO_PUT(string, &dout, &field_addr, real_packet->name);
60053 }
60054 if (BV_ISSET(fields, 2)) {
60055 log_packet_detailed(" field 'rule_name' has changed");
60056 #ifdef FREECIV_JSON_CONNECTION
60057 field_addr.name = "rule_name";
60058#endif /* FREECIV_JSON_CONNECTION */
60059 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
60060 }
60061 if (BV_ISSET(fields, 3)) {
60062 log_packet_detailed(" field 'cost_pct' has changed");
60063 #ifdef FREECIV_JSON_CONNECTION
60064 field_addr.name = "cost_pct";
60065#endif /* FREECIV_JSON_CONNECTION */
60066 DIO_PUT(uint16, &dout, &field_addr, real_packet->cost_pct);
60067 }
60068
60069 *old = *real_packet;
60070#endif /* FREECIV_DELTA_PROTOCOL */
60071#ifndef FREECIV_DELTA_PROTOCOL
60072#ifdef FREECIV_JSON_CONNECTION
60073 field_addr.name = "id";
60074#endif /* FREECIV_JSON_CONNECTION */
60075 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
60076#ifdef FREECIV_JSON_CONNECTION
60077 field_addr.name = "name";
60078#endif /* FREECIV_JSON_CONNECTION */
60079 DIO_PUT(string, &dout, &field_addr, real_packet->name);
60080#ifdef FREECIV_JSON_CONNECTION
60081 field_addr.name = "rule_name";
60082#endif /* FREECIV_JSON_CONNECTION */
60083 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
60084#ifdef FREECIV_JSON_CONNECTION
60085 field_addr.name = "cost_pct";
60086#endif /* FREECIV_JSON_CONNECTION */
60087 DIO_PUT(uint16, &dout, &field_addr, real_packet->cost_pct);
60088
60089#endif
60090 SEND_PACKET_END(PACKET_RULESET_TECH_CLASS);
60091}
60092
60093 int send_packet_ruleset_tech_class(struct connection *pc, const struct packet_ruleset_tech_class *packet)
60094{
60095 if (!pc->used) {
60096 log_error("WARNING: trying to send data to the closed connection %s",
60097 conn_description(pc));
60098 return -1;
60099 }
60100 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TECH_CLASS].packet != NULL, -1,
60101 "Handler for PACKET_RULESET_TECH_CLASS not installed");
60102 return pc->phs.handlers->send[PACKET_RULESET_TECH_CLASS].packet(pc, packet);
60103}
60104
60105 void lsend_packet_ruleset_tech_class(struct conn_list *dest, const struct packet_ruleset_tech_class *packet)
60106{
60107 conn_list_iterate(dest, pconn) {
60108 send_packet_ruleset_tech_class(pconn, packet);
60109 } conn_list_iterate_end;
60110}
60111
60112#ifdef FREECIV_DELTA_PROTOCOL
60113#define hash_packet_ruleset_tech_flag_100 hash_const
60114
60115#define cmp_packet_ruleset_tech_flag_100 cmp_const
60116
60117 BV_DEFINE(packet_ruleset_tech_flag_100_fields, 3);
60118#endif /* FREECIV_DELTA_PROTOCOL */
60119
60120 static struct packet_ruleset_tech_flag *receive_packet_ruleset_tech_flag_100(struct connection *pc)
60121{
60122#ifdef FREECIV_DELTA_PROTOCOL
60123 packet_ruleset_tech_flag_100_fields fields;
60124 struct packet_ruleset_tech_flag *old;
60125 struct genhash **hash = pc->phs.received + PACKET_RULESET_TECH_FLAG;
60126#endif /* FREECIV_DELTA_PROTOCOL */
60127 RECEIVE_PACKET_START(packet_ruleset_tech_flag, real_packet);
60128#ifdef FREECIV_JSON_CONNECTION
60129 struct plocation field_addr;
60130 {
60131 struct plocation *field_addr_tmp = plocation_field_new(NULL);
60132 field_addr = *field_addr_tmp;
60133 FC_FREE(field_addr_tmp);
60134 }
60135#endif /* FREECIV_JSON_CONNECTION */
60136
60137#ifdef FREECIV_DELTA_PROTOCOL
60138#ifdef FREECIV_JSON_CONNECTION
60139 field_addr.name = "fields";
60140#endif /* FREECIV_JSON_CONNECTION */
60141 DIO_BV_GET(&din, &field_addr, fields);
60142
60143#else /* FREECIV_DELTA_PROTOCOL */
60144 #ifdef FREECIV_JSON_CONNECTION
60145 field_addr.name = "id";
60146 #endif /* FREECIV_JSON_CONNECTION */
60147 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
60148 RECEIVE_PACKET_FIELD_ERROR(id);
60149 }
60150 #ifdef FREECIV_JSON_CONNECTION
60151 field_addr.name = "name";
60152 #endif /* FREECIV_JSON_CONNECTION */
60153 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
60154 RECEIVE_PACKET_FIELD_ERROR(name);
60155 }
60156 #ifdef FREECIV_JSON_CONNECTION
60157 field_addr.name = "helptxt";
60158 #endif /* FREECIV_JSON_CONNECTION */
60159 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
60160 RECEIVE_PACKET_FIELD_ERROR(helptxt);
60161 }
60162
60163#endif
60164 log_packet_detailed("packet_ruleset_tech_flag_100: got info about ()");
60165
60166#ifdef FREECIV_DELTA_PROTOCOL
60167 if (NULL == *hash) {
60168 *hash = genhash_new_full(hash_packet_ruleset_tech_flag_100, cmp_packet_ruleset_tech_flag_100,
60169 NULL, NULL, NULL, free);
60170 }
60171
60172 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
60173 *real_packet = *old;
60174 } else {
60175 log_packet_detailed(" no old info");
60176 memset(real_packet, 0, sizeof(*real_packet));
60177 }
60178
60179 if (BV_ISSET(fields, 0)) {
60180 log_packet_detailed(" got field 'id'");
60181 #ifdef FREECIV_JSON_CONNECTION
60182 field_addr.name = "id";
60183 #endif /* FREECIV_JSON_CONNECTION */
60184 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
60185 RECEIVE_PACKET_FIELD_ERROR(id);
60186 }
60187 }
60188 if (BV_ISSET(fields, 1)) {
60189 log_packet_detailed(" got field 'name'");
60190 #ifdef FREECIV_JSON_CONNECTION
60191 field_addr.name = "name";
60192 #endif /* FREECIV_JSON_CONNECTION */
60193 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
60194 RECEIVE_PACKET_FIELD_ERROR(name);
60195 }
60196 }
60197 if (BV_ISSET(fields, 2)) {
60198 log_packet_detailed(" got field 'helptxt'");
60199 #ifdef FREECIV_JSON_CONNECTION
60200 field_addr.name = "helptxt";
60201 #endif /* FREECIV_JSON_CONNECTION */
60202 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
60203 RECEIVE_PACKET_FIELD_ERROR(helptxt);
60204 }
60205 }
60206
60207 if (NULL == old) {
60208 old = fc_malloc(sizeof(*old));
60209 *old = *real_packet;
60210 genhash_insert(*hash, old, old);
60211 } else {
60212 *old = *real_packet;
60213 }
60214
60215#endif /* FREECIV_DELTA_PROTOCOL */
60216 RECEIVE_PACKET_END(real_packet);
60217}
60218
60219 static int send_packet_ruleset_tech_flag_100(struct connection *pc, const struct packet_ruleset_tech_flag *packet)
60220{
60221 const struct packet_ruleset_tech_flag *real_packet = packet;
60222#ifdef FREECIV_DELTA_PROTOCOL
60223 packet_ruleset_tech_flag_100_fields fields;
60224 struct packet_ruleset_tech_flag *old;
60225 bool differ;
60226 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TECH_FLAG;
60227#endif /* FREECIV_DELTA_PROTOCOL */
60228 SEND_PACKET_START(PACKET_RULESET_TECH_FLAG);
60229#ifdef FREECIV_JSON_CONNECTION
60230 struct plocation field_addr;
60231 {
60232 struct plocation *field_addr_tmp = plocation_field_new(NULL);
60233 field_addr = *field_addr_tmp;
60234 FC_FREE(field_addr_tmp);
60235 }
60236#endif /* FREECIV_JSON_CONNECTION */
60237
60238 log_packet_detailed("packet_ruleset_tech_flag_100: sending info about ()");
60239
60240#ifdef FREECIV_DELTA_PROTOCOL
60241 if (NULL == *hash) {
60242 *hash = genhash_new_full(hash_packet_ruleset_tech_flag_100, cmp_packet_ruleset_tech_flag_100,
60243 NULL, NULL, NULL, free);
60244 }
60245 BV_CLR_ALL(fields);
60246
60247 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
60248 old = fc_malloc(sizeof(*old));
60249 *old = *real_packet;
60250 genhash_insert(*hash, old, old);
60251 memset(old, 0, sizeof(*old));
60252 }
60253 differ = (old->id != real_packet->id);
60254 if (differ) {
60255 BV_SET(fields, 0);
60256 }
60257
60258 differ = (strcmp(old->name, real_packet->name) != 0);
60259 if (differ) {
60260 BV_SET(fields, 1);
60261 }
60262
60263 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
60264 if (differ) {
60265 BV_SET(fields, 2);
60266 }
60267
60268
60269#ifdef FREECIV_JSON_CONNECTION
60270 field_addr.name = "fields";
60271#endif /* FREECIV_JSON_CONNECTION */
60272 DIO_BV_PUT(&dout, &field_addr, fields);
60273
60274 if (BV_ISSET(fields, 0)) {
60275 log_packet_detailed(" field 'id' has changed");
60276 #ifdef FREECIV_JSON_CONNECTION
60277 field_addr.name = "id";
60278#endif /* FREECIV_JSON_CONNECTION */
60279 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
60280 }
60281 if (BV_ISSET(fields, 1)) {
60282 log_packet_detailed(" field 'name' has changed");
60283 #ifdef FREECIV_JSON_CONNECTION
60284 field_addr.name = "name";
60285#endif /* FREECIV_JSON_CONNECTION */
60286 DIO_PUT(string, &dout, &field_addr, real_packet->name);
60287 }
60288 if (BV_ISSET(fields, 2)) {
60289 log_packet_detailed(" field 'helptxt' has changed");
60290 #ifdef FREECIV_JSON_CONNECTION
60291 field_addr.name = "helptxt";
60292#endif /* FREECIV_JSON_CONNECTION */
60293 DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
60294 }
60295
60296 *old = *real_packet;
60297#endif /* FREECIV_DELTA_PROTOCOL */
60298#ifndef FREECIV_DELTA_PROTOCOL
60299#ifdef FREECIV_JSON_CONNECTION
60300 field_addr.name = "id";
60301#endif /* FREECIV_JSON_CONNECTION */
60302 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
60303#ifdef FREECIV_JSON_CONNECTION
60304 field_addr.name = "name";
60305#endif /* FREECIV_JSON_CONNECTION */
60306 DIO_PUT(string, &dout, &field_addr, real_packet->name);
60307#ifdef FREECIV_JSON_CONNECTION
60308 field_addr.name = "helptxt";
60309#endif /* FREECIV_JSON_CONNECTION */
60310 DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
60311
60312#endif
60313 SEND_PACKET_END(PACKET_RULESET_TECH_FLAG);
60314}
60315
60316 int send_packet_ruleset_tech_flag(struct connection *pc, const struct packet_ruleset_tech_flag *packet)
60317{
60318 if (!pc->used) {
60319 log_error("WARNING: trying to send data to the closed connection %s",
60320 conn_description(pc));
60321 return -1;
60322 }
60323 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TECH_FLAG].packet != NULL, -1,
60324 "Handler for PACKET_RULESET_TECH_FLAG not installed");
60325 return pc->phs.handlers->send[PACKET_RULESET_TECH_FLAG].packet(pc, packet);
60326}
60327
60328 void lsend_packet_ruleset_tech_flag(struct conn_list *dest, const struct packet_ruleset_tech_flag *packet)
60329{
60330 conn_list_iterate(dest, pconn) {
60331 send_packet_ruleset_tech_flag(pconn, packet);
60332 } conn_list_iterate_end;
60333}
60334
60335#ifdef FREECIV_DELTA_PROTOCOL
60336#define hash_packet_ruleset_government_100 hash_const
60337
60338#define cmp_packet_ruleset_government_100 cmp_const
60339
60340 BV_DEFINE(packet_ruleset_government_100_fields, 8);
60341#endif /* FREECIV_DELTA_PROTOCOL */
60342
60343 static struct packet_ruleset_government *receive_packet_ruleset_government_100(struct connection *pc)
60344{
60345#ifdef FREECIV_DELTA_PROTOCOL
60346 packet_ruleset_government_100_fields fields;
60347 struct packet_ruleset_government *old;
60348 struct genhash **hash = pc->phs.received + PACKET_RULESET_GOVERNMENT;
60349#endif /* FREECIV_DELTA_PROTOCOL */
60350 RECEIVE_PACKET_START(packet_ruleset_government, real_packet);
60351#ifdef FREECIV_JSON_CONNECTION
60352 struct plocation field_addr;
60353 {
60354 struct plocation *field_addr_tmp = plocation_field_new(NULL);
60355 field_addr = *field_addr_tmp;
60356 FC_FREE(field_addr_tmp);
60357 }
60358#endif /* FREECIV_JSON_CONNECTION */
60359
60360#ifdef FREECIV_DELTA_PROTOCOL
60361#ifdef FREECIV_JSON_CONNECTION
60362 field_addr.name = "fields";
60363#endif /* FREECIV_JSON_CONNECTION */
60364 DIO_BV_GET(&din, &field_addr, fields);
60365
60366#else /* FREECIV_DELTA_PROTOCOL */
60367 #ifdef FREECIV_JSON_CONNECTION
60368 field_addr.name = "id";
60369 #endif /* FREECIV_JSON_CONNECTION */
60370 {
60371 int readin;
60372
60373 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
60374 RECEIVE_PACKET_FIELD_ERROR(id);
60375 }
60376 real_packet->id = readin;
60377 }
60378 #ifdef FREECIV_JSON_CONNECTION
60379 field_addr.name = "reqs_count";
60380 #endif /* FREECIV_JSON_CONNECTION */
60381 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
60382 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
60383 }
60384 #ifdef FREECIV_JSON_CONNECTION
60385 field_addr.name = "reqs";
60386 #endif /* FREECIV_JSON_CONNECTION */
60387
60388 {
60389 int i;
60390
60391 #ifdef FREECIV_JSON_CONNECTION
60392 /* Enter array. */
60393 field_addr.sub_location = plocation_elem_new(0);
60394 #endif /* FREECIV_JSON_CONNECTION */
60395
60396 if (real_packet->reqs_count > MAX_NUM_REQS) {
60397 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
60398 }
60399 for (i = 0; i < real_packet->reqs_count; i++) {
60400 #ifdef FREECIV_JSON_CONNECTION
60401 field_addr.sub_location->number = i;
60402 #endif /* FREECIV_JSON_CONNECTION */
60403 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
60404 RECEIVE_PACKET_FIELD_ERROR(reqs);
60405 }
60406 }
60407
60408 #ifdef FREECIV_JSON_CONNECTION
60409 /* Exit array. */
60410 free(field_addr.sub_location);
60411 field_addr.sub_location = NULL;
60412 #endif /* FREECIV_JSON_CONNECTION */
60413 }
60414 #ifdef FREECIV_JSON_CONNECTION
60415 field_addr.name = "name";
60416 #endif /* FREECIV_JSON_CONNECTION */
60417 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
60418 RECEIVE_PACKET_FIELD_ERROR(name);
60419 }
60420 #ifdef FREECIV_JSON_CONNECTION
60421 field_addr.name = "rule_name";
60422 #endif /* FREECIV_JSON_CONNECTION */
60423 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
60424 RECEIVE_PACKET_FIELD_ERROR(rule_name);
60425 }
60426 #ifdef FREECIV_JSON_CONNECTION
60427 field_addr.name = "graphic_str";
60428 #endif /* FREECIV_JSON_CONNECTION */
60429 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
60430 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
60431 }
60432 #ifdef FREECIV_JSON_CONNECTION
60433 field_addr.name = "graphic_alt";
60434 #endif /* FREECIV_JSON_CONNECTION */
60435 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
60436 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
60437 }
60438 #ifdef FREECIV_JSON_CONNECTION
60439 field_addr.name = "helptext";
60440 #endif /* FREECIV_JSON_CONNECTION */
60441 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
60442 RECEIVE_PACKET_FIELD_ERROR(helptext);
60443 }
60444
60445#endif
60446 log_packet_detailed("packet_ruleset_government_100: got info about ()");
60447
60448#ifdef FREECIV_DELTA_PROTOCOL
60449 if (NULL == *hash) {
60450 *hash = genhash_new_full(hash_packet_ruleset_government_100, cmp_packet_ruleset_government_100,
60451 NULL, NULL, NULL, free);
60452 }
60453
60454 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
60455 *real_packet = *old;
60456 } else {
60457 log_packet_detailed(" no old info");
60458 memset(real_packet, 0, sizeof(*real_packet));
60459 }
60460
60461 if (BV_ISSET(fields, 0)) {
60462 log_packet_detailed(" got field 'id'");
60463 #ifdef FREECIV_JSON_CONNECTION
60464 field_addr.name = "id";
60465 #endif /* FREECIV_JSON_CONNECTION */
60466 {
60467 int readin;
60468
60469 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
60470 RECEIVE_PACKET_FIELD_ERROR(id);
60471 }
60472 real_packet->id = readin;
60473 }
60474 }
60475 if (BV_ISSET(fields, 1)) {
60476 log_packet_detailed(" got field 'reqs_count'");
60477 #ifdef FREECIV_JSON_CONNECTION
60478 field_addr.name = "reqs_count";
60479 #endif /* FREECIV_JSON_CONNECTION */
60480 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
60481 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
60482 }
60483 }
60484 if (BV_ISSET(fields, 2)) {
60485 log_packet_detailed(" got field 'reqs'");
60486 #ifdef FREECIV_JSON_CONNECTION
60487 field_addr.name = "reqs";
60488 #endif /* FREECIV_JSON_CONNECTION */
60489
60490 {
60491 int i;
60492
60493 #ifdef FREECIV_JSON_CONNECTION
60494 /* Enter array. */
60495 field_addr.sub_location = plocation_elem_new(0);
60496 #endif /* FREECIV_JSON_CONNECTION */
60497
60498 if (real_packet->reqs_count > MAX_NUM_REQS) {
60499 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
60500 }
60501 for (i = 0; i < real_packet->reqs_count; i++) {
60502 #ifdef FREECIV_JSON_CONNECTION
60503 field_addr.sub_location->number = i;
60504 #endif /* FREECIV_JSON_CONNECTION */
60505 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
60506 RECEIVE_PACKET_FIELD_ERROR(reqs);
60507 }
60508 }
60509
60510 #ifdef FREECIV_JSON_CONNECTION
60511 /* Exit array. */
60512 free(field_addr.sub_location);
60513 field_addr.sub_location = NULL;
60514 #endif /* FREECIV_JSON_CONNECTION */
60515 }
60516 }
60517 if (BV_ISSET(fields, 3)) {
60518 log_packet_detailed(" got field 'name'");
60519 #ifdef FREECIV_JSON_CONNECTION
60520 field_addr.name = "name";
60521 #endif /* FREECIV_JSON_CONNECTION */
60522 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
60523 RECEIVE_PACKET_FIELD_ERROR(name);
60524 }
60525 }
60526 if (BV_ISSET(fields, 4)) {
60527 log_packet_detailed(" got field 'rule_name'");
60528 #ifdef FREECIV_JSON_CONNECTION
60529 field_addr.name = "rule_name";
60530 #endif /* FREECIV_JSON_CONNECTION */
60531 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
60532 RECEIVE_PACKET_FIELD_ERROR(rule_name);
60533 }
60534 }
60535 if (BV_ISSET(fields, 5)) {
60536 log_packet_detailed(" got field 'graphic_str'");
60537 #ifdef FREECIV_JSON_CONNECTION
60538 field_addr.name = "graphic_str";
60539 #endif /* FREECIV_JSON_CONNECTION */
60540 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
60541 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
60542 }
60543 }
60544 if (BV_ISSET(fields, 6)) {
60545 log_packet_detailed(" got field 'graphic_alt'");
60546 #ifdef FREECIV_JSON_CONNECTION
60547 field_addr.name = "graphic_alt";
60548 #endif /* FREECIV_JSON_CONNECTION */
60549 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
60550 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
60551 }
60552 }
60553 if (BV_ISSET(fields, 7)) {
60554 log_packet_detailed(" got field 'helptext'");
60555 #ifdef FREECIV_JSON_CONNECTION
60556 field_addr.name = "helptext";
60557 #endif /* FREECIV_JSON_CONNECTION */
60558 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
60559 RECEIVE_PACKET_FIELD_ERROR(helptext);
60560 }
60561 }
60562
60563 if (NULL == old) {
60564 old = fc_malloc(sizeof(*old));
60565 *old = *real_packet;
60566 genhash_insert(*hash, old, old);
60567 } else {
60568 *old = *real_packet;
60569 }
60570
60571#endif /* FREECIV_DELTA_PROTOCOL */
60572 RECEIVE_PACKET_END(real_packet);
60573}
60574
60575 static int send_packet_ruleset_government_100(struct connection *pc, const struct packet_ruleset_government *packet)
60576{
60577 const struct packet_ruleset_government *real_packet = packet;
60578#ifdef FREECIV_DELTA_PROTOCOL
60579 packet_ruleset_government_100_fields fields;
60580 struct packet_ruleset_government *old;
60581 bool differ;
60582 struct genhash **hash = pc->phs.sent + PACKET_RULESET_GOVERNMENT;
60583#endif /* FREECIV_DELTA_PROTOCOL */
60584 SEND_PACKET_START(PACKET_RULESET_GOVERNMENT);
60585#ifdef FREECIV_JSON_CONNECTION
60586 struct plocation field_addr;
60587 {
60588 struct plocation *field_addr_tmp = plocation_field_new(NULL);
60589 field_addr = *field_addr_tmp;
60590 FC_FREE(field_addr_tmp);
60591 }
60592#endif /* FREECIV_JSON_CONNECTION */
60593
60594 log_packet_detailed("packet_ruleset_government_100: sending info about ()");
60595
60596#ifdef FREECIV_DELTA_PROTOCOL
60597 if (NULL == *hash) {
60598 *hash = genhash_new_full(hash_packet_ruleset_government_100, cmp_packet_ruleset_government_100,
60599 NULL, NULL, NULL, free);
60600 }
60601 BV_CLR_ALL(fields);
60602
60603 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
60604 old = fc_malloc(sizeof(*old));
60605 *old = *real_packet;
60606 genhash_insert(*hash, old, old);
60607 memset(old, 0, sizeof(*old));
60608 }
60609 differ = (old->id != real_packet->id);
60610 if (differ) {
60611 BV_SET(fields, 0);
60612 }
60613
60614 differ = (old->reqs_count != real_packet->reqs_count);
60615 if (differ) {
60616 BV_SET(fields, 1);
60617 }
60618
60619
60620 {
60621 differ = (old->reqs_count != real_packet->reqs_count);
60622 if (!differ) {
60623 int i;
60624
60625 for (i = 0; i < real_packet->reqs_count; i++) {
60626 if (!are_requirements_equal(&old->reqs[i], &real_packet->reqs[i])) {
60627 differ = TRUE;
60628 break;
60629 }
60630 }
60631 }
60632 }
60633 if (differ) {
60634 BV_SET(fields, 2);
60635 }
60636
60637 differ = (strcmp(old->name, real_packet->name) != 0);
60638 if (differ) {
60639 BV_SET(fields, 3);
60640 }
60641
60642 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
60643 if (differ) {
60644 BV_SET(fields, 4);
60645 }
60646
60647 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
60648 if (differ) {
60649 BV_SET(fields, 5);
60650 }
60651
60652 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
60653 if (differ) {
60654 BV_SET(fields, 6);
60655 }
60656
60657 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
60658 if (differ) {
60659 BV_SET(fields, 7);
60660 }
60661
60662
60663#ifdef FREECIV_JSON_CONNECTION
60664 field_addr.name = "fields";
60665#endif /* FREECIV_JSON_CONNECTION */
60666 DIO_BV_PUT(&dout, &field_addr, fields);
60667
60668 if (BV_ISSET(fields, 0)) {
60669 log_packet_detailed(" field 'id' has changed");
60670 #ifdef FREECIV_JSON_CONNECTION
60671 field_addr.name = "id";
60672#endif /* FREECIV_JSON_CONNECTION */
60673 DIO_PUT(sint8, &dout, &field_addr, real_packet->id);
60674 }
60675 if (BV_ISSET(fields, 1)) {
60676 log_packet_detailed(" field 'reqs_count' has changed");
60677 #ifdef FREECIV_JSON_CONNECTION
60678 field_addr.name = "reqs_count";
60679#endif /* FREECIV_JSON_CONNECTION */
60680 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
60681 }
60682 if (BV_ISSET(fields, 2)) {
60683 log_packet_detailed(" field 'reqs' has changed");
60684 #ifdef FREECIV_JSON_CONNECTION
60685 field_addr.name = "reqs";
60686#endif /* FREECIV_JSON_CONNECTION */
60687
60688 {
60689 int i;
60690
60691#ifdef FREECIV_JSON_CONNECTION
60692 /* Create the array. */
60693 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
60694
60695 /* Enter the array. */
60696 field_addr.sub_location = plocation_elem_new(0);
60697#endif /* FREECIV_JSON_CONNECTION */
60698
60699 for (i = 0; i < real_packet->reqs_count; i++) {
60700#ifdef FREECIV_JSON_CONNECTION
60701 /* Next array element. */
60702 field_addr.sub_location->number = i;
60703#endif /* FREECIV_JSON_CONNECTION */
60704 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
60705 }
60706
60707#ifdef FREECIV_JSON_CONNECTION
60708 /* Exit array. */
60709 free(field_addr.sub_location);
60710 field_addr.sub_location = NULL;
60711#endif /* FREECIV_JSON_CONNECTION */
60712 }
60713 }
60714 if (BV_ISSET(fields, 3)) {
60715 log_packet_detailed(" field 'name' has changed");
60716 #ifdef FREECIV_JSON_CONNECTION
60717 field_addr.name = "name";
60718#endif /* FREECIV_JSON_CONNECTION */
60719 DIO_PUT(string, &dout, &field_addr, real_packet->name);
60720 }
60721 if (BV_ISSET(fields, 4)) {
60722 log_packet_detailed(" field 'rule_name' has changed");
60723 #ifdef FREECIV_JSON_CONNECTION
60724 field_addr.name = "rule_name";
60725#endif /* FREECIV_JSON_CONNECTION */
60726 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
60727 }
60728 if (BV_ISSET(fields, 5)) {
60729 log_packet_detailed(" field 'graphic_str' has changed");
60730 #ifdef FREECIV_JSON_CONNECTION
60731 field_addr.name = "graphic_str";
60732#endif /* FREECIV_JSON_CONNECTION */
60733 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
60734 }
60735 if (BV_ISSET(fields, 6)) {
60736 log_packet_detailed(" field 'graphic_alt' has changed");
60737 #ifdef FREECIV_JSON_CONNECTION
60738 field_addr.name = "graphic_alt";
60739#endif /* FREECIV_JSON_CONNECTION */
60740 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
60741 }
60742 if (BV_ISSET(fields, 7)) {
60743 log_packet_detailed(" field 'helptext' has changed");
60744 #ifdef FREECIV_JSON_CONNECTION
60745 field_addr.name = "helptext";
60746#endif /* FREECIV_JSON_CONNECTION */
60747 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
60748 }
60749
60750 *old = *real_packet;
60751#endif /* FREECIV_DELTA_PROTOCOL */
60752#ifndef FREECIV_DELTA_PROTOCOL
60753#ifdef FREECIV_JSON_CONNECTION
60754 field_addr.name = "id";
60755#endif /* FREECIV_JSON_CONNECTION */
60756 DIO_PUT(sint8, &dout, &field_addr, real_packet->id);
60757#ifdef FREECIV_JSON_CONNECTION
60758 field_addr.name = "reqs_count";
60759#endif /* FREECIV_JSON_CONNECTION */
60760 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
60761#ifdef FREECIV_JSON_CONNECTION
60762 field_addr.name = "reqs";
60763#endif /* FREECIV_JSON_CONNECTION */
60764
60765 {
60766 int i;
60767
60768#ifdef FREECIV_JSON_CONNECTION
60769 /* Create the array. */
60770 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
60771
60772 /* Enter the array. */
60773 field_addr.sub_location = plocation_elem_new(0);
60774#endif /* FREECIV_JSON_CONNECTION */
60775
60776 for (i = 0; i < real_packet->reqs_count; i++) {
60777#ifdef FREECIV_JSON_CONNECTION
60778 /* Next array element. */
60779 field_addr.sub_location->number = i;
60780#endif /* FREECIV_JSON_CONNECTION */
60781 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
60782 }
60783
60784#ifdef FREECIV_JSON_CONNECTION
60785 /* Exit array. */
60786 free(field_addr.sub_location);
60787 field_addr.sub_location = NULL;
60788#endif /* FREECIV_JSON_CONNECTION */
60789 }
60790#ifdef FREECIV_JSON_CONNECTION
60791 field_addr.name = "name";
60792#endif /* FREECIV_JSON_CONNECTION */
60793 DIO_PUT(string, &dout, &field_addr, real_packet->name);
60794#ifdef FREECIV_JSON_CONNECTION
60795 field_addr.name = "rule_name";
60796#endif /* FREECIV_JSON_CONNECTION */
60797 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
60798#ifdef FREECIV_JSON_CONNECTION
60799 field_addr.name = "graphic_str";
60800#endif /* FREECIV_JSON_CONNECTION */
60801 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
60802#ifdef FREECIV_JSON_CONNECTION
60803 field_addr.name = "graphic_alt";
60804#endif /* FREECIV_JSON_CONNECTION */
60805 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
60806#ifdef FREECIV_JSON_CONNECTION
60807 field_addr.name = "helptext";
60808#endif /* FREECIV_JSON_CONNECTION */
60809 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
60810
60811#endif
60812 SEND_PACKET_END(PACKET_RULESET_GOVERNMENT);
60813}
60814
60815 int send_packet_ruleset_government(struct connection *pc, const struct packet_ruleset_government *packet)
60816{
60817 if (!pc->used) {
60818 log_error("WARNING: trying to send data to the closed connection %s",
60819 conn_description(pc));
60820 return -1;
60821 }
60822 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_GOVERNMENT].packet != NULL, -1,
60823 "Handler for PACKET_RULESET_GOVERNMENT not installed");
60824 return pc->phs.handlers->send[PACKET_RULESET_GOVERNMENT].packet(pc, packet);
60825}
60826
60827 void lsend_packet_ruleset_government(struct conn_list *dest, const struct packet_ruleset_government *packet)
60828{
60829 conn_list_iterate(dest, pconn) {
60830 send_packet_ruleset_government(pconn, packet);
60831 } conn_list_iterate_end;
60832}
60833
60834#ifdef FREECIV_DELTA_PROTOCOL
60835#define hash_packet_ruleset_terrain_control_100 hash_const
60836
60837#define cmp_packet_ruleset_terrain_control_100 cmp_const
60838
60839 BV_DEFINE(packet_ruleset_terrain_control_100_fields, 12);
60840#endif /* FREECIV_DELTA_PROTOCOL */
60841
60842 static struct packet_ruleset_terrain_control *receive_packet_ruleset_terrain_control_100(struct connection *pc)
60843{
60844#ifdef FREECIV_DELTA_PROTOCOL
60845 packet_ruleset_terrain_control_100_fields fields;
60846 struct packet_ruleset_terrain_control *old;
60847 struct genhash **hash = pc->phs.received + PACKET_RULESET_TERRAIN_CONTROL;
60848#endif /* FREECIV_DELTA_PROTOCOL */
60849 RECEIVE_PACKET_START(packet_ruleset_terrain_control, real_packet);
60850#ifdef FREECIV_JSON_CONNECTION
60851 struct plocation field_addr;
60852 {
60853 struct plocation *field_addr_tmp = plocation_field_new(NULL);
60854 field_addr = *field_addr_tmp;
60855 FC_FREE(field_addr_tmp);
60856 }
60857#endif /* FREECIV_JSON_CONNECTION */
60858
60859#ifdef FREECIV_DELTA_PROTOCOL
60860#ifdef FREECIV_JSON_CONNECTION
60861 field_addr.name = "fields";
60862#endif /* FREECIV_JSON_CONNECTION */
60863 DIO_BV_GET(&din, &field_addr, fields);
60864
60865#else /* FREECIV_DELTA_PROTOCOL */
60866 #ifdef FREECIV_JSON_CONNECTION
60867 field_addr.name = "ocean_reclaim_requirement_pct";
60868 #endif /* FREECIV_JSON_CONNECTION */
60869 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ocean_reclaim_requirement_pct)) {
60870 RECEIVE_PACKET_FIELD_ERROR(ocean_reclaim_requirement_pct);
60871 }
60872 #ifdef FREECIV_JSON_CONNECTION
60873 field_addr.name = "land_channel_requirement_pct";
60874 #endif /* FREECIV_JSON_CONNECTION */
60875 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->land_channel_requirement_pct)) {
60876 RECEIVE_PACKET_FIELD_ERROR(land_channel_requirement_pct);
60877 }
60878 #ifdef FREECIV_JSON_CONNECTION
60879 field_addr.name = "terrain_thaw_requirement_pct";
60880 #endif /* FREECIV_JSON_CONNECTION */
60881 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->terrain_thaw_requirement_pct)) {
60882 RECEIVE_PACKET_FIELD_ERROR(terrain_thaw_requirement_pct);
60883 }
60884 #ifdef FREECIV_JSON_CONNECTION
60885 field_addr.name = "terrain_freeze_requirement_pct";
60886 #endif /* FREECIV_JSON_CONNECTION */
60887 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->terrain_freeze_requirement_pct)) {
60888 RECEIVE_PACKET_FIELD_ERROR(terrain_freeze_requirement_pct);
60889 }
60890 #ifdef FREECIV_JSON_CONNECTION
60891 field_addr.name = "lake_max_size";
60892 #endif /* FREECIV_JSON_CONNECTION */
60893 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->lake_max_size)) {
60894 RECEIVE_PACKET_FIELD_ERROR(lake_max_size);
60895 }
60896 #ifdef FREECIV_JSON_CONNECTION
60897 field_addr.name = "min_start_native_area";
60898 #endif /* FREECIV_JSON_CONNECTION */
60899 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->min_start_native_area)) {
60900 RECEIVE_PACKET_FIELD_ERROR(min_start_native_area);
60901 }
60902 #ifdef FREECIV_JSON_CONNECTION
60903 field_addr.name = "move_fragments";
60904 #endif /* FREECIV_JSON_CONNECTION */
60905 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_fragments)) {
60906 RECEIVE_PACKET_FIELD_ERROR(move_fragments);
60907 }
60908 #ifdef FREECIV_JSON_CONNECTION
60909 field_addr.name = "igter_cost";
60910 #endif /* FREECIV_JSON_CONNECTION */
60911 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->igter_cost)) {
60912 RECEIVE_PACKET_FIELD_ERROR(igter_cost);
60913 }
60914 #ifdef FREECIV_JSON_CONNECTION
60915 field_addr.name = "pythagorean_diagonal";
60916 #endif /* FREECIV_JSON_CONNECTION */
60917 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->pythagorean_diagonal)) {
60918 RECEIVE_PACKET_FIELD_ERROR(pythagorean_diagonal);
60919 }
60920 #ifdef FREECIV_JSON_CONNECTION
60921 field_addr.name = "infrapoints";
60922 #endif /* FREECIV_JSON_CONNECTION */
60923 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->infrapoints)) {
60924 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
60925 }
60926 #ifdef FREECIV_JSON_CONNECTION
60927 field_addr.name = "gui_type_base0";
60928 #endif /* FREECIV_JSON_CONNECTION */
60929 if (!DIO_GET(string, &din, &field_addr, real_packet->gui_type_base0, sizeof(real_packet->gui_type_base0))) {
60930 RECEIVE_PACKET_FIELD_ERROR(gui_type_base0);
60931 }
60932 #ifdef FREECIV_JSON_CONNECTION
60933 field_addr.name = "gui_type_base1";
60934 #endif /* FREECIV_JSON_CONNECTION */
60935 if (!DIO_GET(string, &din, &field_addr, real_packet->gui_type_base1, sizeof(real_packet->gui_type_base1))) {
60936 RECEIVE_PACKET_FIELD_ERROR(gui_type_base1);
60937 }
60938
60939#endif
60940 log_packet_detailed("packet_ruleset_terrain_control_100: got info about ()");
60941
60942#ifdef FREECIV_DELTA_PROTOCOL
60943 if (NULL == *hash) {
60944 *hash = genhash_new_full(hash_packet_ruleset_terrain_control_100, cmp_packet_ruleset_terrain_control_100,
60945 NULL, NULL, NULL, free);
60946 }
60947
60948 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
60949 *real_packet = *old;
60950 } else {
60951 log_packet_detailed(" no old info");
60952 memset(real_packet, 0, sizeof(*real_packet));
60953 }
60954
60955 if (BV_ISSET(fields, 0)) {
60956 log_packet_detailed(" got field 'ocean_reclaim_requirement_pct'");
60957 #ifdef FREECIV_JSON_CONNECTION
60958 field_addr.name = "ocean_reclaim_requirement_pct";
60959 #endif /* FREECIV_JSON_CONNECTION */
60960 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ocean_reclaim_requirement_pct)) {
60961 RECEIVE_PACKET_FIELD_ERROR(ocean_reclaim_requirement_pct);
60962 }
60963 }
60964 if (BV_ISSET(fields, 1)) {
60965 log_packet_detailed(" got field 'land_channel_requirement_pct'");
60966 #ifdef FREECIV_JSON_CONNECTION
60967 field_addr.name = "land_channel_requirement_pct";
60968 #endif /* FREECIV_JSON_CONNECTION */
60969 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->land_channel_requirement_pct)) {
60970 RECEIVE_PACKET_FIELD_ERROR(land_channel_requirement_pct);
60971 }
60972 }
60973 if (BV_ISSET(fields, 2)) {
60974 log_packet_detailed(" got field 'terrain_thaw_requirement_pct'");
60975 #ifdef FREECIV_JSON_CONNECTION
60976 field_addr.name = "terrain_thaw_requirement_pct";
60977 #endif /* FREECIV_JSON_CONNECTION */
60978 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->terrain_thaw_requirement_pct)) {
60979 RECEIVE_PACKET_FIELD_ERROR(terrain_thaw_requirement_pct);
60980 }
60981 }
60982 if (BV_ISSET(fields, 3)) {
60983 log_packet_detailed(" got field 'terrain_freeze_requirement_pct'");
60984 #ifdef FREECIV_JSON_CONNECTION
60985 field_addr.name = "terrain_freeze_requirement_pct";
60986 #endif /* FREECIV_JSON_CONNECTION */
60987 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->terrain_freeze_requirement_pct)) {
60988 RECEIVE_PACKET_FIELD_ERROR(terrain_freeze_requirement_pct);
60989 }
60990 }
60991 if (BV_ISSET(fields, 4)) {
60992 log_packet_detailed(" got field 'lake_max_size'");
60993 #ifdef FREECIV_JSON_CONNECTION
60994 field_addr.name = "lake_max_size";
60995 #endif /* FREECIV_JSON_CONNECTION */
60996 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->lake_max_size)) {
60997 RECEIVE_PACKET_FIELD_ERROR(lake_max_size);
60998 }
60999 }
61000 if (BV_ISSET(fields, 5)) {
61001 log_packet_detailed(" got field 'min_start_native_area'");
61002 #ifdef FREECIV_JSON_CONNECTION
61003 field_addr.name = "min_start_native_area";
61004 #endif /* FREECIV_JSON_CONNECTION */
61005 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->min_start_native_area)) {
61006 RECEIVE_PACKET_FIELD_ERROR(min_start_native_area);
61007 }
61008 }
61009 if (BV_ISSET(fields, 6)) {
61010 log_packet_detailed(" got field 'move_fragments'");
61011 #ifdef FREECIV_JSON_CONNECTION
61012 field_addr.name = "move_fragments";
61013 #endif /* FREECIV_JSON_CONNECTION */
61014 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_fragments)) {
61015 RECEIVE_PACKET_FIELD_ERROR(move_fragments);
61016 }
61017 }
61018 if (BV_ISSET(fields, 7)) {
61019 log_packet_detailed(" got field 'igter_cost'");
61020 #ifdef FREECIV_JSON_CONNECTION
61021 field_addr.name = "igter_cost";
61022 #endif /* FREECIV_JSON_CONNECTION */
61023 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->igter_cost)) {
61024 RECEIVE_PACKET_FIELD_ERROR(igter_cost);
61025 }
61026 }
61027 real_packet->pythagorean_diagonal = BV_ISSET(fields, 8);
61028 real_packet->infrapoints = BV_ISSET(fields, 9);
61029 if (BV_ISSET(fields, 10)) {
61030 log_packet_detailed(" got field 'gui_type_base0'");
61031 #ifdef FREECIV_JSON_CONNECTION
61032 field_addr.name = "gui_type_base0";
61033 #endif /* FREECIV_JSON_CONNECTION */
61034 if (!DIO_GET(string, &din, &field_addr, real_packet->gui_type_base0, sizeof(real_packet->gui_type_base0))) {
61035 RECEIVE_PACKET_FIELD_ERROR(gui_type_base0);
61036 }
61037 }
61038 if (BV_ISSET(fields, 11)) {
61039 log_packet_detailed(" got field 'gui_type_base1'");
61040 #ifdef FREECIV_JSON_CONNECTION
61041 field_addr.name = "gui_type_base1";
61042 #endif /* FREECIV_JSON_CONNECTION */
61043 if (!DIO_GET(string, &din, &field_addr, real_packet->gui_type_base1, sizeof(real_packet->gui_type_base1))) {
61044 RECEIVE_PACKET_FIELD_ERROR(gui_type_base1);
61045 }
61046 }
61047
61048 if (NULL == old) {
61049 old = fc_malloc(sizeof(*old));
61050 *old = *real_packet;
61051 genhash_insert(*hash, old, old);
61052 } else {
61053 *old = *real_packet;
61054 }
61055
61056#endif /* FREECIV_DELTA_PROTOCOL */
61057 RECEIVE_PACKET_END(real_packet);
61058}
61059
61060 static int send_packet_ruleset_terrain_control_100(struct connection *pc, const struct packet_ruleset_terrain_control *packet)
61061{
61062 const struct packet_ruleset_terrain_control *real_packet = packet;
61063#ifdef FREECIV_DELTA_PROTOCOL
61064 packet_ruleset_terrain_control_100_fields fields;
61065 struct packet_ruleset_terrain_control *old;
61066 bool differ;
61067 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TERRAIN_CONTROL;
61068#endif /* FREECIV_DELTA_PROTOCOL */
61069 SEND_PACKET_START(PACKET_RULESET_TERRAIN_CONTROL);
61070#ifdef FREECIV_JSON_CONNECTION
61071 struct plocation field_addr;
61072 {
61073 struct plocation *field_addr_tmp = plocation_field_new(NULL);
61074 field_addr = *field_addr_tmp;
61075 FC_FREE(field_addr_tmp);
61076 }
61077#endif /* FREECIV_JSON_CONNECTION */
61078
61079 log_packet_detailed("packet_ruleset_terrain_control_100: sending info about ()");
61080
61081#ifdef FREECIV_DELTA_PROTOCOL
61082 if (NULL == *hash) {
61083 *hash = genhash_new_full(hash_packet_ruleset_terrain_control_100, cmp_packet_ruleset_terrain_control_100,
61084 NULL, NULL, NULL, free);
61085 }
61086 BV_CLR_ALL(fields);
61087
61088 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
61089 old = fc_malloc(sizeof(*old));
61090 *old = *real_packet;
61091 genhash_insert(*hash, old, old);
61092 memset(old, 0, sizeof(*old));
61093 }
61094 differ = (old->ocean_reclaim_requirement_pct != real_packet->ocean_reclaim_requirement_pct);
61095 if (differ) {
61096 BV_SET(fields, 0);
61097 }
61098
61099 differ = (old->land_channel_requirement_pct != real_packet->land_channel_requirement_pct);
61100 if (differ) {
61101 BV_SET(fields, 1);
61102 }
61103
61104 differ = (old->terrain_thaw_requirement_pct != real_packet->terrain_thaw_requirement_pct);
61105 if (differ) {
61106 BV_SET(fields, 2);
61107 }
61108
61109 differ = (old->terrain_freeze_requirement_pct != real_packet->terrain_freeze_requirement_pct);
61110 if (differ) {
61111 BV_SET(fields, 3);
61112 }
61113
61114 differ = (old->lake_max_size != real_packet->lake_max_size);
61115 if (differ) {
61116 BV_SET(fields, 4);
61117 }
61118
61119 differ = (old->min_start_native_area != real_packet->min_start_native_area);
61120 if (differ) {
61121 BV_SET(fields, 5);
61122 }
61123
61124 differ = (old->move_fragments != real_packet->move_fragments);
61125 if (differ) {
61126 BV_SET(fields, 6);
61127 }
61128
61129 differ = (old->igter_cost != real_packet->igter_cost);
61130 if (differ) {
61131 BV_SET(fields, 7);
61132 }
61133
61134 if (packet->pythagorean_diagonal) {
61135 BV_SET(fields, 8);
61136 }
61137
61138 if (packet->infrapoints) {
61139 BV_SET(fields, 9);
61140 }
61141
61142 differ = (strcmp(old->gui_type_base0, real_packet->gui_type_base0) != 0);
61143 if (differ) {
61144 BV_SET(fields, 10);
61145 }
61146
61147 differ = (strcmp(old->gui_type_base1, real_packet->gui_type_base1) != 0);
61148 if (differ) {
61149 BV_SET(fields, 11);
61150 }
61151
61152
61153#ifdef FREECIV_JSON_CONNECTION
61154 field_addr.name = "fields";
61155#endif /* FREECIV_JSON_CONNECTION */
61156 DIO_BV_PUT(&dout, &field_addr, fields);
61157
61158 if (BV_ISSET(fields, 0)) {
61159 log_packet_detailed(" field 'ocean_reclaim_requirement_pct' has changed");
61160 #ifdef FREECIV_JSON_CONNECTION
61161 field_addr.name = "ocean_reclaim_requirement_pct";
61162#endif /* FREECIV_JSON_CONNECTION */
61163 DIO_PUT(uint8, &dout, &field_addr, real_packet->ocean_reclaim_requirement_pct);
61164 }
61165 if (BV_ISSET(fields, 1)) {
61166 log_packet_detailed(" field 'land_channel_requirement_pct' has changed");
61167 #ifdef FREECIV_JSON_CONNECTION
61168 field_addr.name = "land_channel_requirement_pct";
61169#endif /* FREECIV_JSON_CONNECTION */
61170 DIO_PUT(uint8, &dout, &field_addr, real_packet->land_channel_requirement_pct);
61171 }
61172 if (BV_ISSET(fields, 2)) {
61173 log_packet_detailed(" field 'terrain_thaw_requirement_pct' has changed");
61174 #ifdef FREECIV_JSON_CONNECTION
61175 field_addr.name = "terrain_thaw_requirement_pct";
61176#endif /* FREECIV_JSON_CONNECTION */
61177 DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain_thaw_requirement_pct);
61178 }
61179 if (BV_ISSET(fields, 3)) {
61180 log_packet_detailed(" field 'terrain_freeze_requirement_pct' has changed");
61181 #ifdef FREECIV_JSON_CONNECTION
61182 field_addr.name = "terrain_freeze_requirement_pct";
61183#endif /* FREECIV_JSON_CONNECTION */
61184 DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain_freeze_requirement_pct);
61185 }
61186 if (BV_ISSET(fields, 4)) {
61187 log_packet_detailed(" field 'lake_max_size' has changed");
61188 #ifdef FREECIV_JSON_CONNECTION
61189 field_addr.name = "lake_max_size";
61190#endif /* FREECIV_JSON_CONNECTION */
61191 DIO_PUT(uint8, &dout, &field_addr, real_packet->lake_max_size);
61192 }
61193 if (BV_ISSET(fields, 5)) {
61194 log_packet_detailed(" field 'min_start_native_area' has changed");
61195 #ifdef FREECIV_JSON_CONNECTION
61196 field_addr.name = "min_start_native_area";
61197#endif /* FREECIV_JSON_CONNECTION */
61198 DIO_PUT(uint8, &dout, &field_addr, real_packet->min_start_native_area);
61199 }
61200 if (BV_ISSET(fields, 6)) {
61201 log_packet_detailed(" field 'move_fragments' has changed");
61202 #ifdef FREECIV_JSON_CONNECTION
61203 field_addr.name = "move_fragments";
61204#endif /* FREECIV_JSON_CONNECTION */
61205 DIO_PUT(uint32, &dout, &field_addr, real_packet->move_fragments);
61206 }
61207 if (BV_ISSET(fields, 7)) {
61208 log_packet_detailed(" field 'igter_cost' has changed");
61209 #ifdef FREECIV_JSON_CONNECTION
61210 field_addr.name = "igter_cost";
61211#endif /* FREECIV_JSON_CONNECTION */
61212 DIO_PUT(uint32, &dout, &field_addr, real_packet->igter_cost);
61213 }
61214 /* field 8 is folded into the header */
61215 /* field 9 is folded into the header */
61216 if (BV_ISSET(fields, 10)) {
61217 log_packet_detailed(" field 'gui_type_base0' has changed");
61218 #ifdef FREECIV_JSON_CONNECTION
61219 field_addr.name = "gui_type_base0";
61220#endif /* FREECIV_JSON_CONNECTION */
61221 DIO_PUT(string, &dout, &field_addr, real_packet->gui_type_base0);
61222 }
61223 if (BV_ISSET(fields, 11)) {
61224 log_packet_detailed(" field 'gui_type_base1' has changed");
61225 #ifdef FREECIV_JSON_CONNECTION
61226 field_addr.name = "gui_type_base1";
61227#endif /* FREECIV_JSON_CONNECTION */
61228 DIO_PUT(string, &dout, &field_addr, real_packet->gui_type_base1);
61229 }
61230
61231 *old = *real_packet;
61232#endif /* FREECIV_DELTA_PROTOCOL */
61233#ifndef FREECIV_DELTA_PROTOCOL
61234#ifdef FREECIV_JSON_CONNECTION
61235 field_addr.name = "ocean_reclaim_requirement_pct";
61236#endif /* FREECIV_JSON_CONNECTION */
61237 DIO_PUT(uint8, &dout, &field_addr, real_packet->ocean_reclaim_requirement_pct);
61238#ifdef FREECIV_JSON_CONNECTION
61239 field_addr.name = "land_channel_requirement_pct";
61240#endif /* FREECIV_JSON_CONNECTION */
61241 DIO_PUT(uint8, &dout, &field_addr, real_packet->land_channel_requirement_pct);
61242#ifdef FREECIV_JSON_CONNECTION
61243 field_addr.name = "terrain_thaw_requirement_pct";
61244#endif /* FREECIV_JSON_CONNECTION */
61245 DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain_thaw_requirement_pct);
61246#ifdef FREECIV_JSON_CONNECTION
61247 field_addr.name = "terrain_freeze_requirement_pct";
61248#endif /* FREECIV_JSON_CONNECTION */
61249 DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain_freeze_requirement_pct);
61250#ifdef FREECIV_JSON_CONNECTION
61251 field_addr.name = "lake_max_size";
61252#endif /* FREECIV_JSON_CONNECTION */
61253 DIO_PUT(uint8, &dout, &field_addr, real_packet->lake_max_size);
61254#ifdef FREECIV_JSON_CONNECTION
61255 field_addr.name = "min_start_native_area";
61256#endif /* FREECIV_JSON_CONNECTION */
61257 DIO_PUT(uint8, &dout, &field_addr, real_packet->min_start_native_area);
61258#ifdef FREECIV_JSON_CONNECTION
61259 field_addr.name = "move_fragments";
61260#endif /* FREECIV_JSON_CONNECTION */
61261 DIO_PUT(uint32, &dout, &field_addr, real_packet->move_fragments);
61262#ifdef FREECIV_JSON_CONNECTION
61263 field_addr.name = "igter_cost";
61264#endif /* FREECIV_JSON_CONNECTION */
61265 DIO_PUT(uint32, &dout, &field_addr, real_packet->igter_cost);
61266#ifdef FREECIV_JSON_CONNECTION
61267 field_addr.name = "pythagorean_diagonal";
61268#endif /* FREECIV_JSON_CONNECTION */
61269 DIO_PUT(bool8, &dout, &field_addr, real_packet->pythagorean_diagonal);
61270#ifdef FREECIV_JSON_CONNECTION
61271 field_addr.name = "infrapoints";
61272#endif /* FREECIV_JSON_CONNECTION */
61273 DIO_PUT(bool8, &dout, &field_addr, real_packet->infrapoints);
61274#ifdef FREECIV_JSON_CONNECTION
61275 field_addr.name = "gui_type_base0";
61276#endif /* FREECIV_JSON_CONNECTION */
61277 DIO_PUT(string, &dout, &field_addr, real_packet->gui_type_base0);
61278#ifdef FREECIV_JSON_CONNECTION
61279 field_addr.name = "gui_type_base1";
61280#endif /* FREECIV_JSON_CONNECTION */
61281 DIO_PUT(string, &dout, &field_addr, real_packet->gui_type_base1);
61282
61283#endif
61284 SEND_PACKET_END(PACKET_RULESET_TERRAIN_CONTROL);
61285}
61286
61287 int send_packet_ruleset_terrain_control(struct connection *pc, const struct packet_ruleset_terrain_control *packet)
61288{
61289 if (!pc->used) {
61290 log_error("WARNING: trying to send data to the closed connection %s",
61291 conn_description(pc));
61292 return -1;
61293 }
61294 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TERRAIN_CONTROL].packet != NULL, -1,
61295 "Handler for PACKET_RULESET_TERRAIN_CONTROL not installed");
61296 return pc->phs.handlers->send[PACKET_RULESET_TERRAIN_CONTROL].packet(pc, packet);
61297}
61298
61299 void lsend_packet_ruleset_terrain_control(struct conn_list *dest, const struct packet_ruleset_terrain_control *packet)
61300{
61301 conn_list_iterate(dest, pconn) {
61302 send_packet_ruleset_terrain_control(pconn, packet);
61303 } conn_list_iterate_end;
61304}
61305
61306 static struct packet_rulesets_ready *receive_packet_rulesets_ready_100(struct connection *pc)
61307{
61308 RECEIVE_PACKET_START(packet_rulesets_ready, real_packet);
61309#if 1 /* To match endif */
61310 real_packet->__dummy = 0xff;
61311#endif
61312 log_packet_detailed("packet_rulesets_ready_100: got info about ()");
61313 RECEIVE_PACKET_END(real_packet);
61314}
61315
61316 static int send_packet_rulesets_ready_100(struct connection *pc)
61317{
61318 SEND_PACKET_START(PACKET_RULESETS_READY);
61319
61320 log_packet_detailed("packet_rulesets_ready_100: sending info about ()");
61321 SEND_PACKET_END(PACKET_RULESETS_READY);
61322}
61323
61324 int send_packet_rulesets_ready(struct connection *pc)
61325{
61326 if (!pc->used) {
61327 log_error("WARNING: trying to send data to the closed connection %s",
61328 conn_description(pc));
61329 return -1;
61330 }
61331 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESETS_READY].no_packet != NULL, -1,
61332 "Handler for PACKET_RULESETS_READY not installed");
61333 return pc->phs.handlers->send[PACKET_RULESETS_READY].no_packet(pc);
61334}
61335
61336 void lsend_packet_rulesets_ready(struct conn_list *dest)
61337{
61338 conn_list_iterate(dest, pconn) {
61339 send_packet_rulesets_ready(pconn);
61340 } conn_list_iterate_end;
61341}
61342
61343#ifdef FREECIV_DELTA_PROTOCOL
61344#define hash_packet_ruleset_nation_sets_100 hash_const
61345
61346#define cmp_packet_ruleset_nation_sets_100 cmp_const
61347
61348 BV_DEFINE(packet_ruleset_nation_sets_100_fields, 4);
61349#endif /* FREECIV_DELTA_PROTOCOL */
61350
61351 static struct packet_ruleset_nation_sets *receive_packet_ruleset_nation_sets_100(struct connection *pc)
61352{
61353#ifdef FREECIV_DELTA_PROTOCOL
61354 packet_ruleset_nation_sets_100_fields fields;
61355 struct packet_ruleset_nation_sets *old;
61356 struct genhash **hash = pc->phs.received + PACKET_RULESET_NATION_SETS;
61357#endif /* FREECIV_DELTA_PROTOCOL */
61358 RECEIVE_PACKET_START(packet_ruleset_nation_sets, real_packet);
61359#ifdef FREECIV_JSON_CONNECTION
61360 struct plocation field_addr;
61361 {
61362 struct plocation *field_addr_tmp = plocation_field_new(NULL);
61363 field_addr = *field_addr_tmp;
61364 FC_FREE(field_addr_tmp);
61365 }
61366#endif /* FREECIV_JSON_CONNECTION */
61367
61368#ifdef FREECIV_DELTA_PROTOCOL
61369#ifdef FREECIV_JSON_CONNECTION
61370 field_addr.name = "fields";
61371#endif /* FREECIV_JSON_CONNECTION */
61372 DIO_BV_GET(&din, &field_addr, fields);
61373
61374#else /* FREECIV_DELTA_PROTOCOL */
61375 #ifdef FREECIV_JSON_CONNECTION
61376 field_addr.name = "nsets";
61377 #endif /* FREECIV_JSON_CONNECTION */
61378 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nsets)) {
61379 RECEIVE_PACKET_FIELD_ERROR(nsets);
61380 }
61381 #ifdef FREECIV_JSON_CONNECTION
61382 field_addr.name = "names";
61383 #endif /* FREECIV_JSON_CONNECTION */
61384
61385 {
61386 int i;
61387
61388 #ifdef FREECIV_JSON_CONNECTION
61389 /* Enter array. */
61390 field_addr.sub_location = plocation_elem_new(0);
61391 #endif /* FREECIV_JSON_CONNECTION */
61392
61393 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
61394 RECEIVE_PACKET_FIELD_ERROR(names, ": truncation array");
61395 }
61396 for (i = 0; i < real_packet->nsets; i++) {
61397 #ifdef FREECIV_JSON_CONNECTION
61398 field_addr.sub_location->number = i;
61399 #endif /* FREECIV_JSON_CONNECTION */
61400 if (!DIO_GET(string, &din, &field_addr, real_packet->names[i], sizeof(real_packet->names[i]))) {
61401 RECEIVE_PACKET_FIELD_ERROR(names);
61402 }
61403 }
61404
61405 #ifdef FREECIV_JSON_CONNECTION
61406 /* Exit array. */
61407 free(field_addr.sub_location);
61408 field_addr.sub_location = NULL;
61409 #endif /* FREECIV_JSON_CONNECTION */
61410 }
61411 #ifdef FREECIV_JSON_CONNECTION
61412 field_addr.name = "rule_names";
61413 #endif /* FREECIV_JSON_CONNECTION */
61414
61415 {
61416 int i;
61417
61418 #ifdef FREECIV_JSON_CONNECTION
61419 /* Enter array. */
61420 field_addr.sub_location = plocation_elem_new(0);
61421 #endif /* FREECIV_JSON_CONNECTION */
61422
61423 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
61424 RECEIVE_PACKET_FIELD_ERROR(rule_names, ": truncation array");
61425 }
61426 for (i = 0; i < real_packet->nsets; i++) {
61427 #ifdef FREECIV_JSON_CONNECTION
61428 field_addr.sub_location->number = i;
61429 #endif /* FREECIV_JSON_CONNECTION */
61430 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_names[i], sizeof(real_packet->rule_names[i]))) {
61431 RECEIVE_PACKET_FIELD_ERROR(rule_names);
61432 }
61433 }
61434
61435 #ifdef FREECIV_JSON_CONNECTION
61436 /* Exit array. */
61437 free(field_addr.sub_location);
61438 field_addr.sub_location = NULL;
61439 #endif /* FREECIV_JSON_CONNECTION */
61440 }
61441 #ifdef FREECIV_JSON_CONNECTION
61442 field_addr.name = "descriptions";
61443 #endif /* FREECIV_JSON_CONNECTION */
61444
61445 {
61446 int i;
61447
61448 #ifdef FREECIV_JSON_CONNECTION
61449 /* Enter array. */
61450 field_addr.sub_location = plocation_elem_new(0);
61451 #endif /* FREECIV_JSON_CONNECTION */
61452
61453 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
61454 RECEIVE_PACKET_FIELD_ERROR(descriptions, ": truncation array");
61455 }
61456 for (i = 0; i < real_packet->nsets; i++) {
61457 #ifdef FREECIV_JSON_CONNECTION
61458 field_addr.sub_location->number = i;
61459 #endif /* FREECIV_JSON_CONNECTION */
61460 if (!DIO_GET(string, &din, &field_addr, real_packet->descriptions[i], sizeof(real_packet->descriptions[i]))) {
61461 RECEIVE_PACKET_FIELD_ERROR(descriptions);
61462 }
61463 }
61464
61465 #ifdef FREECIV_JSON_CONNECTION
61466 /* Exit array. */
61467 free(field_addr.sub_location);
61468 field_addr.sub_location = NULL;
61469 #endif /* FREECIV_JSON_CONNECTION */
61470 }
61471
61472#endif
61473 log_packet_detailed("packet_ruleset_nation_sets_100: got info about ()");
61474
61475#ifdef FREECIV_DELTA_PROTOCOL
61476 if (NULL == *hash) {
61477 *hash = genhash_new_full(hash_packet_ruleset_nation_sets_100, cmp_packet_ruleset_nation_sets_100,
61478 NULL, NULL, NULL, free);
61479 }
61480
61481 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
61482 *real_packet = *old;
61483 } else {
61484 log_packet_detailed(" no old info");
61485 memset(real_packet, 0, sizeof(*real_packet));
61486 }
61487
61488 if (BV_ISSET(fields, 0)) {
61489 log_packet_detailed(" got field 'nsets'");
61490 #ifdef FREECIV_JSON_CONNECTION
61491 field_addr.name = "nsets";
61492 #endif /* FREECIV_JSON_CONNECTION */
61493 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nsets)) {
61494 RECEIVE_PACKET_FIELD_ERROR(nsets);
61495 }
61496 }
61497 if (BV_ISSET(fields, 1)) {
61498 log_packet_detailed(" got field 'names'");
61499 #ifdef FREECIV_JSON_CONNECTION
61500 field_addr.name = "names";
61501 #endif /* FREECIV_JSON_CONNECTION */
61502
61503 {
61504 int i;
61505
61506 #ifdef FREECIV_JSON_CONNECTION
61507 /* Enter array. */
61508 field_addr.sub_location = plocation_elem_new(0);
61509 #endif /* FREECIV_JSON_CONNECTION */
61510
61511 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
61512 RECEIVE_PACKET_FIELD_ERROR(names, ": truncation array");
61513 }
61514 for (i = 0; i < real_packet->nsets; i++) {
61515 #ifdef FREECIV_JSON_CONNECTION
61516 field_addr.sub_location->number = i;
61517 #endif /* FREECIV_JSON_CONNECTION */
61518 if (!DIO_GET(string, &din, &field_addr, real_packet->names[i], sizeof(real_packet->names[i]))) {
61519 RECEIVE_PACKET_FIELD_ERROR(names);
61520 }
61521 }
61522
61523 #ifdef FREECIV_JSON_CONNECTION
61524 /* Exit array. */
61525 free(field_addr.sub_location);
61526 field_addr.sub_location = NULL;
61527 #endif /* FREECIV_JSON_CONNECTION */
61528 }
61529 }
61530 if (BV_ISSET(fields, 2)) {
61531 log_packet_detailed(" got field 'rule_names'");
61532 #ifdef FREECIV_JSON_CONNECTION
61533 field_addr.name = "rule_names";
61534 #endif /* FREECIV_JSON_CONNECTION */
61535
61536 {
61537 int i;
61538
61539 #ifdef FREECIV_JSON_CONNECTION
61540 /* Enter array. */
61541 field_addr.sub_location = plocation_elem_new(0);
61542 #endif /* FREECIV_JSON_CONNECTION */
61543
61544 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
61545 RECEIVE_PACKET_FIELD_ERROR(rule_names, ": truncation array");
61546 }
61547 for (i = 0; i < real_packet->nsets; i++) {
61548 #ifdef FREECIV_JSON_CONNECTION
61549 field_addr.sub_location->number = i;
61550 #endif /* FREECIV_JSON_CONNECTION */
61551 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_names[i], sizeof(real_packet->rule_names[i]))) {
61552 RECEIVE_PACKET_FIELD_ERROR(rule_names);
61553 }
61554 }
61555
61556 #ifdef FREECIV_JSON_CONNECTION
61557 /* Exit array. */
61558 free(field_addr.sub_location);
61559 field_addr.sub_location = NULL;
61560 #endif /* FREECIV_JSON_CONNECTION */
61561 }
61562 }
61563 if (BV_ISSET(fields, 3)) {
61564 log_packet_detailed(" got field 'descriptions'");
61565 #ifdef FREECIV_JSON_CONNECTION
61566 field_addr.name = "descriptions";
61567 #endif /* FREECIV_JSON_CONNECTION */
61568
61569 {
61570 int i;
61571
61572 #ifdef FREECIV_JSON_CONNECTION
61573 /* Enter array. */
61574 field_addr.sub_location = plocation_elem_new(0);
61575 #endif /* FREECIV_JSON_CONNECTION */
61576
61577 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
61578 RECEIVE_PACKET_FIELD_ERROR(descriptions, ": truncation array");
61579 }
61580 for (i = 0; i < real_packet->nsets; i++) {
61581 #ifdef FREECIV_JSON_CONNECTION
61582 field_addr.sub_location->number = i;
61583 #endif /* FREECIV_JSON_CONNECTION */
61584 if (!DIO_GET(string, &din, &field_addr, real_packet->descriptions[i], sizeof(real_packet->descriptions[i]))) {
61585 RECEIVE_PACKET_FIELD_ERROR(descriptions);
61586 }
61587 }
61588
61589 #ifdef FREECIV_JSON_CONNECTION
61590 /* Exit array. */
61591 free(field_addr.sub_location);
61592 field_addr.sub_location = NULL;
61593 #endif /* FREECIV_JSON_CONNECTION */
61594 }
61595 }
61596
61597 if (NULL == old) {
61598 old = fc_malloc(sizeof(*old));
61599 *old = *real_packet;
61600 genhash_insert(*hash, old, old);
61601 } else {
61602 *old = *real_packet;
61603 }
61604
61605#endif /* FREECIV_DELTA_PROTOCOL */
61606 RECEIVE_PACKET_END(real_packet);
61607}
61608
61609 static int send_packet_ruleset_nation_sets_100(struct connection *pc, const struct packet_ruleset_nation_sets *packet)
61610{
61611 const struct packet_ruleset_nation_sets *real_packet = packet;
61612#ifdef FREECIV_DELTA_PROTOCOL
61613 packet_ruleset_nation_sets_100_fields fields;
61614 struct packet_ruleset_nation_sets *old;
61615 bool differ;
61616 struct genhash **hash = pc->phs.sent + PACKET_RULESET_NATION_SETS;
61617#endif /* FREECIV_DELTA_PROTOCOL */
61618 SEND_PACKET_START(PACKET_RULESET_NATION_SETS);
61619#ifdef FREECIV_JSON_CONNECTION
61620 struct plocation field_addr;
61621 {
61622 struct plocation *field_addr_tmp = plocation_field_new(NULL);
61623 field_addr = *field_addr_tmp;
61624 FC_FREE(field_addr_tmp);
61625 }
61626#endif /* FREECIV_JSON_CONNECTION */
61627
61628 log_packet_detailed("packet_ruleset_nation_sets_100: sending info about ()");
61629
61630#ifdef FREECIV_DELTA_PROTOCOL
61631 if (NULL == *hash) {
61632 *hash = genhash_new_full(hash_packet_ruleset_nation_sets_100, cmp_packet_ruleset_nation_sets_100,
61633 NULL, NULL, NULL, free);
61634 }
61635 BV_CLR_ALL(fields);
61636
61637 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
61638 old = fc_malloc(sizeof(*old));
61639 *old = *real_packet;
61640 genhash_insert(*hash, old, old);
61641 memset(old, 0, sizeof(*old));
61642 }
61643 differ = (old->nsets != real_packet->nsets);
61644 if (differ) {
61645 BV_SET(fields, 0);
61646 }
61647
61648
61649 {
61650 differ = (old->nsets != real_packet->nsets);
61651 if (!differ) {
61652 int i;
61653
61654 for (i = 0; i < real_packet->nsets; i++) {
61655 if (strcmp(old->names[i], real_packet->names[i]) != 0) {
61656 differ = TRUE;
61657 break;
61658 }
61659 }
61660 }
61661 }
61662 if (differ) {
61663 BV_SET(fields, 1);
61664 }
61665
61666
61667 {
61668 differ = (old->nsets != real_packet->nsets);
61669 if (!differ) {
61670 int i;
61671
61672 for (i = 0; i < real_packet->nsets; i++) {
61673 if (strcmp(old->rule_names[i], real_packet->rule_names[i]) != 0) {
61674 differ = TRUE;
61675 break;
61676 }
61677 }
61678 }
61679 }
61680 if (differ) {
61681 BV_SET(fields, 2);
61682 }
61683
61684
61685 {
61686 differ = (old->nsets != real_packet->nsets);
61687 if (!differ) {
61688 int i;
61689
61690 for (i = 0; i < real_packet->nsets; i++) {
61691 if (strcmp(old->descriptions[i], real_packet->descriptions[i]) != 0) {
61692 differ = TRUE;
61693 break;
61694 }
61695 }
61696 }
61697 }
61698 if (differ) {
61699 BV_SET(fields, 3);
61700 }
61701
61702
61703#ifdef FREECIV_JSON_CONNECTION
61704 field_addr.name = "fields";
61705#endif /* FREECIV_JSON_CONNECTION */
61706 DIO_BV_PUT(&dout, &field_addr, fields);
61707
61708 if (BV_ISSET(fields, 0)) {
61709 log_packet_detailed(" field 'nsets' has changed");
61710 #ifdef FREECIV_JSON_CONNECTION
61711 field_addr.name = "nsets";
61712#endif /* FREECIV_JSON_CONNECTION */
61713 DIO_PUT(uint8, &dout, &field_addr, real_packet->nsets);
61714 }
61715 if (BV_ISSET(fields, 1)) {
61716 log_packet_detailed(" field 'names' has changed");
61717 #ifdef FREECIV_JSON_CONNECTION
61718 field_addr.name = "names";
61719#endif /* FREECIV_JSON_CONNECTION */
61720
61721 {
61722 int i;
61723
61724#ifdef FREECIV_JSON_CONNECTION
61725 /* Create the array. */
61726 DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
61727
61728 /* Enter the array. */
61729 field_addr.sub_location = plocation_elem_new(0);
61730#endif /* FREECIV_JSON_CONNECTION */
61731
61732 for (i = 0; i < real_packet->nsets; i++) {
61733#ifdef FREECIV_JSON_CONNECTION
61734 /* Next array element. */
61735 field_addr.sub_location->number = i;
61736#endif /* FREECIV_JSON_CONNECTION */
61737 DIO_PUT(string, &dout, &field_addr, real_packet->names[i]);
61738 }
61739
61740#ifdef FREECIV_JSON_CONNECTION
61741 /* Exit array. */
61742 free(field_addr.sub_location);
61743 field_addr.sub_location = NULL;
61744#endif /* FREECIV_JSON_CONNECTION */
61745 }
61746 }
61747 if (BV_ISSET(fields, 2)) {
61748 log_packet_detailed(" field 'rule_names' has changed");
61749 #ifdef FREECIV_JSON_CONNECTION
61750 field_addr.name = "rule_names";
61751#endif /* FREECIV_JSON_CONNECTION */
61752
61753 {
61754 int i;
61755
61756#ifdef FREECIV_JSON_CONNECTION
61757 /* Create the array. */
61758 DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
61759
61760 /* Enter the array. */
61761 field_addr.sub_location = plocation_elem_new(0);
61762#endif /* FREECIV_JSON_CONNECTION */
61763
61764 for (i = 0; i < real_packet->nsets; i++) {
61765#ifdef FREECIV_JSON_CONNECTION
61766 /* Next array element. */
61767 field_addr.sub_location->number = i;
61768#endif /* FREECIV_JSON_CONNECTION */
61769 DIO_PUT(string, &dout, &field_addr, real_packet->rule_names[i]);
61770 }
61771
61772#ifdef FREECIV_JSON_CONNECTION
61773 /* Exit array. */
61774 free(field_addr.sub_location);
61775 field_addr.sub_location = NULL;
61776#endif /* FREECIV_JSON_CONNECTION */
61777 }
61778 }
61779 if (BV_ISSET(fields, 3)) {
61780 log_packet_detailed(" field 'descriptions' has changed");
61781 #ifdef FREECIV_JSON_CONNECTION
61782 field_addr.name = "descriptions";
61783#endif /* FREECIV_JSON_CONNECTION */
61784
61785 {
61786 int i;
61787
61788#ifdef FREECIV_JSON_CONNECTION
61789 /* Create the array. */
61790 DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
61791
61792 /* Enter the array. */
61793 field_addr.sub_location = plocation_elem_new(0);
61794#endif /* FREECIV_JSON_CONNECTION */
61795
61796 for (i = 0; i < real_packet->nsets; i++) {
61797#ifdef FREECIV_JSON_CONNECTION
61798 /* Next array element. */
61799 field_addr.sub_location->number = i;
61800#endif /* FREECIV_JSON_CONNECTION */
61801 DIO_PUT(string, &dout, &field_addr, real_packet->descriptions[i]);
61802 }
61803
61804#ifdef FREECIV_JSON_CONNECTION
61805 /* Exit array. */
61806 free(field_addr.sub_location);
61807 field_addr.sub_location = NULL;
61808#endif /* FREECIV_JSON_CONNECTION */
61809 }
61810 }
61811
61812 *old = *real_packet;
61813#endif /* FREECIV_DELTA_PROTOCOL */
61814#ifndef FREECIV_DELTA_PROTOCOL
61815#ifdef FREECIV_JSON_CONNECTION
61816 field_addr.name = "nsets";
61817#endif /* FREECIV_JSON_CONNECTION */
61818 DIO_PUT(uint8, &dout, &field_addr, real_packet->nsets);
61819#ifdef FREECIV_JSON_CONNECTION
61820 field_addr.name = "names";
61821#endif /* FREECIV_JSON_CONNECTION */
61822
61823 {
61824 int i;
61825
61826#ifdef FREECIV_JSON_CONNECTION
61827 /* Create the array. */
61828 DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
61829
61830 /* Enter the array. */
61831 field_addr.sub_location = plocation_elem_new(0);
61832#endif /* FREECIV_JSON_CONNECTION */
61833
61834 for (i = 0; i < real_packet->nsets; i++) {
61835#ifdef FREECIV_JSON_CONNECTION
61836 /* Next array element. */
61837 field_addr.sub_location->number = i;
61838#endif /* FREECIV_JSON_CONNECTION */
61839 DIO_PUT(string, &dout, &field_addr, real_packet->names[i]);
61840 }
61841
61842#ifdef FREECIV_JSON_CONNECTION
61843 /* Exit array. */
61844 free(field_addr.sub_location);
61845 field_addr.sub_location = NULL;
61846#endif /* FREECIV_JSON_CONNECTION */
61847 }
61848#ifdef FREECIV_JSON_CONNECTION
61849 field_addr.name = "rule_names";
61850#endif /* FREECIV_JSON_CONNECTION */
61851
61852 {
61853 int i;
61854
61855#ifdef FREECIV_JSON_CONNECTION
61856 /* Create the array. */
61857 DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
61858
61859 /* Enter the array. */
61860 field_addr.sub_location = plocation_elem_new(0);
61861#endif /* FREECIV_JSON_CONNECTION */
61862
61863 for (i = 0; i < real_packet->nsets; i++) {
61864#ifdef FREECIV_JSON_CONNECTION
61865 /* Next array element. */
61866 field_addr.sub_location->number = i;
61867#endif /* FREECIV_JSON_CONNECTION */
61868 DIO_PUT(string, &dout, &field_addr, real_packet->rule_names[i]);
61869 }
61870
61871#ifdef FREECIV_JSON_CONNECTION
61872 /* Exit array. */
61873 free(field_addr.sub_location);
61874 field_addr.sub_location = NULL;
61875#endif /* FREECIV_JSON_CONNECTION */
61876 }
61877#ifdef FREECIV_JSON_CONNECTION
61878 field_addr.name = "descriptions";
61879#endif /* FREECIV_JSON_CONNECTION */
61880
61881 {
61882 int i;
61883
61884#ifdef FREECIV_JSON_CONNECTION
61885 /* Create the array. */
61886 DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
61887
61888 /* Enter the array. */
61889 field_addr.sub_location = plocation_elem_new(0);
61890#endif /* FREECIV_JSON_CONNECTION */
61891
61892 for (i = 0; i < real_packet->nsets; i++) {
61893#ifdef FREECIV_JSON_CONNECTION
61894 /* Next array element. */
61895 field_addr.sub_location->number = i;
61896#endif /* FREECIV_JSON_CONNECTION */
61897 DIO_PUT(string, &dout, &field_addr, real_packet->descriptions[i]);
61898 }
61899
61900#ifdef FREECIV_JSON_CONNECTION
61901 /* Exit array. */
61902 free(field_addr.sub_location);
61903 field_addr.sub_location = NULL;
61904#endif /* FREECIV_JSON_CONNECTION */
61905 }
61906
61907#endif
61908 SEND_PACKET_END(PACKET_RULESET_NATION_SETS);
61909}
61910
61911 int send_packet_ruleset_nation_sets(struct connection *pc, const struct packet_ruleset_nation_sets *packet)
61912{
61913 if (!pc->used) {
61914 log_error("WARNING: trying to send data to the closed connection %s",
61915 conn_description(pc));
61916 return -1;
61917 }
61918 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_NATION_SETS].packet != NULL, -1,
61919 "Handler for PACKET_RULESET_NATION_SETS not installed");
61920 return pc->phs.handlers->send[PACKET_RULESET_NATION_SETS].packet(pc, packet);
61921}
61922
61923 void lsend_packet_ruleset_nation_sets(struct conn_list *dest, const struct packet_ruleset_nation_sets *packet)
61924{
61925 conn_list_iterate(dest, pconn) {
61926 send_packet_ruleset_nation_sets(pconn, packet);
61927 } conn_list_iterate_end;
61928}
61929
61930#ifdef FREECIV_DELTA_PROTOCOL
61931#define hash_packet_ruleset_nation_groups_100 hash_const
61932
61933#define cmp_packet_ruleset_nation_groups_100 cmp_const
61934
61935 BV_DEFINE(packet_ruleset_nation_groups_100_fields, 3);
61936#endif /* FREECIV_DELTA_PROTOCOL */
61937
61938 static struct packet_ruleset_nation_groups *receive_packet_ruleset_nation_groups_100(struct connection *pc)
61939{
61940#ifdef FREECIV_DELTA_PROTOCOL
61941 packet_ruleset_nation_groups_100_fields fields;
61942 struct packet_ruleset_nation_groups *old;
61943 struct genhash **hash = pc->phs.received + PACKET_RULESET_NATION_GROUPS;
61944#endif /* FREECIV_DELTA_PROTOCOL */
61945 RECEIVE_PACKET_START(packet_ruleset_nation_groups, real_packet);
61946#ifdef FREECIV_JSON_CONNECTION
61947 struct plocation field_addr;
61948 {
61949 struct plocation *field_addr_tmp = plocation_field_new(NULL);
61950 field_addr = *field_addr_tmp;
61951 FC_FREE(field_addr_tmp);
61952 }
61953#endif /* FREECIV_JSON_CONNECTION */
61954
61955#ifdef FREECIV_DELTA_PROTOCOL
61956#ifdef FREECIV_JSON_CONNECTION
61957 field_addr.name = "fields";
61958#endif /* FREECIV_JSON_CONNECTION */
61959 DIO_BV_GET(&din, &field_addr, fields);
61960
61961#else /* FREECIV_DELTA_PROTOCOL */
61962 #ifdef FREECIV_JSON_CONNECTION
61963 field_addr.name = "ngroups";
61964 #endif /* FREECIV_JSON_CONNECTION */
61965 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ngroups)) {
61966 RECEIVE_PACKET_FIELD_ERROR(ngroups);
61967 }
61968 #ifdef FREECIV_JSON_CONNECTION
61969 field_addr.name = "groups";
61970 #endif /* FREECIV_JSON_CONNECTION */
61971
61972 {
61973 int i;
61974
61975 #ifdef FREECIV_JSON_CONNECTION
61976 /* Enter array. */
61977 field_addr.sub_location = plocation_elem_new(0);
61978 #endif /* FREECIV_JSON_CONNECTION */
61979
61980 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
61981 RECEIVE_PACKET_FIELD_ERROR(groups, ": truncation array");
61982 }
61983 for (i = 0; i < real_packet->ngroups; i++) {
61984 #ifdef FREECIV_JSON_CONNECTION
61985 field_addr.sub_location->number = i;
61986 #endif /* FREECIV_JSON_CONNECTION */
61987 if (!DIO_GET(string, &din, &field_addr, real_packet->groups[i], sizeof(real_packet->groups[i]))) {
61988 RECEIVE_PACKET_FIELD_ERROR(groups);
61989 }
61990 }
61991
61992 #ifdef FREECIV_JSON_CONNECTION
61993 /* Exit array. */
61994 free(field_addr.sub_location);
61995 field_addr.sub_location = NULL;
61996 #endif /* FREECIV_JSON_CONNECTION */
61997 }
61998 #ifdef FREECIV_JSON_CONNECTION
61999 field_addr.name = "hidden";
62000 #endif /* FREECIV_JSON_CONNECTION */
62001
62002 {
62003 int i;
62004
62005 #ifdef FREECIV_JSON_CONNECTION
62006 /* Enter array. */
62007 field_addr.sub_location = plocation_elem_new(0);
62008 #endif /* FREECIV_JSON_CONNECTION */
62009
62010 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
62011 RECEIVE_PACKET_FIELD_ERROR(hidden, ": truncation array");
62012 }
62013 for (i = 0; i < real_packet->ngroups; i++) {
62014 #ifdef FREECIV_JSON_CONNECTION
62015 field_addr.sub_location->number = i;
62016 #endif /* FREECIV_JSON_CONNECTION */
62017 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->hidden[i])) {
62018 RECEIVE_PACKET_FIELD_ERROR(hidden);
62019 }
62020 }
62021
62022 #ifdef FREECIV_JSON_CONNECTION
62023 /* Exit array. */
62024 free(field_addr.sub_location);
62025 field_addr.sub_location = NULL;
62026 #endif /* FREECIV_JSON_CONNECTION */
62027 }
62028
62029#endif
62030 log_packet_detailed("packet_ruleset_nation_groups_100: got info about ()");
62031
62032#ifdef FREECIV_DELTA_PROTOCOL
62033 if (NULL == *hash) {
62034 *hash = genhash_new_full(hash_packet_ruleset_nation_groups_100, cmp_packet_ruleset_nation_groups_100,
62035 NULL, NULL, NULL, free);
62036 }
62037
62038 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
62039 *real_packet = *old;
62040 } else {
62041 log_packet_detailed(" no old info");
62042 memset(real_packet, 0, sizeof(*real_packet));
62043 }
62044
62045 if (BV_ISSET(fields, 0)) {
62046 log_packet_detailed(" got field 'ngroups'");
62047 #ifdef FREECIV_JSON_CONNECTION
62048 field_addr.name = "ngroups";
62049 #endif /* FREECIV_JSON_CONNECTION */
62050 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ngroups)) {
62051 RECEIVE_PACKET_FIELD_ERROR(ngroups);
62052 }
62053 }
62054 if (BV_ISSET(fields, 1)) {
62055 log_packet_detailed(" got field 'groups'");
62056 #ifdef FREECIV_JSON_CONNECTION
62057 field_addr.name = "groups";
62058 #endif /* FREECIV_JSON_CONNECTION */
62059
62060 {
62061 int i;
62062
62063 #ifdef FREECIV_JSON_CONNECTION
62064 /* Enter array. */
62065 field_addr.sub_location = plocation_elem_new(0);
62066 #endif /* FREECIV_JSON_CONNECTION */
62067
62068 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
62069 RECEIVE_PACKET_FIELD_ERROR(groups, ": truncation array");
62070 }
62071 for (i = 0; i < real_packet->ngroups; i++) {
62072 #ifdef FREECIV_JSON_CONNECTION
62073 field_addr.sub_location->number = i;
62074 #endif /* FREECIV_JSON_CONNECTION */
62075 if (!DIO_GET(string, &din, &field_addr, real_packet->groups[i], sizeof(real_packet->groups[i]))) {
62076 RECEIVE_PACKET_FIELD_ERROR(groups);
62077 }
62078 }
62079
62080 #ifdef FREECIV_JSON_CONNECTION
62081 /* Exit array. */
62082 free(field_addr.sub_location);
62083 field_addr.sub_location = NULL;
62084 #endif /* FREECIV_JSON_CONNECTION */
62085 }
62086 }
62087 if (BV_ISSET(fields, 2)) {
62088 log_packet_detailed(" got field 'hidden'");
62089 #ifdef FREECIV_JSON_CONNECTION
62090 field_addr.name = "hidden";
62091 #endif /* FREECIV_JSON_CONNECTION */
62092
62093 {
62094 int i;
62095
62096 #ifdef FREECIV_JSON_CONNECTION
62097 /* Enter array. */
62098 field_addr.sub_location = plocation_elem_new(0);
62099 #endif /* FREECIV_JSON_CONNECTION */
62100
62101 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
62102 RECEIVE_PACKET_FIELD_ERROR(hidden, ": truncation array");
62103 }
62104 for (i = 0; i < real_packet->ngroups; i++) {
62105 #ifdef FREECIV_JSON_CONNECTION
62106 field_addr.sub_location->number = i;
62107 #endif /* FREECIV_JSON_CONNECTION */
62108 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->hidden[i])) {
62109 RECEIVE_PACKET_FIELD_ERROR(hidden);
62110 }
62111 }
62112
62113 #ifdef FREECIV_JSON_CONNECTION
62114 /* Exit array. */
62115 free(field_addr.sub_location);
62116 field_addr.sub_location = NULL;
62117 #endif /* FREECIV_JSON_CONNECTION */
62118 }
62119 }
62120
62121 if (NULL == old) {
62122 old = fc_malloc(sizeof(*old));
62123 *old = *real_packet;
62124 genhash_insert(*hash, old, old);
62125 } else {
62126 *old = *real_packet;
62127 }
62128
62129#endif /* FREECIV_DELTA_PROTOCOL */
62130 RECEIVE_PACKET_END(real_packet);
62131}
62132
62133 static int send_packet_ruleset_nation_groups_100(struct connection *pc, const struct packet_ruleset_nation_groups *packet)
62134{
62135 const struct packet_ruleset_nation_groups *real_packet = packet;
62136#ifdef FREECIV_DELTA_PROTOCOL
62137 packet_ruleset_nation_groups_100_fields fields;
62138 struct packet_ruleset_nation_groups *old;
62139 bool differ;
62140 struct genhash **hash = pc->phs.sent + PACKET_RULESET_NATION_GROUPS;
62141#endif /* FREECIV_DELTA_PROTOCOL */
62142 SEND_PACKET_START(PACKET_RULESET_NATION_GROUPS);
62143#ifdef FREECIV_JSON_CONNECTION
62144 struct plocation field_addr;
62145 {
62146 struct plocation *field_addr_tmp = plocation_field_new(NULL);
62147 field_addr = *field_addr_tmp;
62148 FC_FREE(field_addr_tmp);
62149 }
62150#endif /* FREECIV_JSON_CONNECTION */
62151
62152 log_packet_detailed("packet_ruleset_nation_groups_100: sending info about ()");
62153
62154#ifdef FREECIV_DELTA_PROTOCOL
62155 if (NULL == *hash) {
62156 *hash = genhash_new_full(hash_packet_ruleset_nation_groups_100, cmp_packet_ruleset_nation_groups_100,
62157 NULL, NULL, NULL, free);
62158 }
62159 BV_CLR_ALL(fields);
62160
62161 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
62162 old = fc_malloc(sizeof(*old));
62163 *old = *real_packet;
62164 genhash_insert(*hash, old, old);
62165 memset(old, 0, sizeof(*old));
62166 }
62167 differ = (old->ngroups != real_packet->ngroups);
62168 if (differ) {
62169 BV_SET(fields, 0);
62170 }
62171
62172
62173 {
62174 differ = (old->ngroups != real_packet->ngroups);
62175 if (!differ) {
62176 int i;
62177
62178 for (i = 0; i < real_packet->ngroups; i++) {
62179 if (strcmp(old->groups[i], real_packet->groups[i]) != 0) {
62180 differ = TRUE;
62181 break;
62182 }
62183 }
62184 }
62185 }
62186 if (differ) {
62187 BV_SET(fields, 1);
62188 }
62189
62190
62191 {
62192 differ = (old->ngroups != real_packet->ngroups);
62193 if (!differ) {
62194 int i;
62195
62196 for (i = 0; i < real_packet->ngroups; i++) {
62197 if (old->hidden[i] != real_packet->hidden[i]) {
62198 differ = TRUE;
62199 break;
62200 }
62201 }
62202 }
62203 }
62204 if (differ) {
62205 BV_SET(fields, 2);
62206 }
62207
62208
62209#ifdef FREECIV_JSON_CONNECTION
62210 field_addr.name = "fields";
62211#endif /* FREECIV_JSON_CONNECTION */
62212 DIO_BV_PUT(&dout, &field_addr, fields);
62213
62214 if (BV_ISSET(fields, 0)) {
62215 log_packet_detailed(" field 'ngroups' has changed");
62216 #ifdef FREECIV_JSON_CONNECTION
62217 field_addr.name = "ngroups";
62218#endif /* FREECIV_JSON_CONNECTION */
62219 DIO_PUT(uint8, &dout, &field_addr, real_packet->ngroups);
62220 }
62221 if (BV_ISSET(fields, 1)) {
62222 log_packet_detailed(" field 'groups' has changed");
62223 #ifdef FREECIV_JSON_CONNECTION
62224 field_addr.name = "groups";
62225#endif /* FREECIV_JSON_CONNECTION */
62226
62227 {
62228 int i;
62229
62230#ifdef FREECIV_JSON_CONNECTION
62231 /* Create the array. */
62232 DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
62233
62234 /* Enter the array. */
62235 field_addr.sub_location = plocation_elem_new(0);
62236#endif /* FREECIV_JSON_CONNECTION */
62237
62238 for (i = 0; i < real_packet->ngroups; i++) {
62239#ifdef FREECIV_JSON_CONNECTION
62240 /* Next array element. */
62241 field_addr.sub_location->number = i;
62242#endif /* FREECIV_JSON_CONNECTION */
62243 DIO_PUT(string, &dout, &field_addr, real_packet->groups[i]);
62244 }
62245
62246#ifdef FREECIV_JSON_CONNECTION
62247 /* Exit array. */
62248 free(field_addr.sub_location);
62249 field_addr.sub_location = NULL;
62250#endif /* FREECIV_JSON_CONNECTION */
62251 }
62252 }
62253 if (BV_ISSET(fields, 2)) {
62254 log_packet_detailed(" field 'hidden' has changed");
62255 #ifdef FREECIV_JSON_CONNECTION
62256 field_addr.name = "hidden";
62257#endif /* FREECIV_JSON_CONNECTION */
62258
62259 {
62260 int i;
62261
62262#ifdef FREECIV_JSON_CONNECTION
62263 /* Create the array. */
62264 DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
62265
62266 /* Enter the array. */
62267 field_addr.sub_location = plocation_elem_new(0);
62268#endif /* FREECIV_JSON_CONNECTION */
62269
62270 for (i = 0; i < real_packet->ngroups; i++) {
62271#ifdef FREECIV_JSON_CONNECTION
62272 /* Next array element. */
62273 field_addr.sub_location->number = i;
62274#endif /* FREECIV_JSON_CONNECTION */
62275 DIO_PUT(bool8, &dout, &field_addr, real_packet->hidden[i]);
62276 }
62277
62278#ifdef FREECIV_JSON_CONNECTION
62279 /* Exit array. */
62280 free(field_addr.sub_location);
62281 field_addr.sub_location = NULL;
62282#endif /* FREECIV_JSON_CONNECTION */
62283 }
62284 }
62285
62286 *old = *real_packet;
62287#endif /* FREECIV_DELTA_PROTOCOL */
62288#ifndef FREECIV_DELTA_PROTOCOL
62289#ifdef FREECIV_JSON_CONNECTION
62290 field_addr.name = "ngroups";
62291#endif /* FREECIV_JSON_CONNECTION */
62292 DIO_PUT(uint8, &dout, &field_addr, real_packet->ngroups);
62293#ifdef FREECIV_JSON_CONNECTION
62294 field_addr.name = "groups";
62295#endif /* FREECIV_JSON_CONNECTION */
62296
62297 {
62298 int i;
62299
62300#ifdef FREECIV_JSON_CONNECTION
62301 /* Create the array. */
62302 DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
62303
62304 /* Enter the array. */
62305 field_addr.sub_location = plocation_elem_new(0);
62306#endif /* FREECIV_JSON_CONNECTION */
62307
62308 for (i = 0; i < real_packet->ngroups; i++) {
62309#ifdef FREECIV_JSON_CONNECTION
62310 /* Next array element. */
62311 field_addr.sub_location->number = i;
62312#endif /* FREECIV_JSON_CONNECTION */
62313 DIO_PUT(string, &dout, &field_addr, real_packet->groups[i]);
62314 }
62315
62316#ifdef FREECIV_JSON_CONNECTION
62317 /* Exit array. */
62318 free(field_addr.sub_location);
62319 field_addr.sub_location = NULL;
62320#endif /* FREECIV_JSON_CONNECTION */
62321 }
62322#ifdef FREECIV_JSON_CONNECTION
62323 field_addr.name = "hidden";
62324#endif /* FREECIV_JSON_CONNECTION */
62325
62326 {
62327 int i;
62328
62329#ifdef FREECIV_JSON_CONNECTION
62330 /* Create the array. */
62331 DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
62332
62333 /* Enter the array. */
62334 field_addr.sub_location = plocation_elem_new(0);
62335#endif /* FREECIV_JSON_CONNECTION */
62336
62337 for (i = 0; i < real_packet->ngroups; i++) {
62338#ifdef FREECIV_JSON_CONNECTION
62339 /* Next array element. */
62340 field_addr.sub_location->number = i;
62341#endif /* FREECIV_JSON_CONNECTION */
62342 DIO_PUT(bool8, &dout, &field_addr, real_packet->hidden[i]);
62343 }
62344
62345#ifdef FREECIV_JSON_CONNECTION
62346 /* Exit array. */
62347 free(field_addr.sub_location);
62348 field_addr.sub_location = NULL;
62349#endif /* FREECIV_JSON_CONNECTION */
62350 }
62351
62352#endif
62353 SEND_PACKET_END(PACKET_RULESET_NATION_GROUPS);
62354}
62355
62356 int send_packet_ruleset_nation_groups(struct connection *pc, const struct packet_ruleset_nation_groups *packet)
62357{
62358 if (!pc->used) {
62359 log_error("WARNING: trying to send data to the closed connection %s",
62360 conn_description(pc));
62361 return -1;
62362 }
62363 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_NATION_GROUPS].packet != NULL, -1,
62364 "Handler for PACKET_RULESET_NATION_GROUPS not installed");
62365 return pc->phs.handlers->send[PACKET_RULESET_NATION_GROUPS].packet(pc, packet);
62366}
62367
62368 void lsend_packet_ruleset_nation_groups(struct conn_list *dest, const struct packet_ruleset_nation_groups *packet)
62369{
62370 conn_list_iterate(dest, pconn) {
62371 send_packet_ruleset_nation_groups(pconn, packet);
62372 } conn_list_iterate_end;
62373}
62374
62375#ifdef FREECIV_DELTA_PROTOCOL
62376static genhash_val_t hash_packet_ruleset_nation_100(const void *vkey)
62377{
62378 const struct packet_ruleset_nation *key = (const struct packet_ruleset_nation *) vkey;
62379
62380 return key->id;
62381}
62382
62383static bool cmp_packet_ruleset_nation_100(const void *vkey1, const void *vkey2)
62384{
62385 const struct packet_ruleset_nation *key1 = (const struct packet_ruleset_nation *) vkey1;
62386 const struct packet_ruleset_nation *key2 = (const struct packet_ruleset_nation *) vkey2;
62387
62388 return key1->id == key2->id;
62389}
62390 BV_DEFINE(packet_ruleset_nation_100_fields, 24);
62391#endif /* FREECIV_DELTA_PROTOCOL */
62392
62393 static struct packet_ruleset_nation *receive_packet_ruleset_nation_100(struct connection *pc)
62394{
62395#ifdef FREECIV_DELTA_PROTOCOL
62396 packet_ruleset_nation_100_fields fields;
62397 struct packet_ruleset_nation *old;
62398 struct genhash **hash = pc->phs.received + PACKET_RULESET_NATION;
62399#endif /* FREECIV_DELTA_PROTOCOL */
62400 RECEIVE_PACKET_START(packet_ruleset_nation, real_packet);
62401#ifdef FREECIV_JSON_CONNECTION
62402 struct plocation field_addr;
62403 {
62404 struct plocation *field_addr_tmp = plocation_field_new(NULL);
62405 field_addr = *field_addr_tmp;
62406 FC_FREE(field_addr_tmp);
62407 }
62408#endif /* FREECIV_JSON_CONNECTION */
62409
62410#ifdef FREECIV_DELTA_PROTOCOL
62411#ifdef FREECIV_JSON_CONNECTION
62412 field_addr.name = "fields";
62413#endif /* FREECIV_JSON_CONNECTION */
62414 DIO_BV_GET(&din, &field_addr, fields);
62415 #ifdef FREECIV_JSON_CONNECTION
62416 field_addr.name = "id";
62417 #endif /* FREECIV_JSON_CONNECTION */
62418 {
62419 int readin;
62420
62421 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
62422 RECEIVE_PACKET_FIELD_ERROR(id);
62423 }
62424 real_packet->id = readin;
62425 }
62426
62427#else /* FREECIV_DELTA_PROTOCOL */
62428 #ifdef FREECIV_JSON_CONNECTION
62429 field_addr.name = "id";
62430 #endif /* FREECIV_JSON_CONNECTION */
62431 {
62432 int readin;
62433
62434 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
62435 RECEIVE_PACKET_FIELD_ERROR(id);
62436 }
62437 real_packet->id = readin;
62438 }
62439 #ifdef FREECIV_JSON_CONNECTION
62440 field_addr.name = "translation_domain";
62441 #endif /* FREECIV_JSON_CONNECTION */
62442 if (!DIO_GET(string, &din, &field_addr, real_packet->translation_domain, sizeof(real_packet->translation_domain))) {
62443 RECEIVE_PACKET_FIELD_ERROR(translation_domain);
62444 }
62445 #ifdef FREECIV_JSON_CONNECTION
62446 field_addr.name = "adjective";
62447 #endif /* FREECIV_JSON_CONNECTION */
62448 if (!DIO_GET(string, &din, &field_addr, real_packet->adjective, sizeof(real_packet->adjective))) {
62449 RECEIVE_PACKET_FIELD_ERROR(adjective);
62450 }
62451 #ifdef FREECIV_JSON_CONNECTION
62452 field_addr.name = "rule_name";
62453 #endif /* FREECIV_JSON_CONNECTION */
62454 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
62455 RECEIVE_PACKET_FIELD_ERROR(rule_name);
62456 }
62457 #ifdef FREECIV_JSON_CONNECTION
62458 field_addr.name = "noun_plural";
62459 #endif /* FREECIV_JSON_CONNECTION */
62460 if (!DIO_GET(string, &din, &field_addr, real_packet->noun_plural, sizeof(real_packet->noun_plural))) {
62461 RECEIVE_PACKET_FIELD_ERROR(noun_plural);
62462 }
62463 #ifdef FREECIV_JSON_CONNECTION
62464 field_addr.name = "graphic_str";
62465 #endif /* FREECIV_JSON_CONNECTION */
62466 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
62467 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
62468 }
62469 #ifdef FREECIV_JSON_CONNECTION
62470 field_addr.name = "graphic_alt";
62471 #endif /* FREECIV_JSON_CONNECTION */
62472 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
62473 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
62474 }
62475 #ifdef FREECIV_JSON_CONNECTION
62476 field_addr.name = "legend";
62477 #endif /* FREECIV_JSON_CONNECTION */
62478 if (!DIO_GET(string, &din, &field_addr, real_packet->legend, sizeof(real_packet->legend))) {
62479 RECEIVE_PACKET_FIELD_ERROR(legend);
62480 }
62481 #ifdef FREECIV_JSON_CONNECTION
62482 field_addr.name = "style";
62483 #endif /* FREECIV_JSON_CONNECTION */
62484 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
62485 RECEIVE_PACKET_FIELD_ERROR(style);
62486 }
62487 #ifdef FREECIV_JSON_CONNECTION
62488 field_addr.name = "leader_count";
62489 #endif /* FREECIV_JSON_CONNECTION */
62490 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->leader_count)) {
62491 RECEIVE_PACKET_FIELD_ERROR(leader_count);
62492 }
62493 #ifdef FREECIV_JSON_CONNECTION
62494 field_addr.name = "leader_name";
62495 #endif /* FREECIV_JSON_CONNECTION */
62496
62497 {
62498 int i;
62499
62500 #ifdef FREECIV_JSON_CONNECTION
62501 /* Enter array. */
62502 field_addr.sub_location = plocation_elem_new(0);
62503 #endif /* FREECIV_JSON_CONNECTION */
62504
62505 if (real_packet->leader_count > MAX_NUM_LEADERS) {
62506 RECEIVE_PACKET_FIELD_ERROR(leader_name, ": truncation array");
62507 }
62508 for (i = 0; i < real_packet->leader_count; i++) {
62509 #ifdef FREECIV_JSON_CONNECTION
62510 field_addr.sub_location->number = i;
62511 #endif /* FREECIV_JSON_CONNECTION */
62512 if (!DIO_GET(string, &din, &field_addr, real_packet->leader_name[i], sizeof(real_packet->leader_name[i]))) {
62513 RECEIVE_PACKET_FIELD_ERROR(leader_name);
62514 }
62515 }
62516
62517 #ifdef FREECIV_JSON_CONNECTION
62518 /* Exit array. */
62519 free(field_addr.sub_location);
62520 field_addr.sub_location = NULL;
62521 #endif /* FREECIV_JSON_CONNECTION */
62522 }
62523 #ifdef FREECIV_JSON_CONNECTION
62524 field_addr.name = "leader_is_male";
62525 #endif /* FREECIV_JSON_CONNECTION */
62526
62527 {
62528 int i;
62529
62530 #ifdef FREECIV_JSON_CONNECTION
62531 /* Enter array. */
62532 field_addr.sub_location = plocation_elem_new(0);
62533 #endif /* FREECIV_JSON_CONNECTION */
62534
62535 if (real_packet->leader_count > MAX_NUM_LEADERS) {
62536 RECEIVE_PACKET_FIELD_ERROR(leader_is_male, ": truncation array");
62537 }
62538 for (i = 0; i < real_packet->leader_count; i++) {
62539 #ifdef FREECIV_JSON_CONNECTION
62540 field_addr.sub_location->number = i;
62541 #endif /* FREECIV_JSON_CONNECTION */
62542 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->leader_is_male[i])) {
62543 RECEIVE_PACKET_FIELD_ERROR(leader_is_male);
62544 }
62545 }
62546
62547 #ifdef FREECIV_JSON_CONNECTION
62548 /* Exit array. */
62549 free(field_addr.sub_location);
62550 field_addr.sub_location = NULL;
62551 #endif /* FREECIV_JSON_CONNECTION */
62552 }
62553 #ifdef FREECIV_JSON_CONNECTION
62554 field_addr.name = "is_playable";
62555 #endif /* FREECIV_JSON_CONNECTION */
62556 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_playable)) {
62557 RECEIVE_PACKET_FIELD_ERROR(is_playable);
62558 }
62559 #ifdef FREECIV_JSON_CONNECTION
62560 field_addr.name = "barbarian_type";
62561 #endif /* FREECIV_JSON_CONNECTION */
62562 {
62563 int readin;
62564
62565 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62566 RECEIVE_PACKET_FIELD_ERROR(barbarian_type);
62567 }
62568 real_packet->barbarian_type = readin;
62569 }
62570 #ifdef FREECIV_JSON_CONNECTION
62571 field_addr.name = "nsets";
62572 #endif /* FREECIV_JSON_CONNECTION */
62573 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nsets)) {
62574 RECEIVE_PACKET_FIELD_ERROR(nsets);
62575 }
62576 #ifdef FREECIV_JSON_CONNECTION
62577 field_addr.name = "sets";
62578 #endif /* FREECIV_JSON_CONNECTION */
62579
62580 {
62581 int i;
62582
62583 #ifdef FREECIV_JSON_CONNECTION
62584 /* Enter array. */
62585 field_addr.sub_location = plocation_elem_new(0);
62586 #endif /* FREECIV_JSON_CONNECTION */
62587
62588 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
62589 RECEIVE_PACKET_FIELD_ERROR(sets, ": truncation array");
62590 }
62591 for (i = 0; i < real_packet->nsets; i++) {
62592 #ifdef FREECIV_JSON_CONNECTION
62593 field_addr.sub_location->number = i;
62594 #endif /* FREECIV_JSON_CONNECTION */
62595 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sets[i])) {
62596 RECEIVE_PACKET_FIELD_ERROR(sets);
62597 }
62598 }
62599
62600 #ifdef FREECIV_JSON_CONNECTION
62601 /* Exit array. */
62602 free(field_addr.sub_location);
62603 field_addr.sub_location = NULL;
62604 #endif /* FREECIV_JSON_CONNECTION */
62605 }
62606 #ifdef FREECIV_JSON_CONNECTION
62607 field_addr.name = "ngroups";
62608 #endif /* FREECIV_JSON_CONNECTION */
62609 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ngroups)) {
62610 RECEIVE_PACKET_FIELD_ERROR(ngroups);
62611 }
62612 #ifdef FREECIV_JSON_CONNECTION
62613 field_addr.name = "groups";
62614 #endif /* FREECIV_JSON_CONNECTION */
62615
62616 {
62617 int i;
62618
62619 #ifdef FREECIV_JSON_CONNECTION
62620 /* Enter array. */
62621 field_addr.sub_location = plocation_elem_new(0);
62622 #endif /* FREECIV_JSON_CONNECTION */
62623
62624 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
62625 RECEIVE_PACKET_FIELD_ERROR(groups, ": truncation array");
62626 }
62627 for (i = 0; i < real_packet->ngroups; i++) {
62628 #ifdef FREECIV_JSON_CONNECTION
62629 field_addr.sub_location->number = i;
62630 #endif /* FREECIV_JSON_CONNECTION */
62631 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->groups[i])) {
62632 RECEIVE_PACKET_FIELD_ERROR(groups);
62633 }
62634 }
62635
62636 #ifdef FREECIV_JSON_CONNECTION
62637 /* Exit array. */
62638 free(field_addr.sub_location);
62639 field_addr.sub_location = NULL;
62640 #endif /* FREECIV_JSON_CONNECTION */
62641 }
62642 #ifdef FREECIV_JSON_CONNECTION
62643 field_addr.name = "init_government_id";
62644 #endif /* FREECIV_JSON_CONNECTION */
62645 {
62646 int readin;
62647
62648 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
62649 RECEIVE_PACKET_FIELD_ERROR(init_government_id);
62650 }
62651 real_packet->init_government_id = readin;
62652 }
62653 #ifdef FREECIV_JSON_CONNECTION
62654 field_addr.name = "init_techs_count";
62655 #endif /* FREECIV_JSON_CONNECTION */
62656 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_techs_count)) {
62657 RECEIVE_PACKET_FIELD_ERROR(init_techs_count);
62658 }
62659 #ifdef FREECIV_JSON_CONNECTION
62660 field_addr.name = "init_techs";
62661 #endif /* FREECIV_JSON_CONNECTION */
62662
62663 {
62664 int i;
62665
62666 #ifdef FREECIV_JSON_CONNECTION
62667 /* Enter array. */
62668 field_addr.sub_location = plocation_elem_new(0);
62669 #endif /* FREECIV_JSON_CONNECTION */
62670
62671 if (real_packet->init_techs_count > MAX_NUM_TECH_LIST) {
62672 RECEIVE_PACKET_FIELD_ERROR(init_techs, ": truncation array");
62673 }
62674 for (i = 0; i < real_packet->init_techs_count; i++) {
62675 #ifdef FREECIV_JSON_CONNECTION
62676 field_addr.sub_location->number = i;
62677 #endif /* FREECIV_JSON_CONNECTION */
62678 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_techs[i])) {
62679 RECEIVE_PACKET_FIELD_ERROR(init_techs);
62680 }
62681 }
62682
62683 #ifdef FREECIV_JSON_CONNECTION
62684 /* Exit array. */
62685 free(field_addr.sub_location);
62686 field_addr.sub_location = NULL;
62687 #endif /* FREECIV_JSON_CONNECTION */
62688 }
62689 #ifdef FREECIV_JSON_CONNECTION
62690 field_addr.name = "init_units_count";
62691 #endif /* FREECIV_JSON_CONNECTION */
62692 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_units_count)) {
62693 RECEIVE_PACKET_FIELD_ERROR(init_units_count);
62694 }
62695 #ifdef FREECIV_JSON_CONNECTION
62696 field_addr.name = "init_units";
62697 #endif /* FREECIV_JSON_CONNECTION */
62698
62699 {
62700 int i;
62701
62702 #ifdef FREECIV_JSON_CONNECTION
62703 /* Enter array. */
62704 field_addr.sub_location = plocation_elem_new(0);
62705 #endif /* FREECIV_JSON_CONNECTION */
62706
62707 if (real_packet->init_units_count > MAX_NUM_UNIT_LIST) {
62708 RECEIVE_PACKET_FIELD_ERROR(init_units, ": truncation array");
62709 }
62710 for (i = 0; i < real_packet->init_units_count; i++) {
62711 #ifdef FREECIV_JSON_CONNECTION
62712 field_addr.sub_location->number = i;
62713 #endif /* FREECIV_JSON_CONNECTION */
62714 {
62715 int readin;
62716
62717 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62718 RECEIVE_PACKET_FIELD_ERROR(init_units);
62719 }
62720 real_packet->init_units[i] = readin;
62721 }
62722 }
62723
62724 #ifdef FREECIV_JSON_CONNECTION
62725 /* Exit array. */
62726 free(field_addr.sub_location);
62727 field_addr.sub_location = NULL;
62728 #endif /* FREECIV_JSON_CONNECTION */
62729 }
62730 #ifdef FREECIV_JSON_CONNECTION
62731 field_addr.name = "init_buildings_count";
62732 #endif /* FREECIV_JSON_CONNECTION */
62733 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_buildings_count)) {
62734 RECEIVE_PACKET_FIELD_ERROR(init_buildings_count);
62735 }
62736 #ifdef FREECIV_JSON_CONNECTION
62737 field_addr.name = "init_buildings";
62738 #endif /* FREECIV_JSON_CONNECTION */
62739
62740 {
62741 int i;
62742
62743 #ifdef FREECIV_JSON_CONNECTION
62744 /* Enter array. */
62745 field_addr.sub_location = plocation_elem_new(0);
62746 #endif /* FREECIV_JSON_CONNECTION */
62747
62748 if (real_packet->init_buildings_count > MAX_NUM_BUILDING_LIST) {
62749 RECEIVE_PACKET_FIELD_ERROR(init_buildings, ": truncation array");
62750 }
62751 for (i = 0; i < real_packet->init_buildings_count; i++) {
62752 #ifdef FREECIV_JSON_CONNECTION
62753 field_addr.sub_location->number = i;
62754 #endif /* FREECIV_JSON_CONNECTION */
62755 {
62756 int readin;
62757
62758 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62759 RECEIVE_PACKET_FIELD_ERROR(init_buildings);
62760 }
62761 real_packet->init_buildings[i] = readin;
62762 }
62763 }
62764
62765 #ifdef FREECIV_JSON_CONNECTION
62766 /* Exit array. */
62767 free(field_addr.sub_location);
62768 field_addr.sub_location = NULL;
62769 #endif /* FREECIV_JSON_CONNECTION */
62770 }
62771
62772#endif
62773 log_packet_detailed("packet_ruleset_nation_100: got info about (%d)",
62774 real_packet->id);
62775
62776#ifdef FREECIV_DELTA_PROTOCOL
62777 if (NULL == *hash) {
62778 *hash = genhash_new_full(hash_packet_ruleset_nation_100, cmp_packet_ruleset_nation_100,
62779 NULL, NULL, NULL, free);
62780 }
62781
62782 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
62783 *real_packet = *old;
62784 } else {
62785 Nation_type_id id = real_packet->id;
62786
62787 log_packet_detailed(" no old info");
62788 memset(real_packet, 0, sizeof(*real_packet));
62789
62790 real_packet->id = id;
62791 }
62792
62793 if (BV_ISSET(fields, 0)) {
62794 log_packet_detailed(" got field 'translation_domain'");
62795 #ifdef FREECIV_JSON_CONNECTION
62796 field_addr.name = "translation_domain";
62797 #endif /* FREECIV_JSON_CONNECTION */
62798 if (!DIO_GET(string, &din, &field_addr, real_packet->translation_domain, sizeof(real_packet->translation_domain))) {
62799 RECEIVE_PACKET_FIELD_ERROR(translation_domain);
62800 }
62801 }
62802 if (BV_ISSET(fields, 1)) {
62803 log_packet_detailed(" got field 'adjective'");
62804 #ifdef FREECIV_JSON_CONNECTION
62805 field_addr.name = "adjective";
62806 #endif /* FREECIV_JSON_CONNECTION */
62807 if (!DIO_GET(string, &din, &field_addr, real_packet->adjective, sizeof(real_packet->adjective))) {
62808 RECEIVE_PACKET_FIELD_ERROR(adjective);
62809 }
62810 }
62811 if (BV_ISSET(fields, 2)) {
62812 log_packet_detailed(" got field 'rule_name'");
62813 #ifdef FREECIV_JSON_CONNECTION
62814 field_addr.name = "rule_name";
62815 #endif /* FREECIV_JSON_CONNECTION */
62816 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
62817 RECEIVE_PACKET_FIELD_ERROR(rule_name);
62818 }
62819 }
62820 if (BV_ISSET(fields, 3)) {
62821 log_packet_detailed(" got field 'noun_plural'");
62822 #ifdef FREECIV_JSON_CONNECTION
62823 field_addr.name = "noun_plural";
62824 #endif /* FREECIV_JSON_CONNECTION */
62825 if (!DIO_GET(string, &din, &field_addr, real_packet->noun_plural, sizeof(real_packet->noun_plural))) {
62826 RECEIVE_PACKET_FIELD_ERROR(noun_plural);
62827 }
62828 }
62829 if (BV_ISSET(fields, 4)) {
62830 log_packet_detailed(" got field 'graphic_str'");
62831 #ifdef FREECIV_JSON_CONNECTION
62832 field_addr.name = "graphic_str";
62833 #endif /* FREECIV_JSON_CONNECTION */
62834 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
62835 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
62836 }
62837 }
62838 if (BV_ISSET(fields, 5)) {
62839 log_packet_detailed(" got field 'graphic_alt'");
62840 #ifdef FREECIV_JSON_CONNECTION
62841 field_addr.name = "graphic_alt";
62842 #endif /* FREECIV_JSON_CONNECTION */
62843 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
62844 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
62845 }
62846 }
62847 if (BV_ISSET(fields, 6)) {
62848 log_packet_detailed(" got field 'legend'");
62849 #ifdef FREECIV_JSON_CONNECTION
62850 field_addr.name = "legend";
62851 #endif /* FREECIV_JSON_CONNECTION */
62852 if (!DIO_GET(string, &din, &field_addr, real_packet->legend, sizeof(real_packet->legend))) {
62853 RECEIVE_PACKET_FIELD_ERROR(legend);
62854 }
62855 }
62856 if (BV_ISSET(fields, 7)) {
62857 log_packet_detailed(" got field 'style'");
62858 #ifdef FREECIV_JSON_CONNECTION
62859 field_addr.name = "style";
62860 #endif /* FREECIV_JSON_CONNECTION */
62861 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
62862 RECEIVE_PACKET_FIELD_ERROR(style);
62863 }
62864 }
62865 if (BV_ISSET(fields, 8)) {
62866 log_packet_detailed(" got field 'leader_count'");
62867 #ifdef FREECIV_JSON_CONNECTION
62868 field_addr.name = "leader_count";
62869 #endif /* FREECIV_JSON_CONNECTION */
62870 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->leader_count)) {
62871 RECEIVE_PACKET_FIELD_ERROR(leader_count);
62872 }
62873 }
62874 if (BV_ISSET(fields, 9)) {
62875 log_packet_detailed(" got field 'leader_name'");
62876 #ifdef FREECIV_JSON_CONNECTION
62877 field_addr.name = "leader_name";
62878 #endif /* FREECIV_JSON_CONNECTION */
62879
62880 {
62881 int i;
62882
62883 #ifdef FREECIV_JSON_CONNECTION
62884 /* Enter array. */
62885 field_addr.sub_location = plocation_elem_new(0);
62886 #endif /* FREECIV_JSON_CONNECTION */
62887
62888 if (real_packet->leader_count > MAX_NUM_LEADERS) {
62889 RECEIVE_PACKET_FIELD_ERROR(leader_name, ": truncation array");
62890 }
62891 for (i = 0; i < real_packet->leader_count; i++) {
62892 #ifdef FREECIV_JSON_CONNECTION
62893 field_addr.sub_location->number = i;
62894 #endif /* FREECIV_JSON_CONNECTION */
62895 if (!DIO_GET(string, &din, &field_addr, real_packet->leader_name[i], sizeof(real_packet->leader_name[i]))) {
62896 RECEIVE_PACKET_FIELD_ERROR(leader_name);
62897 }
62898 }
62899
62900 #ifdef FREECIV_JSON_CONNECTION
62901 /* Exit array. */
62902 free(field_addr.sub_location);
62903 field_addr.sub_location = NULL;
62904 #endif /* FREECIV_JSON_CONNECTION */
62905 }
62906 }
62907 if (BV_ISSET(fields, 10)) {
62908 log_packet_detailed(" got field 'leader_is_male'");
62909 #ifdef FREECIV_JSON_CONNECTION
62910 field_addr.name = "leader_is_male";
62911 #endif /* FREECIV_JSON_CONNECTION */
62912
62913 {
62914 int i;
62915
62916 #ifdef FREECIV_JSON_CONNECTION
62917 /* Enter array. */
62918 field_addr.sub_location = plocation_elem_new(0);
62919 #endif /* FREECIV_JSON_CONNECTION */
62920
62921 if (real_packet->leader_count > MAX_NUM_LEADERS) {
62922 RECEIVE_PACKET_FIELD_ERROR(leader_is_male, ": truncation array");
62923 }
62924 for (i = 0; i < real_packet->leader_count; i++) {
62925 #ifdef FREECIV_JSON_CONNECTION
62926 field_addr.sub_location->number = i;
62927 #endif /* FREECIV_JSON_CONNECTION */
62928 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->leader_is_male[i])) {
62929 RECEIVE_PACKET_FIELD_ERROR(leader_is_male);
62930 }
62931 }
62932
62933 #ifdef FREECIV_JSON_CONNECTION
62934 /* Exit array. */
62935 free(field_addr.sub_location);
62936 field_addr.sub_location = NULL;
62937 #endif /* FREECIV_JSON_CONNECTION */
62938 }
62939 }
62940 real_packet->is_playable = BV_ISSET(fields, 11);
62941 if (BV_ISSET(fields, 12)) {
62942 log_packet_detailed(" got field 'barbarian_type'");
62943 #ifdef FREECIV_JSON_CONNECTION
62944 field_addr.name = "barbarian_type";
62945 #endif /* FREECIV_JSON_CONNECTION */
62946 {
62947 int readin;
62948
62949 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62950 RECEIVE_PACKET_FIELD_ERROR(barbarian_type);
62951 }
62952 real_packet->barbarian_type = readin;
62953 }
62954 }
62955 if (BV_ISSET(fields, 13)) {
62956 log_packet_detailed(" got field 'nsets'");
62957 #ifdef FREECIV_JSON_CONNECTION
62958 field_addr.name = "nsets";
62959 #endif /* FREECIV_JSON_CONNECTION */
62960 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nsets)) {
62961 RECEIVE_PACKET_FIELD_ERROR(nsets);
62962 }
62963 }
62964 if (BV_ISSET(fields, 14)) {
62965 log_packet_detailed(" got field 'sets'");
62966 #ifdef FREECIV_JSON_CONNECTION
62967 field_addr.name = "sets";
62968 #endif /* FREECIV_JSON_CONNECTION */
62969
62970 {
62971 int i;
62972
62973 #ifdef FREECIV_JSON_CONNECTION
62974 /* Enter array. */
62975 field_addr.sub_location = plocation_elem_new(0);
62976 #endif /* FREECIV_JSON_CONNECTION */
62977
62978 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
62979 RECEIVE_PACKET_FIELD_ERROR(sets, ": truncation array");
62980 }
62981 for (i = 0; i < real_packet->nsets; i++) {
62982 #ifdef FREECIV_JSON_CONNECTION
62983 field_addr.sub_location->number = i;
62984 #endif /* FREECIV_JSON_CONNECTION */
62985 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sets[i])) {
62986 RECEIVE_PACKET_FIELD_ERROR(sets);
62987 }
62988 }
62989
62990 #ifdef FREECIV_JSON_CONNECTION
62991 /* Exit array. */
62992 free(field_addr.sub_location);
62993 field_addr.sub_location = NULL;
62994 #endif /* FREECIV_JSON_CONNECTION */
62995 }
62996 }
62997 if (BV_ISSET(fields, 15)) {
62998 log_packet_detailed(" got field 'ngroups'");
62999 #ifdef FREECIV_JSON_CONNECTION
63000 field_addr.name = "ngroups";
63001 #endif /* FREECIV_JSON_CONNECTION */
63002 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ngroups)) {
63003 RECEIVE_PACKET_FIELD_ERROR(ngroups);
63004 }
63005 }
63006 if (BV_ISSET(fields, 16)) {
63007 log_packet_detailed(" got field 'groups'");
63008 #ifdef FREECIV_JSON_CONNECTION
63009 field_addr.name = "groups";
63010 #endif /* FREECIV_JSON_CONNECTION */
63011
63012 {
63013 int i;
63014
63015 #ifdef FREECIV_JSON_CONNECTION
63016 /* Enter array. */
63017 field_addr.sub_location = plocation_elem_new(0);
63018 #endif /* FREECIV_JSON_CONNECTION */
63019
63020 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
63021 RECEIVE_PACKET_FIELD_ERROR(groups, ": truncation array");
63022 }
63023 for (i = 0; i < real_packet->ngroups; i++) {
63024 #ifdef FREECIV_JSON_CONNECTION
63025 field_addr.sub_location->number = i;
63026 #endif /* FREECIV_JSON_CONNECTION */
63027 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->groups[i])) {
63028 RECEIVE_PACKET_FIELD_ERROR(groups);
63029 }
63030 }
63031
63032 #ifdef FREECIV_JSON_CONNECTION
63033 /* Exit array. */
63034 free(field_addr.sub_location);
63035 field_addr.sub_location = NULL;
63036 #endif /* FREECIV_JSON_CONNECTION */
63037 }
63038 }
63039 if (BV_ISSET(fields, 17)) {
63040 log_packet_detailed(" got field 'init_government_id'");
63041 #ifdef FREECIV_JSON_CONNECTION
63042 field_addr.name = "init_government_id";
63043 #endif /* FREECIV_JSON_CONNECTION */
63044 {
63045 int readin;
63046
63047 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
63048 RECEIVE_PACKET_FIELD_ERROR(init_government_id);
63049 }
63050 real_packet->init_government_id = readin;
63051 }
63052 }
63053 if (BV_ISSET(fields, 18)) {
63054 log_packet_detailed(" got field 'init_techs_count'");
63055 #ifdef FREECIV_JSON_CONNECTION
63056 field_addr.name = "init_techs_count";
63057 #endif /* FREECIV_JSON_CONNECTION */
63058 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_techs_count)) {
63059 RECEIVE_PACKET_FIELD_ERROR(init_techs_count);
63060 }
63061 }
63062 if (BV_ISSET(fields, 19)) {
63063 log_packet_detailed(" got field 'init_techs'");
63064 #ifdef FREECIV_JSON_CONNECTION
63065 field_addr.name = "init_techs";
63066 #endif /* FREECIV_JSON_CONNECTION */
63067
63068 {
63069 int i;
63070
63071 #ifdef FREECIV_JSON_CONNECTION
63072 /* Enter array. */
63073 field_addr.sub_location = plocation_elem_new(0);
63074 #endif /* FREECIV_JSON_CONNECTION */
63075
63076 if (real_packet->init_techs_count > MAX_NUM_TECH_LIST) {
63077 RECEIVE_PACKET_FIELD_ERROR(init_techs, ": truncation array");
63078 }
63079 for (i = 0; i < real_packet->init_techs_count; i++) {
63080 #ifdef FREECIV_JSON_CONNECTION
63081 field_addr.sub_location->number = i;
63082 #endif /* FREECIV_JSON_CONNECTION */
63083 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_techs[i])) {
63084 RECEIVE_PACKET_FIELD_ERROR(init_techs);
63085 }
63086 }
63087
63088 #ifdef FREECIV_JSON_CONNECTION
63089 /* Exit array. */
63090 free(field_addr.sub_location);
63091 field_addr.sub_location = NULL;
63092 #endif /* FREECIV_JSON_CONNECTION */
63093 }
63094 }
63095 if (BV_ISSET(fields, 20)) {
63096 log_packet_detailed(" got field 'init_units_count'");
63097 #ifdef FREECIV_JSON_CONNECTION
63098 field_addr.name = "init_units_count";
63099 #endif /* FREECIV_JSON_CONNECTION */
63100 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_units_count)) {
63101 RECEIVE_PACKET_FIELD_ERROR(init_units_count);
63102 }
63103 }
63104 if (BV_ISSET(fields, 21)) {
63105 log_packet_detailed(" got field 'init_units'");
63106 #ifdef FREECIV_JSON_CONNECTION
63107 field_addr.name = "init_units";
63108 #endif /* FREECIV_JSON_CONNECTION */
63109
63110 {
63111 int i;
63112
63113 #ifdef FREECIV_JSON_CONNECTION
63114 /* Enter array. */
63115 field_addr.sub_location = plocation_elem_new(0);
63116 #endif /* FREECIV_JSON_CONNECTION */
63117
63118 if (real_packet->init_units_count > MAX_NUM_UNIT_LIST) {
63119 RECEIVE_PACKET_FIELD_ERROR(init_units, ": truncation array");
63120 }
63121 for (i = 0; i < real_packet->init_units_count; i++) {
63122 #ifdef FREECIV_JSON_CONNECTION
63123 field_addr.sub_location->number = i;
63124 #endif /* FREECIV_JSON_CONNECTION */
63125 {
63126 int readin;
63127
63128 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63129 RECEIVE_PACKET_FIELD_ERROR(init_units);
63130 }
63131 real_packet->init_units[i] = readin;
63132 }
63133 }
63134
63135 #ifdef FREECIV_JSON_CONNECTION
63136 /* Exit array. */
63137 free(field_addr.sub_location);
63138 field_addr.sub_location = NULL;
63139 #endif /* FREECIV_JSON_CONNECTION */
63140 }
63141 }
63142 if (BV_ISSET(fields, 22)) {
63143 log_packet_detailed(" got field 'init_buildings_count'");
63144 #ifdef FREECIV_JSON_CONNECTION
63145 field_addr.name = "init_buildings_count";
63146 #endif /* FREECIV_JSON_CONNECTION */
63147 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_buildings_count)) {
63148 RECEIVE_PACKET_FIELD_ERROR(init_buildings_count);
63149 }
63150 }
63151 if (BV_ISSET(fields, 23)) {
63152 log_packet_detailed(" got field 'init_buildings'");
63153 #ifdef FREECIV_JSON_CONNECTION
63154 field_addr.name = "init_buildings";
63155 #endif /* FREECIV_JSON_CONNECTION */
63156
63157 {
63158 int i;
63159
63160 #ifdef FREECIV_JSON_CONNECTION
63161 /* Enter array. */
63162 field_addr.sub_location = plocation_elem_new(0);
63163 #endif /* FREECIV_JSON_CONNECTION */
63164
63165 if (real_packet->init_buildings_count > MAX_NUM_BUILDING_LIST) {
63166 RECEIVE_PACKET_FIELD_ERROR(init_buildings, ": truncation array");
63167 }
63168 for (i = 0; i < real_packet->init_buildings_count; i++) {
63169 #ifdef FREECIV_JSON_CONNECTION
63170 field_addr.sub_location->number = i;
63171 #endif /* FREECIV_JSON_CONNECTION */
63172 {
63173 int readin;
63174
63175 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63176 RECEIVE_PACKET_FIELD_ERROR(init_buildings);
63177 }
63178 real_packet->init_buildings[i] = readin;
63179 }
63180 }
63181
63182 #ifdef FREECIV_JSON_CONNECTION
63183 /* Exit array. */
63184 free(field_addr.sub_location);
63185 field_addr.sub_location = NULL;
63186 #endif /* FREECIV_JSON_CONNECTION */
63187 }
63188 }
63189
63190 if (NULL == old) {
63191 old = fc_malloc(sizeof(*old));
63192 *old = *real_packet;
63193 genhash_insert(*hash, old, old);
63194 } else {
63195 *old = *real_packet;
63196 }
63197
63198#endif /* FREECIV_DELTA_PROTOCOL */
63199 RECEIVE_PACKET_END(real_packet);
63200}
63201
63202 static int send_packet_ruleset_nation_100(struct connection *pc, const struct packet_ruleset_nation *packet)
63203{
63204 const struct packet_ruleset_nation *real_packet = packet;
63205#ifdef FREECIV_DELTA_PROTOCOL
63206 packet_ruleset_nation_100_fields fields;
63207 struct packet_ruleset_nation *old;
63208 bool differ;
63209 struct genhash **hash = pc->phs.sent + PACKET_RULESET_NATION;
63210#endif /* FREECIV_DELTA_PROTOCOL */
63211 SEND_PACKET_START(PACKET_RULESET_NATION);
63212#ifdef FREECIV_JSON_CONNECTION
63213 struct plocation field_addr;
63214 {
63215 struct plocation *field_addr_tmp = plocation_field_new(NULL);
63216 field_addr = *field_addr_tmp;
63217 FC_FREE(field_addr_tmp);
63218 }
63219#endif /* FREECIV_JSON_CONNECTION */
63220
63221 log_packet_detailed("packet_ruleset_nation_100: sending info about (%d)",
63222 real_packet->id);
63223
63224#ifdef FREECIV_DELTA_PROTOCOL
63225 if (NULL == *hash) {
63226 *hash = genhash_new_full(hash_packet_ruleset_nation_100, cmp_packet_ruleset_nation_100,
63227 NULL, NULL, NULL, free);
63228 }
63229 BV_CLR_ALL(fields);
63230
63231 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
63232 old = fc_malloc(sizeof(*old));
63233 *old = *real_packet;
63234 genhash_insert(*hash, old, old);
63235 memset(old, 0, sizeof(*old));
63236 }
63237 differ = (strcmp(old->translation_domain, real_packet->translation_domain) != 0);
63238 if (differ) {
63239 BV_SET(fields, 0);
63240 }
63241
63242 differ = (strcmp(old->adjective, real_packet->adjective) != 0);
63243 if (differ) {
63244 BV_SET(fields, 1);
63245 }
63246
63247 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
63248 if (differ) {
63249 BV_SET(fields, 2);
63250 }
63251
63252 differ = (strcmp(old->noun_plural, real_packet->noun_plural) != 0);
63253 if (differ) {
63254 BV_SET(fields, 3);
63255 }
63256
63257 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
63258 if (differ) {
63259 BV_SET(fields, 4);
63260 }
63261
63262 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
63263 if (differ) {
63264 BV_SET(fields, 5);
63265 }
63266
63267 differ = (strcmp(old->legend, real_packet->legend) != 0);
63268 if (differ) {
63269 BV_SET(fields, 6);
63270 }
63271
63272 differ = (old->style != real_packet->style);
63273 if (differ) {
63274 BV_SET(fields, 7);
63275 }
63276
63277 differ = (old->leader_count != real_packet->leader_count);
63278 if (differ) {
63279 BV_SET(fields, 8);
63280 }
63281
63282
63283 {
63284 differ = (old->leader_count != real_packet->leader_count);
63285 if (!differ) {
63286 int i;
63287
63288 for (i = 0; i < real_packet->leader_count; i++) {
63289 if (strcmp(old->leader_name[i], real_packet->leader_name[i]) != 0) {
63290 differ = TRUE;
63291 break;
63292 }
63293 }
63294 }
63295 }
63296 if (differ) {
63297 BV_SET(fields, 9);
63298 }
63299
63300
63301 {
63302 differ = (old->leader_count != real_packet->leader_count);
63303 if (!differ) {
63304 int i;
63305
63306 for (i = 0; i < real_packet->leader_count; i++) {
63307 if (old->leader_is_male[i] != real_packet->leader_is_male[i]) {
63308 differ = TRUE;
63309 break;
63310 }
63311 }
63312 }
63313 }
63314 if (differ) {
63315 BV_SET(fields, 10);
63316 }
63317
63318 if (packet->is_playable) {
63319 BV_SET(fields, 11);
63320 }
63321
63322 differ = (old->barbarian_type != real_packet->barbarian_type);
63323 if (differ) {
63324 BV_SET(fields, 12);
63325 }
63326
63327 differ = (old->nsets != real_packet->nsets);
63328 if (differ) {
63329 BV_SET(fields, 13);
63330 }
63331
63332
63333 {
63334 differ = (old->nsets != real_packet->nsets);
63335 if (!differ) {
63336 int i;
63337
63338 for (i = 0; i < real_packet->nsets; i++) {
63339 if (old->sets[i] != real_packet->sets[i]) {
63340 differ = TRUE;
63341 break;
63342 }
63343 }
63344 }
63345 }
63346 if (differ) {
63347 BV_SET(fields, 14);
63348 }
63349
63350 differ = (old->ngroups != real_packet->ngroups);
63351 if (differ) {
63352 BV_SET(fields, 15);
63353 }
63354
63355
63356 {
63357 differ = (old->ngroups != real_packet->ngroups);
63358 if (!differ) {
63359 int i;
63360
63361 for (i = 0; i < real_packet->ngroups; i++) {
63362 if (old->groups[i] != real_packet->groups[i]) {
63363 differ = TRUE;
63364 break;
63365 }
63366 }
63367 }
63368 }
63369 if (differ) {
63370 BV_SET(fields, 16);
63371 }
63372
63373 differ = (old->init_government_id != real_packet->init_government_id);
63374 if (differ) {
63375 BV_SET(fields, 17);
63376 }
63377
63378 differ = (old->init_techs_count != real_packet->init_techs_count);
63379 if (differ) {
63380 BV_SET(fields, 18);
63381 }
63382
63383
63384 {
63385 differ = (old->init_techs_count != real_packet->init_techs_count);
63386 if (!differ) {
63387 int i;
63388
63389 for (i = 0; i < real_packet->init_techs_count; i++) {
63390 if (old->init_techs[i] != real_packet->init_techs[i]) {
63391 differ = TRUE;
63392 break;
63393 }
63394 }
63395 }
63396 }
63397 if (differ) {
63398 BV_SET(fields, 19);
63399 }
63400
63401 differ = (old->init_units_count != real_packet->init_units_count);
63402 if (differ) {
63403 BV_SET(fields, 20);
63404 }
63405
63406
63407 {
63408 differ = (old->init_units_count != real_packet->init_units_count);
63409 if (!differ) {
63410 int i;
63411
63412 for (i = 0; i < real_packet->init_units_count; i++) {
63413 if (old->init_units[i] != real_packet->init_units[i]) {
63414 differ = TRUE;
63415 break;
63416 }
63417 }
63418 }
63419 }
63420 if (differ) {
63421 BV_SET(fields, 21);
63422 }
63423
63424 differ = (old->init_buildings_count != real_packet->init_buildings_count);
63425 if (differ) {
63426 BV_SET(fields, 22);
63427 }
63428
63429
63430 {
63431 differ = (old->init_buildings_count != real_packet->init_buildings_count);
63432 if (!differ) {
63433 int i;
63434
63435 for (i = 0; i < real_packet->init_buildings_count; i++) {
63436 if (old->init_buildings[i] != real_packet->init_buildings[i]) {
63437 differ = TRUE;
63438 break;
63439 }
63440 }
63441 }
63442 }
63443 if (differ) {
63444 BV_SET(fields, 23);
63445 }
63446
63447
63448#ifdef FREECIV_JSON_CONNECTION
63449 field_addr.name = "fields";
63450#endif /* FREECIV_JSON_CONNECTION */
63451 DIO_BV_PUT(&dout, &field_addr, fields);
63452#ifdef FREECIV_JSON_CONNECTION
63453 field_addr.name = "id";
63454#endif /* FREECIV_JSON_CONNECTION */
63455 DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
63456
63457 if (BV_ISSET(fields, 0)) {
63458 log_packet_detailed(" field 'translation_domain' has changed");
63459 #ifdef FREECIV_JSON_CONNECTION
63460 field_addr.name = "translation_domain";
63461#endif /* FREECIV_JSON_CONNECTION */
63462 DIO_PUT(string, &dout, &field_addr, real_packet->translation_domain);
63463 }
63464 if (BV_ISSET(fields, 1)) {
63465 log_packet_detailed(" field 'adjective' has changed");
63466 #ifdef FREECIV_JSON_CONNECTION
63467 field_addr.name = "adjective";
63468#endif /* FREECIV_JSON_CONNECTION */
63469 DIO_PUT(string, &dout, &field_addr, real_packet->adjective);
63470 }
63471 if (BV_ISSET(fields, 2)) {
63472 log_packet_detailed(" field 'rule_name' has changed");
63473 #ifdef FREECIV_JSON_CONNECTION
63474 field_addr.name = "rule_name";
63475#endif /* FREECIV_JSON_CONNECTION */
63476 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
63477 }
63478 if (BV_ISSET(fields, 3)) {
63479 log_packet_detailed(" field 'noun_plural' has changed");
63480 #ifdef FREECIV_JSON_CONNECTION
63481 field_addr.name = "noun_plural";
63482#endif /* FREECIV_JSON_CONNECTION */
63483 DIO_PUT(string, &dout, &field_addr, real_packet->noun_plural);
63484 }
63485 if (BV_ISSET(fields, 4)) {
63486 log_packet_detailed(" field 'graphic_str' has changed");
63487 #ifdef FREECIV_JSON_CONNECTION
63488 field_addr.name = "graphic_str";
63489#endif /* FREECIV_JSON_CONNECTION */
63490 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
63491 }
63492 if (BV_ISSET(fields, 5)) {
63493 log_packet_detailed(" field 'graphic_alt' has changed");
63494 #ifdef FREECIV_JSON_CONNECTION
63495 field_addr.name = "graphic_alt";
63496#endif /* FREECIV_JSON_CONNECTION */
63497 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
63498 }
63499 if (BV_ISSET(fields, 6)) {
63500 log_packet_detailed(" field 'legend' has changed");
63501 #ifdef FREECIV_JSON_CONNECTION
63502 field_addr.name = "legend";
63503#endif /* FREECIV_JSON_CONNECTION */
63504 DIO_PUT(string, &dout, &field_addr, real_packet->legend);
63505 }
63506 if (BV_ISSET(fields, 7)) {
63507 log_packet_detailed(" field 'style' has changed");
63508 #ifdef FREECIV_JSON_CONNECTION
63509 field_addr.name = "style";
63510#endif /* FREECIV_JSON_CONNECTION */
63511 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
63512 }
63513 if (BV_ISSET(fields, 8)) {
63514 log_packet_detailed(" field 'leader_count' has changed");
63515 #ifdef FREECIV_JSON_CONNECTION
63516 field_addr.name = "leader_count";
63517#endif /* FREECIV_JSON_CONNECTION */
63518 DIO_PUT(uint8, &dout, &field_addr, real_packet->leader_count);
63519 }
63520 if (BV_ISSET(fields, 9)) {
63521 log_packet_detailed(" field 'leader_name' has changed");
63522 #ifdef FREECIV_JSON_CONNECTION
63523 field_addr.name = "leader_name";
63524#endif /* FREECIV_JSON_CONNECTION */
63525
63526 {
63527 int i;
63528
63529#ifdef FREECIV_JSON_CONNECTION
63530 /* Create the array. */
63531 DIO_PUT(farray, &dout, &field_addr, real_packet->leader_count);
63532
63533 /* Enter the array. */
63534 field_addr.sub_location = plocation_elem_new(0);
63535#endif /* FREECIV_JSON_CONNECTION */
63536
63537 for (i = 0; i < real_packet->leader_count; i++) {
63538#ifdef FREECIV_JSON_CONNECTION
63539 /* Next array element. */
63540 field_addr.sub_location->number = i;
63541#endif /* FREECIV_JSON_CONNECTION */
63542 DIO_PUT(string, &dout, &field_addr, real_packet->leader_name[i]);
63543 }
63544
63545#ifdef FREECIV_JSON_CONNECTION
63546 /* Exit array. */
63547 free(field_addr.sub_location);
63548 field_addr.sub_location = NULL;
63549#endif /* FREECIV_JSON_CONNECTION */
63550 }
63551 }
63552 if (BV_ISSET(fields, 10)) {
63553 log_packet_detailed(" field 'leader_is_male' has changed");
63554 #ifdef FREECIV_JSON_CONNECTION
63555 field_addr.name = "leader_is_male";
63556#endif /* FREECIV_JSON_CONNECTION */
63557
63558 {
63559 int i;
63560
63561#ifdef FREECIV_JSON_CONNECTION
63562 /* Create the array. */
63563 DIO_PUT(farray, &dout, &field_addr, real_packet->leader_count);
63564
63565 /* Enter the array. */
63566 field_addr.sub_location = plocation_elem_new(0);
63567#endif /* FREECIV_JSON_CONNECTION */
63568
63569 for (i = 0; i < real_packet->leader_count; i++) {
63570#ifdef FREECIV_JSON_CONNECTION
63571 /* Next array element. */
63572 field_addr.sub_location->number = i;
63573#endif /* FREECIV_JSON_CONNECTION */
63574 DIO_PUT(bool8, &dout, &field_addr, real_packet->leader_is_male[i]);
63575 }
63576
63577#ifdef FREECIV_JSON_CONNECTION
63578 /* Exit array. */
63579 free(field_addr.sub_location);
63580 field_addr.sub_location = NULL;
63581#endif /* FREECIV_JSON_CONNECTION */
63582 }
63583 }
63584 /* field 11 is folded into the header */
63585 if (BV_ISSET(fields, 12)) {
63586 log_packet_detailed(" field 'barbarian_type' has changed");
63587 #ifdef FREECIV_JSON_CONNECTION
63588 field_addr.name = "barbarian_type";
63589#endif /* FREECIV_JSON_CONNECTION */
63590 DIO_PUT(uint8, &dout, &field_addr, real_packet->barbarian_type);
63591 }
63592 if (BV_ISSET(fields, 13)) {
63593 log_packet_detailed(" field 'nsets' has changed");
63594 #ifdef FREECIV_JSON_CONNECTION
63595 field_addr.name = "nsets";
63596#endif /* FREECIV_JSON_CONNECTION */
63597 DIO_PUT(uint8, &dout, &field_addr, real_packet->nsets);
63598 }
63599 if (BV_ISSET(fields, 14)) {
63600 log_packet_detailed(" field 'sets' has changed");
63601 #ifdef FREECIV_JSON_CONNECTION
63602 field_addr.name = "sets";
63603#endif /* FREECIV_JSON_CONNECTION */
63604
63605 {
63606 int i;
63607
63608#ifdef FREECIV_JSON_CONNECTION
63609 /* Create the array. */
63610 DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
63611
63612 /* Enter the array. */
63613 field_addr.sub_location = plocation_elem_new(0);
63614#endif /* FREECIV_JSON_CONNECTION */
63615
63616 for (i = 0; i < real_packet->nsets; i++) {
63617#ifdef FREECIV_JSON_CONNECTION
63618 /* Next array element. */
63619 field_addr.sub_location->number = i;
63620#endif /* FREECIV_JSON_CONNECTION */
63621 DIO_PUT(uint8, &dout, &field_addr, real_packet->sets[i]);
63622 }
63623
63624#ifdef FREECIV_JSON_CONNECTION
63625 /* Exit array. */
63626 free(field_addr.sub_location);
63627 field_addr.sub_location = NULL;
63628#endif /* FREECIV_JSON_CONNECTION */
63629 }
63630 }
63631 if (BV_ISSET(fields, 15)) {
63632 log_packet_detailed(" field 'ngroups' has changed");
63633 #ifdef FREECIV_JSON_CONNECTION
63634 field_addr.name = "ngroups";
63635#endif /* FREECIV_JSON_CONNECTION */
63636 DIO_PUT(uint8, &dout, &field_addr, real_packet->ngroups);
63637 }
63638 if (BV_ISSET(fields, 16)) {
63639 log_packet_detailed(" field 'groups' has changed");
63640 #ifdef FREECIV_JSON_CONNECTION
63641 field_addr.name = "groups";
63642#endif /* FREECIV_JSON_CONNECTION */
63643
63644 {
63645 int i;
63646
63647#ifdef FREECIV_JSON_CONNECTION
63648 /* Create the array. */
63649 DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
63650
63651 /* Enter the array. */
63652 field_addr.sub_location = plocation_elem_new(0);
63653#endif /* FREECIV_JSON_CONNECTION */
63654
63655 for (i = 0; i < real_packet->ngroups; i++) {
63656#ifdef FREECIV_JSON_CONNECTION
63657 /* Next array element. */
63658 field_addr.sub_location->number = i;
63659#endif /* FREECIV_JSON_CONNECTION */
63660 DIO_PUT(uint8, &dout, &field_addr, real_packet->groups[i]);
63661 }
63662
63663#ifdef FREECIV_JSON_CONNECTION
63664 /* Exit array. */
63665 free(field_addr.sub_location);
63666 field_addr.sub_location = NULL;
63667#endif /* FREECIV_JSON_CONNECTION */
63668 }
63669 }
63670 if (BV_ISSET(fields, 17)) {
63671 log_packet_detailed(" field 'init_government_id' has changed");
63672 #ifdef FREECIV_JSON_CONNECTION
63673 field_addr.name = "init_government_id";
63674#endif /* FREECIV_JSON_CONNECTION */
63675 DIO_PUT(sint8, &dout, &field_addr, real_packet->init_government_id);
63676 }
63677 if (BV_ISSET(fields, 18)) {
63678 log_packet_detailed(" field 'init_techs_count' has changed");
63679 #ifdef FREECIV_JSON_CONNECTION
63680 field_addr.name = "init_techs_count";
63681#endif /* FREECIV_JSON_CONNECTION */
63682 DIO_PUT(uint8, &dout, &field_addr, real_packet->init_techs_count);
63683 }
63684 if (BV_ISSET(fields, 19)) {
63685 log_packet_detailed(" field 'init_techs' has changed");
63686 #ifdef FREECIV_JSON_CONNECTION
63687 field_addr.name = "init_techs";
63688#endif /* FREECIV_JSON_CONNECTION */
63689
63690 {
63691 int i;
63692
63693#ifdef FREECIV_JSON_CONNECTION
63694 /* Create the array. */
63695 DIO_PUT(farray, &dout, &field_addr, real_packet->init_techs_count);
63696
63697 /* Enter the array. */
63698 field_addr.sub_location = plocation_elem_new(0);
63699#endif /* FREECIV_JSON_CONNECTION */
63700
63701 for (i = 0; i < real_packet->init_techs_count; i++) {
63702#ifdef FREECIV_JSON_CONNECTION
63703 /* Next array element. */
63704 field_addr.sub_location->number = i;
63705#endif /* FREECIV_JSON_CONNECTION */
63706 DIO_PUT(uint8, &dout, &field_addr, real_packet->init_techs[i]);
63707 }
63708
63709#ifdef FREECIV_JSON_CONNECTION
63710 /* Exit array. */
63711 free(field_addr.sub_location);
63712 field_addr.sub_location = NULL;
63713#endif /* FREECIV_JSON_CONNECTION */
63714 }
63715 }
63716 if (BV_ISSET(fields, 20)) {
63717 log_packet_detailed(" field 'init_units_count' has changed");
63718 #ifdef FREECIV_JSON_CONNECTION
63719 field_addr.name = "init_units_count";
63720#endif /* FREECIV_JSON_CONNECTION */
63721 DIO_PUT(uint8, &dout, &field_addr, real_packet->init_units_count);
63722 }
63723 if (BV_ISSET(fields, 21)) {
63724 log_packet_detailed(" field 'init_units' has changed");
63725 #ifdef FREECIV_JSON_CONNECTION
63726 field_addr.name = "init_units";
63727#endif /* FREECIV_JSON_CONNECTION */
63728
63729 {
63730 int i;
63731
63732#ifdef FREECIV_JSON_CONNECTION
63733 /* Create the array. */
63734 DIO_PUT(farray, &dout, &field_addr, real_packet->init_units_count);
63735
63736 /* Enter the array. */
63737 field_addr.sub_location = plocation_elem_new(0);
63738#endif /* FREECIV_JSON_CONNECTION */
63739
63740 for (i = 0; i < real_packet->init_units_count; i++) {
63741#ifdef FREECIV_JSON_CONNECTION
63742 /* Next array element. */
63743 field_addr.sub_location->number = i;
63744#endif /* FREECIV_JSON_CONNECTION */
63745 DIO_PUT(uint8, &dout, &field_addr, real_packet->init_units[i]);
63746 }
63747
63748#ifdef FREECIV_JSON_CONNECTION
63749 /* Exit array. */
63750 free(field_addr.sub_location);
63751 field_addr.sub_location = NULL;
63752#endif /* FREECIV_JSON_CONNECTION */
63753 }
63754 }
63755 if (BV_ISSET(fields, 22)) {
63756 log_packet_detailed(" field 'init_buildings_count' has changed");
63757 #ifdef FREECIV_JSON_CONNECTION
63758 field_addr.name = "init_buildings_count";
63759#endif /* FREECIV_JSON_CONNECTION */
63760 DIO_PUT(uint8, &dout, &field_addr, real_packet->init_buildings_count);
63761 }
63762 if (BV_ISSET(fields, 23)) {
63763 log_packet_detailed(" field 'init_buildings' has changed");
63764 #ifdef FREECIV_JSON_CONNECTION
63765 field_addr.name = "init_buildings";
63766#endif /* FREECIV_JSON_CONNECTION */
63767
63768 {
63769 int i;
63770
63771#ifdef FREECIV_JSON_CONNECTION
63772 /* Create the array. */
63773 DIO_PUT(farray, &dout, &field_addr, real_packet->init_buildings_count);
63774
63775 /* Enter the array. */
63776 field_addr.sub_location = plocation_elem_new(0);
63777#endif /* FREECIV_JSON_CONNECTION */
63778
63779 for (i = 0; i < real_packet->init_buildings_count; i++) {
63780#ifdef FREECIV_JSON_CONNECTION
63781 /* Next array element. */
63782 field_addr.sub_location->number = i;
63783#endif /* FREECIV_JSON_CONNECTION */
63784 DIO_PUT(uint8, &dout, &field_addr, real_packet->init_buildings[i]);
63785 }
63786
63787#ifdef FREECIV_JSON_CONNECTION
63788 /* Exit array. */
63789 free(field_addr.sub_location);
63790 field_addr.sub_location = NULL;
63791#endif /* FREECIV_JSON_CONNECTION */
63792 }
63793 }
63794
63795 *old = *real_packet;
63796#endif /* FREECIV_DELTA_PROTOCOL */
63797#ifndef FREECIV_DELTA_PROTOCOL
63798#ifdef FREECIV_JSON_CONNECTION
63799 field_addr.name = "id";
63800#endif /* FREECIV_JSON_CONNECTION */
63801 DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
63802#ifdef FREECIV_JSON_CONNECTION
63803 field_addr.name = "translation_domain";
63804#endif /* FREECIV_JSON_CONNECTION */
63805 DIO_PUT(string, &dout, &field_addr, real_packet->translation_domain);
63806#ifdef FREECIV_JSON_CONNECTION
63807 field_addr.name = "adjective";
63808#endif /* FREECIV_JSON_CONNECTION */
63809 DIO_PUT(string, &dout, &field_addr, real_packet->adjective);
63810#ifdef FREECIV_JSON_CONNECTION
63811 field_addr.name = "rule_name";
63812#endif /* FREECIV_JSON_CONNECTION */
63813 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
63814#ifdef FREECIV_JSON_CONNECTION
63815 field_addr.name = "noun_plural";
63816#endif /* FREECIV_JSON_CONNECTION */
63817 DIO_PUT(string, &dout, &field_addr, real_packet->noun_plural);
63818#ifdef FREECIV_JSON_CONNECTION
63819 field_addr.name = "graphic_str";
63820#endif /* FREECIV_JSON_CONNECTION */
63821 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
63822#ifdef FREECIV_JSON_CONNECTION
63823 field_addr.name = "graphic_alt";
63824#endif /* FREECIV_JSON_CONNECTION */
63825 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
63826#ifdef FREECIV_JSON_CONNECTION
63827 field_addr.name = "legend";
63828#endif /* FREECIV_JSON_CONNECTION */
63829 DIO_PUT(string, &dout, &field_addr, real_packet->legend);
63830#ifdef FREECIV_JSON_CONNECTION
63831 field_addr.name = "style";
63832#endif /* FREECIV_JSON_CONNECTION */
63833 DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
63834#ifdef FREECIV_JSON_CONNECTION
63835 field_addr.name = "leader_count";
63836#endif /* FREECIV_JSON_CONNECTION */
63837 DIO_PUT(uint8, &dout, &field_addr, real_packet->leader_count);
63838#ifdef FREECIV_JSON_CONNECTION
63839 field_addr.name = "leader_name";
63840#endif /* FREECIV_JSON_CONNECTION */
63841
63842 {
63843 int i;
63844
63845#ifdef FREECIV_JSON_CONNECTION
63846 /* Create the array. */
63847 DIO_PUT(farray, &dout, &field_addr, real_packet->leader_count);
63848
63849 /* Enter the array. */
63850 field_addr.sub_location = plocation_elem_new(0);
63851#endif /* FREECIV_JSON_CONNECTION */
63852
63853 for (i = 0; i < real_packet->leader_count; i++) {
63854#ifdef FREECIV_JSON_CONNECTION
63855 /* Next array element. */
63856 field_addr.sub_location->number = i;
63857#endif /* FREECIV_JSON_CONNECTION */
63858 DIO_PUT(string, &dout, &field_addr, real_packet->leader_name[i]);
63859 }
63860
63861#ifdef FREECIV_JSON_CONNECTION
63862 /* Exit array. */
63863 free(field_addr.sub_location);
63864 field_addr.sub_location = NULL;
63865#endif /* FREECIV_JSON_CONNECTION */
63866 }
63867#ifdef FREECIV_JSON_CONNECTION
63868 field_addr.name = "leader_is_male";
63869#endif /* FREECIV_JSON_CONNECTION */
63870
63871 {
63872 int i;
63873
63874#ifdef FREECIV_JSON_CONNECTION
63875 /* Create the array. */
63876 DIO_PUT(farray, &dout, &field_addr, real_packet->leader_count);
63877
63878 /* Enter the array. */
63879 field_addr.sub_location = plocation_elem_new(0);
63880#endif /* FREECIV_JSON_CONNECTION */
63881
63882 for (i = 0; i < real_packet->leader_count; i++) {
63883#ifdef FREECIV_JSON_CONNECTION
63884 /* Next array element. */
63885 field_addr.sub_location->number = i;
63886#endif /* FREECIV_JSON_CONNECTION */
63887 DIO_PUT(bool8, &dout, &field_addr, real_packet->leader_is_male[i]);
63888 }
63889
63890#ifdef FREECIV_JSON_CONNECTION
63891 /* Exit array. */
63892 free(field_addr.sub_location);
63893 field_addr.sub_location = NULL;
63894#endif /* FREECIV_JSON_CONNECTION */
63895 }
63896#ifdef FREECIV_JSON_CONNECTION
63897 field_addr.name = "is_playable";
63898#endif /* FREECIV_JSON_CONNECTION */
63899 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_playable);
63900#ifdef FREECIV_JSON_CONNECTION
63901 field_addr.name = "barbarian_type";
63902#endif /* FREECIV_JSON_CONNECTION */
63903 DIO_PUT(uint8, &dout, &field_addr, real_packet->barbarian_type);
63904#ifdef FREECIV_JSON_CONNECTION
63905 field_addr.name = "nsets";
63906#endif /* FREECIV_JSON_CONNECTION */
63907 DIO_PUT(uint8, &dout, &field_addr, real_packet->nsets);
63908#ifdef FREECIV_JSON_CONNECTION
63909 field_addr.name = "sets";
63910#endif /* FREECIV_JSON_CONNECTION */
63911
63912 {
63913 int i;
63914
63915#ifdef FREECIV_JSON_CONNECTION
63916 /* Create the array. */
63917 DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
63918
63919 /* Enter the array. */
63920 field_addr.sub_location = plocation_elem_new(0);
63921#endif /* FREECIV_JSON_CONNECTION */
63922
63923 for (i = 0; i < real_packet->nsets; i++) {
63924#ifdef FREECIV_JSON_CONNECTION
63925 /* Next array element. */
63926 field_addr.sub_location->number = i;
63927#endif /* FREECIV_JSON_CONNECTION */
63928 DIO_PUT(uint8, &dout, &field_addr, real_packet->sets[i]);
63929 }
63930
63931#ifdef FREECIV_JSON_CONNECTION
63932 /* Exit array. */
63933 free(field_addr.sub_location);
63934 field_addr.sub_location = NULL;
63935#endif /* FREECIV_JSON_CONNECTION */
63936 }
63937#ifdef FREECIV_JSON_CONNECTION
63938 field_addr.name = "ngroups";
63939#endif /* FREECIV_JSON_CONNECTION */
63940 DIO_PUT(uint8, &dout, &field_addr, real_packet->ngroups);
63941#ifdef FREECIV_JSON_CONNECTION
63942 field_addr.name = "groups";
63943#endif /* FREECIV_JSON_CONNECTION */
63944
63945 {
63946 int i;
63947
63948#ifdef FREECIV_JSON_CONNECTION
63949 /* Create the array. */
63950 DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
63951
63952 /* Enter the array. */
63953 field_addr.sub_location = plocation_elem_new(0);
63954#endif /* FREECIV_JSON_CONNECTION */
63955
63956 for (i = 0; i < real_packet->ngroups; i++) {
63957#ifdef FREECIV_JSON_CONNECTION
63958 /* Next array element. */
63959 field_addr.sub_location->number = i;
63960#endif /* FREECIV_JSON_CONNECTION */
63961 DIO_PUT(uint8, &dout, &field_addr, real_packet->groups[i]);
63962 }
63963
63964#ifdef FREECIV_JSON_CONNECTION
63965 /* Exit array. */
63966 free(field_addr.sub_location);
63967 field_addr.sub_location = NULL;
63968#endif /* FREECIV_JSON_CONNECTION */
63969 }
63970#ifdef FREECIV_JSON_CONNECTION
63971 field_addr.name = "init_government_id";
63972#endif /* FREECIV_JSON_CONNECTION */
63973 DIO_PUT(sint8, &dout, &field_addr, real_packet->init_government_id);
63974#ifdef FREECIV_JSON_CONNECTION
63975 field_addr.name = "init_techs_count";
63976#endif /* FREECIV_JSON_CONNECTION */
63977 DIO_PUT(uint8, &dout, &field_addr, real_packet->init_techs_count);
63978#ifdef FREECIV_JSON_CONNECTION
63979 field_addr.name = "init_techs";
63980#endif /* FREECIV_JSON_CONNECTION */
63981
63982 {
63983 int i;
63984
63985#ifdef FREECIV_JSON_CONNECTION
63986 /* Create the array. */
63987 DIO_PUT(farray, &dout, &field_addr, real_packet->init_techs_count);
63988
63989 /* Enter the array. */
63990 field_addr.sub_location = plocation_elem_new(0);
63991#endif /* FREECIV_JSON_CONNECTION */
63992
63993 for (i = 0; i < real_packet->init_techs_count; i++) {
63994#ifdef FREECIV_JSON_CONNECTION
63995 /* Next array element. */
63996 field_addr.sub_location->number = i;
63997#endif /* FREECIV_JSON_CONNECTION */
63998 DIO_PUT(uint8, &dout, &field_addr, real_packet->init_techs[i]);
63999 }
64000
64001#ifdef FREECIV_JSON_CONNECTION
64002 /* Exit array. */
64003 free(field_addr.sub_location);
64004 field_addr.sub_location = NULL;
64005#endif /* FREECIV_JSON_CONNECTION */
64006 }
64007#ifdef FREECIV_JSON_CONNECTION
64008 field_addr.name = "init_units_count";
64009#endif /* FREECIV_JSON_CONNECTION */
64010 DIO_PUT(uint8, &dout, &field_addr, real_packet->init_units_count);
64011#ifdef FREECIV_JSON_CONNECTION
64012 field_addr.name = "init_units";
64013#endif /* FREECIV_JSON_CONNECTION */
64014
64015 {
64016 int i;
64017
64018#ifdef FREECIV_JSON_CONNECTION
64019 /* Create the array. */
64020 DIO_PUT(farray, &dout, &field_addr, real_packet->init_units_count);
64021
64022 /* Enter the array. */
64023 field_addr.sub_location = plocation_elem_new(0);
64024#endif /* FREECIV_JSON_CONNECTION */
64025
64026 for (i = 0; i < real_packet->init_units_count; i++) {
64027#ifdef FREECIV_JSON_CONNECTION
64028 /* Next array element. */
64029 field_addr.sub_location->number = i;
64030#endif /* FREECIV_JSON_CONNECTION */
64031 DIO_PUT(uint8, &dout, &field_addr, real_packet->init_units[i]);
64032 }
64033
64034#ifdef FREECIV_JSON_CONNECTION
64035 /* Exit array. */
64036 free(field_addr.sub_location);
64037 field_addr.sub_location = NULL;
64038#endif /* FREECIV_JSON_CONNECTION */
64039 }
64040#ifdef FREECIV_JSON_CONNECTION
64041 field_addr.name = "init_buildings_count";
64042#endif /* FREECIV_JSON_CONNECTION */
64043 DIO_PUT(uint8, &dout, &field_addr, real_packet->init_buildings_count);
64044#ifdef FREECIV_JSON_CONNECTION
64045 field_addr.name = "init_buildings";
64046#endif /* FREECIV_JSON_CONNECTION */
64047
64048 {
64049 int i;
64050
64051#ifdef FREECIV_JSON_CONNECTION
64052 /* Create the array. */
64053 DIO_PUT(farray, &dout, &field_addr, real_packet->init_buildings_count);
64054
64055 /* Enter the array. */
64056 field_addr.sub_location = plocation_elem_new(0);
64057#endif /* FREECIV_JSON_CONNECTION */
64058
64059 for (i = 0; i < real_packet->init_buildings_count; i++) {
64060#ifdef FREECIV_JSON_CONNECTION
64061 /* Next array element. */
64062 field_addr.sub_location->number = i;
64063#endif /* FREECIV_JSON_CONNECTION */
64064 DIO_PUT(uint8, &dout, &field_addr, real_packet->init_buildings[i]);
64065 }
64066
64067#ifdef FREECIV_JSON_CONNECTION
64068 /* Exit array. */
64069 free(field_addr.sub_location);
64070 field_addr.sub_location = NULL;
64071#endif /* FREECIV_JSON_CONNECTION */
64072 }
64073
64074#endif
64075 SEND_PACKET_END(PACKET_RULESET_NATION);
64076}
64077
64078 int send_packet_ruleset_nation(struct connection *pc, const struct packet_ruleset_nation *packet)
64079{
64080 if (!pc->used) {
64081 log_error("WARNING: trying to send data to the closed connection %s",
64082 conn_description(pc));
64083 return -1;
64084 }
64085 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_NATION].packet != NULL, -1,
64086 "Handler for PACKET_RULESET_NATION not installed");
64087 return pc->phs.handlers->send[PACKET_RULESET_NATION].packet(pc, packet);
64088}
64089
64090 void lsend_packet_ruleset_nation(struct conn_list *dest, const struct packet_ruleset_nation *packet)
64091{
64092 conn_list_iterate(dest, pconn) {
64093 send_packet_ruleset_nation(pconn, packet);
64094 } conn_list_iterate_end;
64095}
64096
64097#ifdef FREECIV_DELTA_PROTOCOL
64098#define hash_packet_nation_availability_100 hash_const
64099
64100#define cmp_packet_nation_availability_100 cmp_const
64101
64102 BV_DEFINE(packet_nation_availability_100_fields, 3);
64103#endif /* FREECIV_DELTA_PROTOCOL */
64104
64105 static struct packet_nation_availability *receive_packet_nation_availability_100(struct connection *pc)
64106{
64107#ifdef FREECIV_DELTA_PROTOCOL
64108 packet_nation_availability_100_fields fields;
64109 struct packet_nation_availability *old;
64110 struct genhash **hash = pc->phs.received + PACKET_NATION_AVAILABILITY;
64111#endif /* FREECIV_DELTA_PROTOCOL */
64112 RECEIVE_PACKET_START(packet_nation_availability, real_packet);
64113#ifdef FREECIV_JSON_CONNECTION
64114 struct plocation field_addr;
64115 {
64116 struct plocation *field_addr_tmp = plocation_field_new(NULL);
64117 field_addr = *field_addr_tmp;
64118 FC_FREE(field_addr_tmp);
64119 }
64120#endif /* FREECIV_JSON_CONNECTION */
64121
64122#ifdef FREECIV_DELTA_PROTOCOL
64123#ifdef FREECIV_JSON_CONNECTION
64124 field_addr.name = "fields";
64125#endif /* FREECIV_JSON_CONNECTION */
64126 DIO_BV_GET(&din, &field_addr, fields);
64127
64128#else /* FREECIV_DELTA_PROTOCOL */
64129 #ifdef FREECIV_JSON_CONNECTION
64130 field_addr.name = "ncount";
64131 #endif /* FREECIV_JSON_CONNECTION */
64132 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->ncount)) {
64133 RECEIVE_PACKET_FIELD_ERROR(ncount);
64134 }
64135 #ifdef FREECIV_JSON_CONNECTION
64136 field_addr.name = "is_pickable";
64137 #endif /* FREECIV_JSON_CONNECTION */
64138
64139 {
64140 int i;
64141
64142 #ifdef FREECIV_JSON_CONNECTION
64143 /* Enter array. */
64144 field_addr.sub_location = plocation_elem_new(0);
64145 #endif /* FREECIV_JSON_CONNECTION */
64146
64147 if (real_packet->ncount > MAX_NUM_NATIONS) {
64148 RECEIVE_PACKET_FIELD_ERROR(is_pickable, ": truncation array");
64149 }
64150 for (i = 0; i < real_packet->ncount; i++) {
64151 #ifdef FREECIV_JSON_CONNECTION
64152 field_addr.sub_location->number = i;
64153 #endif /* FREECIV_JSON_CONNECTION */
64154 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_pickable[i])) {
64155 RECEIVE_PACKET_FIELD_ERROR(is_pickable);
64156 }
64157 }
64158
64159 #ifdef FREECIV_JSON_CONNECTION
64160 /* Exit array. */
64161 free(field_addr.sub_location);
64162 field_addr.sub_location = NULL;
64163 #endif /* FREECIV_JSON_CONNECTION */
64164 }
64165 #ifdef FREECIV_JSON_CONNECTION
64166 field_addr.name = "nationset_change";
64167 #endif /* FREECIV_JSON_CONNECTION */
64168 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->nationset_change)) {
64169 RECEIVE_PACKET_FIELD_ERROR(nationset_change);
64170 }
64171
64172#endif
64173 log_packet_detailed("packet_nation_availability_100: got info about ()");
64174
64175#ifdef FREECIV_DELTA_PROTOCOL
64176 if (NULL == *hash) {
64177 *hash = genhash_new_full(hash_packet_nation_availability_100, cmp_packet_nation_availability_100,
64178 NULL, NULL, NULL, free);
64179 }
64180
64181 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
64182 *real_packet = *old;
64183 } else {
64184 log_packet_detailed(" no old info");
64185 memset(real_packet, 0, sizeof(*real_packet));
64186 }
64187
64188 if (BV_ISSET(fields, 0)) {
64189 log_packet_detailed(" got field 'ncount'");
64190 #ifdef FREECIV_JSON_CONNECTION
64191 field_addr.name = "ncount";
64192 #endif /* FREECIV_JSON_CONNECTION */
64193 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->ncount)) {
64194 RECEIVE_PACKET_FIELD_ERROR(ncount);
64195 }
64196 }
64197 if (BV_ISSET(fields, 1)) {
64198 log_packet_detailed(" got field 'is_pickable'");
64199 #ifdef FREECIV_JSON_CONNECTION
64200 field_addr.name = "is_pickable";
64201 #endif /* FREECIV_JSON_CONNECTION */
64202
64203 {
64204 int i;
64205
64206 #ifdef FREECIV_JSON_CONNECTION
64207 /* Enter array. */
64208 field_addr.sub_location = plocation_elem_new(0);
64209 #endif /* FREECIV_JSON_CONNECTION */
64210
64211 if (real_packet->ncount > MAX_NUM_NATIONS) {
64212 RECEIVE_PACKET_FIELD_ERROR(is_pickable, ": truncation array");
64213 }
64214 for (i = 0; i < real_packet->ncount; i++) {
64215 #ifdef FREECIV_JSON_CONNECTION
64216 field_addr.sub_location->number = i;
64217 #endif /* FREECIV_JSON_CONNECTION */
64218 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_pickable[i])) {
64219 RECEIVE_PACKET_FIELD_ERROR(is_pickable);
64220 }
64221 }
64222
64223 #ifdef FREECIV_JSON_CONNECTION
64224 /* Exit array. */
64225 free(field_addr.sub_location);
64226 field_addr.sub_location = NULL;
64227 #endif /* FREECIV_JSON_CONNECTION */
64228 }
64229 }
64230 real_packet->nationset_change = BV_ISSET(fields, 2);
64231
64232 if (NULL == old) {
64233 old = fc_malloc(sizeof(*old));
64234 *old = *real_packet;
64235 genhash_insert(*hash, old, old);
64236 } else {
64237 *old = *real_packet;
64238 }
64239
64240#endif /* FREECIV_DELTA_PROTOCOL */
64241 RECEIVE_PACKET_END(real_packet);
64242}
64243
64244 static int send_packet_nation_availability_100(struct connection *pc, const struct packet_nation_availability *packet)
64245{
64246 const struct packet_nation_availability *real_packet = packet;
64247#ifdef FREECIV_DELTA_PROTOCOL
64248 packet_nation_availability_100_fields fields;
64249 struct packet_nation_availability *old;
64250 bool differ;
64251 struct genhash **hash = pc->phs.sent + PACKET_NATION_AVAILABILITY;
64252#endif /* FREECIV_DELTA_PROTOCOL */
64253 SEND_PACKET_START(PACKET_NATION_AVAILABILITY);
64254#ifdef FREECIV_JSON_CONNECTION
64255 struct plocation field_addr;
64256 {
64257 struct plocation *field_addr_tmp = plocation_field_new(NULL);
64258 field_addr = *field_addr_tmp;
64259 FC_FREE(field_addr_tmp);
64260 }
64261#endif /* FREECIV_JSON_CONNECTION */
64262
64263 log_packet_detailed("packet_nation_availability_100: sending info about ()");
64264
64265#ifdef FREECIV_DELTA_PROTOCOL
64266 if (NULL == *hash) {
64267 *hash = genhash_new_full(hash_packet_nation_availability_100, cmp_packet_nation_availability_100,
64268 NULL, NULL, NULL, free);
64269 }
64270 BV_CLR_ALL(fields);
64271
64272 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
64273 old = fc_malloc(sizeof(*old));
64274 *old = *real_packet;
64275 genhash_insert(*hash, old, old);
64276 memset(old, 0, sizeof(*old));
64277 }
64278 differ = (old->ncount != real_packet->ncount);
64279 if (differ) {
64280 BV_SET(fields, 0);
64281 }
64282
64283
64284 {
64285 differ = (old->ncount != real_packet->ncount);
64286 if (!differ) {
64287 int i;
64288
64289 for (i = 0; i < real_packet->ncount; i++) {
64290 if (old->is_pickable[i] != real_packet->is_pickable[i]) {
64291 differ = TRUE;
64292 break;
64293 }
64294 }
64295 }
64296 }
64297 if (differ) {
64298 BV_SET(fields, 1);
64299 }
64300
64301 if (packet->nationset_change) {
64302 BV_SET(fields, 2);
64303 }
64304
64305
64306#ifdef FREECIV_JSON_CONNECTION
64307 field_addr.name = "fields";
64308#endif /* FREECIV_JSON_CONNECTION */
64309 DIO_BV_PUT(&dout, &field_addr, fields);
64310
64311 if (BV_ISSET(fields, 0)) {
64312 log_packet_detailed(" field 'ncount' has changed");
64313 #ifdef FREECIV_JSON_CONNECTION
64314 field_addr.name = "ncount";
64315#endif /* FREECIV_JSON_CONNECTION */
64316 DIO_PUT(uint16, &dout, &field_addr, real_packet->ncount);
64317 }
64318 if (BV_ISSET(fields, 1)) {
64319 log_packet_detailed(" field 'is_pickable' has changed");
64320 #ifdef FREECIV_JSON_CONNECTION
64321 field_addr.name = "is_pickable";
64322#endif /* FREECIV_JSON_CONNECTION */
64323
64324 {
64325 int i;
64326
64327#ifdef FREECIV_JSON_CONNECTION
64328 /* Create the array. */
64329 DIO_PUT(farray, &dout, &field_addr, real_packet->ncount);
64330
64331 /* Enter the array. */
64332 field_addr.sub_location = plocation_elem_new(0);
64333#endif /* FREECIV_JSON_CONNECTION */
64334
64335 for (i = 0; i < real_packet->ncount; i++) {
64336#ifdef FREECIV_JSON_CONNECTION
64337 /* Next array element. */
64338 field_addr.sub_location->number = i;
64339#endif /* FREECIV_JSON_CONNECTION */
64340 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_pickable[i]);
64341 }
64342
64343#ifdef FREECIV_JSON_CONNECTION
64344 /* Exit array. */
64345 free(field_addr.sub_location);
64346 field_addr.sub_location = NULL;
64347#endif /* FREECIV_JSON_CONNECTION */
64348 }
64349 }
64350 /* field 2 is folded into the header */
64351
64352 *old = *real_packet;
64353#endif /* FREECIV_DELTA_PROTOCOL */
64354#ifndef FREECIV_DELTA_PROTOCOL
64355#ifdef FREECIV_JSON_CONNECTION
64356 field_addr.name = "ncount";
64357#endif /* FREECIV_JSON_CONNECTION */
64358 DIO_PUT(uint16, &dout, &field_addr, real_packet->ncount);
64359#ifdef FREECIV_JSON_CONNECTION
64360 field_addr.name = "is_pickable";
64361#endif /* FREECIV_JSON_CONNECTION */
64362
64363 {
64364 int i;
64365
64366#ifdef FREECIV_JSON_CONNECTION
64367 /* Create the array. */
64368 DIO_PUT(farray, &dout, &field_addr, real_packet->ncount);
64369
64370 /* Enter the array. */
64371 field_addr.sub_location = plocation_elem_new(0);
64372#endif /* FREECIV_JSON_CONNECTION */
64373
64374 for (i = 0; i < real_packet->ncount; i++) {
64375#ifdef FREECIV_JSON_CONNECTION
64376 /* Next array element. */
64377 field_addr.sub_location->number = i;
64378#endif /* FREECIV_JSON_CONNECTION */
64379 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_pickable[i]);
64380 }
64381
64382#ifdef FREECIV_JSON_CONNECTION
64383 /* Exit array. */
64384 free(field_addr.sub_location);
64385 field_addr.sub_location = NULL;
64386#endif /* FREECIV_JSON_CONNECTION */
64387 }
64388#ifdef FREECIV_JSON_CONNECTION
64389 field_addr.name = "nationset_change";
64390#endif /* FREECIV_JSON_CONNECTION */
64391 DIO_PUT(bool8, &dout, &field_addr, real_packet->nationset_change);
64392
64393#endif
64394 SEND_PACKET_END(PACKET_NATION_AVAILABILITY);
64395}
64396
64397 int send_packet_nation_availability(struct connection *pc, const struct packet_nation_availability *packet)
64398{
64399 if (!pc->used) {
64400 log_error("WARNING: trying to send data to the closed connection %s",
64401 conn_description(pc));
64402 return -1;
64403 }
64404 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_NATION_AVAILABILITY].packet != NULL, -1,
64405 "Handler for PACKET_NATION_AVAILABILITY not installed");
64406 return pc->phs.handlers->send[PACKET_NATION_AVAILABILITY].packet(pc, packet);
64407}
64408
64409 void lsend_packet_nation_availability(struct conn_list *dest, const struct packet_nation_availability *packet)
64410{
64411 conn_list_iterate(dest, pconn) {
64412 send_packet_nation_availability(pconn, packet);
64413 } conn_list_iterate_end;
64414}
64415
64416#ifdef FREECIV_DELTA_PROTOCOL
64417#define hash_packet_ruleset_style_100 hash_const
64418
64419#define cmp_packet_ruleset_style_100 cmp_const
64420
64421 BV_DEFINE(packet_ruleset_style_100_fields, 3);
64422#endif /* FREECIV_DELTA_PROTOCOL */
64423
64424 static struct packet_ruleset_style *receive_packet_ruleset_style_100(struct connection *pc)
64425{
64426#ifdef FREECIV_DELTA_PROTOCOL
64427 packet_ruleset_style_100_fields fields;
64428 struct packet_ruleset_style *old;
64429 struct genhash **hash = pc->phs.received + PACKET_RULESET_STYLE;
64430#endif /* FREECIV_DELTA_PROTOCOL */
64431 RECEIVE_PACKET_START(packet_ruleset_style, real_packet);
64432#ifdef FREECIV_JSON_CONNECTION
64433 struct plocation field_addr;
64434 {
64435 struct plocation *field_addr_tmp = plocation_field_new(NULL);
64436 field_addr = *field_addr_tmp;
64437 FC_FREE(field_addr_tmp);
64438 }
64439#endif /* FREECIV_JSON_CONNECTION */
64440
64441#ifdef FREECIV_DELTA_PROTOCOL
64442#ifdef FREECIV_JSON_CONNECTION
64443 field_addr.name = "fields";
64444#endif /* FREECIV_JSON_CONNECTION */
64445 DIO_BV_GET(&din, &field_addr, fields);
64446
64447#else /* FREECIV_DELTA_PROTOCOL */
64448 #ifdef FREECIV_JSON_CONNECTION
64449 field_addr.name = "id";
64450 #endif /* FREECIV_JSON_CONNECTION */
64451 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
64452 RECEIVE_PACKET_FIELD_ERROR(id);
64453 }
64454 #ifdef FREECIV_JSON_CONNECTION
64455 field_addr.name = "name";
64456 #endif /* FREECIV_JSON_CONNECTION */
64457 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
64458 RECEIVE_PACKET_FIELD_ERROR(name);
64459 }
64460 #ifdef FREECIV_JSON_CONNECTION
64461 field_addr.name = "rule_name";
64462 #endif /* FREECIV_JSON_CONNECTION */
64463 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
64464 RECEIVE_PACKET_FIELD_ERROR(rule_name);
64465 }
64466
64467#endif
64468 log_packet_detailed("packet_ruleset_style_100: got info about ()");
64469
64470#ifdef FREECIV_DELTA_PROTOCOL
64471 if (NULL == *hash) {
64472 *hash = genhash_new_full(hash_packet_ruleset_style_100, cmp_packet_ruleset_style_100,
64473 NULL, NULL, NULL, free);
64474 }
64475
64476 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
64477 *real_packet = *old;
64478 } else {
64479 log_packet_detailed(" no old info");
64480 memset(real_packet, 0, sizeof(*real_packet));
64481 }
64482
64483 if (BV_ISSET(fields, 0)) {
64484 log_packet_detailed(" got field 'id'");
64485 #ifdef FREECIV_JSON_CONNECTION
64486 field_addr.name = "id";
64487 #endif /* FREECIV_JSON_CONNECTION */
64488 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
64489 RECEIVE_PACKET_FIELD_ERROR(id);
64490 }
64491 }
64492 if (BV_ISSET(fields, 1)) {
64493 log_packet_detailed(" got field 'name'");
64494 #ifdef FREECIV_JSON_CONNECTION
64495 field_addr.name = "name";
64496 #endif /* FREECIV_JSON_CONNECTION */
64497 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
64498 RECEIVE_PACKET_FIELD_ERROR(name);
64499 }
64500 }
64501 if (BV_ISSET(fields, 2)) {
64502 log_packet_detailed(" got field 'rule_name'");
64503 #ifdef FREECIV_JSON_CONNECTION
64504 field_addr.name = "rule_name";
64505 #endif /* FREECIV_JSON_CONNECTION */
64506 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
64507 RECEIVE_PACKET_FIELD_ERROR(rule_name);
64508 }
64509 }
64510
64511 if (NULL == old) {
64512 old = fc_malloc(sizeof(*old));
64513 *old = *real_packet;
64514 genhash_insert(*hash, old, old);
64515 } else {
64516 *old = *real_packet;
64517 }
64518
64519#endif /* FREECIV_DELTA_PROTOCOL */
64520 RECEIVE_PACKET_END(real_packet);
64521}
64522
64523 static int send_packet_ruleset_style_100(struct connection *pc, const struct packet_ruleset_style *packet)
64524{
64525 const struct packet_ruleset_style *real_packet = packet;
64526#ifdef FREECIV_DELTA_PROTOCOL
64527 packet_ruleset_style_100_fields fields;
64528 struct packet_ruleset_style *old;
64529 bool differ;
64530 struct genhash **hash = pc->phs.sent + PACKET_RULESET_STYLE;
64531#endif /* FREECIV_DELTA_PROTOCOL */
64532 SEND_PACKET_START(PACKET_RULESET_STYLE);
64533#ifdef FREECIV_JSON_CONNECTION
64534 struct plocation field_addr;
64535 {
64536 struct plocation *field_addr_tmp = plocation_field_new(NULL);
64537 field_addr = *field_addr_tmp;
64538 FC_FREE(field_addr_tmp);
64539 }
64540#endif /* FREECIV_JSON_CONNECTION */
64541
64542 log_packet_detailed("packet_ruleset_style_100: sending info about ()");
64543
64544#ifdef FREECIV_DELTA_PROTOCOL
64545 if (NULL == *hash) {
64546 *hash = genhash_new_full(hash_packet_ruleset_style_100, cmp_packet_ruleset_style_100,
64547 NULL, NULL, NULL, free);
64548 }
64549 BV_CLR_ALL(fields);
64550
64551 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
64552 old = fc_malloc(sizeof(*old));
64553 *old = *real_packet;
64554 genhash_insert(*hash, old, old);
64555 memset(old, 0, sizeof(*old));
64556 }
64557 differ = (old->id != real_packet->id);
64558 if (differ) {
64559 BV_SET(fields, 0);
64560 }
64561
64562 differ = (strcmp(old->name, real_packet->name) != 0);
64563 if (differ) {
64564 BV_SET(fields, 1);
64565 }
64566
64567 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
64568 if (differ) {
64569 BV_SET(fields, 2);
64570 }
64571
64572
64573#ifdef FREECIV_JSON_CONNECTION
64574 field_addr.name = "fields";
64575#endif /* FREECIV_JSON_CONNECTION */
64576 DIO_BV_PUT(&dout, &field_addr, fields);
64577
64578 if (BV_ISSET(fields, 0)) {
64579 log_packet_detailed(" field 'id' has changed");
64580 #ifdef FREECIV_JSON_CONNECTION
64581 field_addr.name = "id";
64582#endif /* FREECIV_JSON_CONNECTION */
64583 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
64584 }
64585 if (BV_ISSET(fields, 1)) {
64586 log_packet_detailed(" field 'name' has changed");
64587 #ifdef FREECIV_JSON_CONNECTION
64588 field_addr.name = "name";
64589#endif /* FREECIV_JSON_CONNECTION */
64590 DIO_PUT(string, &dout, &field_addr, real_packet->name);
64591 }
64592 if (BV_ISSET(fields, 2)) {
64593 log_packet_detailed(" field 'rule_name' has changed");
64594 #ifdef FREECIV_JSON_CONNECTION
64595 field_addr.name = "rule_name";
64596#endif /* FREECIV_JSON_CONNECTION */
64597 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
64598 }
64599
64600 *old = *real_packet;
64601#endif /* FREECIV_DELTA_PROTOCOL */
64602#ifndef FREECIV_DELTA_PROTOCOL
64603#ifdef FREECIV_JSON_CONNECTION
64604 field_addr.name = "id";
64605#endif /* FREECIV_JSON_CONNECTION */
64606 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
64607#ifdef FREECIV_JSON_CONNECTION
64608 field_addr.name = "name";
64609#endif /* FREECIV_JSON_CONNECTION */
64610 DIO_PUT(string, &dout, &field_addr, real_packet->name);
64611#ifdef FREECIV_JSON_CONNECTION
64612 field_addr.name = "rule_name";
64613#endif /* FREECIV_JSON_CONNECTION */
64614 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
64615
64616#endif
64617 SEND_PACKET_END(PACKET_RULESET_STYLE);
64618}
64619
64620 int send_packet_ruleset_style(struct connection *pc, const struct packet_ruleset_style *packet)
64621{
64622 if (!pc->used) {
64623 log_error("WARNING: trying to send data to the closed connection %s",
64624 conn_description(pc));
64625 return -1;
64626 }
64627 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_STYLE].packet != NULL, -1,
64628 "Handler for PACKET_RULESET_STYLE not installed");
64629 return pc->phs.handlers->send[PACKET_RULESET_STYLE].packet(pc, packet);
64630}
64631
64632 void lsend_packet_ruleset_style(struct conn_list *dest, const struct packet_ruleset_style *packet)
64633{
64634 conn_list_iterate(dest, pconn) {
64635 send_packet_ruleset_style(pconn, packet);
64636 } conn_list_iterate_end;
64637}
64638
64639#ifdef FREECIV_DELTA_PROTOCOL
64640#define hash_packet_ruleset_city_100 hash_const
64641
64642#define cmp_packet_ruleset_city_100 cmp_const
64643
64644 BV_DEFINE(packet_ruleset_city_100_fields, 8);
64645#endif /* FREECIV_DELTA_PROTOCOL */
64646
64647 static struct packet_ruleset_city *receive_packet_ruleset_city_100(struct connection *pc)
64648{
64649#ifdef FREECIV_DELTA_PROTOCOL
64650 packet_ruleset_city_100_fields fields;
64651 struct packet_ruleset_city *old;
64652 struct genhash **hash = pc->phs.received + PACKET_RULESET_CITY;
64653#endif /* FREECIV_DELTA_PROTOCOL */
64654 RECEIVE_PACKET_START(packet_ruleset_city, real_packet);
64655#ifdef FREECIV_JSON_CONNECTION
64656 struct plocation field_addr;
64657 {
64658 struct plocation *field_addr_tmp = plocation_field_new(NULL);
64659 field_addr = *field_addr_tmp;
64660 FC_FREE(field_addr_tmp);
64661 }
64662#endif /* FREECIV_JSON_CONNECTION */
64663
64664#ifdef FREECIV_DELTA_PROTOCOL
64665#ifdef FREECIV_JSON_CONNECTION
64666 field_addr.name = "fields";
64667#endif /* FREECIV_JSON_CONNECTION */
64668 DIO_BV_GET(&din, &field_addr, fields);
64669
64670#else /* FREECIV_DELTA_PROTOCOL */
64671 #ifdef FREECIV_JSON_CONNECTION
64672 field_addr.name = "style_id";
64673 #endif /* FREECIV_JSON_CONNECTION */
64674 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style_id)) {
64675 RECEIVE_PACKET_FIELD_ERROR(style_id);
64676 }
64677 #ifdef FREECIV_JSON_CONNECTION
64678 field_addr.name = "name";
64679 #endif /* FREECIV_JSON_CONNECTION */
64680 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
64681 RECEIVE_PACKET_FIELD_ERROR(name);
64682 }
64683 #ifdef FREECIV_JSON_CONNECTION
64684 field_addr.name = "rule_name";
64685 #endif /* FREECIV_JSON_CONNECTION */
64686 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
64687 RECEIVE_PACKET_FIELD_ERROR(rule_name);
64688 }
64689 #ifdef FREECIV_JSON_CONNECTION
64690 field_addr.name = "citizens_graphic";
64691 #endif /* FREECIV_JSON_CONNECTION */
64692 if (!DIO_GET(string, &din, &field_addr, real_packet->citizens_graphic, sizeof(real_packet->citizens_graphic))) {
64693 RECEIVE_PACKET_FIELD_ERROR(citizens_graphic);
64694 }
64695 #ifdef FREECIV_JSON_CONNECTION
64696 field_addr.name = "reqs_count";
64697 #endif /* FREECIV_JSON_CONNECTION */
64698 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
64699 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
64700 }
64701 #ifdef FREECIV_JSON_CONNECTION
64702 field_addr.name = "reqs";
64703 #endif /* FREECIV_JSON_CONNECTION */
64704
64705 {
64706 int i;
64707
64708 #ifdef FREECIV_JSON_CONNECTION
64709 /* Enter array. */
64710 field_addr.sub_location = plocation_elem_new(0);
64711 #endif /* FREECIV_JSON_CONNECTION */
64712
64713 if (real_packet->reqs_count > MAX_NUM_REQS) {
64714 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
64715 }
64716 for (i = 0; i < real_packet->reqs_count; i++) {
64717 #ifdef FREECIV_JSON_CONNECTION
64718 field_addr.sub_location->number = i;
64719 #endif /* FREECIV_JSON_CONNECTION */
64720 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
64721 RECEIVE_PACKET_FIELD_ERROR(reqs);
64722 }
64723 }
64724
64725 #ifdef FREECIV_JSON_CONNECTION
64726 /* Exit array. */
64727 free(field_addr.sub_location);
64728 field_addr.sub_location = NULL;
64729 #endif /* FREECIV_JSON_CONNECTION */
64730 }
64731 #ifdef FREECIV_JSON_CONNECTION
64732 field_addr.name = "graphic";
64733 #endif /* FREECIV_JSON_CONNECTION */
64734 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic, sizeof(real_packet->graphic))) {
64735 RECEIVE_PACKET_FIELD_ERROR(graphic);
64736 }
64737 #ifdef FREECIV_JSON_CONNECTION
64738 field_addr.name = "graphic_alt";
64739 #endif /* FREECIV_JSON_CONNECTION */
64740 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
64741 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
64742 }
64743
64744#endif
64745 log_packet_detailed("packet_ruleset_city_100: got info about ()");
64746
64747#ifdef FREECIV_DELTA_PROTOCOL
64748 if (NULL == *hash) {
64749 *hash = genhash_new_full(hash_packet_ruleset_city_100, cmp_packet_ruleset_city_100,
64750 NULL, NULL, NULL, free);
64751 }
64752
64753 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
64754 *real_packet = *old;
64755 } else {
64756 log_packet_detailed(" no old info");
64757 memset(real_packet, 0, sizeof(*real_packet));
64758 }
64759
64760 if (BV_ISSET(fields, 0)) {
64761 log_packet_detailed(" got field 'style_id'");
64762 #ifdef FREECIV_JSON_CONNECTION
64763 field_addr.name = "style_id";
64764 #endif /* FREECIV_JSON_CONNECTION */
64765 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style_id)) {
64766 RECEIVE_PACKET_FIELD_ERROR(style_id);
64767 }
64768 }
64769 if (BV_ISSET(fields, 1)) {
64770 log_packet_detailed(" got field 'name'");
64771 #ifdef FREECIV_JSON_CONNECTION
64772 field_addr.name = "name";
64773 #endif /* FREECIV_JSON_CONNECTION */
64774 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
64775 RECEIVE_PACKET_FIELD_ERROR(name);
64776 }
64777 }
64778 if (BV_ISSET(fields, 2)) {
64779 log_packet_detailed(" got field 'rule_name'");
64780 #ifdef FREECIV_JSON_CONNECTION
64781 field_addr.name = "rule_name";
64782 #endif /* FREECIV_JSON_CONNECTION */
64783 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
64784 RECEIVE_PACKET_FIELD_ERROR(rule_name);
64785 }
64786 }
64787 if (BV_ISSET(fields, 3)) {
64788 log_packet_detailed(" got field 'citizens_graphic'");
64789 #ifdef FREECIV_JSON_CONNECTION
64790 field_addr.name = "citizens_graphic";
64791 #endif /* FREECIV_JSON_CONNECTION */
64792 if (!DIO_GET(string, &din, &field_addr, real_packet->citizens_graphic, sizeof(real_packet->citizens_graphic))) {
64793 RECEIVE_PACKET_FIELD_ERROR(citizens_graphic);
64794 }
64795 }
64796 if (BV_ISSET(fields, 4)) {
64797 log_packet_detailed(" got field 'reqs_count'");
64798 #ifdef FREECIV_JSON_CONNECTION
64799 field_addr.name = "reqs_count";
64800 #endif /* FREECIV_JSON_CONNECTION */
64801 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
64802 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
64803 }
64804 }
64805 if (BV_ISSET(fields, 5)) {
64806 log_packet_detailed(" got field 'reqs'");
64807 #ifdef FREECIV_JSON_CONNECTION
64808 field_addr.name = "reqs";
64809 #endif /* FREECIV_JSON_CONNECTION */
64810
64811 {
64812 int i;
64813
64814 #ifdef FREECIV_JSON_CONNECTION
64815 /* Enter array. */
64816 field_addr.sub_location = plocation_elem_new(0);
64817 #endif /* FREECIV_JSON_CONNECTION */
64818
64819 if (real_packet->reqs_count > MAX_NUM_REQS) {
64820 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
64821 }
64822 for (i = 0; i < real_packet->reqs_count; i++) {
64823 #ifdef FREECIV_JSON_CONNECTION
64824 field_addr.sub_location->number = i;
64825 #endif /* FREECIV_JSON_CONNECTION */
64826 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
64827 RECEIVE_PACKET_FIELD_ERROR(reqs);
64828 }
64829 }
64830
64831 #ifdef FREECIV_JSON_CONNECTION
64832 /* Exit array. */
64833 free(field_addr.sub_location);
64834 field_addr.sub_location = NULL;
64835 #endif /* FREECIV_JSON_CONNECTION */
64836 }
64837 }
64838 if (BV_ISSET(fields, 6)) {
64839 log_packet_detailed(" got field 'graphic'");
64840 #ifdef FREECIV_JSON_CONNECTION
64841 field_addr.name = "graphic";
64842 #endif /* FREECIV_JSON_CONNECTION */
64843 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic, sizeof(real_packet->graphic))) {
64844 RECEIVE_PACKET_FIELD_ERROR(graphic);
64845 }
64846 }
64847 if (BV_ISSET(fields, 7)) {
64848 log_packet_detailed(" got field 'graphic_alt'");
64849 #ifdef FREECIV_JSON_CONNECTION
64850 field_addr.name = "graphic_alt";
64851 #endif /* FREECIV_JSON_CONNECTION */
64852 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
64853 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
64854 }
64855 }
64856
64857 if (NULL == old) {
64858 old = fc_malloc(sizeof(*old));
64859 *old = *real_packet;
64860 genhash_insert(*hash, old, old);
64861 } else {
64862 *old = *real_packet;
64863 }
64864
64865#endif /* FREECIV_DELTA_PROTOCOL */
64866 RECEIVE_PACKET_END(real_packet);
64867}
64868
64869 static int send_packet_ruleset_city_100(struct connection *pc, const struct packet_ruleset_city *packet)
64870{
64871 const struct packet_ruleset_city *real_packet = packet;
64872#ifdef FREECIV_DELTA_PROTOCOL
64873 packet_ruleset_city_100_fields fields;
64874 struct packet_ruleset_city *old;
64875 bool differ;
64876 struct genhash **hash = pc->phs.sent + PACKET_RULESET_CITY;
64877#endif /* FREECIV_DELTA_PROTOCOL */
64878 SEND_PACKET_START(PACKET_RULESET_CITY);
64879#ifdef FREECIV_JSON_CONNECTION
64880 struct plocation field_addr;
64881 {
64882 struct plocation *field_addr_tmp = plocation_field_new(NULL);
64883 field_addr = *field_addr_tmp;
64884 FC_FREE(field_addr_tmp);
64885 }
64886#endif /* FREECIV_JSON_CONNECTION */
64887
64888 log_packet_detailed("packet_ruleset_city_100: sending info about ()");
64889
64890#ifdef FREECIV_DELTA_PROTOCOL
64891 if (NULL == *hash) {
64892 *hash = genhash_new_full(hash_packet_ruleset_city_100, cmp_packet_ruleset_city_100,
64893 NULL, NULL, NULL, free);
64894 }
64895 BV_CLR_ALL(fields);
64896
64897 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
64898 old = fc_malloc(sizeof(*old));
64899 *old = *real_packet;
64900 genhash_insert(*hash, old, old);
64901 memset(old, 0, sizeof(*old));
64902 }
64903 differ = (old->style_id != real_packet->style_id);
64904 if (differ) {
64905 BV_SET(fields, 0);
64906 }
64907
64908 differ = (strcmp(old->name, real_packet->name) != 0);
64909 if (differ) {
64910 BV_SET(fields, 1);
64911 }
64912
64913 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
64914 if (differ) {
64915 BV_SET(fields, 2);
64916 }
64917
64918 differ = (strcmp(old->citizens_graphic, real_packet->citizens_graphic) != 0);
64919 if (differ) {
64920 BV_SET(fields, 3);
64921 }
64922
64923 differ = (old->reqs_count != real_packet->reqs_count);
64924 if (differ) {
64925 BV_SET(fields, 4);
64926 }
64927
64928
64929 {
64930 differ = (old->reqs_count != real_packet->reqs_count);
64931 if (!differ) {
64932 int i;
64933
64934 for (i = 0; i < real_packet->reqs_count; i++) {
64935 if (!are_requirements_equal(&old->reqs[i], &real_packet->reqs[i])) {
64936 differ = TRUE;
64937 break;
64938 }
64939 }
64940 }
64941 }
64942 if (differ) {
64943 BV_SET(fields, 5);
64944 }
64945
64946 differ = (strcmp(old->graphic, real_packet->graphic) != 0);
64947 if (differ) {
64948 BV_SET(fields, 6);
64949 }
64950
64951 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
64952 if (differ) {
64953 BV_SET(fields, 7);
64954 }
64955
64956
64957#ifdef FREECIV_JSON_CONNECTION
64958 field_addr.name = "fields";
64959#endif /* FREECIV_JSON_CONNECTION */
64960 DIO_BV_PUT(&dout, &field_addr, fields);
64961
64962 if (BV_ISSET(fields, 0)) {
64963 log_packet_detailed(" field 'style_id' has changed");
64964 #ifdef FREECIV_JSON_CONNECTION
64965 field_addr.name = "style_id";
64966#endif /* FREECIV_JSON_CONNECTION */
64967 DIO_PUT(uint8, &dout, &field_addr, real_packet->style_id);
64968 }
64969 if (BV_ISSET(fields, 1)) {
64970 log_packet_detailed(" field 'name' has changed");
64971 #ifdef FREECIV_JSON_CONNECTION
64972 field_addr.name = "name";
64973#endif /* FREECIV_JSON_CONNECTION */
64974 DIO_PUT(string, &dout, &field_addr, real_packet->name);
64975 }
64976 if (BV_ISSET(fields, 2)) {
64977 log_packet_detailed(" field 'rule_name' has changed");
64978 #ifdef FREECIV_JSON_CONNECTION
64979 field_addr.name = "rule_name";
64980#endif /* FREECIV_JSON_CONNECTION */
64981 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
64982 }
64983 if (BV_ISSET(fields, 3)) {
64984 log_packet_detailed(" field 'citizens_graphic' has changed");
64985 #ifdef FREECIV_JSON_CONNECTION
64986 field_addr.name = "citizens_graphic";
64987#endif /* FREECIV_JSON_CONNECTION */
64988 DIO_PUT(string, &dout, &field_addr, real_packet->citizens_graphic);
64989 }
64990 if (BV_ISSET(fields, 4)) {
64991 log_packet_detailed(" field 'reqs_count' has changed");
64992 #ifdef FREECIV_JSON_CONNECTION
64993 field_addr.name = "reqs_count";
64994#endif /* FREECIV_JSON_CONNECTION */
64995 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
64996 }
64997 if (BV_ISSET(fields, 5)) {
64998 log_packet_detailed(" field 'reqs' has changed");
64999 #ifdef FREECIV_JSON_CONNECTION
65000 field_addr.name = "reqs";
65001#endif /* FREECIV_JSON_CONNECTION */
65002
65003 {
65004 int i;
65005
65006#ifdef FREECIV_JSON_CONNECTION
65007 /* Create the array. */
65008 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
65009
65010 /* Enter the array. */
65011 field_addr.sub_location = plocation_elem_new(0);
65012#endif /* FREECIV_JSON_CONNECTION */
65013
65014 for (i = 0; i < real_packet->reqs_count; i++) {
65015#ifdef FREECIV_JSON_CONNECTION
65016 /* Next array element. */
65017 field_addr.sub_location->number = i;
65018#endif /* FREECIV_JSON_CONNECTION */
65019 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
65020 }
65021
65022#ifdef FREECIV_JSON_CONNECTION
65023 /* Exit array. */
65024 free(field_addr.sub_location);
65025 field_addr.sub_location = NULL;
65026#endif /* FREECIV_JSON_CONNECTION */
65027 }
65028 }
65029 if (BV_ISSET(fields, 6)) {
65030 log_packet_detailed(" field 'graphic' has changed");
65031 #ifdef FREECIV_JSON_CONNECTION
65032 field_addr.name = "graphic";
65033#endif /* FREECIV_JSON_CONNECTION */
65034 DIO_PUT(string, &dout, &field_addr, real_packet->graphic);
65035 }
65036 if (BV_ISSET(fields, 7)) {
65037 log_packet_detailed(" field 'graphic_alt' has changed");
65038 #ifdef FREECIV_JSON_CONNECTION
65039 field_addr.name = "graphic_alt";
65040#endif /* FREECIV_JSON_CONNECTION */
65041 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
65042 }
65043
65044 *old = *real_packet;
65045#endif /* FREECIV_DELTA_PROTOCOL */
65046#ifndef FREECIV_DELTA_PROTOCOL
65047#ifdef FREECIV_JSON_CONNECTION
65048 field_addr.name = "style_id";
65049#endif /* FREECIV_JSON_CONNECTION */
65050 DIO_PUT(uint8, &dout, &field_addr, real_packet->style_id);
65051#ifdef FREECIV_JSON_CONNECTION
65052 field_addr.name = "name";
65053#endif /* FREECIV_JSON_CONNECTION */
65054 DIO_PUT(string, &dout, &field_addr, real_packet->name);
65055#ifdef FREECIV_JSON_CONNECTION
65056 field_addr.name = "rule_name";
65057#endif /* FREECIV_JSON_CONNECTION */
65058 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
65059#ifdef FREECIV_JSON_CONNECTION
65060 field_addr.name = "citizens_graphic";
65061#endif /* FREECIV_JSON_CONNECTION */
65062 DIO_PUT(string, &dout, &field_addr, real_packet->citizens_graphic);
65063#ifdef FREECIV_JSON_CONNECTION
65064 field_addr.name = "reqs_count";
65065#endif /* FREECIV_JSON_CONNECTION */
65066 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
65067#ifdef FREECIV_JSON_CONNECTION
65068 field_addr.name = "reqs";
65069#endif /* FREECIV_JSON_CONNECTION */
65070
65071 {
65072 int i;
65073
65074#ifdef FREECIV_JSON_CONNECTION
65075 /* Create the array. */
65076 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
65077
65078 /* Enter the array. */
65079 field_addr.sub_location = plocation_elem_new(0);
65080#endif /* FREECIV_JSON_CONNECTION */
65081
65082 for (i = 0; i < real_packet->reqs_count; i++) {
65083#ifdef FREECIV_JSON_CONNECTION
65084 /* Next array element. */
65085 field_addr.sub_location->number = i;
65086#endif /* FREECIV_JSON_CONNECTION */
65087 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
65088 }
65089
65090#ifdef FREECIV_JSON_CONNECTION
65091 /* Exit array. */
65092 free(field_addr.sub_location);
65093 field_addr.sub_location = NULL;
65094#endif /* FREECIV_JSON_CONNECTION */
65095 }
65096#ifdef FREECIV_JSON_CONNECTION
65097 field_addr.name = "graphic";
65098#endif /* FREECIV_JSON_CONNECTION */
65099 DIO_PUT(string, &dout, &field_addr, real_packet->graphic);
65100#ifdef FREECIV_JSON_CONNECTION
65101 field_addr.name = "graphic_alt";
65102#endif /* FREECIV_JSON_CONNECTION */
65103 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
65104
65105#endif
65106 SEND_PACKET_END(PACKET_RULESET_CITY);
65107}
65108
65109 int send_packet_ruleset_city(struct connection *pc, const struct packet_ruleset_city *packet)
65110{
65111 if (!pc->used) {
65112 log_error("WARNING: trying to send data to the closed connection %s",
65113 conn_description(pc));
65114 return -1;
65115 }
65116 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_CITY].packet != NULL, -1,
65117 "Handler for PACKET_RULESET_CITY not installed");
65118 return pc->phs.handlers->send[PACKET_RULESET_CITY].packet(pc, packet);
65119}
65120
65121 void lsend_packet_ruleset_city(struct conn_list *dest, const struct packet_ruleset_city *packet)
65122{
65123 conn_list_iterate(dest, pconn) {
65124 send_packet_ruleset_city(pconn, packet);
65125 } conn_list_iterate_end;
65126}
65127
65128#ifdef FREECIV_DELTA_PROTOCOL
65129#define hash_packet_ruleset_building_100 hash_const
65130
65131#define cmp_packet_ruleset_building_100 cmp_const
65132
65133 BV_DEFINE(packet_ruleset_building_100_fields, 17);
65134#endif /* FREECIV_DELTA_PROTOCOL */
65135
65136 static struct packet_ruleset_building *receive_packet_ruleset_building_100(struct connection *pc)
65137{
65138#ifdef FREECIV_DELTA_PROTOCOL
65139 packet_ruleset_building_100_fields fields;
65140 struct packet_ruleset_building *old;
65141 struct genhash **hash = pc->phs.received + PACKET_RULESET_BUILDING;
65142#endif /* FREECIV_DELTA_PROTOCOL */
65143 RECEIVE_PACKET_START(packet_ruleset_building, real_packet);
65144#ifdef FREECIV_JSON_CONNECTION
65145 struct plocation field_addr;
65146 {
65147 struct plocation *field_addr_tmp = plocation_field_new(NULL);
65148 field_addr = *field_addr_tmp;
65149 FC_FREE(field_addr_tmp);
65150 }
65151#endif /* FREECIV_JSON_CONNECTION */
65152
65153#ifdef FREECIV_DELTA_PROTOCOL
65154#ifdef FREECIV_JSON_CONNECTION
65155 field_addr.name = "fields";
65156#endif /* FREECIV_JSON_CONNECTION */
65157 DIO_BV_GET(&din, &field_addr, fields);
65158
65159#else /* FREECIV_DELTA_PROTOCOL */
65160 #ifdef FREECIV_JSON_CONNECTION
65161 field_addr.name = "id";
65162 #endif /* FREECIV_JSON_CONNECTION */
65163 {
65164 int readin;
65165
65166 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
65167 RECEIVE_PACKET_FIELD_ERROR(id);
65168 }
65169 real_packet->id = readin;
65170 }
65171 #ifdef FREECIV_JSON_CONNECTION
65172 field_addr.name = "genus";
65173 #endif /* FREECIV_JSON_CONNECTION */
65174 {
65175 int readin;
65176
65177 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
65178 RECEIVE_PACKET_FIELD_ERROR(genus);
65179 }
65180 real_packet->genus = readin;
65181 }
65182 #ifdef FREECIV_JSON_CONNECTION
65183 field_addr.name = "name";
65184 #endif /* FREECIV_JSON_CONNECTION */
65185 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
65186 RECEIVE_PACKET_FIELD_ERROR(name);
65187 }
65188 #ifdef FREECIV_JSON_CONNECTION
65189 field_addr.name = "rule_name";
65190 #endif /* FREECIV_JSON_CONNECTION */
65191 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
65192 RECEIVE_PACKET_FIELD_ERROR(rule_name);
65193 }
65194 #ifdef FREECIV_JSON_CONNECTION
65195 field_addr.name = "graphic_str";
65196 #endif /* FREECIV_JSON_CONNECTION */
65197 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
65198 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
65199 }
65200 #ifdef FREECIV_JSON_CONNECTION
65201 field_addr.name = "graphic_alt";
65202 #endif /* FREECIV_JSON_CONNECTION */
65203 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
65204 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
65205 }
65206 #ifdef FREECIV_JSON_CONNECTION
65207 field_addr.name = "reqs_count";
65208 #endif /* FREECIV_JSON_CONNECTION */
65209 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
65210 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
65211 }
65212 #ifdef FREECIV_JSON_CONNECTION
65213 field_addr.name = "reqs";
65214 #endif /* FREECIV_JSON_CONNECTION */
65215
65216 {
65217 int i;
65218
65219 #ifdef FREECIV_JSON_CONNECTION
65220 /* Enter array. */
65221 field_addr.sub_location = plocation_elem_new(0);
65222 #endif /* FREECIV_JSON_CONNECTION */
65223
65224 if (real_packet->reqs_count > MAX_NUM_REQS) {
65225 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
65226 }
65227 for (i = 0; i < real_packet->reqs_count; i++) {
65228 #ifdef FREECIV_JSON_CONNECTION
65229 field_addr.sub_location->number = i;
65230 #endif /* FREECIV_JSON_CONNECTION */
65231 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
65232 RECEIVE_PACKET_FIELD_ERROR(reqs);
65233 }
65234 }
65235
65236 #ifdef FREECIV_JSON_CONNECTION
65237 /* Exit array. */
65238 free(field_addr.sub_location);
65239 field_addr.sub_location = NULL;
65240 #endif /* FREECIV_JSON_CONNECTION */
65241 }
65242 #ifdef FREECIV_JSON_CONNECTION
65243 field_addr.name = "obs_count";
65244 #endif /* FREECIV_JSON_CONNECTION */
65245 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->obs_count)) {
65246 RECEIVE_PACKET_FIELD_ERROR(obs_count);
65247 }
65248 #ifdef FREECIV_JSON_CONNECTION
65249 field_addr.name = "obs_reqs";
65250 #endif /* FREECIV_JSON_CONNECTION */
65251
65252 {
65253 int i;
65254
65255 #ifdef FREECIV_JSON_CONNECTION
65256 /* Enter array. */
65257 field_addr.sub_location = plocation_elem_new(0);
65258 #endif /* FREECIV_JSON_CONNECTION */
65259
65260 if (real_packet->obs_count > MAX_NUM_REQS) {
65261 RECEIVE_PACKET_FIELD_ERROR(obs_reqs, ": truncation array");
65262 }
65263 for (i = 0; i < real_packet->obs_count; i++) {
65264 #ifdef FREECIV_JSON_CONNECTION
65265 field_addr.sub_location->number = i;
65266 #endif /* FREECIV_JSON_CONNECTION */
65267 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->obs_reqs[i])) {
65268 RECEIVE_PACKET_FIELD_ERROR(obs_reqs);
65269 }
65270 }
65271
65272 #ifdef FREECIV_JSON_CONNECTION
65273 /* Exit array. */
65274 free(field_addr.sub_location);
65275 field_addr.sub_location = NULL;
65276 #endif /* FREECIV_JSON_CONNECTION */
65277 }
65278 #ifdef FREECIV_JSON_CONNECTION
65279 field_addr.name = "build_cost";
65280 #endif /* FREECIV_JSON_CONNECTION */
65281 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->build_cost)) {
65282 RECEIVE_PACKET_FIELD_ERROR(build_cost);
65283 }
65284 #ifdef FREECIV_JSON_CONNECTION
65285 field_addr.name = "upkeep";
65286 #endif /* FREECIV_JSON_CONNECTION */
65287 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep)) {
65288 RECEIVE_PACKET_FIELD_ERROR(upkeep);
65289 }
65290 #ifdef FREECIV_JSON_CONNECTION
65291 field_addr.name = "sabotage";
65292 #endif /* FREECIV_JSON_CONNECTION */
65293 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sabotage)) {
65294 RECEIVE_PACKET_FIELD_ERROR(sabotage);
65295 }
65296 #ifdef FREECIV_JSON_CONNECTION
65297 field_addr.name = "flags";
65298 #endif /* FREECIV_JSON_CONNECTION */
65299 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
65300 RECEIVE_PACKET_FIELD_ERROR(flags);
65301 }
65302 #ifdef FREECIV_JSON_CONNECTION
65303 field_addr.name = "soundtag";
65304 #endif /* FREECIV_JSON_CONNECTION */
65305 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag, sizeof(real_packet->soundtag))) {
65306 RECEIVE_PACKET_FIELD_ERROR(soundtag);
65307 }
65308 #ifdef FREECIV_JSON_CONNECTION
65309 field_addr.name = "soundtag_alt";
65310 #endif /* FREECIV_JSON_CONNECTION */
65311 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag_alt, sizeof(real_packet->soundtag_alt))) {
65312 RECEIVE_PACKET_FIELD_ERROR(soundtag_alt);
65313 }
65314 #ifdef FREECIV_JSON_CONNECTION
65315 field_addr.name = "helptext";
65316 #endif /* FREECIV_JSON_CONNECTION */
65317 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
65318 RECEIVE_PACKET_FIELD_ERROR(helptext);
65319 }
65320
65321#endif
65322 log_packet_detailed("packet_ruleset_building_100: got info about ()");
65323
65324#ifdef FREECIV_DELTA_PROTOCOL
65325 if (NULL == *hash) {
65326 *hash = genhash_new_full(hash_packet_ruleset_building_100, cmp_packet_ruleset_building_100,
65327 NULL, NULL, NULL, free);
65328 }
65329
65330 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
65331 *real_packet = *old;
65332 } else {
65333 log_packet_detailed(" no old info");
65334 memset(real_packet, 0, sizeof(*real_packet));
65335 }
65336
65337 if (BV_ISSET(fields, 0)) {
65338 log_packet_detailed(" got field 'id'");
65339 #ifdef FREECIV_JSON_CONNECTION
65340 field_addr.name = "id";
65341 #endif /* FREECIV_JSON_CONNECTION */
65342 {
65343 int readin;
65344
65345 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
65346 RECEIVE_PACKET_FIELD_ERROR(id);
65347 }
65348 real_packet->id = readin;
65349 }
65350 }
65351 if (BV_ISSET(fields, 1)) {
65352 log_packet_detailed(" got field 'genus'");
65353 #ifdef FREECIV_JSON_CONNECTION
65354 field_addr.name = "genus";
65355 #endif /* FREECIV_JSON_CONNECTION */
65356 {
65357 int readin;
65358
65359 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
65360 RECEIVE_PACKET_FIELD_ERROR(genus);
65361 }
65362 real_packet->genus = readin;
65363 }
65364 }
65365 if (BV_ISSET(fields, 2)) {
65366 log_packet_detailed(" got field 'name'");
65367 #ifdef FREECIV_JSON_CONNECTION
65368 field_addr.name = "name";
65369 #endif /* FREECIV_JSON_CONNECTION */
65370 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
65371 RECEIVE_PACKET_FIELD_ERROR(name);
65372 }
65373 }
65374 if (BV_ISSET(fields, 3)) {
65375 log_packet_detailed(" got field 'rule_name'");
65376 #ifdef FREECIV_JSON_CONNECTION
65377 field_addr.name = "rule_name";
65378 #endif /* FREECIV_JSON_CONNECTION */
65379 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
65380 RECEIVE_PACKET_FIELD_ERROR(rule_name);
65381 }
65382 }
65383 if (BV_ISSET(fields, 4)) {
65384 log_packet_detailed(" got field 'graphic_str'");
65385 #ifdef FREECIV_JSON_CONNECTION
65386 field_addr.name = "graphic_str";
65387 #endif /* FREECIV_JSON_CONNECTION */
65388 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
65389 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
65390 }
65391 }
65392 if (BV_ISSET(fields, 5)) {
65393 log_packet_detailed(" got field 'graphic_alt'");
65394 #ifdef FREECIV_JSON_CONNECTION
65395 field_addr.name = "graphic_alt";
65396 #endif /* FREECIV_JSON_CONNECTION */
65397 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
65398 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
65399 }
65400 }
65401 if (BV_ISSET(fields, 6)) {
65402 log_packet_detailed(" got field 'reqs_count'");
65403 #ifdef FREECIV_JSON_CONNECTION
65404 field_addr.name = "reqs_count";
65405 #endif /* FREECIV_JSON_CONNECTION */
65406 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
65407 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
65408 }
65409 }
65410 if (BV_ISSET(fields, 7)) {
65411 log_packet_detailed(" got field 'reqs'");
65412 #ifdef FREECIV_JSON_CONNECTION
65413 field_addr.name = "reqs";
65414 #endif /* FREECIV_JSON_CONNECTION */
65415
65416 {
65417 int i;
65418
65419 #ifdef FREECIV_JSON_CONNECTION
65420 /* Enter array. */
65421 field_addr.sub_location = plocation_elem_new(0);
65422 #endif /* FREECIV_JSON_CONNECTION */
65423
65424 if (real_packet->reqs_count > MAX_NUM_REQS) {
65425 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
65426 }
65427 for (i = 0; i < real_packet->reqs_count; i++) {
65428 #ifdef FREECIV_JSON_CONNECTION
65429 field_addr.sub_location->number = i;
65430 #endif /* FREECIV_JSON_CONNECTION */
65431 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
65432 RECEIVE_PACKET_FIELD_ERROR(reqs);
65433 }
65434 }
65435
65436 #ifdef FREECIV_JSON_CONNECTION
65437 /* Exit array. */
65438 free(field_addr.sub_location);
65439 field_addr.sub_location = NULL;
65440 #endif /* FREECIV_JSON_CONNECTION */
65441 }
65442 }
65443 if (BV_ISSET(fields, 8)) {
65444 log_packet_detailed(" got field 'obs_count'");
65445 #ifdef FREECIV_JSON_CONNECTION
65446 field_addr.name = "obs_count";
65447 #endif /* FREECIV_JSON_CONNECTION */
65448 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->obs_count)) {
65449 RECEIVE_PACKET_FIELD_ERROR(obs_count);
65450 }
65451 }
65452 if (BV_ISSET(fields, 9)) {
65453 log_packet_detailed(" got field 'obs_reqs'");
65454 #ifdef FREECIV_JSON_CONNECTION
65455 field_addr.name = "obs_reqs";
65456 #endif /* FREECIV_JSON_CONNECTION */
65457
65458 {
65459 int i;
65460
65461 #ifdef FREECIV_JSON_CONNECTION
65462 /* Enter array. */
65463 field_addr.sub_location = plocation_elem_new(0);
65464 #endif /* FREECIV_JSON_CONNECTION */
65465
65466 if (real_packet->obs_count > MAX_NUM_REQS) {
65467 RECEIVE_PACKET_FIELD_ERROR(obs_reqs, ": truncation array");
65468 }
65469 for (i = 0; i < real_packet->obs_count; i++) {
65470 #ifdef FREECIV_JSON_CONNECTION
65471 field_addr.sub_location->number = i;
65472 #endif /* FREECIV_JSON_CONNECTION */
65473 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->obs_reqs[i])) {
65474 RECEIVE_PACKET_FIELD_ERROR(obs_reqs);
65475 }
65476 }
65477
65478 #ifdef FREECIV_JSON_CONNECTION
65479 /* Exit array. */
65480 free(field_addr.sub_location);
65481 field_addr.sub_location = NULL;
65482 #endif /* FREECIV_JSON_CONNECTION */
65483 }
65484 }
65485 if (BV_ISSET(fields, 10)) {
65486 log_packet_detailed(" got field 'build_cost'");
65487 #ifdef FREECIV_JSON_CONNECTION
65488 field_addr.name = "build_cost";
65489 #endif /* FREECIV_JSON_CONNECTION */
65490 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->build_cost)) {
65491 RECEIVE_PACKET_FIELD_ERROR(build_cost);
65492 }
65493 }
65494 if (BV_ISSET(fields, 11)) {
65495 log_packet_detailed(" got field 'upkeep'");
65496 #ifdef FREECIV_JSON_CONNECTION
65497 field_addr.name = "upkeep";
65498 #endif /* FREECIV_JSON_CONNECTION */
65499 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep)) {
65500 RECEIVE_PACKET_FIELD_ERROR(upkeep);
65501 }
65502 }
65503 if (BV_ISSET(fields, 12)) {
65504 log_packet_detailed(" got field 'sabotage'");
65505 #ifdef FREECIV_JSON_CONNECTION
65506 field_addr.name = "sabotage";
65507 #endif /* FREECIV_JSON_CONNECTION */
65508 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sabotage)) {
65509 RECEIVE_PACKET_FIELD_ERROR(sabotage);
65510 }
65511 }
65512 if (BV_ISSET(fields, 13)) {
65513 log_packet_detailed(" got field 'flags'");
65514 #ifdef FREECIV_JSON_CONNECTION
65515 field_addr.name = "flags";
65516 #endif /* FREECIV_JSON_CONNECTION */
65517 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
65518 RECEIVE_PACKET_FIELD_ERROR(flags);
65519 }
65520 }
65521 if (BV_ISSET(fields, 14)) {
65522 log_packet_detailed(" got field 'soundtag'");
65523 #ifdef FREECIV_JSON_CONNECTION
65524 field_addr.name = "soundtag";
65525 #endif /* FREECIV_JSON_CONNECTION */
65526 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag, sizeof(real_packet->soundtag))) {
65527 RECEIVE_PACKET_FIELD_ERROR(soundtag);
65528 }
65529 }
65530 if (BV_ISSET(fields, 15)) {
65531 log_packet_detailed(" got field 'soundtag_alt'");
65532 #ifdef FREECIV_JSON_CONNECTION
65533 field_addr.name = "soundtag_alt";
65534 #endif /* FREECIV_JSON_CONNECTION */
65535 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag_alt, sizeof(real_packet->soundtag_alt))) {
65536 RECEIVE_PACKET_FIELD_ERROR(soundtag_alt);
65537 }
65538 }
65539 if (BV_ISSET(fields, 16)) {
65540 log_packet_detailed(" got field 'helptext'");
65541 #ifdef FREECIV_JSON_CONNECTION
65542 field_addr.name = "helptext";
65543 #endif /* FREECIV_JSON_CONNECTION */
65544 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
65545 RECEIVE_PACKET_FIELD_ERROR(helptext);
65546 }
65547 }
65548
65549 if (NULL == old) {
65550 old = fc_malloc(sizeof(*old));
65551 *old = *real_packet;
65552 genhash_insert(*hash, old, old);
65553 } else {
65554 *old = *real_packet;
65555 }
65556
65557#endif /* FREECIV_DELTA_PROTOCOL */
65558 RECEIVE_PACKET_END(real_packet);
65559}
65560
65561 static int send_packet_ruleset_building_100(struct connection *pc, const struct packet_ruleset_building *packet)
65562{
65563 const struct packet_ruleset_building *real_packet = packet;
65564#ifdef FREECIV_DELTA_PROTOCOL
65565 packet_ruleset_building_100_fields fields;
65566 struct packet_ruleset_building *old;
65567 bool differ;
65568 struct genhash **hash = pc->phs.sent + PACKET_RULESET_BUILDING;
65569#endif /* FREECIV_DELTA_PROTOCOL */
65570 SEND_PACKET_START(PACKET_RULESET_BUILDING);
65571#ifdef FREECIV_JSON_CONNECTION
65572 struct plocation field_addr;
65573 {
65574 struct plocation *field_addr_tmp = plocation_field_new(NULL);
65575 field_addr = *field_addr_tmp;
65576 FC_FREE(field_addr_tmp);
65577 }
65578#endif /* FREECIV_JSON_CONNECTION */
65579
65580 log_packet_detailed("packet_ruleset_building_100: sending info about ()");
65581
65582#ifdef FREECIV_DELTA_PROTOCOL
65583 if (NULL == *hash) {
65584 *hash = genhash_new_full(hash_packet_ruleset_building_100, cmp_packet_ruleset_building_100,
65585 NULL, NULL, NULL, free);
65586 }
65587 BV_CLR_ALL(fields);
65588
65589 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
65590 old = fc_malloc(sizeof(*old));
65591 *old = *real_packet;
65592 genhash_insert(*hash, old, old);
65593 memset(old, 0, sizeof(*old));
65594 }
65595 differ = (old->id != real_packet->id);
65596 if (differ) {
65597 BV_SET(fields, 0);
65598 }
65599
65600 differ = (old->genus != real_packet->genus);
65601 if (differ) {
65602 BV_SET(fields, 1);
65603 }
65604
65605 differ = (strcmp(old->name, real_packet->name) != 0);
65606 if (differ) {
65607 BV_SET(fields, 2);
65608 }
65609
65610 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
65611 if (differ) {
65612 BV_SET(fields, 3);
65613 }
65614
65615 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
65616 if (differ) {
65617 BV_SET(fields, 4);
65618 }
65619
65620 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
65621 if (differ) {
65622 BV_SET(fields, 5);
65623 }
65624
65625 differ = (old->reqs_count != real_packet->reqs_count);
65626 if (differ) {
65627 BV_SET(fields, 6);
65628 }
65629
65630
65631 {
65632 differ = (old->reqs_count != real_packet->reqs_count);
65633 if (!differ) {
65634 int i;
65635
65636 for (i = 0; i < real_packet->reqs_count; i++) {
65637 if (!are_requirements_equal(&old->reqs[i], &real_packet->reqs[i])) {
65638 differ = TRUE;
65639 break;
65640 }
65641 }
65642 }
65643 }
65644 if (differ) {
65645 BV_SET(fields, 7);
65646 }
65647
65648 differ = (old->obs_count != real_packet->obs_count);
65649 if (differ) {
65650 BV_SET(fields, 8);
65651 }
65652
65653
65654 {
65655 differ = (old->obs_count != real_packet->obs_count);
65656 if (!differ) {
65657 int i;
65658
65659 for (i = 0; i < real_packet->obs_count; i++) {
65660 if (!are_requirements_equal(&old->obs_reqs[i], &real_packet->obs_reqs[i])) {
65661 differ = TRUE;
65662 break;
65663 }
65664 }
65665 }
65666 }
65667 if (differ) {
65668 BV_SET(fields, 9);
65669 }
65670
65671 differ = (old->build_cost != real_packet->build_cost);
65672 if (differ) {
65673 BV_SET(fields, 10);
65674 }
65675
65676 differ = (old->upkeep != real_packet->upkeep);
65677 if (differ) {
65678 BV_SET(fields, 11);
65679 }
65680
65681 differ = (old->sabotage != real_packet->sabotage);
65682 if (differ) {
65683 BV_SET(fields, 12);
65684 }
65685
65686 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
65687 if (differ) {
65688 BV_SET(fields, 13);
65689 }
65690
65691 differ = (strcmp(old->soundtag, real_packet->soundtag) != 0);
65692 if (differ) {
65693 BV_SET(fields, 14);
65694 }
65695
65696 differ = (strcmp(old->soundtag_alt, real_packet->soundtag_alt) != 0);
65697 if (differ) {
65698 BV_SET(fields, 15);
65699 }
65700
65701 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
65702 if (differ) {
65703 BV_SET(fields, 16);
65704 }
65705
65706
65707#ifdef FREECIV_JSON_CONNECTION
65708 field_addr.name = "fields";
65709#endif /* FREECIV_JSON_CONNECTION */
65710 DIO_BV_PUT(&dout, &field_addr, fields);
65711
65712 if (BV_ISSET(fields, 0)) {
65713 log_packet_detailed(" field 'id' has changed");
65714 #ifdef FREECIV_JSON_CONNECTION
65715 field_addr.name = "id";
65716#endif /* FREECIV_JSON_CONNECTION */
65717 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
65718 }
65719 if (BV_ISSET(fields, 1)) {
65720 log_packet_detailed(" field 'genus' has changed");
65721 #ifdef FREECIV_JSON_CONNECTION
65722 field_addr.name = "genus";
65723#endif /* FREECIV_JSON_CONNECTION */
65724 DIO_PUT(uint8, &dout, &field_addr, real_packet->genus);
65725 }
65726 if (BV_ISSET(fields, 2)) {
65727 log_packet_detailed(" field 'name' has changed");
65728 #ifdef FREECIV_JSON_CONNECTION
65729 field_addr.name = "name";
65730#endif /* FREECIV_JSON_CONNECTION */
65731 DIO_PUT(string, &dout, &field_addr, real_packet->name);
65732 }
65733 if (BV_ISSET(fields, 3)) {
65734 log_packet_detailed(" field 'rule_name' has changed");
65735 #ifdef FREECIV_JSON_CONNECTION
65736 field_addr.name = "rule_name";
65737#endif /* FREECIV_JSON_CONNECTION */
65738 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
65739 }
65740 if (BV_ISSET(fields, 4)) {
65741 log_packet_detailed(" field 'graphic_str' has changed");
65742 #ifdef FREECIV_JSON_CONNECTION
65743 field_addr.name = "graphic_str";
65744#endif /* FREECIV_JSON_CONNECTION */
65745 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
65746 }
65747 if (BV_ISSET(fields, 5)) {
65748 log_packet_detailed(" field 'graphic_alt' has changed");
65749 #ifdef FREECIV_JSON_CONNECTION
65750 field_addr.name = "graphic_alt";
65751#endif /* FREECIV_JSON_CONNECTION */
65752 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
65753 }
65754 if (BV_ISSET(fields, 6)) {
65755 log_packet_detailed(" field 'reqs_count' has changed");
65756 #ifdef FREECIV_JSON_CONNECTION
65757 field_addr.name = "reqs_count";
65758#endif /* FREECIV_JSON_CONNECTION */
65759 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
65760 }
65761 if (BV_ISSET(fields, 7)) {
65762 log_packet_detailed(" field 'reqs' has changed");
65763 #ifdef FREECIV_JSON_CONNECTION
65764 field_addr.name = "reqs";
65765#endif /* FREECIV_JSON_CONNECTION */
65766
65767 {
65768 int i;
65769
65770#ifdef FREECIV_JSON_CONNECTION
65771 /* Create the array. */
65772 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
65773
65774 /* Enter the array. */
65775 field_addr.sub_location = plocation_elem_new(0);
65776#endif /* FREECIV_JSON_CONNECTION */
65777
65778 for (i = 0; i < real_packet->reqs_count; i++) {
65779#ifdef FREECIV_JSON_CONNECTION
65780 /* Next array element. */
65781 field_addr.sub_location->number = i;
65782#endif /* FREECIV_JSON_CONNECTION */
65783 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
65784 }
65785
65786#ifdef FREECIV_JSON_CONNECTION
65787 /* Exit array. */
65788 free(field_addr.sub_location);
65789 field_addr.sub_location = NULL;
65790#endif /* FREECIV_JSON_CONNECTION */
65791 }
65792 }
65793 if (BV_ISSET(fields, 8)) {
65794 log_packet_detailed(" field 'obs_count' has changed");
65795 #ifdef FREECIV_JSON_CONNECTION
65796 field_addr.name = "obs_count";
65797#endif /* FREECIV_JSON_CONNECTION */
65798 DIO_PUT(uint8, &dout, &field_addr, real_packet->obs_count);
65799 }
65800 if (BV_ISSET(fields, 9)) {
65801 log_packet_detailed(" field 'obs_reqs' has changed");
65802 #ifdef FREECIV_JSON_CONNECTION
65803 field_addr.name = "obs_reqs";
65804#endif /* FREECIV_JSON_CONNECTION */
65805
65806 {
65807 int i;
65808
65809#ifdef FREECIV_JSON_CONNECTION
65810 /* Create the array. */
65811 DIO_PUT(farray, &dout, &field_addr, real_packet->obs_count);
65812
65813 /* Enter the array. */
65814 field_addr.sub_location = plocation_elem_new(0);
65815#endif /* FREECIV_JSON_CONNECTION */
65816
65817 for (i = 0; i < real_packet->obs_count; i++) {
65818#ifdef FREECIV_JSON_CONNECTION
65819 /* Next array element. */
65820 field_addr.sub_location->number = i;
65821#endif /* FREECIV_JSON_CONNECTION */
65822 DIO_PUT(requirement, &dout, &field_addr, &real_packet->obs_reqs[i]);
65823 }
65824
65825#ifdef FREECIV_JSON_CONNECTION
65826 /* Exit array. */
65827 free(field_addr.sub_location);
65828 field_addr.sub_location = NULL;
65829#endif /* FREECIV_JSON_CONNECTION */
65830 }
65831 }
65832 if (BV_ISSET(fields, 10)) {
65833 log_packet_detailed(" field 'build_cost' has changed");
65834 #ifdef FREECIV_JSON_CONNECTION
65835 field_addr.name = "build_cost";
65836#endif /* FREECIV_JSON_CONNECTION */
65837 DIO_PUT(uint16, &dout, &field_addr, real_packet->build_cost);
65838 }
65839 if (BV_ISSET(fields, 11)) {
65840 log_packet_detailed(" field 'upkeep' has changed");
65841 #ifdef FREECIV_JSON_CONNECTION
65842 field_addr.name = "upkeep";
65843#endif /* FREECIV_JSON_CONNECTION */
65844 DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep);
65845 }
65846 if (BV_ISSET(fields, 12)) {
65847 log_packet_detailed(" field 'sabotage' has changed");
65848 #ifdef FREECIV_JSON_CONNECTION
65849 field_addr.name = "sabotage";
65850#endif /* FREECIV_JSON_CONNECTION */
65851 DIO_PUT(uint8, &dout, &field_addr, real_packet->sabotage);
65852 }
65853 if (BV_ISSET(fields, 13)) {
65854 log_packet_detailed(" field 'flags' has changed");
65855 #ifdef FREECIV_JSON_CONNECTION
65856 field_addr.name = "flags";
65857#endif /* FREECIV_JSON_CONNECTION */
65858 DIO_BV_PUT(&dout, &field_addr, packet->flags);
65859 }
65860 if (BV_ISSET(fields, 14)) {
65861 log_packet_detailed(" field 'soundtag' has changed");
65862 #ifdef FREECIV_JSON_CONNECTION
65863 field_addr.name = "soundtag";
65864#endif /* FREECIV_JSON_CONNECTION */
65865 DIO_PUT(string, &dout, &field_addr, real_packet->soundtag);
65866 }
65867 if (BV_ISSET(fields, 15)) {
65868 log_packet_detailed(" field 'soundtag_alt' has changed");
65869 #ifdef FREECIV_JSON_CONNECTION
65870 field_addr.name = "soundtag_alt";
65871#endif /* FREECIV_JSON_CONNECTION */
65872 DIO_PUT(string, &dout, &field_addr, real_packet->soundtag_alt);
65873 }
65874 if (BV_ISSET(fields, 16)) {
65875 log_packet_detailed(" field 'helptext' has changed");
65876 #ifdef FREECIV_JSON_CONNECTION
65877 field_addr.name = "helptext";
65878#endif /* FREECIV_JSON_CONNECTION */
65879 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
65880 }
65881
65882 *old = *real_packet;
65883#endif /* FREECIV_DELTA_PROTOCOL */
65884#ifndef FREECIV_DELTA_PROTOCOL
65885#ifdef FREECIV_JSON_CONNECTION
65886 field_addr.name = "id";
65887#endif /* FREECIV_JSON_CONNECTION */
65888 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
65889#ifdef FREECIV_JSON_CONNECTION
65890 field_addr.name = "genus";
65891#endif /* FREECIV_JSON_CONNECTION */
65892 DIO_PUT(uint8, &dout, &field_addr, real_packet->genus);
65893#ifdef FREECIV_JSON_CONNECTION
65894 field_addr.name = "name";
65895#endif /* FREECIV_JSON_CONNECTION */
65896 DIO_PUT(string, &dout, &field_addr, real_packet->name);
65897#ifdef FREECIV_JSON_CONNECTION
65898 field_addr.name = "rule_name";
65899#endif /* FREECIV_JSON_CONNECTION */
65900 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
65901#ifdef FREECIV_JSON_CONNECTION
65902 field_addr.name = "graphic_str";
65903#endif /* FREECIV_JSON_CONNECTION */
65904 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
65905#ifdef FREECIV_JSON_CONNECTION
65906 field_addr.name = "graphic_alt";
65907#endif /* FREECIV_JSON_CONNECTION */
65908 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
65909#ifdef FREECIV_JSON_CONNECTION
65910 field_addr.name = "reqs_count";
65911#endif /* FREECIV_JSON_CONNECTION */
65912 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
65913#ifdef FREECIV_JSON_CONNECTION
65914 field_addr.name = "reqs";
65915#endif /* FREECIV_JSON_CONNECTION */
65916
65917 {
65918 int i;
65919
65920#ifdef FREECIV_JSON_CONNECTION
65921 /* Create the array. */
65922 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
65923
65924 /* Enter the array. */
65925 field_addr.sub_location = plocation_elem_new(0);
65926#endif /* FREECIV_JSON_CONNECTION */
65927
65928 for (i = 0; i < real_packet->reqs_count; i++) {
65929#ifdef FREECIV_JSON_CONNECTION
65930 /* Next array element. */
65931 field_addr.sub_location->number = i;
65932#endif /* FREECIV_JSON_CONNECTION */
65933 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
65934 }
65935
65936#ifdef FREECIV_JSON_CONNECTION
65937 /* Exit array. */
65938 free(field_addr.sub_location);
65939 field_addr.sub_location = NULL;
65940#endif /* FREECIV_JSON_CONNECTION */
65941 }
65942#ifdef FREECIV_JSON_CONNECTION
65943 field_addr.name = "obs_count";
65944#endif /* FREECIV_JSON_CONNECTION */
65945 DIO_PUT(uint8, &dout, &field_addr, real_packet->obs_count);
65946#ifdef FREECIV_JSON_CONNECTION
65947 field_addr.name = "obs_reqs";
65948#endif /* FREECIV_JSON_CONNECTION */
65949
65950 {
65951 int i;
65952
65953#ifdef FREECIV_JSON_CONNECTION
65954 /* Create the array. */
65955 DIO_PUT(farray, &dout, &field_addr, real_packet->obs_count);
65956
65957 /* Enter the array. */
65958 field_addr.sub_location = plocation_elem_new(0);
65959#endif /* FREECIV_JSON_CONNECTION */
65960
65961 for (i = 0; i < real_packet->obs_count; i++) {
65962#ifdef FREECIV_JSON_CONNECTION
65963 /* Next array element. */
65964 field_addr.sub_location->number = i;
65965#endif /* FREECIV_JSON_CONNECTION */
65966 DIO_PUT(requirement, &dout, &field_addr, &real_packet->obs_reqs[i]);
65967 }
65968
65969#ifdef FREECIV_JSON_CONNECTION
65970 /* Exit array. */
65971 free(field_addr.sub_location);
65972 field_addr.sub_location = NULL;
65973#endif /* FREECIV_JSON_CONNECTION */
65974 }
65975#ifdef FREECIV_JSON_CONNECTION
65976 field_addr.name = "build_cost";
65977#endif /* FREECIV_JSON_CONNECTION */
65978 DIO_PUT(uint16, &dout, &field_addr, real_packet->build_cost);
65979#ifdef FREECIV_JSON_CONNECTION
65980 field_addr.name = "upkeep";
65981#endif /* FREECIV_JSON_CONNECTION */
65982 DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep);
65983#ifdef FREECIV_JSON_CONNECTION
65984 field_addr.name = "sabotage";
65985#endif /* FREECIV_JSON_CONNECTION */
65986 DIO_PUT(uint8, &dout, &field_addr, real_packet->sabotage);
65987#ifdef FREECIV_JSON_CONNECTION
65988 field_addr.name = "flags";
65989#endif /* FREECIV_JSON_CONNECTION */
65990 DIO_BV_PUT(&dout, &field_addr, packet->flags);
65991#ifdef FREECIV_JSON_CONNECTION
65992 field_addr.name = "soundtag";
65993#endif /* FREECIV_JSON_CONNECTION */
65994 DIO_PUT(string, &dout, &field_addr, real_packet->soundtag);
65995#ifdef FREECIV_JSON_CONNECTION
65996 field_addr.name = "soundtag_alt";
65997#endif /* FREECIV_JSON_CONNECTION */
65998 DIO_PUT(string, &dout, &field_addr, real_packet->soundtag_alt);
65999#ifdef FREECIV_JSON_CONNECTION
66000 field_addr.name = "helptext";
66001#endif /* FREECIV_JSON_CONNECTION */
66002 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
66003
66004#endif
66005 SEND_PACKET_END(PACKET_RULESET_BUILDING);
66006}
66007
66008 int send_packet_ruleset_building(struct connection *pc, const struct packet_ruleset_building *packet)
66009{
66010 if (!pc->used) {
66011 log_error("WARNING: trying to send data to the closed connection %s",
66012 conn_description(pc));
66013 return -1;
66014 }
66015 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_BUILDING].packet != NULL, -1,
66016 "Handler for PACKET_RULESET_BUILDING not installed");
66017 return pc->phs.handlers->send[PACKET_RULESET_BUILDING].packet(pc, packet);
66018}
66019
66020 void lsend_packet_ruleset_building(struct conn_list *dest, const struct packet_ruleset_building *packet)
66021{
66022 conn_list_iterate(dest, pconn) {
66023 send_packet_ruleset_building(pconn, packet);
66024 } conn_list_iterate_end;
66025}
66026
66027#ifdef FREECIV_DELTA_PROTOCOL
66028#define hash_packet_ruleset_terrain_100 hash_const
66029
66030#define cmp_packet_ruleset_terrain_100 cmp_const
66031
66032 BV_DEFINE(packet_ruleset_terrain_100_fields, 35);
66033#endif /* FREECIV_DELTA_PROTOCOL */
66034
66035 static struct packet_ruleset_terrain *receive_packet_ruleset_terrain_100(struct connection *pc)
66036{
66037#ifdef FREECIV_DELTA_PROTOCOL
66038 packet_ruleset_terrain_100_fields fields;
66039 struct packet_ruleset_terrain *old;
66040 struct genhash **hash = pc->phs.received + PACKET_RULESET_TERRAIN;
66041#endif /* FREECIV_DELTA_PROTOCOL */
66042 RECEIVE_PACKET_START(packet_ruleset_terrain, real_packet);
66043#ifdef FREECIV_JSON_CONNECTION
66044 struct plocation field_addr;
66045 {
66046 struct plocation *field_addr_tmp = plocation_field_new(NULL);
66047 field_addr = *field_addr_tmp;
66048 FC_FREE(field_addr_tmp);
66049 }
66050#endif /* FREECIV_JSON_CONNECTION */
66051
66052#ifdef FREECIV_DELTA_PROTOCOL
66053#ifdef FREECIV_JSON_CONNECTION
66054 field_addr.name = "fields";
66055#endif /* FREECIV_JSON_CONNECTION */
66056 DIO_BV_GET(&din, &field_addr, fields);
66057
66058#else /* FREECIV_DELTA_PROTOCOL */
66059 #ifdef FREECIV_JSON_CONNECTION
66060 field_addr.name = "id";
66061 #endif /* FREECIV_JSON_CONNECTION */
66062 {
66063 int readin;
66064
66065 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66066 RECEIVE_PACKET_FIELD_ERROR(id);
66067 }
66068 real_packet->id = readin;
66069 }
66070 #ifdef FREECIV_JSON_CONNECTION
66071 field_addr.name = "tclass";
66072 #endif /* FREECIV_JSON_CONNECTION */
66073 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tclass)) {
66074 RECEIVE_PACKET_FIELD_ERROR(tclass);
66075 }
66076 #ifdef FREECIV_JSON_CONNECTION
66077 field_addr.name = "flags";
66078 #endif /* FREECIV_JSON_CONNECTION */
66079 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
66080 RECEIVE_PACKET_FIELD_ERROR(flags);
66081 }
66082 #ifdef FREECIV_JSON_CONNECTION
66083 field_addr.name = "native_to";
66084 #endif /* FREECIV_JSON_CONNECTION */
66085 if (!DIO_BV_GET(&din, &field_addr, real_packet->native_to)) {
66086 RECEIVE_PACKET_FIELD_ERROR(native_to);
66087 }
66088 #ifdef FREECIV_JSON_CONNECTION
66089 field_addr.name = "name";
66090 #endif /* FREECIV_JSON_CONNECTION */
66091 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
66092 RECEIVE_PACKET_FIELD_ERROR(name);
66093 }
66094 #ifdef FREECIV_JSON_CONNECTION
66095 field_addr.name = "rule_name";
66096 #endif /* FREECIV_JSON_CONNECTION */
66097 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
66098 RECEIVE_PACKET_FIELD_ERROR(rule_name);
66099 }
66100 #ifdef FREECIV_JSON_CONNECTION
66101 field_addr.name = "graphic_str";
66102 #endif /* FREECIV_JSON_CONNECTION */
66103 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
66104 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
66105 }
66106 #ifdef FREECIV_JSON_CONNECTION
66107 field_addr.name = "graphic_alt";
66108 #endif /* FREECIV_JSON_CONNECTION */
66109 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
66110 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
66111 }
66112 #ifdef FREECIV_JSON_CONNECTION
66113 field_addr.name = "movement_cost";
66114 #endif /* FREECIV_JSON_CONNECTION */
66115 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->movement_cost)) {
66116 RECEIVE_PACKET_FIELD_ERROR(movement_cost);
66117 }
66118 #ifdef FREECIV_JSON_CONNECTION
66119 field_addr.name = "defense_bonus";
66120 #endif /* FREECIV_JSON_CONNECTION */
66121 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->defense_bonus)) {
66122 RECEIVE_PACKET_FIELD_ERROR(defense_bonus);
66123 }
66124 #ifdef FREECIV_JSON_CONNECTION
66125 field_addr.name = "output";
66126 #endif /* FREECIV_JSON_CONNECTION */
66127
66128 {
66129 int i;
66130
66131 #ifdef FREECIV_JSON_CONNECTION
66132 /* Enter array. */
66133 field_addr.sub_location = plocation_elem_new(0);
66134 #endif /* FREECIV_JSON_CONNECTION */
66135
66136 for (i = 0; i < O_LAST; i++) {
66137 #ifdef FREECIV_JSON_CONNECTION
66138 field_addr.sub_location->number = i;
66139 #endif /* FREECIV_JSON_CONNECTION */
66140 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output[i])) {
66141 RECEIVE_PACKET_FIELD_ERROR(output);
66142 }
66143 }
66144
66145 #ifdef FREECIV_JSON_CONNECTION
66146 /* Exit array. */
66147 free(field_addr.sub_location);
66148 field_addr.sub_location = NULL;
66149 #endif /* FREECIV_JSON_CONNECTION */
66150 }
66151 #ifdef FREECIV_JSON_CONNECTION
66152 field_addr.name = "num_resources";
66153 #endif /* FREECIV_JSON_CONNECTION */
66154 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num_resources)) {
66155 RECEIVE_PACKET_FIELD_ERROR(num_resources);
66156 }
66157 #ifdef FREECIV_JSON_CONNECTION
66158 field_addr.name = "resources";
66159 #endif /* FREECIV_JSON_CONNECTION */
66160
66161 {
66162 int i;
66163
66164 #ifdef FREECIV_JSON_CONNECTION
66165 /* Enter array. */
66166 field_addr.sub_location = plocation_elem_new(0);
66167 #endif /* FREECIV_JSON_CONNECTION */
66168
66169 if (real_packet->num_resources > MAX_RESOURCE_TYPES) {
66170 RECEIVE_PACKET_FIELD_ERROR(resources, ": truncation array");
66171 }
66172 for (i = 0; i < real_packet->num_resources; i++) {
66173 #ifdef FREECIV_JSON_CONNECTION
66174 field_addr.sub_location->number = i;
66175 #endif /* FREECIV_JSON_CONNECTION */
66176 {
66177 int readin;
66178
66179 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66180 RECEIVE_PACKET_FIELD_ERROR(resources);
66181 }
66182 real_packet->resources[i] = readin;
66183 }
66184 }
66185
66186 #ifdef FREECIV_JSON_CONNECTION
66187 /* Exit array. */
66188 free(field_addr.sub_location);
66189 field_addr.sub_location = NULL;
66190 #endif /* FREECIV_JSON_CONNECTION */
66191 }
66192 #ifdef FREECIV_JSON_CONNECTION
66193 field_addr.name = "road_output_incr_pct";
66194 #endif /* FREECIV_JSON_CONNECTION */
66195
66196 {
66197 int i;
66198
66199 #ifdef FREECIV_JSON_CONNECTION
66200 /* Enter array. */
66201 field_addr.sub_location = plocation_elem_new(0);
66202 #endif /* FREECIV_JSON_CONNECTION */
66203
66204 for (i = 0; i < O_LAST; i++) {
66205 #ifdef FREECIV_JSON_CONNECTION
66206 field_addr.sub_location->number = i;
66207 #endif /* FREECIV_JSON_CONNECTION */
66208 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->road_output_incr_pct[i])) {
66209 RECEIVE_PACKET_FIELD_ERROR(road_output_incr_pct);
66210 }
66211 }
66212
66213 #ifdef FREECIV_JSON_CONNECTION
66214 /* Exit array. */
66215 free(field_addr.sub_location);
66216 field_addr.sub_location = NULL;
66217 #endif /* FREECIV_JSON_CONNECTION */
66218 }
66219 #ifdef FREECIV_JSON_CONNECTION
66220 field_addr.name = "base_time";
66221 #endif /* FREECIV_JSON_CONNECTION */
66222 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_time)) {
66223 RECEIVE_PACKET_FIELD_ERROR(base_time);
66224 }
66225 #ifdef FREECIV_JSON_CONNECTION
66226 field_addr.name = "road_time";
66227 #endif /* FREECIV_JSON_CONNECTION */
66228 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->road_time)) {
66229 RECEIVE_PACKET_FIELD_ERROR(road_time);
66230 }
66231 #ifdef FREECIV_JSON_CONNECTION
66232 field_addr.name = "cultivate_result";
66233 #endif /* FREECIV_JSON_CONNECTION */
66234 {
66235 int readin;
66236
66237 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66238 RECEIVE_PACKET_FIELD_ERROR(cultivate_result);
66239 }
66240 real_packet->cultivate_result = readin;
66241 }
66242 #ifdef FREECIV_JSON_CONNECTION
66243 field_addr.name = "cultivate_time";
66244 #endif /* FREECIV_JSON_CONNECTION */
66245 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->cultivate_time)) {
66246 RECEIVE_PACKET_FIELD_ERROR(cultivate_time);
66247 }
66248 #ifdef FREECIV_JSON_CONNECTION
66249 field_addr.name = "plant_result";
66250 #endif /* FREECIV_JSON_CONNECTION */
66251 {
66252 int readin;
66253
66254 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66255 RECEIVE_PACKET_FIELD_ERROR(plant_result);
66256 }
66257 real_packet->plant_result = readin;
66258 }
66259 #ifdef FREECIV_JSON_CONNECTION
66260 field_addr.name = "plant_time";
66261 #endif /* FREECIV_JSON_CONNECTION */
66262 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->plant_time)) {
66263 RECEIVE_PACKET_FIELD_ERROR(plant_time);
66264 }
66265 #ifdef FREECIV_JSON_CONNECTION
66266 field_addr.name = "irrigation_food_incr";
66267 #endif /* FREECIV_JSON_CONNECTION */
66268 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->irrigation_food_incr)) {
66269 RECEIVE_PACKET_FIELD_ERROR(irrigation_food_incr);
66270 }
66271 #ifdef FREECIV_JSON_CONNECTION
66272 field_addr.name = "irrigation_time";
66273 #endif /* FREECIV_JSON_CONNECTION */
66274 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->irrigation_time)) {
66275 RECEIVE_PACKET_FIELD_ERROR(irrigation_time);
66276 }
66277 #ifdef FREECIV_JSON_CONNECTION
66278 field_addr.name = "mining_shield_incr";
66279 #endif /* FREECIV_JSON_CONNECTION */
66280 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->mining_shield_incr)) {
66281 RECEIVE_PACKET_FIELD_ERROR(mining_shield_incr);
66282 }
66283 #ifdef FREECIV_JSON_CONNECTION
66284 field_addr.name = "mining_time";
66285 #endif /* FREECIV_JSON_CONNECTION */
66286 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->mining_time)) {
66287 RECEIVE_PACKET_FIELD_ERROR(mining_time);
66288 }
66289 #ifdef FREECIV_JSON_CONNECTION
66290 field_addr.name = "animal";
66291 #endif /* FREECIV_JSON_CONNECTION */
66292 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->animal)) {
66293 RECEIVE_PACKET_FIELD_ERROR(animal);
66294 }
66295 #ifdef FREECIV_JSON_CONNECTION
66296 field_addr.name = "transform_result";
66297 #endif /* FREECIV_JSON_CONNECTION */
66298 {
66299 int readin;
66300
66301 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66302 RECEIVE_PACKET_FIELD_ERROR(transform_result);
66303 }
66304 real_packet->transform_result = readin;
66305 }
66306 #ifdef FREECIV_JSON_CONNECTION
66307 field_addr.name = "transform_time";
66308 #endif /* FREECIV_JSON_CONNECTION */
66309 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->transform_time)) {
66310 RECEIVE_PACKET_FIELD_ERROR(transform_time);
66311 }
66312 #ifdef FREECIV_JSON_CONNECTION
66313 field_addr.name = "placing_time";
66314 #endif /* FREECIV_JSON_CONNECTION */
66315 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->placing_time)) {
66316 RECEIVE_PACKET_FIELD_ERROR(placing_time);
66317 }
66318 #ifdef FREECIV_JSON_CONNECTION
66319 field_addr.name = "clean_pollution_time";
66320 #endif /* FREECIV_JSON_CONNECTION */
66321 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->clean_pollution_time)) {
66322 RECEIVE_PACKET_FIELD_ERROR(clean_pollution_time);
66323 }
66324 #ifdef FREECIV_JSON_CONNECTION
66325 field_addr.name = "clean_fallout_time";
66326 #endif /* FREECIV_JSON_CONNECTION */
66327 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->clean_fallout_time)) {
66328 RECEIVE_PACKET_FIELD_ERROR(clean_fallout_time);
66329 }
66330 #ifdef FREECIV_JSON_CONNECTION
66331 field_addr.name = "pillage_time";
66332 #endif /* FREECIV_JSON_CONNECTION */
66333 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pillage_time)) {
66334 RECEIVE_PACKET_FIELD_ERROR(pillage_time);
66335 }
66336 #ifdef FREECIV_JSON_CONNECTION
66337 field_addr.name = "color_red";
66338 #endif /* FREECIV_JSON_CONNECTION */
66339 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_red)) {
66340 RECEIVE_PACKET_FIELD_ERROR(color_red);
66341 }
66342 #ifdef FREECIV_JSON_CONNECTION
66343 field_addr.name = "color_green";
66344 #endif /* FREECIV_JSON_CONNECTION */
66345 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_green)) {
66346 RECEIVE_PACKET_FIELD_ERROR(color_green);
66347 }
66348 #ifdef FREECIV_JSON_CONNECTION
66349 field_addr.name = "color_blue";
66350 #endif /* FREECIV_JSON_CONNECTION */
66351 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_blue)) {
66352 RECEIVE_PACKET_FIELD_ERROR(color_blue);
66353 }
66354 #ifdef FREECIV_JSON_CONNECTION
66355 field_addr.name = "helptext";
66356 #endif /* FREECIV_JSON_CONNECTION */
66357 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
66358 RECEIVE_PACKET_FIELD_ERROR(helptext);
66359 }
66360
66361#endif
66362 log_packet_detailed("packet_ruleset_terrain_100: got info about ()");
66363
66364#ifdef FREECIV_DELTA_PROTOCOL
66365 if (NULL == *hash) {
66366 *hash = genhash_new_full(hash_packet_ruleset_terrain_100, cmp_packet_ruleset_terrain_100,
66367 NULL, NULL, NULL, free);
66368 }
66369
66370 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
66371 *real_packet = *old;
66372 } else {
66373 log_packet_detailed(" no old info");
66374 memset(real_packet, 0, sizeof(*real_packet));
66375 }
66376
66377 if (BV_ISSET(fields, 0)) {
66378 log_packet_detailed(" got field 'id'");
66379 #ifdef FREECIV_JSON_CONNECTION
66380 field_addr.name = "id";
66381 #endif /* FREECIV_JSON_CONNECTION */
66382 {
66383 int readin;
66384
66385 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66386 RECEIVE_PACKET_FIELD_ERROR(id);
66387 }
66388 real_packet->id = readin;
66389 }
66390 }
66391 if (BV_ISSET(fields, 1)) {
66392 log_packet_detailed(" got field 'tclass'");
66393 #ifdef FREECIV_JSON_CONNECTION
66394 field_addr.name = "tclass";
66395 #endif /* FREECIV_JSON_CONNECTION */
66396 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tclass)) {
66397 RECEIVE_PACKET_FIELD_ERROR(tclass);
66398 }
66399 }
66400 if (BV_ISSET(fields, 2)) {
66401 log_packet_detailed(" got field 'flags'");
66402 #ifdef FREECIV_JSON_CONNECTION
66403 field_addr.name = "flags";
66404 #endif /* FREECIV_JSON_CONNECTION */
66405 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
66406 RECEIVE_PACKET_FIELD_ERROR(flags);
66407 }
66408 }
66409 if (BV_ISSET(fields, 3)) {
66410 log_packet_detailed(" got field 'native_to'");
66411 #ifdef FREECIV_JSON_CONNECTION
66412 field_addr.name = "native_to";
66413 #endif /* FREECIV_JSON_CONNECTION */
66414 if (!DIO_BV_GET(&din, &field_addr, real_packet->native_to)) {
66415 RECEIVE_PACKET_FIELD_ERROR(native_to);
66416 }
66417 }
66418 if (BV_ISSET(fields, 4)) {
66419 log_packet_detailed(" got field 'name'");
66420 #ifdef FREECIV_JSON_CONNECTION
66421 field_addr.name = "name";
66422 #endif /* FREECIV_JSON_CONNECTION */
66423 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
66424 RECEIVE_PACKET_FIELD_ERROR(name);
66425 }
66426 }
66427 if (BV_ISSET(fields, 5)) {
66428 log_packet_detailed(" got field 'rule_name'");
66429 #ifdef FREECIV_JSON_CONNECTION
66430 field_addr.name = "rule_name";
66431 #endif /* FREECIV_JSON_CONNECTION */
66432 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
66433 RECEIVE_PACKET_FIELD_ERROR(rule_name);
66434 }
66435 }
66436 if (BV_ISSET(fields, 6)) {
66437 log_packet_detailed(" got field 'graphic_str'");
66438 #ifdef FREECIV_JSON_CONNECTION
66439 field_addr.name = "graphic_str";
66440 #endif /* FREECIV_JSON_CONNECTION */
66441 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
66442 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
66443 }
66444 }
66445 if (BV_ISSET(fields, 7)) {
66446 log_packet_detailed(" got field 'graphic_alt'");
66447 #ifdef FREECIV_JSON_CONNECTION
66448 field_addr.name = "graphic_alt";
66449 #endif /* FREECIV_JSON_CONNECTION */
66450 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
66451 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
66452 }
66453 }
66454 if (BV_ISSET(fields, 8)) {
66455 log_packet_detailed(" got field 'movement_cost'");
66456 #ifdef FREECIV_JSON_CONNECTION
66457 field_addr.name = "movement_cost";
66458 #endif /* FREECIV_JSON_CONNECTION */
66459 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->movement_cost)) {
66460 RECEIVE_PACKET_FIELD_ERROR(movement_cost);
66461 }
66462 }
66463 if (BV_ISSET(fields, 9)) {
66464 log_packet_detailed(" got field 'defense_bonus'");
66465 #ifdef FREECIV_JSON_CONNECTION
66466 field_addr.name = "defense_bonus";
66467 #endif /* FREECIV_JSON_CONNECTION */
66468 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->defense_bonus)) {
66469 RECEIVE_PACKET_FIELD_ERROR(defense_bonus);
66470 }
66471 }
66472 if (BV_ISSET(fields, 10)) {
66473 log_packet_detailed(" got field 'output'");
66474 #ifdef FREECIV_JSON_CONNECTION
66475 field_addr.name = "output";
66476 #endif /* FREECIV_JSON_CONNECTION */
66477
66478 {
66479 int i;
66480
66481 #ifdef FREECIV_JSON_CONNECTION
66482 /* Enter array. */
66483 field_addr.sub_location = plocation_elem_new(0);
66484 #endif /* FREECIV_JSON_CONNECTION */
66485
66486 for (i = 0; i < O_LAST; i++) {
66487 #ifdef FREECIV_JSON_CONNECTION
66488 field_addr.sub_location->number = i;
66489 #endif /* FREECIV_JSON_CONNECTION */
66490 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output[i])) {
66491 RECEIVE_PACKET_FIELD_ERROR(output);
66492 }
66493 }
66494
66495 #ifdef FREECIV_JSON_CONNECTION
66496 /* Exit array. */
66497 free(field_addr.sub_location);
66498 field_addr.sub_location = NULL;
66499 #endif /* FREECIV_JSON_CONNECTION */
66500 }
66501 }
66502 if (BV_ISSET(fields, 11)) {
66503 log_packet_detailed(" got field 'num_resources'");
66504 #ifdef FREECIV_JSON_CONNECTION
66505 field_addr.name = "num_resources";
66506 #endif /* FREECIV_JSON_CONNECTION */
66507 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num_resources)) {
66508 RECEIVE_PACKET_FIELD_ERROR(num_resources);
66509 }
66510 }
66511 if (BV_ISSET(fields, 12)) {
66512 log_packet_detailed(" got field 'resources'");
66513 #ifdef FREECIV_JSON_CONNECTION
66514 field_addr.name = "resources";
66515 #endif /* FREECIV_JSON_CONNECTION */
66516
66517 {
66518 int i;
66519
66520 #ifdef FREECIV_JSON_CONNECTION
66521 /* Enter array. */
66522 field_addr.sub_location = plocation_elem_new(0);
66523 #endif /* FREECIV_JSON_CONNECTION */
66524
66525 if (real_packet->num_resources > MAX_RESOURCE_TYPES) {
66526 RECEIVE_PACKET_FIELD_ERROR(resources, ": truncation array");
66527 }
66528 for (i = 0; i < real_packet->num_resources; i++) {
66529 #ifdef FREECIV_JSON_CONNECTION
66530 field_addr.sub_location->number = i;
66531 #endif /* FREECIV_JSON_CONNECTION */
66532 {
66533 int readin;
66534
66535 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66536 RECEIVE_PACKET_FIELD_ERROR(resources);
66537 }
66538 real_packet->resources[i] = readin;
66539 }
66540 }
66541
66542 #ifdef FREECIV_JSON_CONNECTION
66543 /* Exit array. */
66544 free(field_addr.sub_location);
66545 field_addr.sub_location = NULL;
66546 #endif /* FREECIV_JSON_CONNECTION */
66547 }
66548 }
66549 if (BV_ISSET(fields, 13)) {
66550 log_packet_detailed(" got field 'road_output_incr_pct'");
66551 #ifdef FREECIV_JSON_CONNECTION
66552 field_addr.name = "road_output_incr_pct";
66553 #endif /* FREECIV_JSON_CONNECTION */
66554
66555 {
66556 int i;
66557
66558 #ifdef FREECIV_JSON_CONNECTION
66559 /* Enter array. */
66560 field_addr.sub_location = plocation_elem_new(0);
66561 #endif /* FREECIV_JSON_CONNECTION */
66562
66563 for (i = 0; i < O_LAST; i++) {
66564 #ifdef FREECIV_JSON_CONNECTION
66565 field_addr.sub_location->number = i;
66566 #endif /* FREECIV_JSON_CONNECTION */
66567 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->road_output_incr_pct[i])) {
66568 RECEIVE_PACKET_FIELD_ERROR(road_output_incr_pct);
66569 }
66570 }
66571
66572 #ifdef FREECIV_JSON_CONNECTION
66573 /* Exit array. */
66574 free(field_addr.sub_location);
66575 field_addr.sub_location = NULL;
66576 #endif /* FREECIV_JSON_CONNECTION */
66577 }
66578 }
66579 if (BV_ISSET(fields, 14)) {
66580 log_packet_detailed(" got field 'base_time'");
66581 #ifdef FREECIV_JSON_CONNECTION
66582 field_addr.name = "base_time";
66583 #endif /* FREECIV_JSON_CONNECTION */
66584 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_time)) {
66585 RECEIVE_PACKET_FIELD_ERROR(base_time);
66586 }
66587 }
66588 if (BV_ISSET(fields, 15)) {
66589 log_packet_detailed(" got field 'road_time'");
66590 #ifdef FREECIV_JSON_CONNECTION
66591 field_addr.name = "road_time";
66592 #endif /* FREECIV_JSON_CONNECTION */
66593 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->road_time)) {
66594 RECEIVE_PACKET_FIELD_ERROR(road_time);
66595 }
66596 }
66597 if (BV_ISSET(fields, 16)) {
66598 log_packet_detailed(" got field 'cultivate_result'");
66599 #ifdef FREECIV_JSON_CONNECTION
66600 field_addr.name = "cultivate_result";
66601 #endif /* FREECIV_JSON_CONNECTION */
66602 {
66603 int readin;
66604
66605 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66606 RECEIVE_PACKET_FIELD_ERROR(cultivate_result);
66607 }
66608 real_packet->cultivate_result = readin;
66609 }
66610 }
66611 if (BV_ISSET(fields, 17)) {
66612 log_packet_detailed(" got field 'cultivate_time'");
66613 #ifdef FREECIV_JSON_CONNECTION
66614 field_addr.name = "cultivate_time";
66615 #endif /* FREECIV_JSON_CONNECTION */
66616 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->cultivate_time)) {
66617 RECEIVE_PACKET_FIELD_ERROR(cultivate_time);
66618 }
66619 }
66620 if (BV_ISSET(fields, 18)) {
66621 log_packet_detailed(" got field 'plant_result'");
66622 #ifdef FREECIV_JSON_CONNECTION
66623 field_addr.name = "plant_result";
66624 #endif /* FREECIV_JSON_CONNECTION */
66625 {
66626 int readin;
66627
66628 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66629 RECEIVE_PACKET_FIELD_ERROR(plant_result);
66630 }
66631 real_packet->plant_result = readin;
66632 }
66633 }
66634 if (BV_ISSET(fields, 19)) {
66635 log_packet_detailed(" got field 'plant_time'");
66636 #ifdef FREECIV_JSON_CONNECTION
66637 field_addr.name = "plant_time";
66638 #endif /* FREECIV_JSON_CONNECTION */
66639 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->plant_time)) {
66640 RECEIVE_PACKET_FIELD_ERROR(plant_time);
66641 }
66642 }
66643 if (BV_ISSET(fields, 20)) {
66644 log_packet_detailed(" got field 'irrigation_food_incr'");
66645 #ifdef FREECIV_JSON_CONNECTION
66646 field_addr.name = "irrigation_food_incr";
66647 #endif /* FREECIV_JSON_CONNECTION */
66648 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->irrigation_food_incr)) {
66649 RECEIVE_PACKET_FIELD_ERROR(irrigation_food_incr);
66650 }
66651 }
66652 if (BV_ISSET(fields, 21)) {
66653 log_packet_detailed(" got field 'irrigation_time'");
66654 #ifdef FREECIV_JSON_CONNECTION
66655 field_addr.name = "irrigation_time";
66656 #endif /* FREECIV_JSON_CONNECTION */
66657 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->irrigation_time)) {
66658 RECEIVE_PACKET_FIELD_ERROR(irrigation_time);
66659 }
66660 }
66661 if (BV_ISSET(fields, 22)) {
66662 log_packet_detailed(" got field 'mining_shield_incr'");
66663 #ifdef FREECIV_JSON_CONNECTION
66664 field_addr.name = "mining_shield_incr";
66665 #endif /* FREECIV_JSON_CONNECTION */
66666 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->mining_shield_incr)) {
66667 RECEIVE_PACKET_FIELD_ERROR(mining_shield_incr);
66668 }
66669 }
66670 if (BV_ISSET(fields, 23)) {
66671 log_packet_detailed(" got field 'mining_time'");
66672 #ifdef FREECIV_JSON_CONNECTION
66673 field_addr.name = "mining_time";
66674 #endif /* FREECIV_JSON_CONNECTION */
66675 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->mining_time)) {
66676 RECEIVE_PACKET_FIELD_ERROR(mining_time);
66677 }
66678 }
66679 if (BV_ISSET(fields, 24)) {
66680 log_packet_detailed(" got field 'animal'");
66681 #ifdef FREECIV_JSON_CONNECTION
66682 field_addr.name = "animal";
66683 #endif /* FREECIV_JSON_CONNECTION */
66684 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->animal)) {
66685 RECEIVE_PACKET_FIELD_ERROR(animal);
66686 }
66687 }
66688 if (BV_ISSET(fields, 25)) {
66689 log_packet_detailed(" got field 'transform_result'");
66690 #ifdef FREECIV_JSON_CONNECTION
66691 field_addr.name = "transform_result";
66692 #endif /* FREECIV_JSON_CONNECTION */
66693 {
66694 int readin;
66695
66696 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66697 RECEIVE_PACKET_FIELD_ERROR(transform_result);
66698 }
66699 real_packet->transform_result = readin;
66700 }
66701 }
66702 if (BV_ISSET(fields, 26)) {
66703 log_packet_detailed(" got field 'transform_time'");
66704 #ifdef FREECIV_JSON_CONNECTION
66705 field_addr.name = "transform_time";
66706 #endif /* FREECIV_JSON_CONNECTION */
66707 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->transform_time)) {
66708 RECEIVE_PACKET_FIELD_ERROR(transform_time);
66709 }
66710 }
66711 if (BV_ISSET(fields, 27)) {
66712 log_packet_detailed(" got field 'placing_time'");
66713 #ifdef FREECIV_JSON_CONNECTION
66714 field_addr.name = "placing_time";
66715 #endif /* FREECIV_JSON_CONNECTION */
66716 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->placing_time)) {
66717 RECEIVE_PACKET_FIELD_ERROR(placing_time);
66718 }
66719 }
66720 if (BV_ISSET(fields, 28)) {
66721 log_packet_detailed(" got field 'clean_pollution_time'");
66722 #ifdef FREECIV_JSON_CONNECTION
66723 field_addr.name = "clean_pollution_time";
66724 #endif /* FREECIV_JSON_CONNECTION */
66725 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->clean_pollution_time)) {
66726 RECEIVE_PACKET_FIELD_ERROR(clean_pollution_time);
66727 }
66728 }
66729 if (BV_ISSET(fields, 29)) {
66730 log_packet_detailed(" got field 'clean_fallout_time'");
66731 #ifdef FREECIV_JSON_CONNECTION
66732 field_addr.name = "clean_fallout_time";
66733 #endif /* FREECIV_JSON_CONNECTION */
66734 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->clean_fallout_time)) {
66735 RECEIVE_PACKET_FIELD_ERROR(clean_fallout_time);
66736 }
66737 }
66738 if (BV_ISSET(fields, 30)) {
66739 log_packet_detailed(" got field 'pillage_time'");
66740 #ifdef FREECIV_JSON_CONNECTION
66741 field_addr.name = "pillage_time";
66742 #endif /* FREECIV_JSON_CONNECTION */
66743 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pillage_time)) {
66744 RECEIVE_PACKET_FIELD_ERROR(pillage_time);
66745 }
66746 }
66747 if (BV_ISSET(fields, 31)) {
66748 log_packet_detailed(" got field 'color_red'");
66749 #ifdef FREECIV_JSON_CONNECTION
66750 field_addr.name = "color_red";
66751 #endif /* FREECIV_JSON_CONNECTION */
66752 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_red)) {
66753 RECEIVE_PACKET_FIELD_ERROR(color_red);
66754 }
66755 }
66756 if (BV_ISSET(fields, 32)) {
66757 log_packet_detailed(" got field 'color_green'");
66758 #ifdef FREECIV_JSON_CONNECTION
66759 field_addr.name = "color_green";
66760 #endif /* FREECIV_JSON_CONNECTION */
66761 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_green)) {
66762 RECEIVE_PACKET_FIELD_ERROR(color_green);
66763 }
66764 }
66765 if (BV_ISSET(fields, 33)) {
66766 log_packet_detailed(" got field 'color_blue'");
66767 #ifdef FREECIV_JSON_CONNECTION
66768 field_addr.name = "color_blue";
66769 #endif /* FREECIV_JSON_CONNECTION */
66770 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_blue)) {
66771 RECEIVE_PACKET_FIELD_ERROR(color_blue);
66772 }
66773 }
66774 if (BV_ISSET(fields, 34)) {
66775 log_packet_detailed(" got field 'helptext'");
66776 #ifdef FREECIV_JSON_CONNECTION
66777 field_addr.name = "helptext";
66778 #endif /* FREECIV_JSON_CONNECTION */
66779 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
66780 RECEIVE_PACKET_FIELD_ERROR(helptext);
66781 }
66782 }
66783
66784 if (NULL == old) {
66785 old = fc_malloc(sizeof(*old));
66786 *old = *real_packet;
66787 genhash_insert(*hash, old, old);
66788 } else {
66789 *old = *real_packet;
66790 }
66791
66792#endif /* FREECIV_DELTA_PROTOCOL */
66793 RECEIVE_PACKET_END(real_packet);
66794}
66795
66796 static int send_packet_ruleset_terrain_100(struct connection *pc, const struct packet_ruleset_terrain *packet)
66797{
66798 const struct packet_ruleset_terrain *real_packet = packet;
66799#ifdef FREECIV_DELTA_PROTOCOL
66800 packet_ruleset_terrain_100_fields fields;
66801 struct packet_ruleset_terrain *old;
66802 bool differ;
66803 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TERRAIN;
66804#endif /* FREECIV_DELTA_PROTOCOL */
66805 SEND_PACKET_START(PACKET_RULESET_TERRAIN);
66806#ifdef FREECIV_JSON_CONNECTION
66807 struct plocation field_addr;
66808 {
66809 struct plocation *field_addr_tmp = plocation_field_new(NULL);
66810 field_addr = *field_addr_tmp;
66811 FC_FREE(field_addr_tmp);
66812 }
66813#endif /* FREECIV_JSON_CONNECTION */
66814
66815 log_packet_detailed("packet_ruleset_terrain_100: sending info about ()");
66816
66817#ifdef FREECIV_DELTA_PROTOCOL
66818 if (NULL == *hash) {
66819 *hash = genhash_new_full(hash_packet_ruleset_terrain_100, cmp_packet_ruleset_terrain_100,
66820 NULL, NULL, NULL, free);
66821 }
66822 BV_CLR_ALL(fields);
66823
66824 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
66825 old = fc_malloc(sizeof(*old));
66826 *old = *real_packet;
66827 genhash_insert(*hash, old, old);
66828 memset(old, 0, sizeof(*old));
66829 }
66830 differ = (old->id != real_packet->id);
66831 if (differ) {
66832 BV_SET(fields, 0);
66833 }
66834
66835 differ = (old->tclass != real_packet->tclass);
66836 if (differ) {
66837 BV_SET(fields, 1);
66838 }
66839
66840 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
66841 if (differ) {
66842 BV_SET(fields, 2);
66843 }
66844
66845 differ = !BV_ARE_EQUAL(old->native_to, real_packet->native_to);
66846 if (differ) {
66847 BV_SET(fields, 3);
66848 }
66849
66850 differ = (strcmp(old->name, real_packet->name) != 0);
66851 if (differ) {
66852 BV_SET(fields, 4);
66853 }
66854
66855 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
66856 if (differ) {
66857 BV_SET(fields, 5);
66858 }
66859
66860 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
66861 if (differ) {
66862 BV_SET(fields, 6);
66863 }
66864
66865 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
66866 if (differ) {
66867 BV_SET(fields, 7);
66868 }
66869
66870 differ = (old->movement_cost != real_packet->movement_cost);
66871 if (differ) {
66872 BV_SET(fields, 8);
66873 }
66874
66875 differ = (old->defense_bonus != real_packet->defense_bonus);
66876 if (differ) {
66877 BV_SET(fields, 9);
66878 }
66879
66880
66881 {
66882 differ = FALSE;
66883 {
66884 int i;
66885
66886 for (i = 0; i < O_LAST; i++) {
66887 if (old->output[i] != real_packet->output[i]) {
66888 differ = TRUE;
66889 break;
66890 }
66891 }
66892 }
66893 }
66894 if (differ) {
66895 BV_SET(fields, 10);
66896 }
66897
66898 differ = (old->num_resources != real_packet->num_resources);
66899 if (differ) {
66900 BV_SET(fields, 11);
66901 }
66902
66903
66904 {
66905 differ = (old->num_resources != real_packet->num_resources);
66906 if (!differ) {
66907 int i;
66908
66909 for (i = 0; i < real_packet->num_resources; i++) {
66910 if (old->resources[i] != real_packet->resources[i]) {
66911 differ = TRUE;
66912 break;
66913 }
66914 }
66915 }
66916 }
66917 if (differ) {
66918 BV_SET(fields, 12);
66919 }
66920
66921
66922 {
66923 differ = FALSE;
66924 {
66925 int i;
66926
66927 for (i = 0; i < O_LAST; i++) {
66928 if (old->road_output_incr_pct[i] != real_packet->road_output_incr_pct[i]) {
66929 differ = TRUE;
66930 break;
66931 }
66932 }
66933 }
66934 }
66935 if (differ) {
66936 BV_SET(fields, 13);
66937 }
66938
66939 differ = (old->base_time != real_packet->base_time);
66940 if (differ) {
66941 BV_SET(fields, 14);
66942 }
66943
66944 differ = (old->road_time != real_packet->road_time);
66945 if (differ) {
66946 BV_SET(fields, 15);
66947 }
66948
66949 differ = (old->cultivate_result != real_packet->cultivate_result);
66950 if (differ) {
66951 BV_SET(fields, 16);
66952 }
66953
66954 differ = (old->cultivate_time != real_packet->cultivate_time);
66955 if (differ) {
66956 BV_SET(fields, 17);
66957 }
66958
66959 differ = (old->plant_result != real_packet->plant_result);
66960 if (differ) {
66961 BV_SET(fields, 18);
66962 }
66963
66964 differ = (old->plant_time != real_packet->plant_time);
66965 if (differ) {
66966 BV_SET(fields, 19);
66967 }
66968
66969 differ = (old->irrigation_food_incr != real_packet->irrigation_food_incr);
66970 if (differ) {
66971 BV_SET(fields, 20);
66972 }
66973
66974 differ = (old->irrigation_time != real_packet->irrigation_time);
66975 if (differ) {
66976 BV_SET(fields, 21);
66977 }
66978
66979 differ = (old->mining_shield_incr != real_packet->mining_shield_incr);
66980 if (differ) {
66981 BV_SET(fields, 22);
66982 }
66983
66984 differ = (old->mining_time != real_packet->mining_time);
66985 if (differ) {
66986 BV_SET(fields, 23);
66987 }
66988
66989 differ = (old->animal != real_packet->animal);
66990 if (differ) {
66991 BV_SET(fields, 24);
66992 }
66993
66994 differ = (old->transform_result != real_packet->transform_result);
66995 if (differ) {
66996 BV_SET(fields, 25);
66997 }
66998
66999 differ = (old->transform_time != real_packet->transform_time);
67000 if (differ) {
67001 BV_SET(fields, 26);
67002 }
67003
67004 differ = (old->placing_time != real_packet->placing_time);
67005 if (differ) {
67006 BV_SET(fields, 27);
67007 }
67008
67009 differ = (old->clean_pollution_time != real_packet->clean_pollution_time);
67010 if (differ) {
67011 BV_SET(fields, 28);
67012 }
67013
67014 differ = (old->clean_fallout_time != real_packet->clean_fallout_time);
67015 if (differ) {
67016 BV_SET(fields, 29);
67017 }
67018
67019 differ = (old->pillage_time != real_packet->pillage_time);
67020 if (differ) {
67021 BV_SET(fields, 30);
67022 }
67023
67024 differ = (old->color_red != real_packet->color_red);
67025 if (differ) {
67026 BV_SET(fields, 31);
67027 }
67028
67029 differ = (old->color_green != real_packet->color_green);
67030 if (differ) {
67031 BV_SET(fields, 32);
67032 }
67033
67034 differ = (old->color_blue != real_packet->color_blue);
67035 if (differ) {
67036 BV_SET(fields, 33);
67037 }
67038
67039 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
67040 if (differ) {
67041 BV_SET(fields, 34);
67042 }
67043
67044
67045#ifdef FREECIV_JSON_CONNECTION
67046 field_addr.name = "fields";
67047#endif /* FREECIV_JSON_CONNECTION */
67048 DIO_BV_PUT(&dout, &field_addr, fields);
67049
67050 if (BV_ISSET(fields, 0)) {
67051 log_packet_detailed(" field 'id' has changed");
67052 #ifdef FREECIV_JSON_CONNECTION
67053 field_addr.name = "id";
67054#endif /* FREECIV_JSON_CONNECTION */
67055 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
67056 }
67057 if (BV_ISSET(fields, 1)) {
67058 log_packet_detailed(" field 'tclass' has changed");
67059 #ifdef FREECIV_JSON_CONNECTION
67060 field_addr.name = "tclass";
67061#endif /* FREECIV_JSON_CONNECTION */
67062 DIO_PUT(uint8, &dout, &field_addr, real_packet->tclass);
67063 }
67064 if (BV_ISSET(fields, 2)) {
67065 log_packet_detailed(" field 'flags' has changed");
67066 #ifdef FREECIV_JSON_CONNECTION
67067 field_addr.name = "flags";
67068#endif /* FREECIV_JSON_CONNECTION */
67069 DIO_BV_PUT(&dout, &field_addr, packet->flags);
67070 }
67071 if (BV_ISSET(fields, 3)) {
67072 log_packet_detailed(" field 'native_to' has changed");
67073 #ifdef FREECIV_JSON_CONNECTION
67074 field_addr.name = "native_to";
67075#endif /* FREECIV_JSON_CONNECTION */
67076 DIO_BV_PUT(&dout, &field_addr, packet->native_to);
67077 }
67078 if (BV_ISSET(fields, 4)) {
67079 log_packet_detailed(" field 'name' has changed");
67080 #ifdef FREECIV_JSON_CONNECTION
67081 field_addr.name = "name";
67082#endif /* FREECIV_JSON_CONNECTION */
67083 DIO_PUT(string, &dout, &field_addr, real_packet->name);
67084 }
67085 if (BV_ISSET(fields, 5)) {
67086 log_packet_detailed(" field 'rule_name' has changed");
67087 #ifdef FREECIV_JSON_CONNECTION
67088 field_addr.name = "rule_name";
67089#endif /* FREECIV_JSON_CONNECTION */
67090 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
67091 }
67092 if (BV_ISSET(fields, 6)) {
67093 log_packet_detailed(" field 'graphic_str' has changed");
67094 #ifdef FREECIV_JSON_CONNECTION
67095 field_addr.name = "graphic_str";
67096#endif /* FREECIV_JSON_CONNECTION */
67097 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
67098 }
67099 if (BV_ISSET(fields, 7)) {
67100 log_packet_detailed(" field 'graphic_alt' has changed");
67101 #ifdef FREECIV_JSON_CONNECTION
67102 field_addr.name = "graphic_alt";
67103#endif /* FREECIV_JSON_CONNECTION */
67104 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
67105 }
67106 if (BV_ISSET(fields, 8)) {
67107 log_packet_detailed(" field 'movement_cost' has changed");
67108 #ifdef FREECIV_JSON_CONNECTION
67109 field_addr.name = "movement_cost";
67110#endif /* FREECIV_JSON_CONNECTION */
67111 DIO_PUT(uint8, &dout, &field_addr, real_packet->movement_cost);
67112 }
67113 if (BV_ISSET(fields, 9)) {
67114 log_packet_detailed(" field 'defense_bonus' has changed");
67115 #ifdef FREECIV_JSON_CONNECTION
67116 field_addr.name = "defense_bonus";
67117#endif /* FREECIV_JSON_CONNECTION */
67118 DIO_PUT(sint16, &dout, &field_addr, real_packet->defense_bonus);
67119 }
67120 if (BV_ISSET(fields, 10)) {
67121 log_packet_detailed(" field 'output' has changed");
67122 #ifdef FREECIV_JSON_CONNECTION
67123 field_addr.name = "output";
67124#endif /* FREECIV_JSON_CONNECTION */
67125
67126 {
67127 int i;
67128
67129#ifdef FREECIV_JSON_CONNECTION
67130 /* Create the array. */
67131 DIO_PUT(farray, &dout, &field_addr, O_LAST);
67132
67133 /* Enter the array. */
67134 field_addr.sub_location = plocation_elem_new(0);
67135#endif /* FREECIV_JSON_CONNECTION */
67136
67137 for (i = 0; i < O_LAST; i++) {
67138#ifdef FREECIV_JSON_CONNECTION
67139 /* Next array element. */
67140 field_addr.sub_location->number = i;
67141#endif /* FREECIV_JSON_CONNECTION */
67142 DIO_PUT(uint8, &dout, &field_addr, real_packet->output[i]);
67143 }
67144
67145#ifdef FREECIV_JSON_CONNECTION
67146 /* Exit array. */
67147 free(field_addr.sub_location);
67148 field_addr.sub_location = NULL;
67149#endif /* FREECIV_JSON_CONNECTION */
67150 }
67151 }
67152 if (BV_ISSET(fields, 11)) {
67153 log_packet_detailed(" field 'num_resources' has changed");
67154 #ifdef FREECIV_JSON_CONNECTION
67155 field_addr.name = "num_resources";
67156#endif /* FREECIV_JSON_CONNECTION */
67157 DIO_PUT(uint8, &dout, &field_addr, real_packet->num_resources);
67158 }
67159 if (BV_ISSET(fields, 12)) {
67160 log_packet_detailed(" field 'resources' has changed");
67161 #ifdef FREECIV_JSON_CONNECTION
67162 field_addr.name = "resources";
67163#endif /* FREECIV_JSON_CONNECTION */
67164
67165 {
67166 int i;
67167
67168#ifdef FREECIV_JSON_CONNECTION
67169 /* Create the array. */
67170 DIO_PUT(farray, &dout, &field_addr, real_packet->num_resources);
67171
67172 /* Enter the array. */
67173 field_addr.sub_location = plocation_elem_new(0);
67174#endif /* FREECIV_JSON_CONNECTION */
67175
67176 for (i = 0; i < real_packet->num_resources; i++) {
67177#ifdef FREECIV_JSON_CONNECTION
67178 /* Next array element. */
67179 field_addr.sub_location->number = i;
67180#endif /* FREECIV_JSON_CONNECTION */
67181 DIO_PUT(uint8, &dout, &field_addr, real_packet->resources[i]);
67182 }
67183
67184#ifdef FREECIV_JSON_CONNECTION
67185 /* Exit array. */
67186 free(field_addr.sub_location);
67187 field_addr.sub_location = NULL;
67188#endif /* FREECIV_JSON_CONNECTION */
67189 }
67190 }
67191 if (BV_ISSET(fields, 13)) {
67192 log_packet_detailed(" field 'road_output_incr_pct' has changed");
67193 #ifdef FREECIV_JSON_CONNECTION
67194 field_addr.name = "road_output_incr_pct";
67195#endif /* FREECIV_JSON_CONNECTION */
67196
67197 {
67198 int i;
67199
67200#ifdef FREECIV_JSON_CONNECTION
67201 /* Create the array. */
67202 DIO_PUT(farray, &dout, &field_addr, O_LAST);
67203
67204 /* Enter the array. */
67205 field_addr.sub_location = plocation_elem_new(0);
67206#endif /* FREECIV_JSON_CONNECTION */
67207
67208 for (i = 0; i < O_LAST; i++) {
67209#ifdef FREECIV_JSON_CONNECTION
67210 /* Next array element. */
67211 field_addr.sub_location->number = i;
67212#endif /* FREECIV_JSON_CONNECTION */
67213 DIO_PUT(uint16, &dout, &field_addr, real_packet->road_output_incr_pct[i]);
67214 }
67215
67216#ifdef FREECIV_JSON_CONNECTION
67217 /* Exit array. */
67218 free(field_addr.sub_location);
67219 field_addr.sub_location = NULL;
67220#endif /* FREECIV_JSON_CONNECTION */
67221 }
67222 }
67223 if (BV_ISSET(fields, 14)) {
67224 log_packet_detailed(" field 'base_time' has changed");
67225 #ifdef FREECIV_JSON_CONNECTION
67226 field_addr.name = "base_time";
67227#endif /* FREECIV_JSON_CONNECTION */
67228 DIO_PUT(uint8, &dout, &field_addr, real_packet->base_time);
67229 }
67230 if (BV_ISSET(fields, 15)) {
67231 log_packet_detailed(" field 'road_time' has changed");
67232 #ifdef FREECIV_JSON_CONNECTION
67233 field_addr.name = "road_time";
67234#endif /* FREECIV_JSON_CONNECTION */
67235 DIO_PUT(uint8, &dout, &field_addr, real_packet->road_time);
67236 }
67237 if (BV_ISSET(fields, 16)) {
67238 log_packet_detailed(" field 'cultivate_result' has changed");
67239 #ifdef FREECIV_JSON_CONNECTION
67240 field_addr.name = "cultivate_result";
67241#endif /* FREECIV_JSON_CONNECTION */
67242 DIO_PUT(uint8, &dout, &field_addr, real_packet->cultivate_result);
67243 }
67244 if (BV_ISSET(fields, 17)) {
67245 log_packet_detailed(" field 'cultivate_time' has changed");
67246 #ifdef FREECIV_JSON_CONNECTION
67247 field_addr.name = "cultivate_time";
67248#endif /* FREECIV_JSON_CONNECTION */
67249 DIO_PUT(uint8, &dout, &field_addr, real_packet->cultivate_time);
67250 }
67251 if (BV_ISSET(fields, 18)) {
67252 log_packet_detailed(" field 'plant_result' has changed");
67253 #ifdef FREECIV_JSON_CONNECTION
67254 field_addr.name = "plant_result";
67255#endif /* FREECIV_JSON_CONNECTION */
67256 DIO_PUT(uint8, &dout, &field_addr, real_packet->plant_result);
67257 }
67258 if (BV_ISSET(fields, 19)) {
67259 log_packet_detailed(" field 'plant_time' has changed");
67260 #ifdef FREECIV_JSON_CONNECTION
67261 field_addr.name = "plant_time";
67262#endif /* FREECIV_JSON_CONNECTION */
67263 DIO_PUT(uint8, &dout, &field_addr, real_packet->plant_time);
67264 }
67265 if (BV_ISSET(fields, 20)) {
67266 log_packet_detailed(" field 'irrigation_food_incr' has changed");
67267 #ifdef FREECIV_JSON_CONNECTION
67268 field_addr.name = "irrigation_food_incr";
67269#endif /* FREECIV_JSON_CONNECTION */
67270 DIO_PUT(uint8, &dout, &field_addr, real_packet->irrigation_food_incr);
67271 }
67272 if (BV_ISSET(fields, 21)) {
67273 log_packet_detailed(" field 'irrigation_time' has changed");
67274 #ifdef FREECIV_JSON_CONNECTION
67275 field_addr.name = "irrigation_time";
67276#endif /* FREECIV_JSON_CONNECTION */
67277 DIO_PUT(uint8, &dout, &field_addr, real_packet->irrigation_time);
67278 }
67279 if (BV_ISSET(fields, 22)) {
67280 log_packet_detailed(" field 'mining_shield_incr' has changed");
67281 #ifdef FREECIV_JSON_CONNECTION
67282 field_addr.name = "mining_shield_incr";
67283#endif /* FREECIV_JSON_CONNECTION */
67284 DIO_PUT(uint8, &dout, &field_addr, real_packet->mining_shield_incr);
67285 }
67286 if (BV_ISSET(fields, 23)) {
67287 log_packet_detailed(" field 'mining_time' has changed");
67288 #ifdef FREECIV_JSON_CONNECTION
67289 field_addr.name = "mining_time";
67290#endif /* FREECIV_JSON_CONNECTION */
67291 DIO_PUT(uint8, &dout, &field_addr, real_packet->mining_time);
67292 }
67293 if (BV_ISSET(fields, 24)) {
67294 log_packet_detailed(" field 'animal' has changed");
67295 #ifdef FREECIV_JSON_CONNECTION
67296 field_addr.name = "animal";
67297#endif /* FREECIV_JSON_CONNECTION */
67298 DIO_PUT(sint16, &dout, &field_addr, real_packet->animal);
67299 }
67300 if (BV_ISSET(fields, 25)) {
67301 log_packet_detailed(" field 'transform_result' has changed");
67302 #ifdef FREECIV_JSON_CONNECTION
67303 field_addr.name = "transform_result";
67304#endif /* FREECIV_JSON_CONNECTION */
67305 DIO_PUT(uint8, &dout, &field_addr, real_packet->transform_result);
67306 }
67307 if (BV_ISSET(fields, 26)) {
67308 log_packet_detailed(" field 'transform_time' has changed");
67309 #ifdef FREECIV_JSON_CONNECTION
67310 field_addr.name = "transform_time";
67311#endif /* FREECIV_JSON_CONNECTION */
67312 DIO_PUT(uint8, &dout, &field_addr, real_packet->transform_time);
67313 }
67314 if (BV_ISSET(fields, 27)) {
67315 log_packet_detailed(" field 'placing_time' has changed");
67316 #ifdef FREECIV_JSON_CONNECTION
67317 field_addr.name = "placing_time";
67318#endif /* FREECIV_JSON_CONNECTION */
67319 DIO_PUT(uint8, &dout, &field_addr, real_packet->placing_time);
67320 }
67321 if (BV_ISSET(fields, 28)) {
67322 log_packet_detailed(" field 'clean_pollution_time' has changed");
67323 #ifdef FREECIV_JSON_CONNECTION
67324 field_addr.name = "clean_pollution_time";
67325#endif /* FREECIV_JSON_CONNECTION */
67326 DIO_PUT(uint8, &dout, &field_addr, real_packet->clean_pollution_time);
67327 }
67328 if (BV_ISSET(fields, 29)) {
67329 log_packet_detailed(" field 'clean_fallout_time' has changed");
67330 #ifdef FREECIV_JSON_CONNECTION
67331 field_addr.name = "clean_fallout_time";
67332#endif /* FREECIV_JSON_CONNECTION */
67333 DIO_PUT(uint8, &dout, &field_addr, real_packet->clean_fallout_time);
67334 }
67335 if (BV_ISSET(fields, 30)) {
67336 log_packet_detailed(" field 'pillage_time' has changed");
67337 #ifdef FREECIV_JSON_CONNECTION
67338 field_addr.name = "pillage_time";
67339#endif /* FREECIV_JSON_CONNECTION */
67340 DIO_PUT(uint8, &dout, &field_addr, real_packet->pillage_time);
67341 }
67342 if (BV_ISSET(fields, 31)) {
67343 log_packet_detailed(" field 'color_red' has changed");
67344 #ifdef FREECIV_JSON_CONNECTION
67345 field_addr.name = "color_red";
67346#endif /* FREECIV_JSON_CONNECTION */
67347 DIO_PUT(uint8, &dout, &field_addr, real_packet->color_red);
67348 }
67349 if (BV_ISSET(fields, 32)) {
67350 log_packet_detailed(" field 'color_green' has changed");
67351 #ifdef FREECIV_JSON_CONNECTION
67352 field_addr.name = "color_green";
67353#endif /* FREECIV_JSON_CONNECTION */
67354 DIO_PUT(uint8, &dout, &field_addr, real_packet->color_green);
67355 }
67356 if (BV_ISSET(fields, 33)) {
67357 log_packet_detailed(" field 'color_blue' has changed");
67358 #ifdef FREECIV_JSON_CONNECTION
67359 field_addr.name = "color_blue";
67360#endif /* FREECIV_JSON_CONNECTION */
67361 DIO_PUT(uint8, &dout, &field_addr, real_packet->color_blue);
67362 }
67363 if (BV_ISSET(fields, 34)) {
67364 log_packet_detailed(" field 'helptext' has changed");
67365 #ifdef FREECIV_JSON_CONNECTION
67366 field_addr.name = "helptext";
67367#endif /* FREECIV_JSON_CONNECTION */
67368 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
67369 }
67370
67371 *old = *real_packet;
67372#endif /* FREECIV_DELTA_PROTOCOL */
67373#ifndef FREECIV_DELTA_PROTOCOL
67374#ifdef FREECIV_JSON_CONNECTION
67375 field_addr.name = "id";
67376#endif /* FREECIV_JSON_CONNECTION */
67377 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
67378#ifdef FREECIV_JSON_CONNECTION
67379 field_addr.name = "tclass";
67380#endif /* FREECIV_JSON_CONNECTION */
67381 DIO_PUT(uint8, &dout, &field_addr, real_packet->tclass);
67382#ifdef FREECIV_JSON_CONNECTION
67383 field_addr.name = "flags";
67384#endif /* FREECIV_JSON_CONNECTION */
67385 DIO_BV_PUT(&dout, &field_addr, packet->flags);
67386#ifdef FREECIV_JSON_CONNECTION
67387 field_addr.name = "native_to";
67388#endif /* FREECIV_JSON_CONNECTION */
67389 DIO_BV_PUT(&dout, &field_addr, packet->native_to);
67390#ifdef FREECIV_JSON_CONNECTION
67391 field_addr.name = "name";
67392#endif /* FREECIV_JSON_CONNECTION */
67393 DIO_PUT(string, &dout, &field_addr, real_packet->name);
67394#ifdef FREECIV_JSON_CONNECTION
67395 field_addr.name = "rule_name";
67396#endif /* FREECIV_JSON_CONNECTION */
67397 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
67398#ifdef FREECIV_JSON_CONNECTION
67399 field_addr.name = "graphic_str";
67400#endif /* FREECIV_JSON_CONNECTION */
67401 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
67402#ifdef FREECIV_JSON_CONNECTION
67403 field_addr.name = "graphic_alt";
67404#endif /* FREECIV_JSON_CONNECTION */
67405 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
67406#ifdef FREECIV_JSON_CONNECTION
67407 field_addr.name = "movement_cost";
67408#endif /* FREECIV_JSON_CONNECTION */
67409 DIO_PUT(uint8, &dout, &field_addr, real_packet->movement_cost);
67410#ifdef FREECIV_JSON_CONNECTION
67411 field_addr.name = "defense_bonus";
67412#endif /* FREECIV_JSON_CONNECTION */
67413 DIO_PUT(sint16, &dout, &field_addr, real_packet->defense_bonus);
67414#ifdef FREECIV_JSON_CONNECTION
67415 field_addr.name = "output";
67416#endif /* FREECIV_JSON_CONNECTION */
67417
67418 {
67419 int i;
67420
67421#ifdef FREECIV_JSON_CONNECTION
67422 /* Create the array. */
67423 DIO_PUT(farray, &dout, &field_addr, O_LAST);
67424
67425 /* Enter the array. */
67426 field_addr.sub_location = plocation_elem_new(0);
67427#endif /* FREECIV_JSON_CONNECTION */
67428
67429 for (i = 0; i < O_LAST; i++) {
67430#ifdef FREECIV_JSON_CONNECTION
67431 /* Next array element. */
67432 field_addr.sub_location->number = i;
67433#endif /* FREECIV_JSON_CONNECTION */
67434 DIO_PUT(uint8, &dout, &field_addr, real_packet->output[i]);
67435 }
67436
67437#ifdef FREECIV_JSON_CONNECTION
67438 /* Exit array. */
67439 free(field_addr.sub_location);
67440 field_addr.sub_location = NULL;
67441#endif /* FREECIV_JSON_CONNECTION */
67442 }
67443#ifdef FREECIV_JSON_CONNECTION
67444 field_addr.name = "num_resources";
67445#endif /* FREECIV_JSON_CONNECTION */
67446 DIO_PUT(uint8, &dout, &field_addr, real_packet->num_resources);
67447#ifdef FREECIV_JSON_CONNECTION
67448 field_addr.name = "resources";
67449#endif /* FREECIV_JSON_CONNECTION */
67450
67451 {
67452 int i;
67453
67454#ifdef FREECIV_JSON_CONNECTION
67455 /* Create the array. */
67456 DIO_PUT(farray, &dout, &field_addr, real_packet->num_resources);
67457
67458 /* Enter the array. */
67459 field_addr.sub_location = plocation_elem_new(0);
67460#endif /* FREECIV_JSON_CONNECTION */
67461
67462 for (i = 0; i < real_packet->num_resources; i++) {
67463#ifdef FREECIV_JSON_CONNECTION
67464 /* Next array element. */
67465 field_addr.sub_location->number = i;
67466#endif /* FREECIV_JSON_CONNECTION */
67467 DIO_PUT(uint8, &dout, &field_addr, real_packet->resources[i]);
67468 }
67469
67470#ifdef FREECIV_JSON_CONNECTION
67471 /* Exit array. */
67472 free(field_addr.sub_location);
67473 field_addr.sub_location = NULL;
67474#endif /* FREECIV_JSON_CONNECTION */
67475 }
67476#ifdef FREECIV_JSON_CONNECTION
67477 field_addr.name = "road_output_incr_pct";
67478#endif /* FREECIV_JSON_CONNECTION */
67479
67480 {
67481 int i;
67482
67483#ifdef FREECIV_JSON_CONNECTION
67484 /* Create the array. */
67485 DIO_PUT(farray, &dout, &field_addr, O_LAST);
67486
67487 /* Enter the array. */
67488 field_addr.sub_location = plocation_elem_new(0);
67489#endif /* FREECIV_JSON_CONNECTION */
67490
67491 for (i = 0; i < O_LAST; i++) {
67492#ifdef FREECIV_JSON_CONNECTION
67493 /* Next array element. */
67494 field_addr.sub_location->number = i;
67495#endif /* FREECIV_JSON_CONNECTION */
67496 DIO_PUT(uint16, &dout, &field_addr, real_packet->road_output_incr_pct[i]);
67497 }
67498
67499#ifdef FREECIV_JSON_CONNECTION
67500 /* Exit array. */
67501 free(field_addr.sub_location);
67502 field_addr.sub_location = NULL;
67503#endif /* FREECIV_JSON_CONNECTION */
67504 }
67505#ifdef FREECIV_JSON_CONNECTION
67506 field_addr.name = "base_time";
67507#endif /* FREECIV_JSON_CONNECTION */
67508 DIO_PUT(uint8, &dout, &field_addr, real_packet->base_time);
67509#ifdef FREECIV_JSON_CONNECTION
67510 field_addr.name = "road_time";
67511#endif /* FREECIV_JSON_CONNECTION */
67512 DIO_PUT(uint8, &dout, &field_addr, real_packet->road_time);
67513#ifdef FREECIV_JSON_CONNECTION
67514 field_addr.name = "cultivate_result";
67515#endif /* FREECIV_JSON_CONNECTION */
67516 DIO_PUT(uint8, &dout, &field_addr, real_packet->cultivate_result);
67517#ifdef FREECIV_JSON_CONNECTION
67518 field_addr.name = "cultivate_time";
67519#endif /* FREECIV_JSON_CONNECTION */
67520 DIO_PUT(uint8, &dout, &field_addr, real_packet->cultivate_time);
67521#ifdef FREECIV_JSON_CONNECTION
67522 field_addr.name = "plant_result";
67523#endif /* FREECIV_JSON_CONNECTION */
67524 DIO_PUT(uint8, &dout, &field_addr, real_packet->plant_result);
67525#ifdef FREECIV_JSON_CONNECTION
67526 field_addr.name = "plant_time";
67527#endif /* FREECIV_JSON_CONNECTION */
67528 DIO_PUT(uint8, &dout, &field_addr, real_packet->plant_time);
67529#ifdef FREECIV_JSON_CONNECTION
67530 field_addr.name = "irrigation_food_incr";
67531#endif /* FREECIV_JSON_CONNECTION */
67532 DIO_PUT(uint8, &dout, &field_addr, real_packet->irrigation_food_incr);
67533#ifdef FREECIV_JSON_CONNECTION
67534 field_addr.name = "irrigation_time";
67535#endif /* FREECIV_JSON_CONNECTION */
67536 DIO_PUT(uint8, &dout, &field_addr, real_packet->irrigation_time);
67537#ifdef FREECIV_JSON_CONNECTION
67538 field_addr.name = "mining_shield_incr";
67539#endif /* FREECIV_JSON_CONNECTION */
67540 DIO_PUT(uint8, &dout, &field_addr, real_packet->mining_shield_incr);
67541#ifdef FREECIV_JSON_CONNECTION
67542 field_addr.name = "mining_time";
67543#endif /* FREECIV_JSON_CONNECTION */
67544 DIO_PUT(uint8, &dout, &field_addr, real_packet->mining_time);
67545#ifdef FREECIV_JSON_CONNECTION
67546 field_addr.name = "animal";
67547#endif /* FREECIV_JSON_CONNECTION */
67548 DIO_PUT(sint16, &dout, &field_addr, real_packet->animal);
67549#ifdef FREECIV_JSON_CONNECTION
67550 field_addr.name = "transform_result";
67551#endif /* FREECIV_JSON_CONNECTION */
67552 DIO_PUT(uint8, &dout, &field_addr, real_packet->transform_result);
67553#ifdef FREECIV_JSON_CONNECTION
67554 field_addr.name = "transform_time";
67555#endif /* FREECIV_JSON_CONNECTION */
67556 DIO_PUT(uint8, &dout, &field_addr, real_packet->transform_time);
67557#ifdef FREECIV_JSON_CONNECTION
67558 field_addr.name = "placing_time";
67559#endif /* FREECIV_JSON_CONNECTION */
67560 DIO_PUT(uint8, &dout, &field_addr, real_packet->placing_time);
67561#ifdef FREECIV_JSON_CONNECTION
67562 field_addr.name = "clean_pollution_time";
67563#endif /* FREECIV_JSON_CONNECTION */
67564 DIO_PUT(uint8, &dout, &field_addr, real_packet->clean_pollution_time);
67565#ifdef FREECIV_JSON_CONNECTION
67566 field_addr.name = "clean_fallout_time";
67567#endif /* FREECIV_JSON_CONNECTION */
67568 DIO_PUT(uint8, &dout, &field_addr, real_packet->clean_fallout_time);
67569#ifdef FREECIV_JSON_CONNECTION
67570 field_addr.name = "pillage_time";
67571#endif /* FREECIV_JSON_CONNECTION */
67572 DIO_PUT(uint8, &dout, &field_addr, real_packet->pillage_time);
67573#ifdef FREECIV_JSON_CONNECTION
67574 field_addr.name = "color_red";
67575#endif /* FREECIV_JSON_CONNECTION */
67576 DIO_PUT(uint8, &dout, &field_addr, real_packet->color_red);
67577#ifdef FREECIV_JSON_CONNECTION
67578 field_addr.name = "color_green";
67579#endif /* FREECIV_JSON_CONNECTION */
67580 DIO_PUT(uint8, &dout, &field_addr, real_packet->color_green);
67581#ifdef FREECIV_JSON_CONNECTION
67582 field_addr.name = "color_blue";
67583#endif /* FREECIV_JSON_CONNECTION */
67584 DIO_PUT(uint8, &dout, &field_addr, real_packet->color_blue);
67585#ifdef FREECIV_JSON_CONNECTION
67586 field_addr.name = "helptext";
67587#endif /* FREECIV_JSON_CONNECTION */
67588 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
67589
67590#endif
67591 SEND_PACKET_END(PACKET_RULESET_TERRAIN);
67592}
67593
67594 int send_packet_ruleset_terrain(struct connection *pc, const struct packet_ruleset_terrain *packet)
67595{
67596 if (!pc->used) {
67597 log_error("WARNING: trying to send data to the closed connection %s",
67598 conn_description(pc));
67599 return -1;
67600 }
67601 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TERRAIN].packet != NULL, -1,
67602 "Handler for PACKET_RULESET_TERRAIN not installed");
67603 return pc->phs.handlers->send[PACKET_RULESET_TERRAIN].packet(pc, packet);
67604}
67605
67606 void lsend_packet_ruleset_terrain(struct conn_list *dest, const struct packet_ruleset_terrain *packet)
67607{
67608 conn_list_iterate(dest, pconn) {
67609 send_packet_ruleset_terrain(pconn, packet);
67610 } conn_list_iterate_end;
67611}
67612
67613#ifdef FREECIV_DELTA_PROTOCOL
67614#define hash_packet_ruleset_terrain_flag_100 hash_const
67615
67616#define cmp_packet_ruleset_terrain_flag_100 cmp_const
67617
67618 BV_DEFINE(packet_ruleset_terrain_flag_100_fields, 3);
67619#endif /* FREECIV_DELTA_PROTOCOL */
67620
67621 static struct packet_ruleset_terrain_flag *receive_packet_ruleset_terrain_flag_100(struct connection *pc)
67622{
67623#ifdef FREECIV_DELTA_PROTOCOL
67624 packet_ruleset_terrain_flag_100_fields fields;
67625 struct packet_ruleset_terrain_flag *old;
67626 struct genhash **hash = pc->phs.received + PACKET_RULESET_TERRAIN_FLAG;
67627#endif /* FREECIV_DELTA_PROTOCOL */
67628 RECEIVE_PACKET_START(packet_ruleset_terrain_flag, real_packet);
67629#ifdef FREECIV_JSON_CONNECTION
67630 struct plocation field_addr;
67631 {
67632 struct plocation *field_addr_tmp = plocation_field_new(NULL);
67633 field_addr = *field_addr_tmp;
67634 FC_FREE(field_addr_tmp);
67635 }
67636#endif /* FREECIV_JSON_CONNECTION */
67637
67638#ifdef FREECIV_DELTA_PROTOCOL
67639#ifdef FREECIV_JSON_CONNECTION
67640 field_addr.name = "fields";
67641#endif /* FREECIV_JSON_CONNECTION */
67642 DIO_BV_GET(&din, &field_addr, fields);
67643
67644#else /* FREECIV_DELTA_PROTOCOL */
67645 #ifdef FREECIV_JSON_CONNECTION
67646 field_addr.name = "id";
67647 #endif /* FREECIV_JSON_CONNECTION */
67648 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
67649 RECEIVE_PACKET_FIELD_ERROR(id);
67650 }
67651 #ifdef FREECIV_JSON_CONNECTION
67652 field_addr.name = "name";
67653 #endif /* FREECIV_JSON_CONNECTION */
67654 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
67655 RECEIVE_PACKET_FIELD_ERROR(name);
67656 }
67657 #ifdef FREECIV_JSON_CONNECTION
67658 field_addr.name = "helptxt";
67659 #endif /* FREECIV_JSON_CONNECTION */
67660 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
67661 RECEIVE_PACKET_FIELD_ERROR(helptxt);
67662 }
67663
67664#endif
67665 log_packet_detailed("packet_ruleset_terrain_flag_100: got info about ()");
67666
67667#ifdef FREECIV_DELTA_PROTOCOL
67668 if (NULL == *hash) {
67669 *hash = genhash_new_full(hash_packet_ruleset_terrain_flag_100, cmp_packet_ruleset_terrain_flag_100,
67670 NULL, NULL, NULL, free);
67671 }
67672
67673 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
67674 *real_packet = *old;
67675 } else {
67676 log_packet_detailed(" no old info");
67677 memset(real_packet, 0, sizeof(*real_packet));
67678 }
67679
67680 if (BV_ISSET(fields, 0)) {
67681 log_packet_detailed(" got field 'id'");
67682 #ifdef FREECIV_JSON_CONNECTION
67683 field_addr.name = "id";
67684 #endif /* FREECIV_JSON_CONNECTION */
67685 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
67686 RECEIVE_PACKET_FIELD_ERROR(id);
67687 }
67688 }
67689 if (BV_ISSET(fields, 1)) {
67690 log_packet_detailed(" got field 'name'");
67691 #ifdef FREECIV_JSON_CONNECTION
67692 field_addr.name = "name";
67693 #endif /* FREECIV_JSON_CONNECTION */
67694 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
67695 RECEIVE_PACKET_FIELD_ERROR(name);
67696 }
67697 }
67698 if (BV_ISSET(fields, 2)) {
67699 log_packet_detailed(" got field 'helptxt'");
67700 #ifdef FREECIV_JSON_CONNECTION
67701 field_addr.name = "helptxt";
67702 #endif /* FREECIV_JSON_CONNECTION */
67703 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
67704 RECEIVE_PACKET_FIELD_ERROR(helptxt);
67705 }
67706 }
67707
67708 if (NULL == old) {
67709 old = fc_malloc(sizeof(*old));
67710 *old = *real_packet;
67711 genhash_insert(*hash, old, old);
67712 } else {
67713 *old = *real_packet;
67714 }
67715
67716#endif /* FREECIV_DELTA_PROTOCOL */
67717 RECEIVE_PACKET_END(real_packet);
67718}
67719
67720 static int send_packet_ruleset_terrain_flag_100(struct connection *pc, const struct packet_ruleset_terrain_flag *packet)
67721{
67722 const struct packet_ruleset_terrain_flag *real_packet = packet;
67723#ifdef FREECIV_DELTA_PROTOCOL
67724 packet_ruleset_terrain_flag_100_fields fields;
67725 struct packet_ruleset_terrain_flag *old;
67726 bool differ;
67727 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TERRAIN_FLAG;
67728#endif /* FREECIV_DELTA_PROTOCOL */
67729 SEND_PACKET_START(PACKET_RULESET_TERRAIN_FLAG);
67730#ifdef FREECIV_JSON_CONNECTION
67731 struct plocation field_addr;
67732 {
67733 struct plocation *field_addr_tmp = plocation_field_new(NULL);
67734 field_addr = *field_addr_tmp;
67735 FC_FREE(field_addr_tmp);
67736 }
67737#endif /* FREECIV_JSON_CONNECTION */
67738
67739 log_packet_detailed("packet_ruleset_terrain_flag_100: sending info about ()");
67740
67741#ifdef FREECIV_DELTA_PROTOCOL
67742 if (NULL == *hash) {
67743 *hash = genhash_new_full(hash_packet_ruleset_terrain_flag_100, cmp_packet_ruleset_terrain_flag_100,
67744 NULL, NULL, NULL, free);
67745 }
67746 BV_CLR_ALL(fields);
67747
67748 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
67749 old = fc_malloc(sizeof(*old));
67750 *old = *real_packet;
67751 genhash_insert(*hash, old, old);
67752 memset(old, 0, sizeof(*old));
67753 }
67754 differ = (old->id != real_packet->id);
67755 if (differ) {
67756 BV_SET(fields, 0);
67757 }
67758
67759 differ = (strcmp(old->name, real_packet->name) != 0);
67760 if (differ) {
67761 BV_SET(fields, 1);
67762 }
67763
67764 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
67765 if (differ) {
67766 BV_SET(fields, 2);
67767 }
67768
67769
67770#ifdef FREECIV_JSON_CONNECTION
67771 field_addr.name = "fields";
67772#endif /* FREECIV_JSON_CONNECTION */
67773 DIO_BV_PUT(&dout, &field_addr, fields);
67774
67775 if (BV_ISSET(fields, 0)) {
67776 log_packet_detailed(" field 'id' has changed");
67777 #ifdef FREECIV_JSON_CONNECTION
67778 field_addr.name = "id";
67779#endif /* FREECIV_JSON_CONNECTION */
67780 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
67781 }
67782 if (BV_ISSET(fields, 1)) {
67783 log_packet_detailed(" field 'name' has changed");
67784 #ifdef FREECIV_JSON_CONNECTION
67785 field_addr.name = "name";
67786#endif /* FREECIV_JSON_CONNECTION */
67787 DIO_PUT(string, &dout, &field_addr, real_packet->name);
67788 }
67789 if (BV_ISSET(fields, 2)) {
67790 log_packet_detailed(" field 'helptxt' has changed");
67791 #ifdef FREECIV_JSON_CONNECTION
67792 field_addr.name = "helptxt";
67793#endif /* FREECIV_JSON_CONNECTION */
67794 DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
67795 }
67796
67797 *old = *real_packet;
67798#endif /* FREECIV_DELTA_PROTOCOL */
67799#ifndef FREECIV_DELTA_PROTOCOL
67800#ifdef FREECIV_JSON_CONNECTION
67801 field_addr.name = "id";
67802#endif /* FREECIV_JSON_CONNECTION */
67803 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
67804#ifdef FREECIV_JSON_CONNECTION
67805 field_addr.name = "name";
67806#endif /* FREECIV_JSON_CONNECTION */
67807 DIO_PUT(string, &dout, &field_addr, real_packet->name);
67808#ifdef FREECIV_JSON_CONNECTION
67809 field_addr.name = "helptxt";
67810#endif /* FREECIV_JSON_CONNECTION */
67811 DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
67812
67813#endif
67814 SEND_PACKET_END(PACKET_RULESET_TERRAIN_FLAG);
67815}
67816
67817 int send_packet_ruleset_terrain_flag(struct connection *pc, const struct packet_ruleset_terrain_flag *packet)
67818{
67819 if (!pc->used) {
67820 log_error("WARNING: trying to send data to the closed connection %s",
67821 conn_description(pc));
67822 return -1;
67823 }
67824 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TERRAIN_FLAG].packet != NULL, -1,
67825 "Handler for PACKET_RULESET_TERRAIN_FLAG not installed");
67826 return pc->phs.handlers->send[PACKET_RULESET_TERRAIN_FLAG].packet(pc, packet);
67827}
67828
67829 void lsend_packet_ruleset_terrain_flag(struct conn_list *dest, const struct packet_ruleset_terrain_flag *packet)
67830{
67831 conn_list_iterate(dest, pconn) {
67832 send_packet_ruleset_terrain_flag(pconn, packet);
67833 } conn_list_iterate_end;
67834}
67835
67836#ifdef FREECIV_DELTA_PROTOCOL
67837#define hash_packet_ruleset_unit_class_100 hash_const
67838
67839#define cmp_packet_ruleset_unit_class_100 cmp_const
67840
67841 BV_DEFINE(packet_ruleset_unit_class_100_fields, 8);
67842#endif /* FREECIV_DELTA_PROTOCOL */
67843
67844 static struct packet_ruleset_unit_class *receive_packet_ruleset_unit_class_100(struct connection *pc)
67845{
67846#ifdef FREECIV_DELTA_PROTOCOL
67847 packet_ruleset_unit_class_100_fields fields;
67848 struct packet_ruleset_unit_class *old;
67849 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT_CLASS;
67850#endif /* FREECIV_DELTA_PROTOCOL */
67851 RECEIVE_PACKET_START(packet_ruleset_unit_class, real_packet);
67852#ifdef FREECIV_JSON_CONNECTION
67853 struct plocation field_addr;
67854 {
67855 struct plocation *field_addr_tmp = plocation_field_new(NULL);
67856 field_addr = *field_addr_tmp;
67857 FC_FREE(field_addr_tmp);
67858 }
67859#endif /* FREECIV_JSON_CONNECTION */
67860
67861#ifdef FREECIV_DELTA_PROTOCOL
67862#ifdef FREECIV_JSON_CONNECTION
67863 field_addr.name = "fields";
67864#endif /* FREECIV_JSON_CONNECTION */
67865 DIO_BV_GET(&din, &field_addr, fields);
67866
67867#else /* FREECIV_DELTA_PROTOCOL */
67868 #ifdef FREECIV_JSON_CONNECTION
67869 field_addr.name = "id";
67870 #endif /* FREECIV_JSON_CONNECTION */
67871 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
67872 RECEIVE_PACKET_FIELD_ERROR(id);
67873 }
67874 #ifdef FREECIV_JSON_CONNECTION
67875 field_addr.name = "name";
67876 #endif /* FREECIV_JSON_CONNECTION */
67877 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
67878 RECEIVE_PACKET_FIELD_ERROR(name);
67879 }
67880 #ifdef FREECIV_JSON_CONNECTION
67881 field_addr.name = "rule_name";
67882 #endif /* FREECIV_JSON_CONNECTION */
67883 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
67884 RECEIVE_PACKET_FIELD_ERROR(rule_name);
67885 }
67886 #ifdef FREECIV_JSON_CONNECTION
67887 field_addr.name = "min_speed";
67888 #endif /* FREECIV_JSON_CONNECTION */
67889 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->min_speed)) {
67890 RECEIVE_PACKET_FIELD_ERROR(min_speed);
67891 }
67892 #ifdef FREECIV_JSON_CONNECTION
67893 field_addr.name = "hp_loss_pct";
67894 #endif /* FREECIV_JSON_CONNECTION */
67895 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp_loss_pct)) {
67896 RECEIVE_PACKET_FIELD_ERROR(hp_loss_pct);
67897 }
67898 #ifdef FREECIV_JSON_CONNECTION
67899 field_addr.name = "non_native_def_pct";
67900 #endif /* FREECIV_JSON_CONNECTION */
67901 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->non_native_def_pct)) {
67902 RECEIVE_PACKET_FIELD_ERROR(non_native_def_pct);
67903 }
67904 #ifdef FREECIV_JSON_CONNECTION
67905 field_addr.name = "flags";
67906 #endif /* FREECIV_JSON_CONNECTION */
67907 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
67908 RECEIVE_PACKET_FIELD_ERROR(flags);
67909 }
67910 #ifdef FREECIV_JSON_CONNECTION
67911 field_addr.name = "helptext";
67912 #endif /* FREECIV_JSON_CONNECTION */
67913 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
67914 RECEIVE_PACKET_FIELD_ERROR(helptext);
67915 }
67916
67917#endif
67918 log_packet_detailed("packet_ruleset_unit_class_100: got info about ()");
67919
67920#ifdef FREECIV_DELTA_PROTOCOL
67921 if (NULL == *hash) {
67922 *hash = genhash_new_full(hash_packet_ruleset_unit_class_100, cmp_packet_ruleset_unit_class_100,
67923 NULL, NULL, NULL, free);
67924 }
67925
67926 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
67927 *real_packet = *old;
67928 } else {
67929 log_packet_detailed(" no old info");
67930 memset(real_packet, 0, sizeof(*real_packet));
67931 }
67932
67933 if (BV_ISSET(fields, 0)) {
67934 log_packet_detailed(" got field 'id'");
67935 #ifdef FREECIV_JSON_CONNECTION
67936 field_addr.name = "id";
67937 #endif /* FREECIV_JSON_CONNECTION */
67938 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
67939 RECEIVE_PACKET_FIELD_ERROR(id);
67940 }
67941 }
67942 if (BV_ISSET(fields, 1)) {
67943 log_packet_detailed(" got field 'name'");
67944 #ifdef FREECIV_JSON_CONNECTION
67945 field_addr.name = "name";
67946 #endif /* FREECIV_JSON_CONNECTION */
67947 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
67948 RECEIVE_PACKET_FIELD_ERROR(name);
67949 }
67950 }
67951 if (BV_ISSET(fields, 2)) {
67952 log_packet_detailed(" got field 'rule_name'");
67953 #ifdef FREECIV_JSON_CONNECTION
67954 field_addr.name = "rule_name";
67955 #endif /* FREECIV_JSON_CONNECTION */
67956 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
67957 RECEIVE_PACKET_FIELD_ERROR(rule_name);
67958 }
67959 }
67960 if (BV_ISSET(fields, 3)) {
67961 log_packet_detailed(" got field 'min_speed'");
67962 #ifdef FREECIV_JSON_CONNECTION
67963 field_addr.name = "min_speed";
67964 #endif /* FREECIV_JSON_CONNECTION */
67965 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->min_speed)) {
67966 RECEIVE_PACKET_FIELD_ERROR(min_speed);
67967 }
67968 }
67969 if (BV_ISSET(fields, 4)) {
67970 log_packet_detailed(" got field 'hp_loss_pct'");
67971 #ifdef FREECIV_JSON_CONNECTION
67972 field_addr.name = "hp_loss_pct";
67973 #endif /* FREECIV_JSON_CONNECTION */
67974 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp_loss_pct)) {
67975 RECEIVE_PACKET_FIELD_ERROR(hp_loss_pct);
67976 }
67977 }
67978 if (BV_ISSET(fields, 5)) {
67979 log_packet_detailed(" got field 'non_native_def_pct'");
67980 #ifdef FREECIV_JSON_CONNECTION
67981 field_addr.name = "non_native_def_pct";
67982 #endif /* FREECIV_JSON_CONNECTION */
67983 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->non_native_def_pct)) {
67984 RECEIVE_PACKET_FIELD_ERROR(non_native_def_pct);
67985 }
67986 }
67987 if (BV_ISSET(fields, 6)) {
67988 log_packet_detailed(" got field 'flags'");
67989 #ifdef FREECIV_JSON_CONNECTION
67990 field_addr.name = "flags";
67991 #endif /* FREECIV_JSON_CONNECTION */
67992 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
67993 RECEIVE_PACKET_FIELD_ERROR(flags);
67994 }
67995 }
67996 if (BV_ISSET(fields, 7)) {
67997 log_packet_detailed(" got field 'helptext'");
67998 #ifdef FREECIV_JSON_CONNECTION
67999 field_addr.name = "helptext";
68000 #endif /* FREECIV_JSON_CONNECTION */
68001 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
68002 RECEIVE_PACKET_FIELD_ERROR(helptext);
68003 }
68004 }
68005
68006 if (NULL == old) {
68007 old = fc_malloc(sizeof(*old));
68008 *old = *real_packet;
68009 genhash_insert(*hash, old, old);
68010 } else {
68011 *old = *real_packet;
68012 }
68013
68014#endif /* FREECIV_DELTA_PROTOCOL */
68015 RECEIVE_PACKET_END(real_packet);
68016}
68017
68018 static int send_packet_ruleset_unit_class_100(struct connection *pc, const struct packet_ruleset_unit_class *packet)
68019{
68020 const struct packet_ruleset_unit_class *real_packet = packet;
68021#ifdef FREECIV_DELTA_PROTOCOL
68022 packet_ruleset_unit_class_100_fields fields;
68023 struct packet_ruleset_unit_class *old;
68024 bool differ;
68025 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT_CLASS;
68026#endif /* FREECIV_DELTA_PROTOCOL */
68027 SEND_PACKET_START(PACKET_RULESET_UNIT_CLASS);
68028#ifdef FREECIV_JSON_CONNECTION
68029 struct plocation field_addr;
68030 {
68031 struct plocation *field_addr_tmp = plocation_field_new(NULL);
68032 field_addr = *field_addr_tmp;
68033 FC_FREE(field_addr_tmp);
68034 }
68035#endif /* FREECIV_JSON_CONNECTION */
68036
68037 log_packet_detailed("packet_ruleset_unit_class_100: sending info about ()");
68038
68039#ifdef FREECIV_DELTA_PROTOCOL
68040 if (NULL == *hash) {
68041 *hash = genhash_new_full(hash_packet_ruleset_unit_class_100, cmp_packet_ruleset_unit_class_100,
68042 NULL, NULL, NULL, free);
68043 }
68044 BV_CLR_ALL(fields);
68045
68046 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
68047 old = fc_malloc(sizeof(*old));
68048 *old = *real_packet;
68049 genhash_insert(*hash, old, old);
68050 memset(old, 0, sizeof(*old));
68051 }
68052 differ = (old->id != real_packet->id);
68053 if (differ) {
68054 BV_SET(fields, 0);
68055 }
68056
68057 differ = (strcmp(old->name, real_packet->name) != 0);
68058 if (differ) {
68059 BV_SET(fields, 1);
68060 }
68061
68062 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
68063 if (differ) {
68064 BV_SET(fields, 2);
68065 }
68066
68067 differ = (old->min_speed != real_packet->min_speed);
68068 if (differ) {
68069 BV_SET(fields, 3);
68070 }
68071
68072 differ = (old->hp_loss_pct != real_packet->hp_loss_pct);
68073 if (differ) {
68074 BV_SET(fields, 4);
68075 }
68076
68077 differ = (old->non_native_def_pct != real_packet->non_native_def_pct);
68078 if (differ) {
68079 BV_SET(fields, 5);
68080 }
68081
68082 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
68083 if (differ) {
68084 BV_SET(fields, 6);
68085 }
68086
68087 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
68088 if (differ) {
68089 BV_SET(fields, 7);
68090 }
68091
68092
68093#ifdef FREECIV_JSON_CONNECTION
68094 field_addr.name = "fields";
68095#endif /* FREECIV_JSON_CONNECTION */
68096 DIO_BV_PUT(&dout, &field_addr, fields);
68097
68098 if (BV_ISSET(fields, 0)) {
68099 log_packet_detailed(" field 'id' has changed");
68100 #ifdef FREECIV_JSON_CONNECTION
68101 field_addr.name = "id";
68102#endif /* FREECIV_JSON_CONNECTION */
68103 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
68104 }
68105 if (BV_ISSET(fields, 1)) {
68106 log_packet_detailed(" field 'name' has changed");
68107 #ifdef FREECIV_JSON_CONNECTION
68108 field_addr.name = "name";
68109#endif /* FREECIV_JSON_CONNECTION */
68110 DIO_PUT(string, &dout, &field_addr, real_packet->name);
68111 }
68112 if (BV_ISSET(fields, 2)) {
68113 log_packet_detailed(" field 'rule_name' has changed");
68114 #ifdef FREECIV_JSON_CONNECTION
68115 field_addr.name = "rule_name";
68116#endif /* FREECIV_JSON_CONNECTION */
68117 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
68118 }
68119 if (BV_ISSET(fields, 3)) {
68120 log_packet_detailed(" field 'min_speed' has changed");
68121 #ifdef FREECIV_JSON_CONNECTION
68122 field_addr.name = "min_speed";
68123#endif /* FREECIV_JSON_CONNECTION */
68124 DIO_PUT(uint32, &dout, &field_addr, real_packet->min_speed);
68125 }
68126 if (BV_ISSET(fields, 4)) {
68127 log_packet_detailed(" field 'hp_loss_pct' has changed");
68128 #ifdef FREECIV_JSON_CONNECTION
68129 field_addr.name = "hp_loss_pct";
68130#endif /* FREECIV_JSON_CONNECTION */
68131 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp_loss_pct);
68132 }
68133 if (BV_ISSET(fields, 5)) {
68134 log_packet_detailed(" field 'non_native_def_pct' has changed");
68135 #ifdef FREECIV_JSON_CONNECTION
68136 field_addr.name = "non_native_def_pct";
68137#endif /* FREECIV_JSON_CONNECTION */
68138 DIO_PUT(uint16, &dout, &field_addr, real_packet->non_native_def_pct);
68139 }
68140 if (BV_ISSET(fields, 6)) {
68141 log_packet_detailed(" field 'flags' has changed");
68142 #ifdef FREECIV_JSON_CONNECTION
68143 field_addr.name = "flags";
68144#endif /* FREECIV_JSON_CONNECTION */
68145 DIO_BV_PUT(&dout, &field_addr, packet->flags);
68146 }
68147 if (BV_ISSET(fields, 7)) {
68148 log_packet_detailed(" field 'helptext' has changed");
68149 #ifdef FREECIV_JSON_CONNECTION
68150 field_addr.name = "helptext";
68151#endif /* FREECIV_JSON_CONNECTION */
68152 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
68153 }
68154
68155 *old = *real_packet;
68156#endif /* FREECIV_DELTA_PROTOCOL */
68157#ifndef FREECIV_DELTA_PROTOCOL
68158#ifdef FREECIV_JSON_CONNECTION
68159 field_addr.name = "id";
68160#endif /* FREECIV_JSON_CONNECTION */
68161 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
68162#ifdef FREECIV_JSON_CONNECTION
68163 field_addr.name = "name";
68164#endif /* FREECIV_JSON_CONNECTION */
68165 DIO_PUT(string, &dout, &field_addr, real_packet->name);
68166#ifdef FREECIV_JSON_CONNECTION
68167 field_addr.name = "rule_name";
68168#endif /* FREECIV_JSON_CONNECTION */
68169 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
68170#ifdef FREECIV_JSON_CONNECTION
68171 field_addr.name = "min_speed";
68172#endif /* FREECIV_JSON_CONNECTION */
68173 DIO_PUT(uint32, &dout, &field_addr, real_packet->min_speed);
68174#ifdef FREECIV_JSON_CONNECTION
68175 field_addr.name = "hp_loss_pct";
68176#endif /* FREECIV_JSON_CONNECTION */
68177 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp_loss_pct);
68178#ifdef FREECIV_JSON_CONNECTION
68179 field_addr.name = "non_native_def_pct";
68180#endif /* FREECIV_JSON_CONNECTION */
68181 DIO_PUT(uint16, &dout, &field_addr, real_packet->non_native_def_pct);
68182#ifdef FREECIV_JSON_CONNECTION
68183 field_addr.name = "flags";
68184#endif /* FREECIV_JSON_CONNECTION */
68185 DIO_BV_PUT(&dout, &field_addr, packet->flags);
68186#ifdef FREECIV_JSON_CONNECTION
68187 field_addr.name = "helptext";
68188#endif /* FREECIV_JSON_CONNECTION */
68189 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
68190
68191#endif
68192 SEND_PACKET_END(PACKET_RULESET_UNIT_CLASS);
68193}
68194
68195 int send_packet_ruleset_unit_class(struct connection *pc, const struct packet_ruleset_unit_class *packet)
68196{
68197 if (!pc->used) {
68198 log_error("WARNING: trying to send data to the closed connection %s",
68199 conn_description(pc));
68200 return -1;
68201 }
68202 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT_CLASS].packet != NULL, -1,
68203 "Handler for PACKET_RULESET_UNIT_CLASS not installed");
68204 return pc->phs.handlers->send[PACKET_RULESET_UNIT_CLASS].packet(pc, packet);
68205}
68206
68207 void lsend_packet_ruleset_unit_class(struct conn_list *dest, const struct packet_ruleset_unit_class *packet)
68208{
68209 conn_list_iterate(dest, pconn) {
68210 send_packet_ruleset_unit_class(pconn, packet);
68211 } conn_list_iterate_end;
68212}
68213
68214#ifdef FREECIV_DELTA_PROTOCOL
68215#define hash_packet_ruleset_extra_100 hash_const
68216
68217#define cmp_packet_ruleset_extra_100 cmp_const
68218
68219 BV_DEFINE(packet_ruleset_extra_100_fields, 39);
68220#endif /* FREECIV_DELTA_PROTOCOL */
68221
68222 static struct packet_ruleset_extra *receive_packet_ruleset_extra_100(struct connection *pc)
68223{
68224#ifdef FREECIV_DELTA_PROTOCOL
68225 packet_ruleset_extra_100_fields fields;
68226 struct packet_ruleset_extra *old;
68227 struct genhash **hash = pc->phs.received + PACKET_RULESET_EXTRA;
68228#endif /* FREECIV_DELTA_PROTOCOL */
68229 RECEIVE_PACKET_START(packet_ruleset_extra, real_packet);
68230#ifdef FREECIV_JSON_CONNECTION
68231 struct plocation field_addr;
68232 {
68233 struct plocation *field_addr_tmp = plocation_field_new(NULL);
68234 field_addr = *field_addr_tmp;
68235 FC_FREE(field_addr_tmp);
68236 }
68237#endif /* FREECIV_JSON_CONNECTION */
68238
68239#ifdef FREECIV_DELTA_PROTOCOL
68240#ifdef FREECIV_JSON_CONNECTION
68241 field_addr.name = "fields";
68242#endif /* FREECIV_JSON_CONNECTION */
68243 DIO_BV_GET(&din, &field_addr, fields);
68244
68245#else /* FREECIV_DELTA_PROTOCOL */
68246 #ifdef FREECIV_JSON_CONNECTION
68247 field_addr.name = "id";
68248 #endif /* FREECIV_JSON_CONNECTION */
68249 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
68250 RECEIVE_PACKET_FIELD_ERROR(id);
68251 }
68252 #ifdef FREECIV_JSON_CONNECTION
68253 field_addr.name = "name";
68254 #endif /* FREECIV_JSON_CONNECTION */
68255 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
68256 RECEIVE_PACKET_FIELD_ERROR(name);
68257 }
68258 #ifdef FREECIV_JSON_CONNECTION
68259 field_addr.name = "rule_name";
68260 #endif /* FREECIV_JSON_CONNECTION */
68261 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
68262 RECEIVE_PACKET_FIELD_ERROR(rule_name);
68263 }
68264 #ifdef FREECIV_JSON_CONNECTION
68265 field_addr.name = "category";
68266 #endif /* FREECIV_JSON_CONNECTION */
68267 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category)) {
68268 RECEIVE_PACKET_FIELD_ERROR(category);
68269 }
68270 #ifdef FREECIV_JSON_CONNECTION
68271 field_addr.name = "causes";
68272 #endif /* FREECIV_JSON_CONNECTION */
68273 if (!DIO_BV_GET(&din, &field_addr, real_packet->causes)) {
68274 RECEIVE_PACKET_FIELD_ERROR(causes);
68275 }
68276 #ifdef FREECIV_JSON_CONNECTION
68277 field_addr.name = "rmcauses";
68278 #endif /* FREECIV_JSON_CONNECTION */
68279 if (!DIO_BV_GET(&din, &field_addr, real_packet->rmcauses)) {
68280 RECEIVE_PACKET_FIELD_ERROR(rmcauses);
68281 }
68282 #ifdef FREECIV_JSON_CONNECTION
68283 field_addr.name = "activity_gfx";
68284 #endif /* FREECIV_JSON_CONNECTION */
68285 if (!DIO_GET(string, &din, &field_addr, real_packet->activity_gfx, sizeof(real_packet->activity_gfx))) {
68286 RECEIVE_PACKET_FIELD_ERROR(activity_gfx);
68287 }
68288 #ifdef FREECIV_JSON_CONNECTION
68289 field_addr.name = "act_gfx_alt";
68290 #endif /* FREECIV_JSON_CONNECTION */
68291 if (!DIO_GET(string, &din, &field_addr, real_packet->act_gfx_alt, sizeof(real_packet->act_gfx_alt))) {
68292 RECEIVE_PACKET_FIELD_ERROR(act_gfx_alt);
68293 }
68294 #ifdef FREECIV_JSON_CONNECTION
68295 field_addr.name = "act_gfx_alt2";
68296 #endif /* FREECIV_JSON_CONNECTION */
68297 if (!DIO_GET(string, &din, &field_addr, real_packet->act_gfx_alt2, sizeof(real_packet->act_gfx_alt2))) {
68298 RECEIVE_PACKET_FIELD_ERROR(act_gfx_alt2);
68299 }
68300 #ifdef FREECIV_JSON_CONNECTION
68301 field_addr.name = "rmact_gfx";
68302 #endif /* FREECIV_JSON_CONNECTION */
68303 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx, sizeof(real_packet->rmact_gfx))) {
68304 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx);
68305 }
68306 #ifdef FREECIV_JSON_CONNECTION
68307 field_addr.name = "rmact_gfx_alt";
68308 #endif /* FREECIV_JSON_CONNECTION */
68309 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx_alt, sizeof(real_packet->rmact_gfx_alt))) {
68310 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx_alt);
68311 }
68312 #ifdef FREECIV_JSON_CONNECTION
68313 field_addr.name = "graphic_str";
68314 #endif /* FREECIV_JSON_CONNECTION */
68315 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
68316 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
68317 }
68318 #ifdef FREECIV_JSON_CONNECTION
68319 field_addr.name = "graphic_alt";
68320 #endif /* FREECIV_JSON_CONNECTION */
68321 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
68322 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
68323 }
68324 #ifdef FREECIV_JSON_CONNECTION
68325 field_addr.name = "reqs_count";
68326 #endif /* FREECIV_JSON_CONNECTION */
68327 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
68328 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
68329 }
68330 #ifdef FREECIV_JSON_CONNECTION
68331 field_addr.name = "reqs";
68332 #endif /* FREECIV_JSON_CONNECTION */
68333
68334 {
68335 int i;
68336
68337 #ifdef FREECIV_JSON_CONNECTION
68338 /* Enter array. */
68339 field_addr.sub_location = plocation_elem_new(0);
68340 #endif /* FREECIV_JSON_CONNECTION */
68341
68342 if (real_packet->reqs_count > MAX_NUM_REQS) {
68343 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
68344 }
68345 for (i = 0; i < real_packet->reqs_count; i++) {
68346 #ifdef FREECIV_JSON_CONNECTION
68347 field_addr.sub_location->number = i;
68348 #endif /* FREECIV_JSON_CONNECTION */
68349 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
68350 RECEIVE_PACKET_FIELD_ERROR(reqs);
68351 }
68352 }
68353
68354 #ifdef FREECIV_JSON_CONNECTION
68355 /* Exit array. */
68356 free(field_addr.sub_location);
68357 field_addr.sub_location = NULL;
68358 #endif /* FREECIV_JSON_CONNECTION */
68359 }
68360 #ifdef FREECIV_JSON_CONNECTION
68361 field_addr.name = "rmreqs_count";
68362 #endif /* FREECIV_JSON_CONNECTION */
68363 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rmreqs_count)) {
68364 RECEIVE_PACKET_FIELD_ERROR(rmreqs_count);
68365 }
68366 #ifdef FREECIV_JSON_CONNECTION
68367 field_addr.name = "rmreqs";
68368 #endif /* FREECIV_JSON_CONNECTION */
68369
68370 {
68371 int i;
68372
68373 #ifdef FREECIV_JSON_CONNECTION
68374 /* Enter array. */
68375 field_addr.sub_location = plocation_elem_new(0);
68376 #endif /* FREECIV_JSON_CONNECTION */
68377
68378 if (real_packet->rmreqs_count > MAX_NUM_REQS) {
68379 RECEIVE_PACKET_FIELD_ERROR(rmreqs, ": truncation array");
68380 }
68381 for (i = 0; i < real_packet->rmreqs_count; i++) {
68382 #ifdef FREECIV_JSON_CONNECTION
68383 field_addr.sub_location->number = i;
68384 #endif /* FREECIV_JSON_CONNECTION */
68385 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->rmreqs[i])) {
68386 RECEIVE_PACKET_FIELD_ERROR(rmreqs);
68387 }
68388 }
68389
68390 #ifdef FREECIV_JSON_CONNECTION
68391 /* Exit array. */
68392 free(field_addr.sub_location);
68393 field_addr.sub_location = NULL;
68394 #endif /* FREECIV_JSON_CONNECTION */
68395 }
68396 #ifdef FREECIV_JSON_CONNECTION
68397 field_addr.name = "appearance_chance";
68398 #endif /* FREECIV_JSON_CONNECTION */
68399 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->appearance_chance)) {
68400 RECEIVE_PACKET_FIELD_ERROR(appearance_chance);
68401 }
68402 #ifdef FREECIV_JSON_CONNECTION
68403 field_addr.name = "appearance_reqs_count";
68404 #endif /* FREECIV_JSON_CONNECTION */
68405 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->appearance_reqs_count)) {
68406 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs_count);
68407 }
68408 #ifdef FREECIV_JSON_CONNECTION
68409 field_addr.name = "appearance_reqs";
68410 #endif /* FREECIV_JSON_CONNECTION */
68411
68412 {
68413 int i;
68414
68415 #ifdef FREECIV_JSON_CONNECTION
68416 /* Enter array. */
68417 field_addr.sub_location = plocation_elem_new(0);
68418 #endif /* FREECIV_JSON_CONNECTION */
68419
68420 if (real_packet->appearance_reqs_count > MAX_NUM_REQS) {
68421 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs, ": truncation array");
68422 }
68423 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
68424 #ifdef FREECIV_JSON_CONNECTION
68425 field_addr.sub_location->number = i;
68426 #endif /* FREECIV_JSON_CONNECTION */
68427 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->appearance_reqs[i])) {
68428 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs);
68429 }
68430 }
68431
68432 #ifdef FREECIV_JSON_CONNECTION
68433 /* Exit array. */
68434 free(field_addr.sub_location);
68435 field_addr.sub_location = NULL;
68436 #endif /* FREECIV_JSON_CONNECTION */
68437 }
68438 #ifdef FREECIV_JSON_CONNECTION
68439 field_addr.name = "disappearance_chance";
68440 #endif /* FREECIV_JSON_CONNECTION */
68441 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disappearance_chance)) {
68442 RECEIVE_PACKET_FIELD_ERROR(disappearance_chance);
68443 }
68444 #ifdef FREECIV_JSON_CONNECTION
68445 field_addr.name = "disappearance_reqs_count";
68446 #endif /* FREECIV_JSON_CONNECTION */
68447 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->disappearance_reqs_count)) {
68448 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs_count);
68449 }
68450 #ifdef FREECIV_JSON_CONNECTION
68451 field_addr.name = "disappearance_reqs";
68452 #endif /* FREECIV_JSON_CONNECTION */
68453
68454 {
68455 int i;
68456
68457 #ifdef FREECIV_JSON_CONNECTION
68458 /* Enter array. */
68459 field_addr.sub_location = plocation_elem_new(0);
68460 #endif /* FREECIV_JSON_CONNECTION */
68461
68462 if (real_packet->disappearance_reqs_count > MAX_NUM_REQS) {
68463 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs, ": truncation array");
68464 }
68465 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
68466 #ifdef FREECIV_JSON_CONNECTION
68467 field_addr.sub_location->number = i;
68468 #endif /* FREECIV_JSON_CONNECTION */
68469 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->disappearance_reqs[i])) {
68470 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs);
68471 }
68472 }
68473
68474 #ifdef FREECIV_JSON_CONNECTION
68475 /* Exit array. */
68476 free(field_addr.sub_location);
68477 field_addr.sub_location = NULL;
68478 #endif /* FREECIV_JSON_CONNECTION */
68479 }
68480 #ifdef FREECIV_JSON_CONNECTION
68481 field_addr.name = "visibility_req";
68482 #endif /* FREECIV_JSON_CONNECTION */
68483 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->visibility_req)) {
68484 RECEIVE_PACKET_FIELD_ERROR(visibility_req);
68485 }
68486 #ifdef FREECIV_JSON_CONNECTION
68487 field_addr.name = "buildable";
68488 #endif /* FREECIV_JSON_CONNECTION */
68489 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->buildable)) {
68490 RECEIVE_PACKET_FIELD_ERROR(buildable);
68491 }
68492 #ifdef FREECIV_JSON_CONNECTION
68493 field_addr.name = "generated";
68494 #endif /* FREECIV_JSON_CONNECTION */
68495 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->generated)) {
68496 RECEIVE_PACKET_FIELD_ERROR(generated);
68497 }
68498 #ifdef FREECIV_JSON_CONNECTION
68499 field_addr.name = "build_time";
68500 #endif /* FREECIV_JSON_CONNECTION */
68501 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_time)) {
68502 RECEIVE_PACKET_FIELD_ERROR(build_time);
68503 }
68504 #ifdef FREECIV_JSON_CONNECTION
68505 field_addr.name = "build_time_factor";
68506 #endif /* FREECIV_JSON_CONNECTION */
68507 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_time_factor)) {
68508 RECEIVE_PACKET_FIELD_ERROR(build_time_factor);
68509 }
68510 #ifdef FREECIV_JSON_CONNECTION
68511 field_addr.name = "removal_time";
68512 #endif /* FREECIV_JSON_CONNECTION */
68513 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->removal_time)) {
68514 RECEIVE_PACKET_FIELD_ERROR(removal_time);
68515 }
68516 #ifdef FREECIV_JSON_CONNECTION
68517 field_addr.name = "removal_time_factor";
68518 #endif /* FREECIV_JSON_CONNECTION */
68519 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->removal_time_factor)) {
68520 RECEIVE_PACKET_FIELD_ERROR(removal_time_factor);
68521 }
68522 #ifdef FREECIV_JSON_CONNECTION
68523 field_addr.name = "infracost";
68524 #endif /* FREECIV_JSON_CONNECTION */
68525 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->infracost)) {
68526 RECEIVE_PACKET_FIELD_ERROR(infracost);
68527 }
68528 #ifdef FREECIV_JSON_CONNECTION
68529 field_addr.name = "defense_bonus";
68530 #endif /* FREECIV_JSON_CONNECTION */
68531 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defense_bonus)) {
68532 RECEIVE_PACKET_FIELD_ERROR(defense_bonus);
68533 }
68534 #ifdef FREECIV_JSON_CONNECTION
68535 field_addr.name = "eus";
68536 #endif /* FREECIV_JSON_CONNECTION */
68537 {
68538 int readin;
68539
68540 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
68541 RECEIVE_PACKET_FIELD_ERROR(eus);
68542 }
68543 real_packet->eus = readin;
68544 }
68545 #ifdef FREECIV_JSON_CONNECTION
68546 field_addr.name = "native_to";
68547 #endif /* FREECIV_JSON_CONNECTION */
68548 if (!DIO_BV_GET(&din, &field_addr, real_packet->native_to)) {
68549 RECEIVE_PACKET_FIELD_ERROR(native_to);
68550 }
68551 #ifdef FREECIV_JSON_CONNECTION
68552 field_addr.name = "flags";
68553 #endif /* FREECIV_JSON_CONNECTION */
68554 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
68555 RECEIVE_PACKET_FIELD_ERROR(flags);
68556 }
68557 #ifdef FREECIV_JSON_CONNECTION
68558 field_addr.name = "hidden_by";
68559 #endif /* FREECIV_JSON_CONNECTION */
68560 if (!DIO_BV_GET(&din, &field_addr, real_packet->hidden_by)) {
68561 RECEIVE_PACKET_FIELD_ERROR(hidden_by);
68562 }
68563 #ifdef FREECIV_JSON_CONNECTION
68564 field_addr.name = "bridged_over";
68565 #endif /* FREECIV_JSON_CONNECTION */
68566 if (!DIO_BV_GET(&din, &field_addr, real_packet->bridged_over)) {
68567 RECEIVE_PACKET_FIELD_ERROR(bridged_over);
68568 }
68569 #ifdef FREECIV_JSON_CONNECTION
68570 field_addr.name = "conflicts";
68571 #endif /* FREECIV_JSON_CONNECTION */
68572 if (!DIO_BV_GET(&din, &field_addr, real_packet->conflicts)) {
68573 RECEIVE_PACKET_FIELD_ERROR(conflicts);
68574 }
68575 #ifdef FREECIV_JSON_CONNECTION
68576 field_addr.name = "helptext";
68577 #endif /* FREECIV_JSON_CONNECTION */
68578 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
68579 RECEIVE_PACKET_FIELD_ERROR(helptext);
68580 }
68581
68582#endif
68583 log_packet_detailed("packet_ruleset_extra_100: got info about ()");
68584
68585#ifdef FREECIV_DELTA_PROTOCOL
68586 if (NULL == *hash) {
68587 *hash = genhash_new_full(hash_packet_ruleset_extra_100, cmp_packet_ruleset_extra_100,
68588 NULL, NULL, NULL, free);
68589 }
68590
68591 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
68592 *real_packet = *old;
68593 } else {
68594 log_packet_detailed(" no old info");
68595 memset(real_packet, 0, sizeof(*real_packet));
68596 }
68597
68598 if (BV_ISSET(fields, 0)) {
68599 log_packet_detailed(" got field 'id'");
68600 #ifdef FREECIV_JSON_CONNECTION
68601 field_addr.name = "id";
68602 #endif /* FREECIV_JSON_CONNECTION */
68603 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
68604 RECEIVE_PACKET_FIELD_ERROR(id);
68605 }
68606 }
68607 if (BV_ISSET(fields, 1)) {
68608 log_packet_detailed(" got field 'name'");
68609 #ifdef FREECIV_JSON_CONNECTION
68610 field_addr.name = "name";
68611 #endif /* FREECIV_JSON_CONNECTION */
68612 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
68613 RECEIVE_PACKET_FIELD_ERROR(name);
68614 }
68615 }
68616 if (BV_ISSET(fields, 2)) {
68617 log_packet_detailed(" got field 'rule_name'");
68618 #ifdef FREECIV_JSON_CONNECTION
68619 field_addr.name = "rule_name";
68620 #endif /* FREECIV_JSON_CONNECTION */
68621 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
68622 RECEIVE_PACKET_FIELD_ERROR(rule_name);
68623 }
68624 }
68625 if (BV_ISSET(fields, 3)) {
68626 log_packet_detailed(" got field 'category'");
68627 #ifdef FREECIV_JSON_CONNECTION
68628 field_addr.name = "category";
68629 #endif /* FREECIV_JSON_CONNECTION */
68630 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category)) {
68631 RECEIVE_PACKET_FIELD_ERROR(category);
68632 }
68633 }
68634 if (BV_ISSET(fields, 4)) {
68635 log_packet_detailed(" got field 'causes'");
68636 #ifdef FREECIV_JSON_CONNECTION
68637 field_addr.name = "causes";
68638 #endif /* FREECIV_JSON_CONNECTION */
68639 if (!DIO_BV_GET(&din, &field_addr, real_packet->causes)) {
68640 RECEIVE_PACKET_FIELD_ERROR(causes);
68641 }
68642 }
68643 if (BV_ISSET(fields, 5)) {
68644 log_packet_detailed(" got field 'rmcauses'");
68645 #ifdef FREECIV_JSON_CONNECTION
68646 field_addr.name = "rmcauses";
68647 #endif /* FREECIV_JSON_CONNECTION */
68648 if (!DIO_BV_GET(&din, &field_addr, real_packet->rmcauses)) {
68649 RECEIVE_PACKET_FIELD_ERROR(rmcauses);
68650 }
68651 }
68652 if (BV_ISSET(fields, 6)) {
68653 log_packet_detailed(" got field 'activity_gfx'");
68654 #ifdef FREECIV_JSON_CONNECTION
68655 field_addr.name = "activity_gfx";
68656 #endif /* FREECIV_JSON_CONNECTION */
68657 if (!DIO_GET(string, &din, &field_addr, real_packet->activity_gfx, sizeof(real_packet->activity_gfx))) {
68658 RECEIVE_PACKET_FIELD_ERROR(activity_gfx);
68659 }
68660 }
68661 if (BV_ISSET(fields, 7)) {
68662 log_packet_detailed(" got field 'act_gfx_alt'");
68663 #ifdef FREECIV_JSON_CONNECTION
68664 field_addr.name = "act_gfx_alt";
68665 #endif /* FREECIV_JSON_CONNECTION */
68666 if (!DIO_GET(string, &din, &field_addr, real_packet->act_gfx_alt, sizeof(real_packet->act_gfx_alt))) {
68667 RECEIVE_PACKET_FIELD_ERROR(act_gfx_alt);
68668 }
68669 }
68670 if (BV_ISSET(fields, 8)) {
68671 log_packet_detailed(" got field 'act_gfx_alt2'");
68672 #ifdef FREECIV_JSON_CONNECTION
68673 field_addr.name = "act_gfx_alt2";
68674 #endif /* FREECIV_JSON_CONNECTION */
68675 if (!DIO_GET(string, &din, &field_addr, real_packet->act_gfx_alt2, sizeof(real_packet->act_gfx_alt2))) {
68676 RECEIVE_PACKET_FIELD_ERROR(act_gfx_alt2);
68677 }
68678 }
68679 if (BV_ISSET(fields, 9)) {
68680 log_packet_detailed(" got field 'rmact_gfx'");
68681 #ifdef FREECIV_JSON_CONNECTION
68682 field_addr.name = "rmact_gfx";
68683 #endif /* FREECIV_JSON_CONNECTION */
68684 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx, sizeof(real_packet->rmact_gfx))) {
68685 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx);
68686 }
68687 }
68688 if (BV_ISSET(fields, 10)) {
68689 log_packet_detailed(" got field 'rmact_gfx_alt'");
68690 #ifdef FREECIV_JSON_CONNECTION
68691 field_addr.name = "rmact_gfx_alt";
68692 #endif /* FREECIV_JSON_CONNECTION */
68693 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx_alt, sizeof(real_packet->rmact_gfx_alt))) {
68694 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx_alt);
68695 }
68696 }
68697 if (BV_ISSET(fields, 11)) {
68698 log_packet_detailed(" got field 'graphic_str'");
68699 #ifdef FREECIV_JSON_CONNECTION
68700 field_addr.name = "graphic_str";
68701 #endif /* FREECIV_JSON_CONNECTION */
68702 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
68703 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
68704 }
68705 }
68706 if (BV_ISSET(fields, 12)) {
68707 log_packet_detailed(" got field 'graphic_alt'");
68708 #ifdef FREECIV_JSON_CONNECTION
68709 field_addr.name = "graphic_alt";
68710 #endif /* FREECIV_JSON_CONNECTION */
68711 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
68712 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
68713 }
68714 }
68715 if (BV_ISSET(fields, 13)) {
68716 log_packet_detailed(" got field 'reqs_count'");
68717 #ifdef FREECIV_JSON_CONNECTION
68718 field_addr.name = "reqs_count";
68719 #endif /* FREECIV_JSON_CONNECTION */
68720 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
68721 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
68722 }
68723 }
68724 if (BV_ISSET(fields, 14)) {
68725 log_packet_detailed(" got field 'reqs'");
68726 #ifdef FREECIV_JSON_CONNECTION
68727 field_addr.name = "reqs";
68728 #endif /* FREECIV_JSON_CONNECTION */
68729
68730 {
68731 int i;
68732
68733 #ifdef FREECIV_JSON_CONNECTION
68734 /* Enter array. */
68735 field_addr.sub_location = plocation_elem_new(0);
68736 #endif /* FREECIV_JSON_CONNECTION */
68737
68738 if (real_packet->reqs_count > MAX_NUM_REQS) {
68739 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
68740 }
68741 for (i = 0; i < real_packet->reqs_count; i++) {
68742 #ifdef FREECIV_JSON_CONNECTION
68743 field_addr.sub_location->number = i;
68744 #endif /* FREECIV_JSON_CONNECTION */
68745 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
68746 RECEIVE_PACKET_FIELD_ERROR(reqs);
68747 }
68748 }
68749
68750 #ifdef FREECIV_JSON_CONNECTION
68751 /* Exit array. */
68752 free(field_addr.sub_location);
68753 field_addr.sub_location = NULL;
68754 #endif /* FREECIV_JSON_CONNECTION */
68755 }
68756 }
68757 if (BV_ISSET(fields, 15)) {
68758 log_packet_detailed(" got field 'rmreqs_count'");
68759 #ifdef FREECIV_JSON_CONNECTION
68760 field_addr.name = "rmreqs_count";
68761 #endif /* FREECIV_JSON_CONNECTION */
68762 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rmreqs_count)) {
68763 RECEIVE_PACKET_FIELD_ERROR(rmreqs_count);
68764 }
68765 }
68766 if (BV_ISSET(fields, 16)) {
68767 log_packet_detailed(" got field 'rmreqs'");
68768 #ifdef FREECIV_JSON_CONNECTION
68769 field_addr.name = "rmreqs";
68770 #endif /* FREECIV_JSON_CONNECTION */
68771
68772 {
68773 int i;
68774
68775 #ifdef FREECIV_JSON_CONNECTION
68776 /* Enter array. */
68777 field_addr.sub_location = plocation_elem_new(0);
68778 #endif /* FREECIV_JSON_CONNECTION */
68779
68780 if (real_packet->rmreqs_count > MAX_NUM_REQS) {
68781 RECEIVE_PACKET_FIELD_ERROR(rmreqs, ": truncation array");
68782 }
68783 for (i = 0; i < real_packet->rmreqs_count; i++) {
68784 #ifdef FREECIV_JSON_CONNECTION
68785 field_addr.sub_location->number = i;
68786 #endif /* FREECIV_JSON_CONNECTION */
68787 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->rmreqs[i])) {
68788 RECEIVE_PACKET_FIELD_ERROR(rmreqs);
68789 }
68790 }
68791
68792 #ifdef FREECIV_JSON_CONNECTION
68793 /* Exit array. */
68794 free(field_addr.sub_location);
68795 field_addr.sub_location = NULL;
68796 #endif /* FREECIV_JSON_CONNECTION */
68797 }
68798 }
68799 if (BV_ISSET(fields, 17)) {
68800 log_packet_detailed(" got field 'appearance_chance'");
68801 #ifdef FREECIV_JSON_CONNECTION
68802 field_addr.name = "appearance_chance";
68803 #endif /* FREECIV_JSON_CONNECTION */
68804 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->appearance_chance)) {
68805 RECEIVE_PACKET_FIELD_ERROR(appearance_chance);
68806 }
68807 }
68808 if (BV_ISSET(fields, 18)) {
68809 log_packet_detailed(" got field 'appearance_reqs_count'");
68810 #ifdef FREECIV_JSON_CONNECTION
68811 field_addr.name = "appearance_reqs_count";
68812 #endif /* FREECIV_JSON_CONNECTION */
68813 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->appearance_reqs_count)) {
68814 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs_count);
68815 }
68816 }
68817 if (BV_ISSET(fields, 19)) {
68818 log_packet_detailed(" got field 'appearance_reqs'");
68819 #ifdef FREECIV_JSON_CONNECTION
68820 field_addr.name = "appearance_reqs";
68821 #endif /* FREECIV_JSON_CONNECTION */
68822
68823 {
68824 int i;
68825
68826 #ifdef FREECIV_JSON_CONNECTION
68827 /* Enter array. */
68828 field_addr.sub_location = plocation_elem_new(0);
68829 #endif /* FREECIV_JSON_CONNECTION */
68830
68831 if (real_packet->appearance_reqs_count > MAX_NUM_REQS) {
68832 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs, ": truncation array");
68833 }
68834 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
68835 #ifdef FREECIV_JSON_CONNECTION
68836 field_addr.sub_location->number = i;
68837 #endif /* FREECIV_JSON_CONNECTION */
68838 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->appearance_reqs[i])) {
68839 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs);
68840 }
68841 }
68842
68843 #ifdef FREECIV_JSON_CONNECTION
68844 /* Exit array. */
68845 free(field_addr.sub_location);
68846 field_addr.sub_location = NULL;
68847 #endif /* FREECIV_JSON_CONNECTION */
68848 }
68849 }
68850 if (BV_ISSET(fields, 20)) {
68851 log_packet_detailed(" got field 'disappearance_chance'");
68852 #ifdef FREECIV_JSON_CONNECTION
68853 field_addr.name = "disappearance_chance";
68854 #endif /* FREECIV_JSON_CONNECTION */
68855 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disappearance_chance)) {
68856 RECEIVE_PACKET_FIELD_ERROR(disappearance_chance);
68857 }
68858 }
68859 if (BV_ISSET(fields, 21)) {
68860 log_packet_detailed(" got field 'disappearance_reqs_count'");
68861 #ifdef FREECIV_JSON_CONNECTION
68862 field_addr.name = "disappearance_reqs_count";
68863 #endif /* FREECIV_JSON_CONNECTION */
68864 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->disappearance_reqs_count)) {
68865 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs_count);
68866 }
68867 }
68868 if (BV_ISSET(fields, 22)) {
68869 log_packet_detailed(" got field 'disappearance_reqs'");
68870 #ifdef FREECIV_JSON_CONNECTION
68871 field_addr.name = "disappearance_reqs";
68872 #endif /* FREECIV_JSON_CONNECTION */
68873
68874 {
68875 int i;
68876
68877 #ifdef FREECIV_JSON_CONNECTION
68878 /* Enter array. */
68879 field_addr.sub_location = plocation_elem_new(0);
68880 #endif /* FREECIV_JSON_CONNECTION */
68881
68882 if (real_packet->disappearance_reqs_count > MAX_NUM_REQS) {
68883 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs, ": truncation array");
68884 }
68885 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
68886 #ifdef FREECIV_JSON_CONNECTION
68887 field_addr.sub_location->number = i;
68888 #endif /* FREECIV_JSON_CONNECTION */
68889 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->disappearance_reqs[i])) {
68890 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs);
68891 }
68892 }
68893
68894 #ifdef FREECIV_JSON_CONNECTION
68895 /* Exit array. */
68896 free(field_addr.sub_location);
68897 field_addr.sub_location = NULL;
68898 #endif /* FREECIV_JSON_CONNECTION */
68899 }
68900 }
68901 if (BV_ISSET(fields, 23)) {
68902 log_packet_detailed(" got field 'visibility_req'");
68903 #ifdef FREECIV_JSON_CONNECTION
68904 field_addr.name = "visibility_req";
68905 #endif /* FREECIV_JSON_CONNECTION */
68906 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->visibility_req)) {
68907 RECEIVE_PACKET_FIELD_ERROR(visibility_req);
68908 }
68909 }
68910 real_packet->buildable = BV_ISSET(fields, 24);
68911 real_packet->generated = BV_ISSET(fields, 25);
68912 if (BV_ISSET(fields, 26)) {
68913 log_packet_detailed(" got field 'build_time'");
68914 #ifdef FREECIV_JSON_CONNECTION
68915 field_addr.name = "build_time";
68916 #endif /* FREECIV_JSON_CONNECTION */
68917 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_time)) {
68918 RECEIVE_PACKET_FIELD_ERROR(build_time);
68919 }
68920 }
68921 if (BV_ISSET(fields, 27)) {
68922 log_packet_detailed(" got field 'build_time_factor'");
68923 #ifdef FREECIV_JSON_CONNECTION
68924 field_addr.name = "build_time_factor";
68925 #endif /* FREECIV_JSON_CONNECTION */
68926 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_time_factor)) {
68927 RECEIVE_PACKET_FIELD_ERROR(build_time_factor);
68928 }
68929 }
68930 if (BV_ISSET(fields, 28)) {
68931 log_packet_detailed(" got field 'removal_time'");
68932 #ifdef FREECIV_JSON_CONNECTION
68933 field_addr.name = "removal_time";
68934 #endif /* FREECIV_JSON_CONNECTION */
68935 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->removal_time)) {
68936 RECEIVE_PACKET_FIELD_ERROR(removal_time);
68937 }
68938 }
68939 if (BV_ISSET(fields, 29)) {
68940 log_packet_detailed(" got field 'removal_time_factor'");
68941 #ifdef FREECIV_JSON_CONNECTION
68942 field_addr.name = "removal_time_factor";
68943 #endif /* FREECIV_JSON_CONNECTION */
68944 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->removal_time_factor)) {
68945 RECEIVE_PACKET_FIELD_ERROR(removal_time_factor);
68946 }
68947 }
68948 if (BV_ISSET(fields, 30)) {
68949 log_packet_detailed(" got field 'infracost'");
68950 #ifdef FREECIV_JSON_CONNECTION
68951 field_addr.name = "infracost";
68952 #endif /* FREECIV_JSON_CONNECTION */
68953 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->infracost)) {
68954 RECEIVE_PACKET_FIELD_ERROR(infracost);
68955 }
68956 }
68957 if (BV_ISSET(fields, 31)) {
68958 log_packet_detailed(" got field 'defense_bonus'");
68959 #ifdef FREECIV_JSON_CONNECTION
68960 field_addr.name = "defense_bonus";
68961 #endif /* FREECIV_JSON_CONNECTION */
68962 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defense_bonus)) {
68963 RECEIVE_PACKET_FIELD_ERROR(defense_bonus);
68964 }
68965 }
68966 if (BV_ISSET(fields, 32)) {
68967 log_packet_detailed(" got field 'eus'");
68968 #ifdef FREECIV_JSON_CONNECTION
68969 field_addr.name = "eus";
68970 #endif /* FREECIV_JSON_CONNECTION */
68971 {
68972 int readin;
68973
68974 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
68975 RECEIVE_PACKET_FIELD_ERROR(eus);
68976 }
68977 real_packet->eus = readin;
68978 }
68979 }
68980 if (BV_ISSET(fields, 33)) {
68981 log_packet_detailed(" got field 'native_to'");
68982 #ifdef FREECIV_JSON_CONNECTION
68983 field_addr.name = "native_to";
68984 #endif /* FREECIV_JSON_CONNECTION */
68985 if (!DIO_BV_GET(&din, &field_addr, real_packet->native_to)) {
68986 RECEIVE_PACKET_FIELD_ERROR(native_to);
68987 }
68988 }
68989 if (BV_ISSET(fields, 34)) {
68990 log_packet_detailed(" got field 'flags'");
68991 #ifdef FREECIV_JSON_CONNECTION
68992 field_addr.name = "flags";
68993 #endif /* FREECIV_JSON_CONNECTION */
68994 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
68995 RECEIVE_PACKET_FIELD_ERROR(flags);
68996 }
68997 }
68998 if (BV_ISSET(fields, 35)) {
68999 log_packet_detailed(" got field 'hidden_by'");
69000 #ifdef FREECIV_JSON_CONNECTION
69001 field_addr.name = "hidden_by";
69002 #endif /* FREECIV_JSON_CONNECTION */
69003 if (!DIO_BV_GET(&din, &field_addr, real_packet->hidden_by)) {
69004 RECEIVE_PACKET_FIELD_ERROR(hidden_by);
69005 }
69006 }
69007 if (BV_ISSET(fields, 36)) {
69008 log_packet_detailed(" got field 'bridged_over'");
69009 #ifdef FREECIV_JSON_CONNECTION
69010 field_addr.name = "bridged_over";
69011 #endif /* FREECIV_JSON_CONNECTION */
69012 if (!DIO_BV_GET(&din, &field_addr, real_packet->bridged_over)) {
69013 RECEIVE_PACKET_FIELD_ERROR(bridged_over);
69014 }
69015 }
69016 if (BV_ISSET(fields, 37)) {
69017 log_packet_detailed(" got field 'conflicts'");
69018 #ifdef FREECIV_JSON_CONNECTION
69019 field_addr.name = "conflicts";
69020 #endif /* FREECIV_JSON_CONNECTION */
69021 if (!DIO_BV_GET(&din, &field_addr, real_packet->conflicts)) {
69022 RECEIVE_PACKET_FIELD_ERROR(conflicts);
69023 }
69024 }
69025 if (BV_ISSET(fields, 38)) {
69026 log_packet_detailed(" got field 'helptext'");
69027 #ifdef FREECIV_JSON_CONNECTION
69028 field_addr.name = "helptext";
69029 #endif /* FREECIV_JSON_CONNECTION */
69030 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
69031 RECEIVE_PACKET_FIELD_ERROR(helptext);
69032 }
69033 }
69034
69035 if (NULL == old) {
69036 old = fc_malloc(sizeof(*old));
69037 *old = *real_packet;
69038 genhash_insert(*hash, old, old);
69039 } else {
69040 *old = *real_packet;
69041 }
69042
69043#endif /* FREECIV_DELTA_PROTOCOL */
69044 RECEIVE_PACKET_END(real_packet);
69045}
69046
69047 static int send_packet_ruleset_extra_100(struct connection *pc, const struct packet_ruleset_extra *packet)
69048{
69049 const struct packet_ruleset_extra *real_packet = packet;
69050#ifdef FREECIV_DELTA_PROTOCOL
69051 packet_ruleset_extra_100_fields fields;
69052 struct packet_ruleset_extra *old;
69053 bool differ;
69054 struct genhash **hash = pc->phs.sent + PACKET_RULESET_EXTRA;
69055#endif /* FREECIV_DELTA_PROTOCOL */
69056 SEND_PACKET_START(PACKET_RULESET_EXTRA);
69057#ifdef FREECIV_JSON_CONNECTION
69058 struct plocation field_addr;
69059 {
69060 struct plocation *field_addr_tmp = plocation_field_new(NULL);
69061 field_addr = *field_addr_tmp;
69062 FC_FREE(field_addr_tmp);
69063 }
69064#endif /* FREECIV_JSON_CONNECTION */
69065
69066 log_packet_detailed("packet_ruleset_extra_100: sending info about ()");
69067
69068#ifdef FREECIV_DELTA_PROTOCOL
69069 if (NULL == *hash) {
69070 *hash = genhash_new_full(hash_packet_ruleset_extra_100, cmp_packet_ruleset_extra_100,
69071 NULL, NULL, NULL, free);
69072 }
69073 BV_CLR_ALL(fields);
69074
69075 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
69076 old = fc_malloc(sizeof(*old));
69077 *old = *real_packet;
69078 genhash_insert(*hash, old, old);
69079 memset(old, 0, sizeof(*old));
69080 }
69081 differ = (old->id != real_packet->id);
69082 if (differ) {
69083 BV_SET(fields, 0);
69084 }
69085
69086 differ = (strcmp(old->name, real_packet->name) != 0);
69087 if (differ) {
69088 BV_SET(fields, 1);
69089 }
69090
69091 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
69092 if (differ) {
69093 BV_SET(fields, 2);
69094 }
69095
69096 differ = (old->category != real_packet->category);
69097 if (differ) {
69098 BV_SET(fields, 3);
69099 }
69100
69101 differ = !BV_ARE_EQUAL(old->causes, real_packet->causes);
69102 if (differ) {
69103 BV_SET(fields, 4);
69104 }
69105
69106 differ = !BV_ARE_EQUAL(old->rmcauses, real_packet->rmcauses);
69107 if (differ) {
69108 BV_SET(fields, 5);
69109 }
69110
69111 differ = (strcmp(old->activity_gfx, real_packet->activity_gfx) != 0);
69112 if (differ) {
69113 BV_SET(fields, 6);
69114 }
69115
69116 differ = (strcmp(old->act_gfx_alt, real_packet->act_gfx_alt) != 0);
69117 if (differ) {
69118 BV_SET(fields, 7);
69119 }
69120
69121 differ = (strcmp(old->act_gfx_alt2, real_packet->act_gfx_alt2) != 0);
69122 if (differ) {
69123 BV_SET(fields, 8);
69124 }
69125
69126 differ = (strcmp(old->rmact_gfx, real_packet->rmact_gfx) != 0);
69127 if (differ) {
69128 BV_SET(fields, 9);
69129 }
69130
69131 differ = (strcmp(old->rmact_gfx_alt, real_packet->rmact_gfx_alt) != 0);
69132 if (differ) {
69133 BV_SET(fields, 10);
69134 }
69135
69136 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
69137 if (differ) {
69138 BV_SET(fields, 11);
69139 }
69140
69141 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
69142 if (differ) {
69143 BV_SET(fields, 12);
69144 }
69145
69146 differ = (old->reqs_count != real_packet->reqs_count);
69147 if (differ) {
69148 BV_SET(fields, 13);
69149 }
69150
69151
69152 {
69153 differ = (old->reqs_count != real_packet->reqs_count);
69154 if (!differ) {
69155 int i;
69156
69157 for (i = 0; i < real_packet->reqs_count; i++) {
69158 if (!are_requirements_equal(&old->reqs[i], &real_packet->reqs[i])) {
69159 differ = TRUE;
69160 break;
69161 }
69162 }
69163 }
69164 }
69165 if (differ) {
69166 BV_SET(fields, 14);
69167 }
69168
69169 differ = (old->rmreqs_count != real_packet->rmreqs_count);
69170 if (differ) {
69171 BV_SET(fields, 15);
69172 }
69173
69174
69175 {
69176 differ = (old->rmreqs_count != real_packet->rmreqs_count);
69177 if (!differ) {
69178 int i;
69179
69180 for (i = 0; i < real_packet->rmreqs_count; i++) {
69181 if (!are_requirements_equal(&old->rmreqs[i], &real_packet->rmreqs[i])) {
69182 differ = TRUE;
69183 break;
69184 }
69185 }
69186 }
69187 }
69188 if (differ) {
69189 BV_SET(fields, 16);
69190 }
69191
69192 differ = (old->appearance_chance != real_packet->appearance_chance);
69193 if (differ) {
69194 BV_SET(fields, 17);
69195 }
69196
69197 differ = (old->appearance_reqs_count != real_packet->appearance_reqs_count);
69198 if (differ) {
69199 BV_SET(fields, 18);
69200 }
69201
69202
69203 {
69204 differ = (old->appearance_reqs_count != real_packet->appearance_reqs_count);
69205 if (!differ) {
69206 int i;
69207
69208 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
69209 if (!are_requirements_equal(&old->appearance_reqs[i], &real_packet->appearance_reqs[i])) {
69210 differ = TRUE;
69211 break;
69212 }
69213 }
69214 }
69215 }
69216 if (differ) {
69217 BV_SET(fields, 19);
69218 }
69219
69220 differ = (old->disappearance_chance != real_packet->disappearance_chance);
69221 if (differ) {
69222 BV_SET(fields, 20);
69223 }
69224
69225 differ = (old->disappearance_reqs_count != real_packet->disappearance_reqs_count);
69226 if (differ) {
69227 BV_SET(fields, 21);
69228 }
69229
69230
69231 {
69232 differ = (old->disappearance_reqs_count != real_packet->disappearance_reqs_count);
69233 if (!differ) {
69234 int i;
69235
69236 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
69237 if (!are_requirements_equal(&old->disappearance_reqs[i], &real_packet->disappearance_reqs[i])) {
69238 differ = TRUE;
69239 break;
69240 }
69241 }
69242 }
69243 }
69244 if (differ) {
69245 BV_SET(fields, 22);
69246 }
69247
69248 differ = (old->visibility_req != real_packet->visibility_req);
69249 if (differ) {
69250 BV_SET(fields, 23);
69251 }
69252
69253 if (packet->buildable) {
69254 BV_SET(fields, 24);
69255 }
69256
69257 if (packet->generated) {
69258 BV_SET(fields, 25);
69259 }
69260
69261 differ = (old->build_time != real_packet->build_time);
69262 if (differ) {
69263 BV_SET(fields, 26);
69264 }
69265
69266 differ = (old->build_time_factor != real_packet->build_time_factor);
69267 if (differ) {
69268 BV_SET(fields, 27);
69269 }
69270
69271 differ = (old->removal_time != real_packet->removal_time);
69272 if (differ) {
69273 BV_SET(fields, 28);
69274 }
69275
69276 differ = (old->removal_time_factor != real_packet->removal_time_factor);
69277 if (differ) {
69278 BV_SET(fields, 29);
69279 }
69280
69281 differ = (old->infracost != real_packet->infracost);
69282 if (differ) {
69283 BV_SET(fields, 30);
69284 }
69285
69286 differ = (old->defense_bonus != real_packet->defense_bonus);
69287 if (differ) {
69288 BV_SET(fields, 31);
69289 }
69290
69291 differ = (old->eus != real_packet->eus);
69292 if (differ) {
69293 BV_SET(fields, 32);
69294 }
69295
69296 differ = !BV_ARE_EQUAL(old->native_to, real_packet->native_to);
69297 if (differ) {
69298 BV_SET(fields, 33);
69299 }
69300
69301 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
69302 if (differ) {
69303 BV_SET(fields, 34);
69304 }
69305
69306 differ = !BV_ARE_EQUAL(old->hidden_by, real_packet->hidden_by);
69307 if (differ) {
69308 BV_SET(fields, 35);
69309 }
69310
69311 differ = !BV_ARE_EQUAL(old->bridged_over, real_packet->bridged_over);
69312 if (differ) {
69313 BV_SET(fields, 36);
69314 }
69315
69316 differ = !BV_ARE_EQUAL(old->conflicts, real_packet->conflicts);
69317 if (differ) {
69318 BV_SET(fields, 37);
69319 }
69320
69321 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
69322 if (differ) {
69323 BV_SET(fields, 38);
69324 }
69325
69326
69327#ifdef FREECIV_JSON_CONNECTION
69328 field_addr.name = "fields";
69329#endif /* FREECIV_JSON_CONNECTION */
69330 DIO_BV_PUT(&dout, &field_addr, fields);
69331
69332 if (BV_ISSET(fields, 0)) {
69333 log_packet_detailed(" field 'id' has changed");
69334 #ifdef FREECIV_JSON_CONNECTION
69335 field_addr.name = "id";
69336#endif /* FREECIV_JSON_CONNECTION */
69337 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
69338 }
69339 if (BV_ISSET(fields, 1)) {
69340 log_packet_detailed(" field 'name' has changed");
69341 #ifdef FREECIV_JSON_CONNECTION
69342 field_addr.name = "name";
69343#endif /* FREECIV_JSON_CONNECTION */
69344 DIO_PUT(string, &dout, &field_addr, real_packet->name);
69345 }
69346 if (BV_ISSET(fields, 2)) {
69347 log_packet_detailed(" field 'rule_name' has changed");
69348 #ifdef FREECIV_JSON_CONNECTION
69349 field_addr.name = "rule_name";
69350#endif /* FREECIV_JSON_CONNECTION */
69351 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
69352 }
69353 if (BV_ISSET(fields, 3)) {
69354 log_packet_detailed(" field 'category' has changed");
69355 #ifdef FREECIV_JSON_CONNECTION
69356 field_addr.name = "category";
69357#endif /* FREECIV_JSON_CONNECTION */
69358 DIO_PUT(uint8, &dout, &field_addr, real_packet->category);
69359 }
69360 if (BV_ISSET(fields, 4)) {
69361 log_packet_detailed(" field 'causes' has changed");
69362 #ifdef FREECIV_JSON_CONNECTION
69363 field_addr.name = "causes";
69364#endif /* FREECIV_JSON_CONNECTION */
69365 DIO_BV_PUT(&dout, &field_addr, packet->causes);
69366 }
69367 if (BV_ISSET(fields, 5)) {
69368 log_packet_detailed(" field 'rmcauses' has changed");
69369 #ifdef FREECIV_JSON_CONNECTION
69370 field_addr.name = "rmcauses";
69371#endif /* FREECIV_JSON_CONNECTION */
69372 DIO_BV_PUT(&dout, &field_addr, packet->rmcauses);
69373 }
69374 if (BV_ISSET(fields, 6)) {
69375 log_packet_detailed(" field 'activity_gfx' has changed");
69376 #ifdef FREECIV_JSON_CONNECTION
69377 field_addr.name = "activity_gfx";
69378#endif /* FREECIV_JSON_CONNECTION */
69379 DIO_PUT(string, &dout, &field_addr, real_packet->activity_gfx);
69380 }
69381 if (BV_ISSET(fields, 7)) {
69382 log_packet_detailed(" field 'act_gfx_alt' has changed");
69383 #ifdef FREECIV_JSON_CONNECTION
69384 field_addr.name = "act_gfx_alt";
69385#endif /* FREECIV_JSON_CONNECTION */
69386 DIO_PUT(string, &dout, &field_addr, real_packet->act_gfx_alt);
69387 }
69388 if (BV_ISSET(fields, 8)) {
69389 log_packet_detailed(" field 'act_gfx_alt2' has changed");
69390 #ifdef FREECIV_JSON_CONNECTION
69391 field_addr.name = "act_gfx_alt2";
69392#endif /* FREECIV_JSON_CONNECTION */
69393 DIO_PUT(string, &dout, &field_addr, real_packet->act_gfx_alt2);
69394 }
69395 if (BV_ISSET(fields, 9)) {
69396 log_packet_detailed(" field 'rmact_gfx' has changed");
69397 #ifdef FREECIV_JSON_CONNECTION
69398 field_addr.name = "rmact_gfx";
69399#endif /* FREECIV_JSON_CONNECTION */
69400 DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx);
69401 }
69402 if (BV_ISSET(fields, 10)) {
69403 log_packet_detailed(" field 'rmact_gfx_alt' has changed");
69404 #ifdef FREECIV_JSON_CONNECTION
69405 field_addr.name = "rmact_gfx_alt";
69406#endif /* FREECIV_JSON_CONNECTION */
69407 DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx_alt);
69408 }
69409 if (BV_ISSET(fields, 11)) {
69410 log_packet_detailed(" field 'graphic_str' has changed");
69411 #ifdef FREECIV_JSON_CONNECTION
69412 field_addr.name = "graphic_str";
69413#endif /* FREECIV_JSON_CONNECTION */
69414 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
69415 }
69416 if (BV_ISSET(fields, 12)) {
69417 log_packet_detailed(" field 'graphic_alt' has changed");
69418 #ifdef FREECIV_JSON_CONNECTION
69419 field_addr.name = "graphic_alt";
69420#endif /* FREECIV_JSON_CONNECTION */
69421 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
69422 }
69423 if (BV_ISSET(fields, 13)) {
69424 log_packet_detailed(" field 'reqs_count' has changed");
69425 #ifdef FREECIV_JSON_CONNECTION
69426 field_addr.name = "reqs_count";
69427#endif /* FREECIV_JSON_CONNECTION */
69428 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
69429 }
69430 if (BV_ISSET(fields, 14)) {
69431 log_packet_detailed(" field 'reqs' has changed");
69432 #ifdef FREECIV_JSON_CONNECTION
69433 field_addr.name = "reqs";
69434#endif /* FREECIV_JSON_CONNECTION */
69435
69436 {
69437 int i;
69438
69439#ifdef FREECIV_JSON_CONNECTION
69440 /* Create the array. */
69441 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
69442
69443 /* Enter the array. */
69444 field_addr.sub_location = plocation_elem_new(0);
69445#endif /* FREECIV_JSON_CONNECTION */
69446
69447 for (i = 0; i < real_packet->reqs_count; i++) {
69448#ifdef FREECIV_JSON_CONNECTION
69449 /* Next array element. */
69450 field_addr.sub_location->number = i;
69451#endif /* FREECIV_JSON_CONNECTION */
69452 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
69453 }
69454
69455#ifdef FREECIV_JSON_CONNECTION
69456 /* Exit array. */
69457 free(field_addr.sub_location);
69458 field_addr.sub_location = NULL;
69459#endif /* FREECIV_JSON_CONNECTION */
69460 }
69461 }
69462 if (BV_ISSET(fields, 15)) {
69463 log_packet_detailed(" field 'rmreqs_count' has changed");
69464 #ifdef FREECIV_JSON_CONNECTION
69465 field_addr.name = "rmreqs_count";
69466#endif /* FREECIV_JSON_CONNECTION */
69467 DIO_PUT(uint8, &dout, &field_addr, real_packet->rmreqs_count);
69468 }
69469 if (BV_ISSET(fields, 16)) {
69470 log_packet_detailed(" field 'rmreqs' has changed");
69471 #ifdef FREECIV_JSON_CONNECTION
69472 field_addr.name = "rmreqs";
69473#endif /* FREECIV_JSON_CONNECTION */
69474
69475 {
69476 int i;
69477
69478#ifdef FREECIV_JSON_CONNECTION
69479 /* Create the array. */
69480 DIO_PUT(farray, &dout, &field_addr, real_packet->rmreqs_count);
69481
69482 /* Enter the array. */
69483 field_addr.sub_location = plocation_elem_new(0);
69484#endif /* FREECIV_JSON_CONNECTION */
69485
69486 for (i = 0; i < real_packet->rmreqs_count; i++) {
69487#ifdef FREECIV_JSON_CONNECTION
69488 /* Next array element. */
69489 field_addr.sub_location->number = i;
69490#endif /* FREECIV_JSON_CONNECTION */
69491 DIO_PUT(requirement, &dout, &field_addr, &real_packet->rmreqs[i]);
69492 }
69493
69494#ifdef FREECIV_JSON_CONNECTION
69495 /* Exit array. */
69496 free(field_addr.sub_location);
69497 field_addr.sub_location = NULL;
69498#endif /* FREECIV_JSON_CONNECTION */
69499 }
69500 }
69501 if (BV_ISSET(fields, 17)) {
69502 log_packet_detailed(" field 'appearance_chance' has changed");
69503 #ifdef FREECIV_JSON_CONNECTION
69504 field_addr.name = "appearance_chance";
69505#endif /* FREECIV_JSON_CONNECTION */
69506 DIO_PUT(uint16, &dout, &field_addr, real_packet->appearance_chance);
69507 }
69508 if (BV_ISSET(fields, 18)) {
69509 log_packet_detailed(" field 'appearance_reqs_count' has changed");
69510 #ifdef FREECIV_JSON_CONNECTION
69511 field_addr.name = "appearance_reqs_count";
69512#endif /* FREECIV_JSON_CONNECTION */
69513 DIO_PUT(uint8, &dout, &field_addr, real_packet->appearance_reqs_count);
69514 }
69515 if (BV_ISSET(fields, 19)) {
69516 log_packet_detailed(" field 'appearance_reqs' has changed");
69517 #ifdef FREECIV_JSON_CONNECTION
69518 field_addr.name = "appearance_reqs";
69519#endif /* FREECIV_JSON_CONNECTION */
69520
69521 {
69522 int i;
69523
69524#ifdef FREECIV_JSON_CONNECTION
69525 /* Create the array. */
69526 DIO_PUT(farray, &dout, &field_addr, real_packet->appearance_reqs_count);
69527
69528 /* Enter the array. */
69529 field_addr.sub_location = plocation_elem_new(0);
69530#endif /* FREECIV_JSON_CONNECTION */
69531
69532 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
69533#ifdef FREECIV_JSON_CONNECTION
69534 /* Next array element. */
69535 field_addr.sub_location->number = i;
69536#endif /* FREECIV_JSON_CONNECTION */
69537 DIO_PUT(requirement, &dout, &field_addr, &real_packet->appearance_reqs[i]);
69538 }
69539
69540#ifdef FREECIV_JSON_CONNECTION
69541 /* Exit array. */
69542 free(field_addr.sub_location);
69543 field_addr.sub_location = NULL;
69544#endif /* FREECIV_JSON_CONNECTION */
69545 }
69546 }
69547 if (BV_ISSET(fields, 20)) {
69548 log_packet_detailed(" field 'disappearance_chance' has changed");
69549 #ifdef FREECIV_JSON_CONNECTION
69550 field_addr.name = "disappearance_chance";
69551#endif /* FREECIV_JSON_CONNECTION */
69552 DIO_PUT(uint16, &dout, &field_addr, real_packet->disappearance_chance);
69553 }
69554 if (BV_ISSET(fields, 21)) {
69555 log_packet_detailed(" field 'disappearance_reqs_count' has changed");
69556 #ifdef FREECIV_JSON_CONNECTION
69557 field_addr.name = "disappearance_reqs_count";
69558#endif /* FREECIV_JSON_CONNECTION */
69559 DIO_PUT(uint8, &dout, &field_addr, real_packet->disappearance_reqs_count);
69560 }
69561 if (BV_ISSET(fields, 22)) {
69562 log_packet_detailed(" field 'disappearance_reqs' has changed");
69563 #ifdef FREECIV_JSON_CONNECTION
69564 field_addr.name = "disappearance_reqs";
69565#endif /* FREECIV_JSON_CONNECTION */
69566
69567 {
69568 int i;
69569
69570#ifdef FREECIV_JSON_CONNECTION
69571 /* Create the array. */
69572 DIO_PUT(farray, &dout, &field_addr, real_packet->disappearance_reqs_count);
69573
69574 /* Enter the array. */
69575 field_addr.sub_location = plocation_elem_new(0);
69576#endif /* FREECIV_JSON_CONNECTION */
69577
69578 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
69579#ifdef FREECIV_JSON_CONNECTION
69580 /* Next array element. */
69581 field_addr.sub_location->number = i;
69582#endif /* FREECIV_JSON_CONNECTION */
69583 DIO_PUT(requirement, &dout, &field_addr, &real_packet->disappearance_reqs[i]);
69584 }
69585
69586#ifdef FREECIV_JSON_CONNECTION
69587 /* Exit array. */
69588 free(field_addr.sub_location);
69589 field_addr.sub_location = NULL;
69590#endif /* FREECIV_JSON_CONNECTION */
69591 }
69592 }
69593 if (BV_ISSET(fields, 23)) {
69594 log_packet_detailed(" field 'visibility_req' has changed");
69595 #ifdef FREECIV_JSON_CONNECTION
69596 field_addr.name = "visibility_req";
69597#endif /* FREECIV_JSON_CONNECTION */
69598 DIO_PUT(uint8, &dout, &field_addr, real_packet->visibility_req);
69599 }
69600 /* field 24 is folded into the header */
69601 /* field 25 is folded into the header */
69602 if (BV_ISSET(fields, 26)) {
69603 log_packet_detailed(" field 'build_time' has changed");
69604 #ifdef FREECIV_JSON_CONNECTION
69605 field_addr.name = "build_time";
69606#endif /* FREECIV_JSON_CONNECTION */
69607 DIO_PUT(uint8, &dout, &field_addr, real_packet->build_time);
69608 }
69609 if (BV_ISSET(fields, 27)) {
69610 log_packet_detailed(" field 'build_time_factor' has changed");
69611 #ifdef FREECIV_JSON_CONNECTION
69612 field_addr.name = "build_time_factor";
69613#endif /* FREECIV_JSON_CONNECTION */
69614 DIO_PUT(uint8, &dout, &field_addr, real_packet->build_time_factor);
69615 }
69616 if (BV_ISSET(fields, 28)) {
69617 log_packet_detailed(" field 'removal_time' has changed");
69618 #ifdef FREECIV_JSON_CONNECTION
69619 field_addr.name = "removal_time";
69620#endif /* FREECIV_JSON_CONNECTION */
69621 DIO_PUT(uint8, &dout, &field_addr, real_packet->removal_time);
69622 }
69623 if (BV_ISSET(fields, 29)) {
69624 log_packet_detailed(" field 'removal_time_factor' has changed");
69625 #ifdef FREECIV_JSON_CONNECTION
69626 field_addr.name = "removal_time_factor";
69627#endif /* FREECIV_JSON_CONNECTION */
69628 DIO_PUT(uint8, &dout, &field_addr, real_packet->removal_time_factor);
69629 }
69630 if (BV_ISSET(fields, 30)) {
69631 log_packet_detailed(" field 'infracost' has changed");
69632 #ifdef FREECIV_JSON_CONNECTION
69633 field_addr.name = "infracost";
69634#endif /* FREECIV_JSON_CONNECTION */
69635 DIO_PUT(uint16, &dout, &field_addr, real_packet->infracost);
69636 }
69637 if (BV_ISSET(fields, 31)) {
69638 log_packet_detailed(" field 'defense_bonus' has changed");
69639 #ifdef FREECIV_JSON_CONNECTION
69640 field_addr.name = "defense_bonus";
69641#endif /* FREECIV_JSON_CONNECTION */
69642 DIO_PUT(uint8, &dout, &field_addr, real_packet->defense_bonus);
69643 }
69644 if (BV_ISSET(fields, 32)) {
69645 log_packet_detailed(" field 'eus' has changed");
69646 #ifdef FREECIV_JSON_CONNECTION
69647 field_addr.name = "eus";
69648#endif /* FREECIV_JSON_CONNECTION */
69649 DIO_PUT(uint8, &dout, &field_addr, real_packet->eus);
69650 }
69651 if (BV_ISSET(fields, 33)) {
69652 log_packet_detailed(" field 'native_to' has changed");
69653 #ifdef FREECIV_JSON_CONNECTION
69654 field_addr.name = "native_to";
69655#endif /* FREECIV_JSON_CONNECTION */
69656 DIO_BV_PUT(&dout, &field_addr, packet->native_to);
69657 }
69658 if (BV_ISSET(fields, 34)) {
69659 log_packet_detailed(" field 'flags' has changed");
69660 #ifdef FREECIV_JSON_CONNECTION
69661 field_addr.name = "flags";
69662#endif /* FREECIV_JSON_CONNECTION */
69663 DIO_BV_PUT(&dout, &field_addr, packet->flags);
69664 }
69665 if (BV_ISSET(fields, 35)) {
69666 log_packet_detailed(" field 'hidden_by' has changed");
69667 #ifdef FREECIV_JSON_CONNECTION
69668 field_addr.name = "hidden_by";
69669#endif /* FREECIV_JSON_CONNECTION */
69670 DIO_BV_PUT(&dout, &field_addr, packet->hidden_by);
69671 }
69672 if (BV_ISSET(fields, 36)) {
69673 log_packet_detailed(" field 'bridged_over' has changed");
69674 #ifdef FREECIV_JSON_CONNECTION
69675 field_addr.name = "bridged_over";
69676#endif /* FREECIV_JSON_CONNECTION */
69677 DIO_BV_PUT(&dout, &field_addr, packet->bridged_over);
69678 }
69679 if (BV_ISSET(fields, 37)) {
69680 log_packet_detailed(" field 'conflicts' has changed");
69681 #ifdef FREECIV_JSON_CONNECTION
69682 field_addr.name = "conflicts";
69683#endif /* FREECIV_JSON_CONNECTION */
69684 DIO_BV_PUT(&dout, &field_addr, packet->conflicts);
69685 }
69686 if (BV_ISSET(fields, 38)) {
69687 log_packet_detailed(" field 'helptext' has changed");
69688 #ifdef FREECIV_JSON_CONNECTION
69689 field_addr.name = "helptext";
69690#endif /* FREECIV_JSON_CONNECTION */
69691 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
69692 }
69693
69694 *old = *real_packet;
69695#endif /* FREECIV_DELTA_PROTOCOL */
69696#ifndef FREECIV_DELTA_PROTOCOL
69697#ifdef FREECIV_JSON_CONNECTION
69698 field_addr.name = "id";
69699#endif /* FREECIV_JSON_CONNECTION */
69700 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
69701#ifdef FREECIV_JSON_CONNECTION
69702 field_addr.name = "name";
69703#endif /* FREECIV_JSON_CONNECTION */
69704 DIO_PUT(string, &dout, &field_addr, real_packet->name);
69705#ifdef FREECIV_JSON_CONNECTION
69706 field_addr.name = "rule_name";
69707#endif /* FREECIV_JSON_CONNECTION */
69708 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
69709#ifdef FREECIV_JSON_CONNECTION
69710 field_addr.name = "category";
69711#endif /* FREECIV_JSON_CONNECTION */
69712 DIO_PUT(uint8, &dout, &field_addr, real_packet->category);
69713#ifdef FREECIV_JSON_CONNECTION
69714 field_addr.name = "causes";
69715#endif /* FREECIV_JSON_CONNECTION */
69716 DIO_BV_PUT(&dout, &field_addr, packet->causes);
69717#ifdef FREECIV_JSON_CONNECTION
69718 field_addr.name = "rmcauses";
69719#endif /* FREECIV_JSON_CONNECTION */
69720 DIO_BV_PUT(&dout, &field_addr, packet->rmcauses);
69721#ifdef FREECIV_JSON_CONNECTION
69722 field_addr.name = "activity_gfx";
69723#endif /* FREECIV_JSON_CONNECTION */
69724 DIO_PUT(string, &dout, &field_addr, real_packet->activity_gfx);
69725#ifdef FREECIV_JSON_CONNECTION
69726 field_addr.name = "act_gfx_alt";
69727#endif /* FREECIV_JSON_CONNECTION */
69728 DIO_PUT(string, &dout, &field_addr, real_packet->act_gfx_alt);
69729#ifdef FREECIV_JSON_CONNECTION
69730 field_addr.name = "act_gfx_alt2";
69731#endif /* FREECIV_JSON_CONNECTION */
69732 DIO_PUT(string, &dout, &field_addr, real_packet->act_gfx_alt2);
69733#ifdef FREECIV_JSON_CONNECTION
69734 field_addr.name = "rmact_gfx";
69735#endif /* FREECIV_JSON_CONNECTION */
69736 DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx);
69737#ifdef FREECIV_JSON_CONNECTION
69738 field_addr.name = "rmact_gfx_alt";
69739#endif /* FREECIV_JSON_CONNECTION */
69740 DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx_alt);
69741#ifdef FREECIV_JSON_CONNECTION
69742 field_addr.name = "graphic_str";
69743#endif /* FREECIV_JSON_CONNECTION */
69744 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
69745#ifdef FREECIV_JSON_CONNECTION
69746 field_addr.name = "graphic_alt";
69747#endif /* FREECIV_JSON_CONNECTION */
69748 DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
69749#ifdef FREECIV_JSON_CONNECTION
69750 field_addr.name = "reqs_count";
69751#endif /* FREECIV_JSON_CONNECTION */
69752 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
69753#ifdef FREECIV_JSON_CONNECTION
69754 field_addr.name = "reqs";
69755#endif /* FREECIV_JSON_CONNECTION */
69756
69757 {
69758 int i;
69759
69760#ifdef FREECIV_JSON_CONNECTION
69761 /* Create the array. */
69762 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
69763
69764 /* Enter the array. */
69765 field_addr.sub_location = plocation_elem_new(0);
69766#endif /* FREECIV_JSON_CONNECTION */
69767
69768 for (i = 0; i < real_packet->reqs_count; i++) {
69769#ifdef FREECIV_JSON_CONNECTION
69770 /* Next array element. */
69771 field_addr.sub_location->number = i;
69772#endif /* FREECIV_JSON_CONNECTION */
69773 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
69774 }
69775
69776#ifdef FREECIV_JSON_CONNECTION
69777 /* Exit array. */
69778 free(field_addr.sub_location);
69779 field_addr.sub_location = NULL;
69780#endif /* FREECIV_JSON_CONNECTION */
69781 }
69782#ifdef FREECIV_JSON_CONNECTION
69783 field_addr.name = "rmreqs_count";
69784#endif /* FREECIV_JSON_CONNECTION */
69785 DIO_PUT(uint8, &dout, &field_addr, real_packet->rmreqs_count);
69786#ifdef FREECIV_JSON_CONNECTION
69787 field_addr.name = "rmreqs";
69788#endif /* FREECIV_JSON_CONNECTION */
69789
69790 {
69791 int i;
69792
69793#ifdef FREECIV_JSON_CONNECTION
69794 /* Create the array. */
69795 DIO_PUT(farray, &dout, &field_addr, real_packet->rmreqs_count);
69796
69797 /* Enter the array. */
69798 field_addr.sub_location = plocation_elem_new(0);
69799#endif /* FREECIV_JSON_CONNECTION */
69800
69801 for (i = 0; i < real_packet->rmreqs_count; i++) {
69802#ifdef FREECIV_JSON_CONNECTION
69803 /* Next array element. */
69804 field_addr.sub_location->number = i;
69805#endif /* FREECIV_JSON_CONNECTION */
69806 DIO_PUT(requirement, &dout, &field_addr, &real_packet->rmreqs[i]);
69807 }
69808
69809#ifdef FREECIV_JSON_CONNECTION
69810 /* Exit array. */
69811 free(field_addr.sub_location);
69812 field_addr.sub_location = NULL;
69813#endif /* FREECIV_JSON_CONNECTION */
69814 }
69815#ifdef FREECIV_JSON_CONNECTION
69816 field_addr.name = "appearance_chance";
69817#endif /* FREECIV_JSON_CONNECTION */
69818 DIO_PUT(uint16, &dout, &field_addr, real_packet->appearance_chance);
69819#ifdef FREECIV_JSON_CONNECTION
69820 field_addr.name = "appearance_reqs_count";
69821#endif /* FREECIV_JSON_CONNECTION */
69822 DIO_PUT(uint8, &dout, &field_addr, real_packet->appearance_reqs_count);
69823#ifdef FREECIV_JSON_CONNECTION
69824 field_addr.name = "appearance_reqs";
69825#endif /* FREECIV_JSON_CONNECTION */
69826
69827 {
69828 int i;
69829
69830#ifdef FREECIV_JSON_CONNECTION
69831 /* Create the array. */
69832 DIO_PUT(farray, &dout, &field_addr, real_packet->appearance_reqs_count);
69833
69834 /* Enter the array. */
69835 field_addr.sub_location = plocation_elem_new(0);
69836#endif /* FREECIV_JSON_CONNECTION */
69837
69838 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
69839#ifdef FREECIV_JSON_CONNECTION
69840 /* Next array element. */
69841 field_addr.sub_location->number = i;
69842#endif /* FREECIV_JSON_CONNECTION */
69843 DIO_PUT(requirement, &dout, &field_addr, &real_packet->appearance_reqs[i]);
69844 }
69845
69846#ifdef FREECIV_JSON_CONNECTION
69847 /* Exit array. */
69848 free(field_addr.sub_location);
69849 field_addr.sub_location = NULL;
69850#endif /* FREECIV_JSON_CONNECTION */
69851 }
69852#ifdef FREECIV_JSON_CONNECTION
69853 field_addr.name = "disappearance_chance";
69854#endif /* FREECIV_JSON_CONNECTION */
69855 DIO_PUT(uint16, &dout, &field_addr, real_packet->disappearance_chance);
69856#ifdef FREECIV_JSON_CONNECTION
69857 field_addr.name = "disappearance_reqs_count";
69858#endif /* FREECIV_JSON_CONNECTION */
69859 DIO_PUT(uint8, &dout, &field_addr, real_packet->disappearance_reqs_count);
69860#ifdef FREECIV_JSON_CONNECTION
69861 field_addr.name = "disappearance_reqs";
69862#endif /* FREECIV_JSON_CONNECTION */
69863
69864 {
69865 int i;
69866
69867#ifdef FREECIV_JSON_CONNECTION
69868 /* Create the array. */
69869 DIO_PUT(farray, &dout, &field_addr, real_packet->disappearance_reqs_count);
69870
69871 /* Enter the array. */
69872 field_addr.sub_location = plocation_elem_new(0);
69873#endif /* FREECIV_JSON_CONNECTION */
69874
69875 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
69876#ifdef FREECIV_JSON_CONNECTION
69877 /* Next array element. */
69878 field_addr.sub_location->number = i;
69879#endif /* FREECIV_JSON_CONNECTION */
69880 DIO_PUT(requirement, &dout, &field_addr, &real_packet->disappearance_reqs[i]);
69881 }
69882
69883#ifdef FREECIV_JSON_CONNECTION
69884 /* Exit array. */
69885 free(field_addr.sub_location);
69886 field_addr.sub_location = NULL;
69887#endif /* FREECIV_JSON_CONNECTION */
69888 }
69889#ifdef FREECIV_JSON_CONNECTION
69890 field_addr.name = "visibility_req";
69891#endif /* FREECIV_JSON_CONNECTION */
69892 DIO_PUT(uint8, &dout, &field_addr, real_packet->visibility_req);
69893#ifdef FREECIV_JSON_CONNECTION
69894 field_addr.name = "buildable";
69895#endif /* FREECIV_JSON_CONNECTION */
69896 DIO_PUT(bool8, &dout, &field_addr, real_packet->buildable);
69897#ifdef FREECIV_JSON_CONNECTION
69898 field_addr.name = "generated";
69899#endif /* FREECIV_JSON_CONNECTION */
69900 DIO_PUT(bool8, &dout, &field_addr, real_packet->generated);
69901#ifdef FREECIV_JSON_CONNECTION
69902 field_addr.name = "build_time";
69903#endif /* FREECIV_JSON_CONNECTION */
69904 DIO_PUT(uint8, &dout, &field_addr, real_packet->build_time);
69905#ifdef FREECIV_JSON_CONNECTION
69906 field_addr.name = "build_time_factor";
69907#endif /* FREECIV_JSON_CONNECTION */
69908 DIO_PUT(uint8, &dout, &field_addr, real_packet->build_time_factor);
69909#ifdef FREECIV_JSON_CONNECTION
69910 field_addr.name = "removal_time";
69911#endif /* FREECIV_JSON_CONNECTION */
69912 DIO_PUT(uint8, &dout, &field_addr, real_packet->removal_time);
69913#ifdef FREECIV_JSON_CONNECTION
69914 field_addr.name = "removal_time_factor";
69915#endif /* FREECIV_JSON_CONNECTION */
69916 DIO_PUT(uint8, &dout, &field_addr, real_packet->removal_time_factor);
69917#ifdef FREECIV_JSON_CONNECTION
69918 field_addr.name = "infracost";
69919#endif /* FREECIV_JSON_CONNECTION */
69920 DIO_PUT(uint16, &dout, &field_addr, real_packet->infracost);
69921#ifdef FREECIV_JSON_CONNECTION
69922 field_addr.name = "defense_bonus";
69923#endif /* FREECIV_JSON_CONNECTION */
69924 DIO_PUT(uint8, &dout, &field_addr, real_packet->defense_bonus);
69925#ifdef FREECIV_JSON_CONNECTION
69926 field_addr.name = "eus";
69927#endif /* FREECIV_JSON_CONNECTION */
69928 DIO_PUT(uint8, &dout, &field_addr, real_packet->eus);
69929#ifdef FREECIV_JSON_CONNECTION
69930 field_addr.name = "native_to";
69931#endif /* FREECIV_JSON_CONNECTION */
69932 DIO_BV_PUT(&dout, &field_addr, packet->native_to);
69933#ifdef FREECIV_JSON_CONNECTION
69934 field_addr.name = "flags";
69935#endif /* FREECIV_JSON_CONNECTION */
69936 DIO_BV_PUT(&dout, &field_addr, packet->flags);
69937#ifdef FREECIV_JSON_CONNECTION
69938 field_addr.name = "hidden_by";
69939#endif /* FREECIV_JSON_CONNECTION */
69940 DIO_BV_PUT(&dout, &field_addr, packet->hidden_by);
69941#ifdef FREECIV_JSON_CONNECTION
69942 field_addr.name = "bridged_over";
69943#endif /* FREECIV_JSON_CONNECTION */
69944 DIO_BV_PUT(&dout, &field_addr, packet->bridged_over);
69945#ifdef FREECIV_JSON_CONNECTION
69946 field_addr.name = "conflicts";
69947#endif /* FREECIV_JSON_CONNECTION */
69948 DIO_BV_PUT(&dout, &field_addr, packet->conflicts);
69949#ifdef FREECIV_JSON_CONNECTION
69950 field_addr.name = "helptext";
69951#endif /* FREECIV_JSON_CONNECTION */
69952 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
69953
69954#endif
69955 SEND_PACKET_END(PACKET_RULESET_EXTRA);
69956}
69957
69958 int send_packet_ruleset_extra(struct connection *pc, const struct packet_ruleset_extra *packet)
69959{
69960 if (!pc->used) {
69961 log_error("WARNING: trying to send data to the closed connection %s",
69962 conn_description(pc));
69963 return -1;
69964 }
69965 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_EXTRA].packet != NULL, -1,
69966 "Handler for PACKET_RULESET_EXTRA not installed");
69967 return pc->phs.handlers->send[PACKET_RULESET_EXTRA].packet(pc, packet);
69968}
69969
69970 void lsend_packet_ruleset_extra(struct conn_list *dest, const struct packet_ruleset_extra *packet)
69971{
69972 conn_list_iterate(dest, pconn) {
69973 send_packet_ruleset_extra(pconn, packet);
69974 } conn_list_iterate_end;
69975}
69976
69977#ifdef FREECIV_DELTA_PROTOCOL
69978#define hash_packet_ruleset_extra_flag_100 hash_const
69979
69980#define cmp_packet_ruleset_extra_flag_100 cmp_const
69981
69982 BV_DEFINE(packet_ruleset_extra_flag_100_fields, 3);
69983#endif /* FREECIV_DELTA_PROTOCOL */
69984
69985 static struct packet_ruleset_extra_flag *receive_packet_ruleset_extra_flag_100(struct connection *pc)
69986{
69987#ifdef FREECIV_DELTA_PROTOCOL
69988 packet_ruleset_extra_flag_100_fields fields;
69989 struct packet_ruleset_extra_flag *old;
69990 struct genhash **hash = pc->phs.received + PACKET_RULESET_EXTRA_FLAG;
69991#endif /* FREECIV_DELTA_PROTOCOL */
69992 RECEIVE_PACKET_START(packet_ruleset_extra_flag, real_packet);
69993#ifdef FREECIV_JSON_CONNECTION
69994 struct plocation field_addr;
69995 {
69996 struct plocation *field_addr_tmp = plocation_field_new(NULL);
69997 field_addr = *field_addr_tmp;
69998 FC_FREE(field_addr_tmp);
69999 }
70000#endif /* FREECIV_JSON_CONNECTION */
70001
70002#ifdef FREECIV_DELTA_PROTOCOL
70003#ifdef FREECIV_JSON_CONNECTION
70004 field_addr.name = "fields";
70005#endif /* FREECIV_JSON_CONNECTION */
70006 DIO_BV_GET(&din, &field_addr, fields);
70007
70008#else /* FREECIV_DELTA_PROTOCOL */
70009 #ifdef FREECIV_JSON_CONNECTION
70010 field_addr.name = "id";
70011 #endif /* FREECIV_JSON_CONNECTION */
70012 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
70013 RECEIVE_PACKET_FIELD_ERROR(id);
70014 }
70015 #ifdef FREECIV_JSON_CONNECTION
70016 field_addr.name = "name";
70017 #endif /* FREECIV_JSON_CONNECTION */
70018 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
70019 RECEIVE_PACKET_FIELD_ERROR(name);
70020 }
70021 #ifdef FREECIV_JSON_CONNECTION
70022 field_addr.name = "helptxt";
70023 #endif /* FREECIV_JSON_CONNECTION */
70024 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
70025 RECEIVE_PACKET_FIELD_ERROR(helptxt);
70026 }
70027
70028#endif
70029 log_packet_detailed("packet_ruleset_extra_flag_100: got info about ()");
70030
70031#ifdef FREECIV_DELTA_PROTOCOL
70032 if (NULL == *hash) {
70033 *hash = genhash_new_full(hash_packet_ruleset_extra_flag_100, cmp_packet_ruleset_extra_flag_100,
70034 NULL, NULL, NULL, free);
70035 }
70036
70037 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
70038 *real_packet = *old;
70039 } else {
70040 log_packet_detailed(" no old info");
70041 memset(real_packet, 0, sizeof(*real_packet));
70042 }
70043
70044 if (BV_ISSET(fields, 0)) {
70045 log_packet_detailed(" got field 'id'");
70046 #ifdef FREECIV_JSON_CONNECTION
70047 field_addr.name = "id";
70048 #endif /* FREECIV_JSON_CONNECTION */
70049 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
70050 RECEIVE_PACKET_FIELD_ERROR(id);
70051 }
70052 }
70053 if (BV_ISSET(fields, 1)) {
70054 log_packet_detailed(" got field 'name'");
70055 #ifdef FREECIV_JSON_CONNECTION
70056 field_addr.name = "name";
70057 #endif /* FREECIV_JSON_CONNECTION */
70058 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
70059 RECEIVE_PACKET_FIELD_ERROR(name);
70060 }
70061 }
70062 if (BV_ISSET(fields, 2)) {
70063 log_packet_detailed(" got field 'helptxt'");
70064 #ifdef FREECIV_JSON_CONNECTION
70065 field_addr.name = "helptxt";
70066 #endif /* FREECIV_JSON_CONNECTION */
70067 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
70068 RECEIVE_PACKET_FIELD_ERROR(helptxt);
70069 }
70070 }
70071
70072 if (NULL == old) {
70073 old = fc_malloc(sizeof(*old));
70074 *old = *real_packet;
70075 genhash_insert(*hash, old, old);
70076 } else {
70077 *old = *real_packet;
70078 }
70079
70080#endif /* FREECIV_DELTA_PROTOCOL */
70081 RECEIVE_PACKET_END(real_packet);
70082}
70083
70084 static int send_packet_ruleset_extra_flag_100(struct connection *pc, const struct packet_ruleset_extra_flag *packet)
70085{
70086 const struct packet_ruleset_extra_flag *real_packet = packet;
70087#ifdef FREECIV_DELTA_PROTOCOL
70088 packet_ruleset_extra_flag_100_fields fields;
70089 struct packet_ruleset_extra_flag *old;
70090 bool differ;
70091 struct genhash **hash = pc->phs.sent + PACKET_RULESET_EXTRA_FLAG;
70092#endif /* FREECIV_DELTA_PROTOCOL */
70093 SEND_PACKET_START(PACKET_RULESET_EXTRA_FLAG);
70094#ifdef FREECIV_JSON_CONNECTION
70095 struct plocation field_addr;
70096 {
70097 struct plocation *field_addr_tmp = plocation_field_new(NULL);
70098 field_addr = *field_addr_tmp;
70099 FC_FREE(field_addr_tmp);
70100 }
70101#endif /* FREECIV_JSON_CONNECTION */
70102
70103 log_packet_detailed("packet_ruleset_extra_flag_100: sending info about ()");
70104
70105#ifdef FREECIV_DELTA_PROTOCOL
70106 if (NULL == *hash) {
70107 *hash = genhash_new_full(hash_packet_ruleset_extra_flag_100, cmp_packet_ruleset_extra_flag_100,
70108 NULL, NULL, NULL, free);
70109 }
70110 BV_CLR_ALL(fields);
70111
70112 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
70113 old = fc_malloc(sizeof(*old));
70114 *old = *real_packet;
70115 genhash_insert(*hash, old, old);
70116 memset(old, 0, sizeof(*old));
70117 }
70118 differ = (old->id != real_packet->id);
70119 if (differ) {
70120 BV_SET(fields, 0);
70121 }
70122
70123 differ = (strcmp(old->name, real_packet->name) != 0);
70124 if (differ) {
70125 BV_SET(fields, 1);
70126 }
70127
70128 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
70129 if (differ) {
70130 BV_SET(fields, 2);
70131 }
70132
70133
70134#ifdef FREECIV_JSON_CONNECTION
70135 field_addr.name = "fields";
70136#endif /* FREECIV_JSON_CONNECTION */
70137 DIO_BV_PUT(&dout, &field_addr, fields);
70138
70139 if (BV_ISSET(fields, 0)) {
70140 log_packet_detailed(" field 'id' has changed");
70141 #ifdef FREECIV_JSON_CONNECTION
70142 field_addr.name = "id";
70143#endif /* FREECIV_JSON_CONNECTION */
70144 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
70145 }
70146 if (BV_ISSET(fields, 1)) {
70147 log_packet_detailed(" field 'name' has changed");
70148 #ifdef FREECIV_JSON_CONNECTION
70149 field_addr.name = "name";
70150#endif /* FREECIV_JSON_CONNECTION */
70151 DIO_PUT(string, &dout, &field_addr, real_packet->name);
70152 }
70153 if (BV_ISSET(fields, 2)) {
70154 log_packet_detailed(" field 'helptxt' has changed");
70155 #ifdef FREECIV_JSON_CONNECTION
70156 field_addr.name = "helptxt";
70157#endif /* FREECIV_JSON_CONNECTION */
70158 DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
70159 }
70160
70161 *old = *real_packet;
70162#endif /* FREECIV_DELTA_PROTOCOL */
70163#ifndef FREECIV_DELTA_PROTOCOL
70164#ifdef FREECIV_JSON_CONNECTION
70165 field_addr.name = "id";
70166#endif /* FREECIV_JSON_CONNECTION */
70167 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
70168#ifdef FREECIV_JSON_CONNECTION
70169 field_addr.name = "name";
70170#endif /* FREECIV_JSON_CONNECTION */
70171 DIO_PUT(string, &dout, &field_addr, real_packet->name);
70172#ifdef FREECIV_JSON_CONNECTION
70173 field_addr.name = "helptxt";
70174#endif /* FREECIV_JSON_CONNECTION */
70175 DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
70176
70177#endif
70178 SEND_PACKET_END(PACKET_RULESET_EXTRA_FLAG);
70179}
70180
70181 int send_packet_ruleset_extra_flag(struct connection *pc, const struct packet_ruleset_extra_flag *packet)
70182{
70183 if (!pc->used) {
70184 log_error("WARNING: trying to send data to the closed connection %s",
70185 conn_description(pc));
70186 return -1;
70187 }
70188 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_EXTRA_FLAG].packet != NULL, -1,
70189 "Handler for PACKET_RULESET_EXTRA_FLAG not installed");
70190 return pc->phs.handlers->send[PACKET_RULESET_EXTRA_FLAG].packet(pc, packet);
70191}
70192
70193 void lsend_packet_ruleset_extra_flag(struct conn_list *dest, const struct packet_ruleset_extra_flag *packet)
70194{
70195 conn_list_iterate(dest, pconn) {
70196 send_packet_ruleset_extra_flag(pconn, packet);
70197 } conn_list_iterate_end;
70198}
70199
70200#ifdef FREECIV_DELTA_PROTOCOL
70201#define hash_packet_ruleset_base_100 hash_const
70202
70203#define cmp_packet_ruleset_base_100 cmp_const
70204
70205 BV_DEFINE(packet_ruleset_base_100_fields, 6);
70206#endif /* FREECIV_DELTA_PROTOCOL */
70207
70208 static struct packet_ruleset_base *receive_packet_ruleset_base_100(struct connection *pc)
70209{
70210#ifdef FREECIV_DELTA_PROTOCOL
70211 packet_ruleset_base_100_fields fields;
70212 struct packet_ruleset_base *old;
70213 struct genhash **hash = pc->phs.received + PACKET_RULESET_BASE;
70214#endif /* FREECIV_DELTA_PROTOCOL */
70215 RECEIVE_PACKET_START(packet_ruleset_base, real_packet);
70216#ifdef FREECIV_JSON_CONNECTION
70217 struct plocation field_addr;
70218 {
70219 struct plocation *field_addr_tmp = plocation_field_new(NULL);
70220 field_addr = *field_addr_tmp;
70221 FC_FREE(field_addr_tmp);
70222 }
70223#endif /* FREECIV_JSON_CONNECTION */
70224
70225#ifdef FREECIV_DELTA_PROTOCOL
70226#ifdef FREECIV_JSON_CONNECTION
70227 field_addr.name = "fields";
70228#endif /* FREECIV_JSON_CONNECTION */
70229 DIO_BV_GET(&din, &field_addr, fields);
70230
70231#else /* FREECIV_DELTA_PROTOCOL */
70232 #ifdef FREECIV_JSON_CONNECTION
70233 field_addr.name = "id";
70234 #endif /* FREECIV_JSON_CONNECTION */
70235 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
70236 RECEIVE_PACKET_FIELD_ERROR(id);
70237 }
70238 #ifdef FREECIV_JSON_CONNECTION
70239 field_addr.name = "gui_type";
70240 #endif /* FREECIV_JSON_CONNECTION */
70241 {
70242 int readin;
70243
70244 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
70245 RECEIVE_PACKET_FIELD_ERROR(gui_type);
70246 }
70247 real_packet->gui_type = readin;
70248 }
70249 #ifdef FREECIV_JSON_CONNECTION
70250 field_addr.name = "border_sq";
70251 #endif /* FREECIV_JSON_CONNECTION */
70252 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->border_sq)) {
70253 RECEIVE_PACKET_FIELD_ERROR(border_sq);
70254 }
70255 #ifdef FREECIV_JSON_CONNECTION
70256 field_addr.name = "vision_main_sq";
70257 #endif /* FREECIV_JSON_CONNECTION */
70258 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_main_sq)) {
70259 RECEIVE_PACKET_FIELD_ERROR(vision_main_sq);
70260 }
70261 #ifdef FREECIV_JSON_CONNECTION
70262 field_addr.name = "vision_invis_sq";
70263 #endif /* FREECIV_JSON_CONNECTION */
70264 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_invis_sq)) {
70265 RECEIVE_PACKET_FIELD_ERROR(vision_invis_sq);
70266 }
70267 #ifdef FREECIV_JSON_CONNECTION
70268 field_addr.name = "vision_subs_sq";
70269 #endif /* FREECIV_JSON_CONNECTION */
70270 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_subs_sq)) {
70271 RECEIVE_PACKET_FIELD_ERROR(vision_subs_sq);
70272 }
70273
70274#endif
70275 log_packet_detailed("packet_ruleset_base_100: got info about ()");
70276
70277#ifdef FREECIV_DELTA_PROTOCOL
70278 if (NULL == *hash) {
70279 *hash = genhash_new_full(hash_packet_ruleset_base_100, cmp_packet_ruleset_base_100,
70280 NULL, NULL, NULL, free);
70281 }
70282
70283 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
70284 *real_packet = *old;
70285 } else {
70286 log_packet_detailed(" no old info");
70287 memset(real_packet, 0, sizeof(*real_packet));
70288 }
70289
70290 if (BV_ISSET(fields, 0)) {
70291 log_packet_detailed(" got field 'id'");
70292 #ifdef FREECIV_JSON_CONNECTION
70293 field_addr.name = "id";
70294 #endif /* FREECIV_JSON_CONNECTION */
70295 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
70296 RECEIVE_PACKET_FIELD_ERROR(id);
70297 }
70298 }
70299 if (BV_ISSET(fields, 1)) {
70300 log_packet_detailed(" got field 'gui_type'");
70301 #ifdef FREECIV_JSON_CONNECTION
70302 field_addr.name = "gui_type";
70303 #endif /* FREECIV_JSON_CONNECTION */
70304 {
70305 int readin;
70306
70307 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
70308 RECEIVE_PACKET_FIELD_ERROR(gui_type);
70309 }
70310 real_packet->gui_type = readin;
70311 }
70312 }
70313 if (BV_ISSET(fields, 2)) {
70314 log_packet_detailed(" got field 'border_sq'");
70315 #ifdef FREECIV_JSON_CONNECTION
70316 field_addr.name = "border_sq";
70317 #endif /* FREECIV_JSON_CONNECTION */
70318 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->border_sq)) {
70319 RECEIVE_PACKET_FIELD_ERROR(border_sq);
70320 }
70321 }
70322 if (BV_ISSET(fields, 3)) {
70323 log_packet_detailed(" got field 'vision_main_sq'");
70324 #ifdef FREECIV_JSON_CONNECTION
70325 field_addr.name = "vision_main_sq";
70326 #endif /* FREECIV_JSON_CONNECTION */
70327 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_main_sq)) {
70328 RECEIVE_PACKET_FIELD_ERROR(vision_main_sq);
70329 }
70330 }
70331 if (BV_ISSET(fields, 4)) {
70332 log_packet_detailed(" got field 'vision_invis_sq'");
70333 #ifdef FREECIV_JSON_CONNECTION
70334 field_addr.name = "vision_invis_sq";
70335 #endif /* FREECIV_JSON_CONNECTION */
70336 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_invis_sq)) {
70337 RECEIVE_PACKET_FIELD_ERROR(vision_invis_sq);
70338 }
70339 }
70340 if (BV_ISSET(fields, 5)) {
70341 log_packet_detailed(" got field 'vision_subs_sq'");
70342 #ifdef FREECIV_JSON_CONNECTION
70343 field_addr.name = "vision_subs_sq";
70344 #endif /* FREECIV_JSON_CONNECTION */
70345 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_subs_sq)) {
70346 RECEIVE_PACKET_FIELD_ERROR(vision_subs_sq);
70347 }
70348 }
70349
70350 if (NULL == old) {
70351 old = fc_malloc(sizeof(*old));
70352 *old = *real_packet;
70353 genhash_insert(*hash, old, old);
70354 } else {
70355 *old = *real_packet;
70356 }
70357
70358#endif /* FREECIV_DELTA_PROTOCOL */
70359 RECEIVE_PACKET_END(real_packet);
70360}
70361
70362 static int send_packet_ruleset_base_100(struct connection *pc, const struct packet_ruleset_base *packet)
70363{
70364 const struct packet_ruleset_base *real_packet = packet;
70365#ifdef FREECIV_DELTA_PROTOCOL
70366 packet_ruleset_base_100_fields fields;
70367 struct packet_ruleset_base *old;
70368 bool differ;
70369 struct genhash **hash = pc->phs.sent + PACKET_RULESET_BASE;
70370#endif /* FREECIV_DELTA_PROTOCOL */
70371 SEND_PACKET_START(PACKET_RULESET_BASE);
70372#ifdef FREECIV_JSON_CONNECTION
70373 struct plocation field_addr;
70374 {
70375 struct plocation *field_addr_tmp = plocation_field_new(NULL);
70376 field_addr = *field_addr_tmp;
70377 FC_FREE(field_addr_tmp);
70378 }
70379#endif /* FREECIV_JSON_CONNECTION */
70380
70381 log_packet_detailed("packet_ruleset_base_100: sending info about ()");
70382
70383#ifdef FREECIV_DELTA_PROTOCOL
70384 if (NULL == *hash) {
70385 *hash = genhash_new_full(hash_packet_ruleset_base_100, cmp_packet_ruleset_base_100,
70386 NULL, NULL, NULL, free);
70387 }
70388 BV_CLR_ALL(fields);
70389
70390 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
70391 old = fc_malloc(sizeof(*old));
70392 *old = *real_packet;
70393 genhash_insert(*hash, old, old);
70394 memset(old, 0, sizeof(*old));
70395 }
70396 differ = (old->id != real_packet->id);
70397 if (differ) {
70398 BV_SET(fields, 0);
70399 }
70400
70401 differ = (old->gui_type != real_packet->gui_type);
70402 if (differ) {
70403 BV_SET(fields, 1);
70404 }
70405
70406 differ = (old->border_sq != real_packet->border_sq);
70407 if (differ) {
70408 BV_SET(fields, 2);
70409 }
70410
70411 differ = (old->vision_main_sq != real_packet->vision_main_sq);
70412 if (differ) {
70413 BV_SET(fields, 3);
70414 }
70415
70416 differ = (old->vision_invis_sq != real_packet->vision_invis_sq);
70417 if (differ) {
70418 BV_SET(fields, 4);
70419 }
70420
70421 differ = (old->vision_subs_sq != real_packet->vision_subs_sq);
70422 if (differ) {
70423 BV_SET(fields, 5);
70424 }
70425
70426
70427#ifdef FREECIV_JSON_CONNECTION
70428 field_addr.name = "fields";
70429#endif /* FREECIV_JSON_CONNECTION */
70430 DIO_BV_PUT(&dout, &field_addr, fields);
70431
70432 if (BV_ISSET(fields, 0)) {
70433 log_packet_detailed(" field 'id' has changed");
70434 #ifdef FREECIV_JSON_CONNECTION
70435 field_addr.name = "id";
70436#endif /* FREECIV_JSON_CONNECTION */
70437 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
70438 }
70439 if (BV_ISSET(fields, 1)) {
70440 log_packet_detailed(" field 'gui_type' has changed");
70441 #ifdef FREECIV_JSON_CONNECTION
70442 field_addr.name = "gui_type";
70443#endif /* FREECIV_JSON_CONNECTION */
70444 DIO_PUT(uint8, &dout, &field_addr, real_packet->gui_type);
70445 }
70446 if (BV_ISSET(fields, 2)) {
70447 log_packet_detailed(" field 'border_sq' has changed");
70448 #ifdef FREECIV_JSON_CONNECTION
70449 field_addr.name = "border_sq";
70450#endif /* FREECIV_JSON_CONNECTION */
70451 DIO_PUT(sint8, &dout, &field_addr, real_packet->border_sq);
70452 }
70453 if (BV_ISSET(fields, 3)) {
70454 log_packet_detailed(" field 'vision_main_sq' has changed");
70455 #ifdef FREECIV_JSON_CONNECTION
70456 field_addr.name = "vision_main_sq";
70457#endif /* FREECIV_JSON_CONNECTION */
70458 DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_main_sq);
70459 }
70460 if (BV_ISSET(fields, 4)) {
70461 log_packet_detailed(" field 'vision_invis_sq' has changed");
70462 #ifdef FREECIV_JSON_CONNECTION
70463 field_addr.name = "vision_invis_sq";
70464#endif /* FREECIV_JSON_CONNECTION */
70465 DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_invis_sq);
70466 }
70467 if (BV_ISSET(fields, 5)) {
70468 log_packet_detailed(" field 'vision_subs_sq' has changed");
70469 #ifdef FREECIV_JSON_CONNECTION
70470 field_addr.name = "vision_subs_sq";
70471#endif /* FREECIV_JSON_CONNECTION */
70472 DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_subs_sq);
70473 }
70474
70475 *old = *real_packet;
70476#endif /* FREECIV_DELTA_PROTOCOL */
70477#ifndef FREECIV_DELTA_PROTOCOL
70478#ifdef FREECIV_JSON_CONNECTION
70479 field_addr.name = "id";
70480#endif /* FREECIV_JSON_CONNECTION */
70481 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
70482#ifdef FREECIV_JSON_CONNECTION
70483 field_addr.name = "gui_type";
70484#endif /* FREECIV_JSON_CONNECTION */
70485 DIO_PUT(uint8, &dout, &field_addr, real_packet->gui_type);
70486#ifdef FREECIV_JSON_CONNECTION
70487 field_addr.name = "border_sq";
70488#endif /* FREECIV_JSON_CONNECTION */
70489 DIO_PUT(sint8, &dout, &field_addr, real_packet->border_sq);
70490#ifdef FREECIV_JSON_CONNECTION
70491 field_addr.name = "vision_main_sq";
70492#endif /* FREECIV_JSON_CONNECTION */
70493 DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_main_sq);
70494#ifdef FREECIV_JSON_CONNECTION
70495 field_addr.name = "vision_invis_sq";
70496#endif /* FREECIV_JSON_CONNECTION */
70497 DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_invis_sq);
70498#ifdef FREECIV_JSON_CONNECTION
70499 field_addr.name = "vision_subs_sq";
70500#endif /* FREECIV_JSON_CONNECTION */
70501 DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_subs_sq);
70502
70503#endif
70504 SEND_PACKET_END(PACKET_RULESET_BASE);
70505}
70506
70507 int send_packet_ruleset_base(struct connection *pc, const struct packet_ruleset_base *packet)
70508{
70509 if (!pc->used) {
70510 log_error("WARNING: trying to send data to the closed connection %s",
70511 conn_description(pc));
70512 return -1;
70513 }
70514 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_BASE].packet != NULL, -1,
70515 "Handler for PACKET_RULESET_BASE not installed");
70516 return pc->phs.handlers->send[PACKET_RULESET_BASE].packet(pc, packet);
70517}
70518
70519 void lsend_packet_ruleset_base(struct conn_list *dest, const struct packet_ruleset_base *packet)
70520{
70521 conn_list_iterate(dest, pconn) {
70522 send_packet_ruleset_base(pconn, packet);
70523 } conn_list_iterate_end;
70524}
70525
70526#ifdef FREECIV_DELTA_PROTOCOL
70527#define hash_packet_ruleset_road_100 hash_const
70528
70529#define cmp_packet_ruleset_road_100 cmp_const
70530
70531 BV_DEFINE(packet_ruleset_road_100_fields, 12);
70532#endif /* FREECIV_DELTA_PROTOCOL */
70533
70534 static struct packet_ruleset_road *receive_packet_ruleset_road_100(struct connection *pc)
70535{
70536#ifdef FREECIV_DELTA_PROTOCOL
70537 packet_ruleset_road_100_fields fields;
70538 struct packet_ruleset_road *old;
70539 struct genhash **hash = pc->phs.received + PACKET_RULESET_ROAD;
70540#endif /* FREECIV_DELTA_PROTOCOL */
70541 RECEIVE_PACKET_START(packet_ruleset_road, real_packet);
70542#ifdef FREECIV_JSON_CONNECTION
70543 struct plocation field_addr;
70544 {
70545 struct plocation *field_addr_tmp = plocation_field_new(NULL);
70546 field_addr = *field_addr_tmp;
70547 FC_FREE(field_addr_tmp);
70548 }
70549#endif /* FREECIV_JSON_CONNECTION */
70550
70551#ifdef FREECIV_DELTA_PROTOCOL
70552#ifdef FREECIV_JSON_CONNECTION
70553 field_addr.name = "fields";
70554#endif /* FREECIV_JSON_CONNECTION */
70555 DIO_BV_GET(&din, &field_addr, fields);
70556
70557#else /* FREECIV_DELTA_PROTOCOL */
70558 #ifdef FREECIV_JSON_CONNECTION
70559 field_addr.name = "id";
70560 #endif /* FREECIV_JSON_CONNECTION */
70561 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
70562 RECEIVE_PACKET_FIELD_ERROR(id);
70563 }
70564 #ifdef FREECIV_JSON_CONNECTION
70565 field_addr.name = "gui_type";
70566 #endif /* FREECIV_JSON_CONNECTION */
70567 {
70568 int readin;
70569
70570 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
70571 RECEIVE_PACKET_FIELD_ERROR(gui_type);
70572 }
70573 real_packet->gui_type = readin;
70574 }
70575 #ifdef FREECIV_JSON_CONNECTION
70576 field_addr.name = "first_reqs_count";
70577 #endif /* FREECIV_JSON_CONNECTION */
70578 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->first_reqs_count)) {
70579 RECEIVE_PACKET_FIELD_ERROR(first_reqs_count);
70580 }
70581 #ifdef FREECIV_JSON_CONNECTION
70582 field_addr.name = "first_reqs";
70583 #endif /* FREECIV_JSON_CONNECTION */
70584
70585 {
70586 int i;
70587
70588 #ifdef FREECIV_JSON_CONNECTION
70589 /* Enter array. */
70590 field_addr.sub_location = plocation_elem_new(0);
70591 #endif /* FREECIV_JSON_CONNECTION */
70592
70593 if (real_packet->first_reqs_count > MAX_NUM_REQS) {
70594 RECEIVE_PACKET_FIELD_ERROR(first_reqs, ": truncation array");
70595 }
70596 for (i = 0; i < real_packet->first_reqs_count; i++) {
70597 #ifdef FREECIV_JSON_CONNECTION
70598 field_addr.sub_location->number = i;
70599 #endif /* FREECIV_JSON_CONNECTION */
70600 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->first_reqs[i])) {
70601 RECEIVE_PACKET_FIELD_ERROR(first_reqs);
70602 }
70603 }
70604
70605 #ifdef FREECIV_JSON_CONNECTION
70606 /* Exit array. */
70607 free(field_addr.sub_location);
70608 field_addr.sub_location = NULL;
70609 #endif /* FREECIV_JSON_CONNECTION */
70610 }
70611 #ifdef FREECIV_JSON_CONNECTION
70612 field_addr.name = "move_cost";
70613 #endif /* FREECIV_JSON_CONNECTION */
70614 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->move_cost)) {
70615 RECEIVE_PACKET_FIELD_ERROR(move_cost);
70616 }
70617 #ifdef FREECIV_JSON_CONNECTION
70618 field_addr.name = "move_mode";
70619 #endif /* FREECIV_JSON_CONNECTION */
70620 {
70621 int readin;
70622
70623 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
70624 RECEIVE_PACKET_FIELD_ERROR(move_mode);
70625 }
70626 real_packet->move_mode = readin;
70627 }
70628 #ifdef FREECIV_JSON_CONNECTION
70629 field_addr.name = "tile_incr_const";
70630 #endif /* FREECIV_JSON_CONNECTION */
70631
70632 {
70633 int i;
70634
70635 #ifdef FREECIV_JSON_CONNECTION
70636 /* Enter array. */
70637 field_addr.sub_location = plocation_elem_new(0);
70638 #endif /* FREECIV_JSON_CONNECTION */
70639
70640 for (i = 0; i < O_LAST; i++) {
70641 #ifdef FREECIV_JSON_CONNECTION
70642 field_addr.sub_location->number = i;
70643 #endif /* FREECIV_JSON_CONNECTION */
70644 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_incr_const[i])) {
70645 RECEIVE_PACKET_FIELD_ERROR(tile_incr_const);
70646 }
70647 }
70648
70649 #ifdef FREECIV_JSON_CONNECTION
70650 /* Exit array. */
70651 free(field_addr.sub_location);
70652 field_addr.sub_location = NULL;
70653 #endif /* FREECIV_JSON_CONNECTION */
70654 }
70655 #ifdef FREECIV_JSON_CONNECTION
70656 field_addr.name = "tile_incr";
70657 #endif /* FREECIV_JSON_CONNECTION */
70658
70659 {
70660 int i;
70661
70662 #ifdef FREECIV_JSON_CONNECTION
70663 /* Enter array. */
70664 field_addr.sub_location = plocation_elem_new(0);
70665 #endif /* FREECIV_JSON_CONNECTION */
70666
70667 for (i = 0; i < O_LAST; i++) {
70668 #ifdef FREECIV_JSON_CONNECTION
70669 field_addr.sub_location->number = i;
70670 #endif /* FREECIV_JSON_CONNECTION */
70671 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_incr[i])) {
70672 RECEIVE_PACKET_FIELD_ERROR(tile_incr);
70673 }
70674 }
70675
70676 #ifdef FREECIV_JSON_CONNECTION
70677 /* Exit array. */
70678 free(field_addr.sub_location);
70679 field_addr.sub_location = NULL;
70680 #endif /* FREECIV_JSON_CONNECTION */
70681 }
70682 #ifdef FREECIV_JSON_CONNECTION
70683 field_addr.name = "tile_bonus";
70684 #endif /* FREECIV_JSON_CONNECTION */
70685
70686 {
70687 int i;
70688
70689 #ifdef FREECIV_JSON_CONNECTION
70690 /* Enter array. */
70691 field_addr.sub_location = plocation_elem_new(0);
70692 #endif /* FREECIV_JSON_CONNECTION */
70693
70694 for (i = 0; i < O_LAST; i++) {
70695 #ifdef FREECIV_JSON_CONNECTION
70696 field_addr.sub_location->number = i;
70697 #endif /* FREECIV_JSON_CONNECTION */
70698 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_bonus[i])) {
70699 RECEIVE_PACKET_FIELD_ERROR(tile_bonus);
70700 }
70701 }
70702
70703 #ifdef FREECIV_JSON_CONNECTION
70704 /* Exit array. */
70705 free(field_addr.sub_location);
70706 field_addr.sub_location = NULL;
70707 #endif /* FREECIV_JSON_CONNECTION */
70708 }
70709 #ifdef FREECIV_JSON_CONNECTION
70710 field_addr.name = "compat";
70711 #endif /* FREECIV_JSON_CONNECTION */
70712 {
70713 int readin;
70714
70715 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
70716 RECEIVE_PACKET_FIELD_ERROR(compat);
70717 }
70718 real_packet->compat = readin;
70719 }
70720 #ifdef FREECIV_JSON_CONNECTION
70721 field_addr.name = "integrates";
70722 #endif /* FREECIV_JSON_CONNECTION */
70723 if (!DIO_BV_GET(&din, &field_addr, real_packet->integrates)) {
70724 RECEIVE_PACKET_FIELD_ERROR(integrates);
70725 }
70726 #ifdef FREECIV_JSON_CONNECTION
70727 field_addr.name = "flags";
70728 #endif /* FREECIV_JSON_CONNECTION */
70729 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
70730 RECEIVE_PACKET_FIELD_ERROR(flags);
70731 }
70732
70733#endif
70734 log_packet_detailed("packet_ruleset_road_100: got info about ()");
70735
70736#ifdef FREECIV_DELTA_PROTOCOL
70737 if (NULL == *hash) {
70738 *hash = genhash_new_full(hash_packet_ruleset_road_100, cmp_packet_ruleset_road_100,
70739 NULL, NULL, NULL, free);
70740 }
70741
70742 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
70743 *real_packet = *old;
70744 } else {
70745 log_packet_detailed(" no old info");
70746 memset(real_packet, 0, sizeof(*real_packet));
70747 }
70748
70749 if (BV_ISSET(fields, 0)) {
70750 log_packet_detailed(" got field 'id'");
70751 #ifdef FREECIV_JSON_CONNECTION
70752 field_addr.name = "id";
70753 #endif /* FREECIV_JSON_CONNECTION */
70754 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
70755 RECEIVE_PACKET_FIELD_ERROR(id);
70756 }
70757 }
70758 if (BV_ISSET(fields, 1)) {
70759 log_packet_detailed(" got field 'gui_type'");
70760 #ifdef FREECIV_JSON_CONNECTION
70761 field_addr.name = "gui_type";
70762 #endif /* FREECIV_JSON_CONNECTION */
70763 {
70764 int readin;
70765
70766 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
70767 RECEIVE_PACKET_FIELD_ERROR(gui_type);
70768 }
70769 real_packet->gui_type = readin;
70770 }
70771 }
70772 if (BV_ISSET(fields, 2)) {
70773 log_packet_detailed(" got field 'first_reqs_count'");
70774 #ifdef FREECIV_JSON_CONNECTION
70775 field_addr.name = "first_reqs_count";
70776 #endif /* FREECIV_JSON_CONNECTION */
70777 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->first_reqs_count)) {
70778 RECEIVE_PACKET_FIELD_ERROR(first_reqs_count);
70779 }
70780 }
70781 if (BV_ISSET(fields, 3)) {
70782 log_packet_detailed(" got field 'first_reqs'");
70783 #ifdef FREECIV_JSON_CONNECTION
70784 field_addr.name = "first_reqs";
70785 #endif /* FREECIV_JSON_CONNECTION */
70786
70787 {
70788 int i;
70789
70790 #ifdef FREECIV_JSON_CONNECTION
70791 /* Enter array. */
70792 field_addr.sub_location = plocation_elem_new(0);
70793 #endif /* FREECIV_JSON_CONNECTION */
70794
70795 if (real_packet->first_reqs_count > MAX_NUM_REQS) {
70796 RECEIVE_PACKET_FIELD_ERROR(first_reqs, ": truncation array");
70797 }
70798 for (i = 0; i < real_packet->first_reqs_count; i++) {
70799 #ifdef FREECIV_JSON_CONNECTION
70800 field_addr.sub_location->number = i;
70801 #endif /* FREECIV_JSON_CONNECTION */
70802 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->first_reqs[i])) {
70803 RECEIVE_PACKET_FIELD_ERROR(first_reqs);
70804 }
70805 }
70806
70807 #ifdef FREECIV_JSON_CONNECTION
70808 /* Exit array. */
70809 free(field_addr.sub_location);
70810 field_addr.sub_location = NULL;
70811 #endif /* FREECIV_JSON_CONNECTION */
70812 }
70813 }
70814 if (BV_ISSET(fields, 4)) {
70815 log_packet_detailed(" got field 'move_cost'");
70816 #ifdef FREECIV_JSON_CONNECTION
70817 field_addr.name = "move_cost";
70818 #endif /* FREECIV_JSON_CONNECTION */
70819 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->move_cost)) {
70820 RECEIVE_PACKET_FIELD_ERROR(move_cost);
70821 }
70822 }
70823 if (BV_ISSET(fields, 5)) {
70824 log_packet_detailed(" got field 'move_mode'");
70825 #ifdef FREECIV_JSON_CONNECTION
70826 field_addr.name = "move_mode";
70827 #endif /* FREECIV_JSON_CONNECTION */
70828 {
70829 int readin;
70830
70831 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
70832 RECEIVE_PACKET_FIELD_ERROR(move_mode);
70833 }
70834 real_packet->move_mode = readin;
70835 }
70836 }
70837 if (BV_ISSET(fields, 6)) {
70838 log_packet_detailed(" got field 'tile_incr_const'");
70839 #ifdef FREECIV_JSON_CONNECTION
70840 field_addr.name = "tile_incr_const";
70841 #endif /* FREECIV_JSON_CONNECTION */
70842
70843 {
70844 int i;
70845
70846 #ifdef FREECIV_JSON_CONNECTION
70847 /* Enter array. */
70848 field_addr.sub_location = plocation_elem_new(0);
70849 #endif /* FREECIV_JSON_CONNECTION */
70850
70851 for (i = 0; i < O_LAST; i++) {
70852 #ifdef FREECIV_JSON_CONNECTION
70853 field_addr.sub_location->number = i;
70854 #endif /* FREECIV_JSON_CONNECTION */
70855 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_incr_const[i])) {
70856 RECEIVE_PACKET_FIELD_ERROR(tile_incr_const);
70857 }
70858 }
70859
70860 #ifdef FREECIV_JSON_CONNECTION
70861 /* Exit array. */
70862 free(field_addr.sub_location);
70863 field_addr.sub_location = NULL;
70864 #endif /* FREECIV_JSON_CONNECTION */
70865 }
70866 }
70867 if (BV_ISSET(fields, 7)) {
70868 log_packet_detailed(" got field 'tile_incr'");
70869 #ifdef FREECIV_JSON_CONNECTION
70870 field_addr.name = "tile_incr";
70871 #endif /* FREECIV_JSON_CONNECTION */
70872
70873 {
70874 int i;
70875
70876 #ifdef FREECIV_JSON_CONNECTION
70877 /* Enter array. */
70878 field_addr.sub_location = plocation_elem_new(0);
70879 #endif /* FREECIV_JSON_CONNECTION */
70880
70881 for (i = 0; i < O_LAST; i++) {
70882 #ifdef FREECIV_JSON_CONNECTION
70883 field_addr.sub_location->number = i;
70884 #endif /* FREECIV_JSON_CONNECTION */
70885 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_incr[i])) {
70886 RECEIVE_PACKET_FIELD_ERROR(tile_incr);
70887 }
70888 }
70889
70890 #ifdef FREECIV_JSON_CONNECTION
70891 /* Exit array. */
70892 free(field_addr.sub_location);
70893 field_addr.sub_location = NULL;
70894 #endif /* FREECIV_JSON_CONNECTION */
70895 }
70896 }
70897 if (BV_ISSET(fields, 8)) {
70898 log_packet_detailed(" got field 'tile_bonus'");
70899 #ifdef FREECIV_JSON_CONNECTION
70900 field_addr.name = "tile_bonus";
70901 #endif /* FREECIV_JSON_CONNECTION */
70902
70903 {
70904 int i;
70905
70906 #ifdef FREECIV_JSON_CONNECTION
70907 /* Enter array. */
70908 field_addr.sub_location = plocation_elem_new(0);
70909 #endif /* FREECIV_JSON_CONNECTION */
70910
70911 for (i = 0; i < O_LAST; i++) {
70912 #ifdef FREECIV_JSON_CONNECTION
70913 field_addr.sub_location->number = i;
70914 #endif /* FREECIV_JSON_CONNECTION */
70915 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_bonus[i])) {
70916 RECEIVE_PACKET_FIELD_ERROR(tile_bonus);
70917 }
70918 }
70919
70920 #ifdef FREECIV_JSON_CONNECTION
70921 /* Exit array. */
70922 free(field_addr.sub_location);
70923 field_addr.sub_location = NULL;
70924 #endif /* FREECIV_JSON_CONNECTION */
70925 }
70926 }
70927 if (BV_ISSET(fields, 9)) {
70928 log_packet_detailed(" got field 'compat'");
70929 #ifdef FREECIV_JSON_CONNECTION
70930 field_addr.name = "compat";
70931 #endif /* FREECIV_JSON_CONNECTION */
70932 {
70933 int readin;
70934
70935 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
70936 RECEIVE_PACKET_FIELD_ERROR(compat);
70937 }
70938 real_packet->compat = readin;
70939 }
70940 }
70941 if (BV_ISSET(fields, 10)) {
70942 log_packet_detailed(" got field 'integrates'");
70943 #ifdef FREECIV_JSON_CONNECTION
70944 field_addr.name = "integrates";
70945 #endif /* FREECIV_JSON_CONNECTION */
70946 if (!DIO_BV_GET(&din, &field_addr, real_packet->integrates)) {
70947 RECEIVE_PACKET_FIELD_ERROR(integrates);
70948 }
70949 }
70950 if (BV_ISSET(fields, 11)) {
70951 log_packet_detailed(" got field 'flags'");
70952 #ifdef FREECIV_JSON_CONNECTION
70953 field_addr.name = "flags";
70954 #endif /* FREECIV_JSON_CONNECTION */
70955 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
70956 RECEIVE_PACKET_FIELD_ERROR(flags);
70957 }
70958 }
70959
70960 if (NULL == old) {
70961 old = fc_malloc(sizeof(*old));
70962 *old = *real_packet;
70963 genhash_insert(*hash, old, old);
70964 } else {
70965 *old = *real_packet;
70966 }
70967
70968#endif /* FREECIV_DELTA_PROTOCOL */
70969 RECEIVE_PACKET_END(real_packet);
70970}
70971
70972 static int send_packet_ruleset_road_100(struct connection *pc, const struct packet_ruleset_road *packet)
70973{
70974 const struct packet_ruleset_road *real_packet = packet;
70975#ifdef FREECIV_DELTA_PROTOCOL
70976 packet_ruleset_road_100_fields fields;
70977 struct packet_ruleset_road *old;
70978 bool differ;
70979 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ROAD;
70980#endif /* FREECIV_DELTA_PROTOCOL */
70981 SEND_PACKET_START(PACKET_RULESET_ROAD);
70982#ifdef FREECIV_JSON_CONNECTION
70983 struct plocation field_addr;
70984 {
70985 struct plocation *field_addr_tmp = plocation_field_new(NULL);
70986 field_addr = *field_addr_tmp;
70987 FC_FREE(field_addr_tmp);
70988 }
70989#endif /* FREECIV_JSON_CONNECTION */
70990
70991 log_packet_detailed("packet_ruleset_road_100: sending info about ()");
70992
70993#ifdef FREECIV_DELTA_PROTOCOL
70994 if (NULL == *hash) {
70995 *hash = genhash_new_full(hash_packet_ruleset_road_100, cmp_packet_ruleset_road_100,
70996 NULL, NULL, NULL, free);
70997 }
70998 BV_CLR_ALL(fields);
70999
71000 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
71001 old = fc_malloc(sizeof(*old));
71002 *old = *real_packet;
71003 genhash_insert(*hash, old, old);
71004 memset(old, 0, sizeof(*old));
71005 }
71006 differ = (old->id != real_packet->id);
71007 if (differ) {
71008 BV_SET(fields, 0);
71009 }
71010
71011 differ = (old->gui_type != real_packet->gui_type);
71012 if (differ) {
71013 BV_SET(fields, 1);
71014 }
71015
71016 differ = (old->first_reqs_count != real_packet->first_reqs_count);
71017 if (differ) {
71018 BV_SET(fields, 2);
71019 }
71020
71021
71022 {
71023 differ = (old->first_reqs_count != real_packet->first_reqs_count);
71024 if (!differ) {
71025 int i;
71026
71027 for (i = 0; i < real_packet->first_reqs_count; i++) {
71028 if (!are_requirements_equal(&old->first_reqs[i], &real_packet->first_reqs[i])) {
71029 differ = TRUE;
71030 break;
71031 }
71032 }
71033 }
71034 }
71035 if (differ) {
71036 BV_SET(fields, 3);
71037 }
71038
71039 differ = (old->move_cost != real_packet->move_cost);
71040 if (differ) {
71041 BV_SET(fields, 4);
71042 }
71043
71044 differ = (old->move_mode != real_packet->move_mode);
71045 if (differ) {
71046 BV_SET(fields, 5);
71047 }
71048
71049
71050 {
71051 differ = FALSE;
71052 {
71053 int i;
71054
71055 for (i = 0; i < O_LAST; i++) {
71056 if (old->tile_incr_const[i] != real_packet->tile_incr_const[i]) {
71057 differ = TRUE;
71058 break;
71059 }
71060 }
71061 }
71062 }
71063 if (differ) {
71064 BV_SET(fields, 6);
71065 }
71066
71067
71068 {
71069 differ = FALSE;
71070 {
71071 int i;
71072
71073 for (i = 0; i < O_LAST; i++) {
71074 if (old->tile_incr[i] != real_packet->tile_incr[i]) {
71075 differ = TRUE;
71076 break;
71077 }
71078 }
71079 }
71080 }
71081 if (differ) {
71082 BV_SET(fields, 7);
71083 }
71084
71085
71086 {
71087 differ = FALSE;
71088 {
71089 int i;
71090
71091 for (i = 0; i < O_LAST; i++) {
71092 if (old->tile_bonus[i] != real_packet->tile_bonus[i]) {
71093 differ = TRUE;
71094 break;
71095 }
71096 }
71097 }
71098 }
71099 if (differ) {
71100 BV_SET(fields, 8);
71101 }
71102
71103 differ = (old->compat != real_packet->compat);
71104 if (differ) {
71105 BV_SET(fields, 9);
71106 }
71107
71108 differ = !BV_ARE_EQUAL(old->integrates, real_packet->integrates);
71109 if (differ) {
71110 BV_SET(fields, 10);
71111 }
71112
71113 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
71114 if (differ) {
71115 BV_SET(fields, 11);
71116 }
71117
71118
71119#ifdef FREECIV_JSON_CONNECTION
71120 field_addr.name = "fields";
71121#endif /* FREECIV_JSON_CONNECTION */
71122 DIO_BV_PUT(&dout, &field_addr, fields);
71123
71124 if (BV_ISSET(fields, 0)) {
71125 log_packet_detailed(" field 'id' has changed");
71126 #ifdef FREECIV_JSON_CONNECTION
71127 field_addr.name = "id";
71128#endif /* FREECIV_JSON_CONNECTION */
71129 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
71130 }
71131 if (BV_ISSET(fields, 1)) {
71132 log_packet_detailed(" field 'gui_type' has changed");
71133 #ifdef FREECIV_JSON_CONNECTION
71134 field_addr.name = "gui_type";
71135#endif /* FREECIV_JSON_CONNECTION */
71136 DIO_PUT(uint8, &dout, &field_addr, real_packet->gui_type);
71137 }
71138 if (BV_ISSET(fields, 2)) {
71139 log_packet_detailed(" field 'first_reqs_count' has changed");
71140 #ifdef FREECIV_JSON_CONNECTION
71141 field_addr.name = "first_reqs_count";
71142#endif /* FREECIV_JSON_CONNECTION */
71143 DIO_PUT(uint8, &dout, &field_addr, real_packet->first_reqs_count);
71144 }
71145 if (BV_ISSET(fields, 3)) {
71146 log_packet_detailed(" field 'first_reqs' has changed");
71147 #ifdef FREECIV_JSON_CONNECTION
71148 field_addr.name = "first_reqs";
71149#endif /* FREECIV_JSON_CONNECTION */
71150
71151 {
71152 int i;
71153
71154#ifdef FREECIV_JSON_CONNECTION
71155 /* Create the array. */
71156 DIO_PUT(farray, &dout, &field_addr, real_packet->first_reqs_count);
71157
71158 /* Enter the array. */
71159 field_addr.sub_location = plocation_elem_new(0);
71160#endif /* FREECIV_JSON_CONNECTION */
71161
71162 for (i = 0; i < real_packet->first_reqs_count; i++) {
71163#ifdef FREECIV_JSON_CONNECTION
71164 /* Next array element. */
71165 field_addr.sub_location->number = i;
71166#endif /* FREECIV_JSON_CONNECTION */
71167 DIO_PUT(requirement, &dout, &field_addr, &real_packet->first_reqs[i]);
71168 }
71169
71170#ifdef FREECIV_JSON_CONNECTION
71171 /* Exit array. */
71172 free(field_addr.sub_location);
71173 field_addr.sub_location = NULL;
71174#endif /* FREECIV_JSON_CONNECTION */
71175 }
71176 }
71177 if (BV_ISSET(fields, 4)) {
71178 log_packet_detailed(" field 'move_cost' has changed");
71179 #ifdef FREECIV_JSON_CONNECTION
71180 field_addr.name = "move_cost";
71181#endif /* FREECIV_JSON_CONNECTION */
71182 DIO_PUT(sint16, &dout, &field_addr, real_packet->move_cost);
71183 }
71184 if (BV_ISSET(fields, 5)) {
71185 log_packet_detailed(" field 'move_mode' has changed");
71186 #ifdef FREECIV_JSON_CONNECTION
71187 field_addr.name = "move_mode";
71188#endif /* FREECIV_JSON_CONNECTION */
71189 DIO_PUT(uint8, &dout, &field_addr, real_packet->move_mode);
71190 }
71191 if (BV_ISSET(fields, 6)) {
71192 log_packet_detailed(" field 'tile_incr_const' has changed");
71193 #ifdef FREECIV_JSON_CONNECTION
71194 field_addr.name = "tile_incr_const";
71195#endif /* FREECIV_JSON_CONNECTION */
71196
71197 {
71198 int i;
71199
71200#ifdef FREECIV_JSON_CONNECTION
71201 /* Create the array. */
71202 DIO_PUT(farray, &dout, &field_addr, O_LAST);
71203
71204 /* Enter the array. */
71205 field_addr.sub_location = plocation_elem_new(0);
71206#endif /* FREECIV_JSON_CONNECTION */
71207
71208 for (i = 0; i < O_LAST; i++) {
71209#ifdef FREECIV_JSON_CONNECTION
71210 /* Next array element. */
71211 field_addr.sub_location->number = i;
71212#endif /* FREECIV_JSON_CONNECTION */
71213 DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_incr_const[i]);
71214 }
71215
71216#ifdef FREECIV_JSON_CONNECTION
71217 /* Exit array. */
71218 free(field_addr.sub_location);
71219 field_addr.sub_location = NULL;
71220#endif /* FREECIV_JSON_CONNECTION */
71221 }
71222 }
71223 if (BV_ISSET(fields, 7)) {
71224 log_packet_detailed(" field 'tile_incr' has changed");
71225 #ifdef FREECIV_JSON_CONNECTION
71226 field_addr.name = "tile_incr";
71227#endif /* FREECIV_JSON_CONNECTION */
71228
71229 {
71230 int i;
71231
71232#ifdef FREECIV_JSON_CONNECTION
71233 /* Create the array. */
71234 DIO_PUT(farray, &dout, &field_addr, O_LAST);
71235
71236 /* Enter the array. */
71237 field_addr.sub_location = plocation_elem_new(0);
71238#endif /* FREECIV_JSON_CONNECTION */
71239
71240 for (i = 0; i < O_LAST; i++) {
71241#ifdef FREECIV_JSON_CONNECTION
71242 /* Next array element. */
71243 field_addr.sub_location->number = i;
71244#endif /* FREECIV_JSON_CONNECTION */
71245 DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_incr[i]);
71246 }
71247
71248#ifdef FREECIV_JSON_CONNECTION
71249 /* Exit array. */
71250 free(field_addr.sub_location);
71251 field_addr.sub_location = NULL;
71252#endif /* FREECIV_JSON_CONNECTION */
71253 }
71254 }
71255 if (BV_ISSET(fields, 8)) {
71256 log_packet_detailed(" field 'tile_bonus' has changed");
71257 #ifdef FREECIV_JSON_CONNECTION
71258 field_addr.name = "tile_bonus";
71259#endif /* FREECIV_JSON_CONNECTION */
71260
71261 {
71262 int i;
71263
71264#ifdef FREECIV_JSON_CONNECTION
71265 /* Create the array. */
71266 DIO_PUT(farray, &dout, &field_addr, O_LAST);
71267
71268 /* Enter the array. */
71269 field_addr.sub_location = plocation_elem_new(0);
71270#endif /* FREECIV_JSON_CONNECTION */
71271
71272 for (i = 0; i < O_LAST; i++) {
71273#ifdef FREECIV_JSON_CONNECTION
71274 /* Next array element. */
71275 field_addr.sub_location->number = i;
71276#endif /* FREECIV_JSON_CONNECTION */
71277 DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_bonus[i]);
71278 }
71279
71280#ifdef FREECIV_JSON_CONNECTION
71281 /* Exit array. */
71282 free(field_addr.sub_location);
71283 field_addr.sub_location = NULL;
71284#endif /* FREECIV_JSON_CONNECTION */
71285 }
71286 }
71287 if (BV_ISSET(fields, 9)) {
71288 log_packet_detailed(" field 'compat' has changed");
71289 #ifdef FREECIV_JSON_CONNECTION
71290 field_addr.name = "compat";
71291#endif /* FREECIV_JSON_CONNECTION */
71292 DIO_PUT(uint8, &dout, &field_addr, real_packet->compat);
71293 }
71294 if (BV_ISSET(fields, 10)) {
71295 log_packet_detailed(" field 'integrates' has changed");
71296 #ifdef FREECIV_JSON_CONNECTION
71297 field_addr.name = "integrates";
71298#endif /* FREECIV_JSON_CONNECTION */
71299 DIO_BV_PUT(&dout, &field_addr, packet->integrates);
71300 }
71301 if (BV_ISSET(fields, 11)) {
71302 log_packet_detailed(" field 'flags' has changed");
71303 #ifdef FREECIV_JSON_CONNECTION
71304 field_addr.name = "flags";
71305#endif /* FREECIV_JSON_CONNECTION */
71306 DIO_BV_PUT(&dout, &field_addr, packet->flags);
71307 }
71308
71309 *old = *real_packet;
71310#endif /* FREECIV_DELTA_PROTOCOL */
71311#ifndef FREECIV_DELTA_PROTOCOL
71312#ifdef FREECIV_JSON_CONNECTION
71313 field_addr.name = "id";
71314#endif /* FREECIV_JSON_CONNECTION */
71315 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
71316#ifdef FREECIV_JSON_CONNECTION
71317 field_addr.name = "gui_type";
71318#endif /* FREECIV_JSON_CONNECTION */
71319 DIO_PUT(uint8, &dout, &field_addr, real_packet->gui_type);
71320#ifdef FREECIV_JSON_CONNECTION
71321 field_addr.name = "first_reqs_count";
71322#endif /* FREECIV_JSON_CONNECTION */
71323 DIO_PUT(uint8, &dout, &field_addr, real_packet->first_reqs_count);
71324#ifdef FREECIV_JSON_CONNECTION
71325 field_addr.name = "first_reqs";
71326#endif /* FREECIV_JSON_CONNECTION */
71327
71328 {
71329 int i;
71330
71331#ifdef FREECIV_JSON_CONNECTION
71332 /* Create the array. */
71333 DIO_PUT(farray, &dout, &field_addr, real_packet->first_reqs_count);
71334
71335 /* Enter the array. */
71336 field_addr.sub_location = plocation_elem_new(0);
71337#endif /* FREECIV_JSON_CONNECTION */
71338
71339 for (i = 0; i < real_packet->first_reqs_count; i++) {
71340#ifdef FREECIV_JSON_CONNECTION
71341 /* Next array element. */
71342 field_addr.sub_location->number = i;
71343#endif /* FREECIV_JSON_CONNECTION */
71344 DIO_PUT(requirement, &dout, &field_addr, &real_packet->first_reqs[i]);
71345 }
71346
71347#ifdef FREECIV_JSON_CONNECTION
71348 /* Exit array. */
71349 free(field_addr.sub_location);
71350 field_addr.sub_location = NULL;
71351#endif /* FREECIV_JSON_CONNECTION */
71352 }
71353#ifdef FREECIV_JSON_CONNECTION
71354 field_addr.name = "move_cost";
71355#endif /* FREECIV_JSON_CONNECTION */
71356 DIO_PUT(sint16, &dout, &field_addr, real_packet->move_cost);
71357#ifdef FREECIV_JSON_CONNECTION
71358 field_addr.name = "move_mode";
71359#endif /* FREECIV_JSON_CONNECTION */
71360 DIO_PUT(uint8, &dout, &field_addr, real_packet->move_mode);
71361#ifdef FREECIV_JSON_CONNECTION
71362 field_addr.name = "tile_incr_const";
71363#endif /* FREECIV_JSON_CONNECTION */
71364
71365 {
71366 int i;
71367
71368#ifdef FREECIV_JSON_CONNECTION
71369 /* Create the array. */
71370 DIO_PUT(farray, &dout, &field_addr, O_LAST);
71371
71372 /* Enter the array. */
71373 field_addr.sub_location = plocation_elem_new(0);
71374#endif /* FREECIV_JSON_CONNECTION */
71375
71376 for (i = 0; i < O_LAST; i++) {
71377#ifdef FREECIV_JSON_CONNECTION
71378 /* Next array element. */
71379 field_addr.sub_location->number = i;
71380#endif /* FREECIV_JSON_CONNECTION */
71381 DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_incr_const[i]);
71382 }
71383
71384#ifdef FREECIV_JSON_CONNECTION
71385 /* Exit array. */
71386 free(field_addr.sub_location);
71387 field_addr.sub_location = NULL;
71388#endif /* FREECIV_JSON_CONNECTION */
71389 }
71390#ifdef FREECIV_JSON_CONNECTION
71391 field_addr.name = "tile_incr";
71392#endif /* FREECIV_JSON_CONNECTION */
71393
71394 {
71395 int i;
71396
71397#ifdef FREECIV_JSON_CONNECTION
71398 /* Create the array. */
71399 DIO_PUT(farray, &dout, &field_addr, O_LAST);
71400
71401 /* Enter the array. */
71402 field_addr.sub_location = plocation_elem_new(0);
71403#endif /* FREECIV_JSON_CONNECTION */
71404
71405 for (i = 0; i < O_LAST; i++) {
71406#ifdef FREECIV_JSON_CONNECTION
71407 /* Next array element. */
71408 field_addr.sub_location->number = i;
71409#endif /* FREECIV_JSON_CONNECTION */
71410 DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_incr[i]);
71411 }
71412
71413#ifdef FREECIV_JSON_CONNECTION
71414 /* Exit array. */
71415 free(field_addr.sub_location);
71416 field_addr.sub_location = NULL;
71417#endif /* FREECIV_JSON_CONNECTION */
71418 }
71419#ifdef FREECIV_JSON_CONNECTION
71420 field_addr.name = "tile_bonus";
71421#endif /* FREECIV_JSON_CONNECTION */
71422
71423 {
71424 int i;
71425
71426#ifdef FREECIV_JSON_CONNECTION
71427 /* Create the array. */
71428 DIO_PUT(farray, &dout, &field_addr, O_LAST);
71429
71430 /* Enter the array. */
71431 field_addr.sub_location = plocation_elem_new(0);
71432#endif /* FREECIV_JSON_CONNECTION */
71433
71434 for (i = 0; i < O_LAST; i++) {
71435#ifdef FREECIV_JSON_CONNECTION
71436 /* Next array element. */
71437 field_addr.sub_location->number = i;
71438#endif /* FREECIV_JSON_CONNECTION */
71439 DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_bonus[i]);
71440 }
71441
71442#ifdef FREECIV_JSON_CONNECTION
71443 /* Exit array. */
71444 free(field_addr.sub_location);
71445 field_addr.sub_location = NULL;
71446#endif /* FREECIV_JSON_CONNECTION */
71447 }
71448#ifdef FREECIV_JSON_CONNECTION
71449 field_addr.name = "compat";
71450#endif /* FREECIV_JSON_CONNECTION */
71451 DIO_PUT(uint8, &dout, &field_addr, real_packet->compat);
71452#ifdef FREECIV_JSON_CONNECTION
71453 field_addr.name = "integrates";
71454#endif /* FREECIV_JSON_CONNECTION */
71455 DIO_BV_PUT(&dout, &field_addr, packet->integrates);
71456#ifdef FREECIV_JSON_CONNECTION
71457 field_addr.name = "flags";
71458#endif /* FREECIV_JSON_CONNECTION */
71459 DIO_BV_PUT(&dout, &field_addr, packet->flags);
71460
71461#endif
71462 SEND_PACKET_END(PACKET_RULESET_ROAD);
71463}
71464
71465 int send_packet_ruleset_road(struct connection *pc, const struct packet_ruleset_road *packet)
71466{
71467 if (!pc->used) {
71468 log_error("WARNING: trying to send data to the closed connection %s",
71469 conn_description(pc));
71470 return -1;
71471 }
71472 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ROAD].packet != NULL, -1,
71473 "Handler for PACKET_RULESET_ROAD not installed");
71474 return pc->phs.handlers->send[PACKET_RULESET_ROAD].packet(pc, packet);
71475}
71476
71477 void lsend_packet_ruleset_road(struct conn_list *dest, const struct packet_ruleset_road *packet)
71478{
71479 conn_list_iterate(dest, pconn) {
71480 send_packet_ruleset_road(pconn, packet);
71481 } conn_list_iterate_end;
71482}
71483
71484#ifdef FREECIV_DELTA_PROTOCOL
71485#define hash_packet_ruleset_goods_100 hash_const
71486
71487#define cmp_packet_ruleset_goods_100 cmp_const
71488
71489 BV_DEFINE(packet_ruleset_goods_100_fields, 10);
71490#endif /* FREECIV_DELTA_PROTOCOL */
71491
71492 static struct packet_ruleset_goods *receive_packet_ruleset_goods_100(struct connection *pc)
71493{
71494#ifdef FREECIV_DELTA_PROTOCOL
71495 packet_ruleset_goods_100_fields fields;
71496 struct packet_ruleset_goods *old;
71497 struct genhash **hash = pc->phs.received + PACKET_RULESET_GOODS;
71498#endif /* FREECIV_DELTA_PROTOCOL */
71499 RECEIVE_PACKET_START(packet_ruleset_goods, real_packet);
71500#ifdef FREECIV_JSON_CONNECTION
71501 struct plocation field_addr;
71502 {
71503 struct plocation *field_addr_tmp = plocation_field_new(NULL);
71504 field_addr = *field_addr_tmp;
71505 FC_FREE(field_addr_tmp);
71506 }
71507#endif /* FREECIV_JSON_CONNECTION */
71508
71509#ifdef FREECIV_DELTA_PROTOCOL
71510#ifdef FREECIV_JSON_CONNECTION
71511 field_addr.name = "fields";
71512#endif /* FREECIV_JSON_CONNECTION */
71513 DIO_BV_GET(&din, &field_addr, fields);
71514
71515#else /* FREECIV_DELTA_PROTOCOL */
71516 #ifdef FREECIV_JSON_CONNECTION
71517 field_addr.name = "id";
71518 #endif /* FREECIV_JSON_CONNECTION */
71519 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
71520 RECEIVE_PACKET_FIELD_ERROR(id);
71521 }
71522 #ifdef FREECIV_JSON_CONNECTION
71523 field_addr.name = "name";
71524 #endif /* FREECIV_JSON_CONNECTION */
71525 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
71526 RECEIVE_PACKET_FIELD_ERROR(name);
71527 }
71528 #ifdef FREECIV_JSON_CONNECTION
71529 field_addr.name = "rule_name";
71530 #endif /* FREECIV_JSON_CONNECTION */
71531 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
71532 RECEIVE_PACKET_FIELD_ERROR(rule_name);
71533 }
71534 #ifdef FREECIV_JSON_CONNECTION
71535 field_addr.name = "reqs_count";
71536 #endif /* FREECIV_JSON_CONNECTION */
71537 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
71538 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
71539 }
71540 #ifdef FREECIV_JSON_CONNECTION
71541 field_addr.name = "reqs";
71542 #endif /* FREECIV_JSON_CONNECTION */
71543
71544 {
71545 int i;
71546
71547 #ifdef FREECIV_JSON_CONNECTION
71548 /* Enter array. */
71549 field_addr.sub_location = plocation_elem_new(0);
71550 #endif /* FREECIV_JSON_CONNECTION */
71551
71552 if (real_packet->reqs_count > MAX_NUM_REQS) {
71553 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
71554 }
71555 for (i = 0; i < real_packet->reqs_count; i++) {
71556 #ifdef FREECIV_JSON_CONNECTION
71557 field_addr.sub_location->number = i;
71558 #endif /* FREECIV_JSON_CONNECTION */
71559 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
71560 RECEIVE_PACKET_FIELD_ERROR(reqs);
71561 }
71562 }
71563
71564 #ifdef FREECIV_JSON_CONNECTION
71565 /* Exit array. */
71566 free(field_addr.sub_location);
71567 field_addr.sub_location = NULL;
71568 #endif /* FREECIV_JSON_CONNECTION */
71569 }
71570 #ifdef FREECIV_JSON_CONNECTION
71571 field_addr.name = "from_pct";
71572 #endif /* FREECIV_JSON_CONNECTION */
71573 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->from_pct)) {
71574 RECEIVE_PACKET_FIELD_ERROR(from_pct);
71575 }
71576 #ifdef FREECIV_JSON_CONNECTION
71577 field_addr.name = "to_pct";
71578 #endif /* FREECIV_JSON_CONNECTION */
71579 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->to_pct)) {
71580 RECEIVE_PACKET_FIELD_ERROR(to_pct);
71581 }
71582 #ifdef FREECIV_JSON_CONNECTION
71583 field_addr.name = "onetime_pct";
71584 #endif /* FREECIV_JSON_CONNECTION */
71585 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->onetime_pct)) {
71586 RECEIVE_PACKET_FIELD_ERROR(onetime_pct);
71587 }
71588 #ifdef FREECIV_JSON_CONNECTION
71589 field_addr.name = "flags";
71590 #endif /* FREECIV_JSON_CONNECTION */
71591 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
71592 RECEIVE_PACKET_FIELD_ERROR(flags);
71593 }
71594 #ifdef FREECIV_JSON_CONNECTION
71595 field_addr.name = "helptext";
71596 #endif /* FREECIV_JSON_CONNECTION */
71597 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
71598 RECEIVE_PACKET_FIELD_ERROR(helptext);
71599 }
71600
71601#endif
71602 log_packet_detailed("packet_ruleset_goods_100: got info about ()");
71603
71604#ifdef FREECIV_DELTA_PROTOCOL
71605 if (NULL == *hash) {
71606 *hash = genhash_new_full(hash_packet_ruleset_goods_100, cmp_packet_ruleset_goods_100,
71607 NULL, NULL, NULL, free);
71608 }
71609
71610 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
71611 *real_packet = *old;
71612 } else {
71613 log_packet_detailed(" no old info");
71614 memset(real_packet, 0, sizeof(*real_packet));
71615 }
71616
71617 if (BV_ISSET(fields, 0)) {
71618 log_packet_detailed(" got field 'id'");
71619 #ifdef FREECIV_JSON_CONNECTION
71620 field_addr.name = "id";
71621 #endif /* FREECIV_JSON_CONNECTION */
71622 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
71623 RECEIVE_PACKET_FIELD_ERROR(id);
71624 }
71625 }
71626 if (BV_ISSET(fields, 1)) {
71627 log_packet_detailed(" got field 'name'");
71628 #ifdef FREECIV_JSON_CONNECTION
71629 field_addr.name = "name";
71630 #endif /* FREECIV_JSON_CONNECTION */
71631 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
71632 RECEIVE_PACKET_FIELD_ERROR(name);
71633 }
71634 }
71635 if (BV_ISSET(fields, 2)) {
71636 log_packet_detailed(" got field 'rule_name'");
71637 #ifdef FREECIV_JSON_CONNECTION
71638 field_addr.name = "rule_name";
71639 #endif /* FREECIV_JSON_CONNECTION */
71640 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
71641 RECEIVE_PACKET_FIELD_ERROR(rule_name);
71642 }
71643 }
71644 if (BV_ISSET(fields, 3)) {
71645 log_packet_detailed(" got field 'reqs_count'");
71646 #ifdef FREECIV_JSON_CONNECTION
71647 field_addr.name = "reqs_count";
71648 #endif /* FREECIV_JSON_CONNECTION */
71649 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
71650 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
71651 }
71652 }
71653 if (BV_ISSET(fields, 4)) {
71654 log_packet_detailed(" got field 'reqs'");
71655 #ifdef FREECIV_JSON_CONNECTION
71656 field_addr.name = "reqs";
71657 #endif /* FREECIV_JSON_CONNECTION */
71658
71659 {
71660 int i;
71661
71662 #ifdef FREECIV_JSON_CONNECTION
71663 /* Enter array. */
71664 field_addr.sub_location = plocation_elem_new(0);
71665 #endif /* FREECIV_JSON_CONNECTION */
71666
71667 if (real_packet->reqs_count > MAX_NUM_REQS) {
71668 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
71669 }
71670 for (i = 0; i < real_packet->reqs_count; i++) {
71671 #ifdef FREECIV_JSON_CONNECTION
71672 field_addr.sub_location->number = i;
71673 #endif /* FREECIV_JSON_CONNECTION */
71674 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
71675 RECEIVE_PACKET_FIELD_ERROR(reqs);
71676 }
71677 }
71678
71679 #ifdef FREECIV_JSON_CONNECTION
71680 /* Exit array. */
71681 free(field_addr.sub_location);
71682 field_addr.sub_location = NULL;
71683 #endif /* FREECIV_JSON_CONNECTION */
71684 }
71685 }
71686 if (BV_ISSET(fields, 5)) {
71687 log_packet_detailed(" got field 'from_pct'");
71688 #ifdef FREECIV_JSON_CONNECTION
71689 field_addr.name = "from_pct";
71690 #endif /* FREECIV_JSON_CONNECTION */
71691 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->from_pct)) {
71692 RECEIVE_PACKET_FIELD_ERROR(from_pct);
71693 }
71694 }
71695 if (BV_ISSET(fields, 6)) {
71696 log_packet_detailed(" got field 'to_pct'");
71697 #ifdef FREECIV_JSON_CONNECTION
71698 field_addr.name = "to_pct";
71699 #endif /* FREECIV_JSON_CONNECTION */
71700 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->to_pct)) {
71701 RECEIVE_PACKET_FIELD_ERROR(to_pct);
71702 }
71703 }
71704 if (BV_ISSET(fields, 7)) {
71705 log_packet_detailed(" got field 'onetime_pct'");
71706 #ifdef FREECIV_JSON_CONNECTION
71707 field_addr.name = "onetime_pct";
71708 #endif /* FREECIV_JSON_CONNECTION */
71709 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->onetime_pct)) {
71710 RECEIVE_PACKET_FIELD_ERROR(onetime_pct);
71711 }
71712 }
71713 if (BV_ISSET(fields, 8)) {
71714 log_packet_detailed(" got field 'flags'");
71715 #ifdef FREECIV_JSON_CONNECTION
71716 field_addr.name = "flags";
71717 #endif /* FREECIV_JSON_CONNECTION */
71718 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
71719 RECEIVE_PACKET_FIELD_ERROR(flags);
71720 }
71721 }
71722 if (BV_ISSET(fields, 9)) {
71723 log_packet_detailed(" got field 'helptext'");
71724 #ifdef FREECIV_JSON_CONNECTION
71725 field_addr.name = "helptext";
71726 #endif /* FREECIV_JSON_CONNECTION */
71727 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
71728 RECEIVE_PACKET_FIELD_ERROR(helptext);
71729 }
71730 }
71731
71732 if (NULL == old) {
71733 old = fc_malloc(sizeof(*old));
71734 *old = *real_packet;
71735 genhash_insert(*hash, old, old);
71736 } else {
71737 *old = *real_packet;
71738 }
71739
71740#endif /* FREECIV_DELTA_PROTOCOL */
71741 RECEIVE_PACKET_END(real_packet);
71742}
71743
71744 static int send_packet_ruleset_goods_100(struct connection *pc, const struct packet_ruleset_goods *packet)
71745{
71746 const struct packet_ruleset_goods *real_packet = packet;
71747#ifdef FREECIV_DELTA_PROTOCOL
71748 packet_ruleset_goods_100_fields fields;
71749 struct packet_ruleset_goods *old;
71750 bool differ;
71751 struct genhash **hash = pc->phs.sent + PACKET_RULESET_GOODS;
71752#endif /* FREECIV_DELTA_PROTOCOL */
71753 SEND_PACKET_START(PACKET_RULESET_GOODS);
71754#ifdef FREECIV_JSON_CONNECTION
71755 struct plocation field_addr;
71756 {
71757 struct plocation *field_addr_tmp = plocation_field_new(NULL);
71758 field_addr = *field_addr_tmp;
71759 FC_FREE(field_addr_tmp);
71760 }
71761#endif /* FREECIV_JSON_CONNECTION */
71762
71763 log_packet_detailed("packet_ruleset_goods_100: sending info about ()");
71764
71765#ifdef FREECIV_DELTA_PROTOCOL
71766 if (NULL == *hash) {
71767 *hash = genhash_new_full(hash_packet_ruleset_goods_100, cmp_packet_ruleset_goods_100,
71768 NULL, NULL, NULL, free);
71769 }
71770 BV_CLR_ALL(fields);
71771
71772 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
71773 old = fc_malloc(sizeof(*old));
71774 *old = *real_packet;
71775 genhash_insert(*hash, old, old);
71776 memset(old, 0, sizeof(*old));
71777 }
71778 differ = (old->id != real_packet->id);
71779 if (differ) {
71780 BV_SET(fields, 0);
71781 }
71782
71783 differ = (strcmp(old->name, real_packet->name) != 0);
71784 if (differ) {
71785 BV_SET(fields, 1);
71786 }
71787
71788 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
71789 if (differ) {
71790 BV_SET(fields, 2);
71791 }
71792
71793 differ = (old->reqs_count != real_packet->reqs_count);
71794 if (differ) {
71795 BV_SET(fields, 3);
71796 }
71797
71798
71799 {
71800 differ = (old->reqs_count != real_packet->reqs_count);
71801 if (!differ) {
71802 int i;
71803
71804 for (i = 0; i < real_packet->reqs_count; i++) {
71805 if (!are_requirements_equal(&old->reqs[i], &real_packet->reqs[i])) {
71806 differ = TRUE;
71807 break;
71808 }
71809 }
71810 }
71811 }
71812 if (differ) {
71813 BV_SET(fields, 4);
71814 }
71815
71816 differ = (old->from_pct != real_packet->from_pct);
71817 if (differ) {
71818 BV_SET(fields, 5);
71819 }
71820
71821 differ = (old->to_pct != real_packet->to_pct);
71822 if (differ) {
71823 BV_SET(fields, 6);
71824 }
71825
71826 differ = (old->onetime_pct != real_packet->onetime_pct);
71827 if (differ) {
71828 BV_SET(fields, 7);
71829 }
71830
71831 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
71832 if (differ) {
71833 BV_SET(fields, 8);
71834 }
71835
71836 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
71837 if (differ) {
71838 BV_SET(fields, 9);
71839 }
71840
71841
71842#ifdef FREECIV_JSON_CONNECTION
71843 field_addr.name = "fields";
71844#endif /* FREECIV_JSON_CONNECTION */
71845 DIO_BV_PUT(&dout, &field_addr, fields);
71846
71847 if (BV_ISSET(fields, 0)) {
71848 log_packet_detailed(" field 'id' has changed");
71849 #ifdef FREECIV_JSON_CONNECTION
71850 field_addr.name = "id";
71851#endif /* FREECIV_JSON_CONNECTION */
71852 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
71853 }
71854 if (BV_ISSET(fields, 1)) {
71855 log_packet_detailed(" field 'name' has changed");
71856 #ifdef FREECIV_JSON_CONNECTION
71857 field_addr.name = "name";
71858#endif /* FREECIV_JSON_CONNECTION */
71859 DIO_PUT(string, &dout, &field_addr, real_packet->name);
71860 }
71861 if (BV_ISSET(fields, 2)) {
71862 log_packet_detailed(" field 'rule_name' has changed");
71863 #ifdef FREECIV_JSON_CONNECTION
71864 field_addr.name = "rule_name";
71865#endif /* FREECIV_JSON_CONNECTION */
71866 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
71867 }
71868 if (BV_ISSET(fields, 3)) {
71869 log_packet_detailed(" field 'reqs_count' has changed");
71870 #ifdef FREECIV_JSON_CONNECTION
71871 field_addr.name = "reqs_count";
71872#endif /* FREECIV_JSON_CONNECTION */
71873 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
71874 }
71875 if (BV_ISSET(fields, 4)) {
71876 log_packet_detailed(" field 'reqs' has changed");
71877 #ifdef FREECIV_JSON_CONNECTION
71878 field_addr.name = "reqs";
71879#endif /* FREECIV_JSON_CONNECTION */
71880
71881 {
71882 int i;
71883
71884#ifdef FREECIV_JSON_CONNECTION
71885 /* Create the array. */
71886 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
71887
71888 /* Enter the array. */
71889 field_addr.sub_location = plocation_elem_new(0);
71890#endif /* FREECIV_JSON_CONNECTION */
71891
71892 for (i = 0; i < real_packet->reqs_count; i++) {
71893#ifdef FREECIV_JSON_CONNECTION
71894 /* Next array element. */
71895 field_addr.sub_location->number = i;
71896#endif /* FREECIV_JSON_CONNECTION */
71897 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
71898 }
71899
71900#ifdef FREECIV_JSON_CONNECTION
71901 /* Exit array. */
71902 free(field_addr.sub_location);
71903 field_addr.sub_location = NULL;
71904#endif /* FREECIV_JSON_CONNECTION */
71905 }
71906 }
71907 if (BV_ISSET(fields, 5)) {
71908 log_packet_detailed(" field 'from_pct' has changed");
71909 #ifdef FREECIV_JSON_CONNECTION
71910 field_addr.name = "from_pct";
71911#endif /* FREECIV_JSON_CONNECTION */
71912 DIO_PUT(uint16, &dout, &field_addr, real_packet->from_pct);
71913 }
71914 if (BV_ISSET(fields, 6)) {
71915 log_packet_detailed(" field 'to_pct' has changed");
71916 #ifdef FREECIV_JSON_CONNECTION
71917 field_addr.name = "to_pct";
71918#endif /* FREECIV_JSON_CONNECTION */
71919 DIO_PUT(uint16, &dout, &field_addr, real_packet->to_pct);
71920 }
71921 if (BV_ISSET(fields, 7)) {
71922 log_packet_detailed(" field 'onetime_pct' has changed");
71923 #ifdef FREECIV_JSON_CONNECTION
71924 field_addr.name = "onetime_pct";
71925#endif /* FREECIV_JSON_CONNECTION */
71926 DIO_PUT(uint16, &dout, &field_addr, real_packet->onetime_pct);
71927 }
71928 if (BV_ISSET(fields, 8)) {
71929 log_packet_detailed(" field 'flags' has changed");
71930 #ifdef FREECIV_JSON_CONNECTION
71931 field_addr.name = "flags";
71932#endif /* FREECIV_JSON_CONNECTION */
71933 DIO_BV_PUT(&dout, &field_addr, packet->flags);
71934 }
71935 if (BV_ISSET(fields, 9)) {
71936 log_packet_detailed(" field 'helptext' has changed");
71937 #ifdef FREECIV_JSON_CONNECTION
71938 field_addr.name = "helptext";
71939#endif /* FREECIV_JSON_CONNECTION */
71940 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
71941 }
71942
71943 *old = *real_packet;
71944#endif /* FREECIV_DELTA_PROTOCOL */
71945#ifndef FREECIV_DELTA_PROTOCOL
71946#ifdef FREECIV_JSON_CONNECTION
71947 field_addr.name = "id";
71948#endif /* FREECIV_JSON_CONNECTION */
71949 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
71950#ifdef FREECIV_JSON_CONNECTION
71951 field_addr.name = "name";
71952#endif /* FREECIV_JSON_CONNECTION */
71953 DIO_PUT(string, &dout, &field_addr, real_packet->name);
71954#ifdef FREECIV_JSON_CONNECTION
71955 field_addr.name = "rule_name";
71956#endif /* FREECIV_JSON_CONNECTION */
71957 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
71958#ifdef FREECIV_JSON_CONNECTION
71959 field_addr.name = "reqs_count";
71960#endif /* FREECIV_JSON_CONNECTION */
71961 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
71962#ifdef FREECIV_JSON_CONNECTION
71963 field_addr.name = "reqs";
71964#endif /* FREECIV_JSON_CONNECTION */
71965
71966 {
71967 int i;
71968
71969#ifdef FREECIV_JSON_CONNECTION
71970 /* Create the array. */
71971 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
71972
71973 /* Enter the array. */
71974 field_addr.sub_location = plocation_elem_new(0);
71975#endif /* FREECIV_JSON_CONNECTION */
71976
71977 for (i = 0; i < real_packet->reqs_count; i++) {
71978#ifdef FREECIV_JSON_CONNECTION
71979 /* Next array element. */
71980 field_addr.sub_location->number = i;
71981#endif /* FREECIV_JSON_CONNECTION */
71982 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
71983 }
71984
71985#ifdef FREECIV_JSON_CONNECTION
71986 /* Exit array. */
71987 free(field_addr.sub_location);
71988 field_addr.sub_location = NULL;
71989#endif /* FREECIV_JSON_CONNECTION */
71990 }
71991#ifdef FREECIV_JSON_CONNECTION
71992 field_addr.name = "from_pct";
71993#endif /* FREECIV_JSON_CONNECTION */
71994 DIO_PUT(uint16, &dout, &field_addr, real_packet->from_pct);
71995#ifdef FREECIV_JSON_CONNECTION
71996 field_addr.name = "to_pct";
71997#endif /* FREECIV_JSON_CONNECTION */
71998 DIO_PUT(uint16, &dout, &field_addr, real_packet->to_pct);
71999#ifdef FREECIV_JSON_CONNECTION
72000 field_addr.name = "onetime_pct";
72001#endif /* FREECIV_JSON_CONNECTION */
72002 DIO_PUT(uint16, &dout, &field_addr, real_packet->onetime_pct);
72003#ifdef FREECIV_JSON_CONNECTION
72004 field_addr.name = "flags";
72005#endif /* FREECIV_JSON_CONNECTION */
72006 DIO_BV_PUT(&dout, &field_addr, packet->flags);
72007#ifdef FREECIV_JSON_CONNECTION
72008 field_addr.name = "helptext";
72009#endif /* FREECIV_JSON_CONNECTION */
72010 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
72011
72012#endif
72013 SEND_PACKET_END(PACKET_RULESET_GOODS);
72014}
72015
72016 int send_packet_ruleset_goods(struct connection *pc, const struct packet_ruleset_goods *packet)
72017{
72018 if (!pc->used) {
72019 log_error("WARNING: trying to send data to the closed connection %s",
72020 conn_description(pc));
72021 return -1;
72022 }
72023 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_GOODS].packet != NULL, -1,
72024 "Handler for PACKET_RULESET_GOODS not installed");
72025 return pc->phs.handlers->send[PACKET_RULESET_GOODS].packet(pc, packet);
72026}
72027
72028 void lsend_packet_ruleset_goods(struct conn_list *dest, const struct packet_ruleset_goods *packet)
72029{
72030 conn_list_iterate(dest, pconn) {
72031 send_packet_ruleset_goods(pconn, packet);
72032 } conn_list_iterate_end;
72033}
72034
72035#ifdef FREECIV_DELTA_PROTOCOL
72036#define hash_packet_ruleset_disaster_100 hash_const
72037
72038#define cmp_packet_ruleset_disaster_100 cmp_const
72039
72040 BV_DEFINE(packet_ruleset_disaster_100_fields, 7);
72041#endif /* FREECIV_DELTA_PROTOCOL */
72042
72043 static struct packet_ruleset_disaster *receive_packet_ruleset_disaster_100(struct connection *pc)
72044{
72045#ifdef FREECIV_DELTA_PROTOCOL
72046 packet_ruleset_disaster_100_fields fields;
72047 struct packet_ruleset_disaster *old;
72048 struct genhash **hash = pc->phs.received + PACKET_RULESET_DISASTER;
72049#endif /* FREECIV_DELTA_PROTOCOL */
72050 RECEIVE_PACKET_START(packet_ruleset_disaster, real_packet);
72051#ifdef FREECIV_JSON_CONNECTION
72052 struct plocation field_addr;
72053 {
72054 struct plocation *field_addr_tmp = plocation_field_new(NULL);
72055 field_addr = *field_addr_tmp;
72056 FC_FREE(field_addr_tmp);
72057 }
72058#endif /* FREECIV_JSON_CONNECTION */
72059
72060#ifdef FREECIV_DELTA_PROTOCOL
72061#ifdef FREECIV_JSON_CONNECTION
72062 field_addr.name = "fields";
72063#endif /* FREECIV_JSON_CONNECTION */
72064 DIO_BV_GET(&din, &field_addr, fields);
72065
72066#else /* FREECIV_DELTA_PROTOCOL */
72067 #ifdef FREECIV_JSON_CONNECTION
72068 field_addr.name = "id";
72069 #endif /* FREECIV_JSON_CONNECTION */
72070 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
72071 RECEIVE_PACKET_FIELD_ERROR(id);
72072 }
72073 #ifdef FREECIV_JSON_CONNECTION
72074 field_addr.name = "name";
72075 #endif /* FREECIV_JSON_CONNECTION */
72076 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
72077 RECEIVE_PACKET_FIELD_ERROR(name);
72078 }
72079 #ifdef FREECIV_JSON_CONNECTION
72080 field_addr.name = "rule_name";
72081 #endif /* FREECIV_JSON_CONNECTION */
72082 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
72083 RECEIVE_PACKET_FIELD_ERROR(rule_name);
72084 }
72085 #ifdef FREECIV_JSON_CONNECTION
72086 field_addr.name = "reqs_count";
72087 #endif /* FREECIV_JSON_CONNECTION */
72088 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
72089 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
72090 }
72091 #ifdef FREECIV_JSON_CONNECTION
72092 field_addr.name = "reqs";
72093 #endif /* FREECIV_JSON_CONNECTION */
72094
72095 {
72096 int i;
72097
72098 #ifdef FREECIV_JSON_CONNECTION
72099 /* Enter array. */
72100 field_addr.sub_location = plocation_elem_new(0);
72101 #endif /* FREECIV_JSON_CONNECTION */
72102
72103 if (real_packet->reqs_count > MAX_NUM_REQS) {
72104 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
72105 }
72106 for (i = 0; i < real_packet->reqs_count; i++) {
72107 #ifdef FREECIV_JSON_CONNECTION
72108 field_addr.sub_location->number = i;
72109 #endif /* FREECIV_JSON_CONNECTION */
72110 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
72111 RECEIVE_PACKET_FIELD_ERROR(reqs);
72112 }
72113 }
72114
72115 #ifdef FREECIV_JSON_CONNECTION
72116 /* Exit array. */
72117 free(field_addr.sub_location);
72118 field_addr.sub_location = NULL;
72119 #endif /* FREECIV_JSON_CONNECTION */
72120 }
72121 #ifdef FREECIV_JSON_CONNECTION
72122 field_addr.name = "frequency";
72123 #endif /* FREECIV_JSON_CONNECTION */
72124 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->frequency)) {
72125 RECEIVE_PACKET_FIELD_ERROR(frequency);
72126 }
72127 #ifdef FREECIV_JSON_CONNECTION
72128 field_addr.name = "effects";
72129 #endif /* FREECIV_JSON_CONNECTION */
72130 if (!DIO_BV_GET(&din, &field_addr, real_packet->effects)) {
72131 RECEIVE_PACKET_FIELD_ERROR(effects);
72132 }
72133
72134#endif
72135 log_packet_detailed("packet_ruleset_disaster_100: got info about ()");
72136
72137#ifdef FREECIV_DELTA_PROTOCOL
72138 if (NULL == *hash) {
72139 *hash = genhash_new_full(hash_packet_ruleset_disaster_100, cmp_packet_ruleset_disaster_100,
72140 NULL, NULL, NULL, free);
72141 }
72142
72143 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
72144 *real_packet = *old;
72145 } else {
72146 log_packet_detailed(" no old info");
72147 memset(real_packet, 0, sizeof(*real_packet));
72148 }
72149
72150 if (BV_ISSET(fields, 0)) {
72151 log_packet_detailed(" got field 'id'");
72152 #ifdef FREECIV_JSON_CONNECTION
72153 field_addr.name = "id";
72154 #endif /* FREECIV_JSON_CONNECTION */
72155 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
72156 RECEIVE_PACKET_FIELD_ERROR(id);
72157 }
72158 }
72159 if (BV_ISSET(fields, 1)) {
72160 log_packet_detailed(" got field 'name'");
72161 #ifdef FREECIV_JSON_CONNECTION
72162 field_addr.name = "name";
72163 #endif /* FREECIV_JSON_CONNECTION */
72164 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
72165 RECEIVE_PACKET_FIELD_ERROR(name);
72166 }
72167 }
72168 if (BV_ISSET(fields, 2)) {
72169 log_packet_detailed(" got field 'rule_name'");
72170 #ifdef FREECIV_JSON_CONNECTION
72171 field_addr.name = "rule_name";
72172 #endif /* FREECIV_JSON_CONNECTION */
72173 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
72174 RECEIVE_PACKET_FIELD_ERROR(rule_name);
72175 }
72176 }
72177 if (BV_ISSET(fields, 3)) {
72178 log_packet_detailed(" got field 'reqs_count'");
72179 #ifdef FREECIV_JSON_CONNECTION
72180 field_addr.name = "reqs_count";
72181 #endif /* FREECIV_JSON_CONNECTION */
72182 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
72183 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
72184 }
72185 }
72186 if (BV_ISSET(fields, 4)) {
72187 log_packet_detailed(" got field 'reqs'");
72188 #ifdef FREECIV_JSON_CONNECTION
72189 field_addr.name = "reqs";
72190 #endif /* FREECIV_JSON_CONNECTION */
72191
72192 {
72193 int i;
72194
72195 #ifdef FREECIV_JSON_CONNECTION
72196 /* Enter array. */
72197 field_addr.sub_location = plocation_elem_new(0);
72198 #endif /* FREECIV_JSON_CONNECTION */
72199
72200 if (real_packet->reqs_count > MAX_NUM_REQS) {
72201 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
72202 }
72203 for (i = 0; i < real_packet->reqs_count; i++) {
72204 #ifdef FREECIV_JSON_CONNECTION
72205 field_addr.sub_location->number = i;
72206 #endif /* FREECIV_JSON_CONNECTION */
72207 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
72208 RECEIVE_PACKET_FIELD_ERROR(reqs);
72209 }
72210 }
72211
72212 #ifdef FREECIV_JSON_CONNECTION
72213 /* Exit array. */
72214 free(field_addr.sub_location);
72215 field_addr.sub_location = NULL;
72216 #endif /* FREECIV_JSON_CONNECTION */
72217 }
72218 }
72219 if (BV_ISSET(fields, 5)) {
72220 log_packet_detailed(" got field 'frequency'");
72221 #ifdef FREECIV_JSON_CONNECTION
72222 field_addr.name = "frequency";
72223 #endif /* FREECIV_JSON_CONNECTION */
72224 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->frequency)) {
72225 RECEIVE_PACKET_FIELD_ERROR(frequency);
72226 }
72227 }
72228 if (BV_ISSET(fields, 6)) {
72229 log_packet_detailed(" got field 'effects'");
72230 #ifdef FREECIV_JSON_CONNECTION
72231 field_addr.name = "effects";
72232 #endif /* FREECIV_JSON_CONNECTION */
72233 if (!DIO_BV_GET(&din, &field_addr, real_packet->effects)) {
72234 RECEIVE_PACKET_FIELD_ERROR(effects);
72235 }
72236 }
72237
72238 if (NULL == old) {
72239 old = fc_malloc(sizeof(*old));
72240 *old = *real_packet;
72241 genhash_insert(*hash, old, old);
72242 } else {
72243 *old = *real_packet;
72244 }
72245
72246#endif /* FREECIV_DELTA_PROTOCOL */
72247 RECEIVE_PACKET_END(real_packet);
72248}
72249
72250 static int send_packet_ruleset_disaster_100(struct connection *pc, const struct packet_ruleset_disaster *packet)
72251{
72252 const struct packet_ruleset_disaster *real_packet = packet;
72253#ifdef FREECIV_DELTA_PROTOCOL
72254 packet_ruleset_disaster_100_fields fields;
72255 struct packet_ruleset_disaster *old;
72256 bool differ;
72257 struct genhash **hash = pc->phs.sent + PACKET_RULESET_DISASTER;
72258#endif /* FREECIV_DELTA_PROTOCOL */
72259 SEND_PACKET_START(PACKET_RULESET_DISASTER);
72260#ifdef FREECIV_JSON_CONNECTION
72261 struct plocation field_addr;
72262 {
72263 struct plocation *field_addr_tmp = plocation_field_new(NULL);
72264 field_addr = *field_addr_tmp;
72265 FC_FREE(field_addr_tmp);
72266 }
72267#endif /* FREECIV_JSON_CONNECTION */
72268
72269 log_packet_detailed("packet_ruleset_disaster_100: sending info about ()");
72270
72271#ifdef FREECIV_DELTA_PROTOCOL
72272 if (NULL == *hash) {
72273 *hash = genhash_new_full(hash_packet_ruleset_disaster_100, cmp_packet_ruleset_disaster_100,
72274 NULL, NULL, NULL, free);
72275 }
72276 BV_CLR_ALL(fields);
72277
72278 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
72279 old = fc_malloc(sizeof(*old));
72280 *old = *real_packet;
72281 genhash_insert(*hash, old, old);
72282 memset(old, 0, sizeof(*old));
72283 }
72284 differ = (old->id != real_packet->id);
72285 if (differ) {
72286 BV_SET(fields, 0);
72287 }
72288
72289 differ = (strcmp(old->name, real_packet->name) != 0);
72290 if (differ) {
72291 BV_SET(fields, 1);
72292 }
72293
72294 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
72295 if (differ) {
72296 BV_SET(fields, 2);
72297 }
72298
72299 differ = (old->reqs_count != real_packet->reqs_count);
72300 if (differ) {
72301 BV_SET(fields, 3);
72302 }
72303
72304
72305 {
72306 differ = (old->reqs_count != real_packet->reqs_count);
72307 if (!differ) {
72308 int i;
72309
72310 for (i = 0; i < real_packet->reqs_count; i++) {
72311 if (!are_requirements_equal(&old->reqs[i], &real_packet->reqs[i])) {
72312 differ = TRUE;
72313 break;
72314 }
72315 }
72316 }
72317 }
72318 if (differ) {
72319 BV_SET(fields, 4);
72320 }
72321
72322 differ = (old->frequency != real_packet->frequency);
72323 if (differ) {
72324 BV_SET(fields, 5);
72325 }
72326
72327 differ = !BV_ARE_EQUAL(old->effects, real_packet->effects);
72328 if (differ) {
72329 BV_SET(fields, 6);
72330 }
72331
72332
72333#ifdef FREECIV_JSON_CONNECTION
72334 field_addr.name = "fields";
72335#endif /* FREECIV_JSON_CONNECTION */
72336 DIO_BV_PUT(&dout, &field_addr, fields);
72337
72338 if (BV_ISSET(fields, 0)) {
72339 log_packet_detailed(" field 'id' has changed");
72340 #ifdef FREECIV_JSON_CONNECTION
72341 field_addr.name = "id";
72342#endif /* FREECIV_JSON_CONNECTION */
72343 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
72344 }
72345 if (BV_ISSET(fields, 1)) {
72346 log_packet_detailed(" field 'name' has changed");
72347 #ifdef FREECIV_JSON_CONNECTION
72348 field_addr.name = "name";
72349#endif /* FREECIV_JSON_CONNECTION */
72350 DIO_PUT(string, &dout, &field_addr, real_packet->name);
72351 }
72352 if (BV_ISSET(fields, 2)) {
72353 log_packet_detailed(" field 'rule_name' has changed");
72354 #ifdef FREECIV_JSON_CONNECTION
72355 field_addr.name = "rule_name";
72356#endif /* FREECIV_JSON_CONNECTION */
72357 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
72358 }
72359 if (BV_ISSET(fields, 3)) {
72360 log_packet_detailed(" field 'reqs_count' has changed");
72361 #ifdef FREECIV_JSON_CONNECTION
72362 field_addr.name = "reqs_count";
72363#endif /* FREECIV_JSON_CONNECTION */
72364 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
72365 }
72366 if (BV_ISSET(fields, 4)) {
72367 log_packet_detailed(" field 'reqs' has changed");
72368 #ifdef FREECIV_JSON_CONNECTION
72369 field_addr.name = "reqs";
72370#endif /* FREECIV_JSON_CONNECTION */
72371
72372 {
72373 int i;
72374
72375#ifdef FREECIV_JSON_CONNECTION
72376 /* Create the array. */
72377 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
72378
72379 /* Enter the array. */
72380 field_addr.sub_location = plocation_elem_new(0);
72381#endif /* FREECIV_JSON_CONNECTION */
72382
72383 for (i = 0; i < real_packet->reqs_count; i++) {
72384#ifdef FREECIV_JSON_CONNECTION
72385 /* Next array element. */
72386 field_addr.sub_location->number = i;
72387#endif /* FREECIV_JSON_CONNECTION */
72388 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
72389 }
72390
72391#ifdef FREECIV_JSON_CONNECTION
72392 /* Exit array. */
72393 free(field_addr.sub_location);
72394 field_addr.sub_location = NULL;
72395#endif /* FREECIV_JSON_CONNECTION */
72396 }
72397 }
72398 if (BV_ISSET(fields, 5)) {
72399 log_packet_detailed(" field 'frequency' has changed");
72400 #ifdef FREECIV_JSON_CONNECTION
72401 field_addr.name = "frequency";
72402#endif /* FREECIV_JSON_CONNECTION */
72403 DIO_PUT(uint8, &dout, &field_addr, real_packet->frequency);
72404 }
72405 if (BV_ISSET(fields, 6)) {
72406 log_packet_detailed(" field 'effects' has changed");
72407 #ifdef FREECIV_JSON_CONNECTION
72408 field_addr.name = "effects";
72409#endif /* FREECIV_JSON_CONNECTION */
72410 DIO_BV_PUT(&dout, &field_addr, packet->effects);
72411 }
72412
72413 *old = *real_packet;
72414#endif /* FREECIV_DELTA_PROTOCOL */
72415#ifndef FREECIV_DELTA_PROTOCOL
72416#ifdef FREECIV_JSON_CONNECTION
72417 field_addr.name = "id";
72418#endif /* FREECIV_JSON_CONNECTION */
72419 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
72420#ifdef FREECIV_JSON_CONNECTION
72421 field_addr.name = "name";
72422#endif /* FREECIV_JSON_CONNECTION */
72423 DIO_PUT(string, &dout, &field_addr, real_packet->name);
72424#ifdef FREECIV_JSON_CONNECTION
72425 field_addr.name = "rule_name";
72426#endif /* FREECIV_JSON_CONNECTION */
72427 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
72428#ifdef FREECIV_JSON_CONNECTION
72429 field_addr.name = "reqs_count";
72430#endif /* FREECIV_JSON_CONNECTION */
72431 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
72432#ifdef FREECIV_JSON_CONNECTION
72433 field_addr.name = "reqs";
72434#endif /* FREECIV_JSON_CONNECTION */
72435
72436 {
72437 int i;
72438
72439#ifdef FREECIV_JSON_CONNECTION
72440 /* Create the array. */
72441 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
72442
72443 /* Enter the array. */
72444 field_addr.sub_location = plocation_elem_new(0);
72445#endif /* FREECIV_JSON_CONNECTION */
72446
72447 for (i = 0; i < real_packet->reqs_count; i++) {
72448#ifdef FREECIV_JSON_CONNECTION
72449 /* Next array element. */
72450 field_addr.sub_location->number = i;
72451#endif /* FREECIV_JSON_CONNECTION */
72452 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
72453 }
72454
72455#ifdef FREECIV_JSON_CONNECTION
72456 /* Exit array. */
72457 free(field_addr.sub_location);
72458 field_addr.sub_location = NULL;
72459#endif /* FREECIV_JSON_CONNECTION */
72460 }
72461#ifdef FREECIV_JSON_CONNECTION
72462 field_addr.name = "frequency";
72463#endif /* FREECIV_JSON_CONNECTION */
72464 DIO_PUT(uint8, &dout, &field_addr, real_packet->frequency);
72465#ifdef FREECIV_JSON_CONNECTION
72466 field_addr.name = "effects";
72467#endif /* FREECIV_JSON_CONNECTION */
72468 DIO_BV_PUT(&dout, &field_addr, packet->effects);
72469
72470#endif
72471 SEND_PACKET_END(PACKET_RULESET_DISASTER);
72472}
72473
72474 int send_packet_ruleset_disaster(struct connection *pc, const struct packet_ruleset_disaster *packet)
72475{
72476 if (!pc->used) {
72477 log_error("WARNING: trying to send data to the closed connection %s",
72478 conn_description(pc));
72479 return -1;
72480 }
72481 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_DISASTER].packet != NULL, -1,
72482 "Handler for PACKET_RULESET_DISASTER not installed");
72483 return pc->phs.handlers->send[PACKET_RULESET_DISASTER].packet(pc, packet);
72484}
72485
72486 void lsend_packet_ruleset_disaster(struct conn_list *dest, const struct packet_ruleset_disaster *packet)
72487{
72488 conn_list_iterate(dest, pconn) {
72489 send_packet_ruleset_disaster(pconn, packet);
72490 } conn_list_iterate_end;
72491}
72492
72493#ifdef FREECIV_DELTA_PROTOCOL
72494#define hash_packet_ruleset_achievement_100 hash_const
72495
72496#define cmp_packet_ruleset_achievement_100 cmp_const
72497
72498 BV_DEFINE(packet_ruleset_achievement_100_fields, 6);
72499#endif /* FREECIV_DELTA_PROTOCOL */
72500
72501 static struct packet_ruleset_achievement *receive_packet_ruleset_achievement_100(struct connection *pc)
72502{
72503#ifdef FREECIV_DELTA_PROTOCOL
72504 packet_ruleset_achievement_100_fields fields;
72505 struct packet_ruleset_achievement *old;
72506 struct genhash **hash = pc->phs.received + PACKET_RULESET_ACHIEVEMENT;
72507#endif /* FREECIV_DELTA_PROTOCOL */
72508 RECEIVE_PACKET_START(packet_ruleset_achievement, real_packet);
72509#ifdef FREECIV_JSON_CONNECTION
72510 struct plocation field_addr;
72511 {
72512 struct plocation *field_addr_tmp = plocation_field_new(NULL);
72513 field_addr = *field_addr_tmp;
72514 FC_FREE(field_addr_tmp);
72515 }
72516#endif /* FREECIV_JSON_CONNECTION */
72517
72518#ifdef FREECIV_DELTA_PROTOCOL
72519#ifdef FREECIV_JSON_CONNECTION
72520 field_addr.name = "fields";
72521#endif /* FREECIV_JSON_CONNECTION */
72522 DIO_BV_GET(&din, &field_addr, fields);
72523
72524#else /* FREECIV_DELTA_PROTOCOL */
72525 #ifdef FREECIV_JSON_CONNECTION
72526 field_addr.name = "id";
72527 #endif /* FREECIV_JSON_CONNECTION */
72528 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
72529 RECEIVE_PACKET_FIELD_ERROR(id);
72530 }
72531 #ifdef FREECIV_JSON_CONNECTION
72532 field_addr.name = "name";
72533 #endif /* FREECIV_JSON_CONNECTION */
72534 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
72535 RECEIVE_PACKET_FIELD_ERROR(name);
72536 }
72537 #ifdef FREECIV_JSON_CONNECTION
72538 field_addr.name = "rule_name";
72539 #endif /* FREECIV_JSON_CONNECTION */
72540 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
72541 RECEIVE_PACKET_FIELD_ERROR(rule_name);
72542 }
72543 #ifdef FREECIV_JSON_CONNECTION
72544 field_addr.name = "type";
72545 #endif /* FREECIV_JSON_CONNECTION */
72546 {
72547 int readin;
72548
72549 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
72550 RECEIVE_PACKET_FIELD_ERROR(type);
72551 }
72552 real_packet->type = readin;
72553 }
72554 #ifdef FREECIV_JSON_CONNECTION
72555 field_addr.name = "unique";
72556 #endif /* FREECIV_JSON_CONNECTION */
72557 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unique)) {
72558 RECEIVE_PACKET_FIELD_ERROR(unique);
72559 }
72560 #ifdef FREECIV_JSON_CONNECTION
72561 field_addr.name = "value";
72562 #endif /* FREECIV_JSON_CONNECTION */
72563 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->value)) {
72564 RECEIVE_PACKET_FIELD_ERROR(value);
72565 }
72566
72567#endif
72568 log_packet_detailed("packet_ruleset_achievement_100: got info about ()");
72569
72570#ifdef FREECIV_DELTA_PROTOCOL
72571 if (NULL == *hash) {
72572 *hash = genhash_new_full(hash_packet_ruleset_achievement_100, cmp_packet_ruleset_achievement_100,
72573 NULL, NULL, NULL, free);
72574 }
72575
72576 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
72577 *real_packet = *old;
72578 } else {
72579 log_packet_detailed(" no old info");
72580 memset(real_packet, 0, sizeof(*real_packet));
72581 }
72582
72583 if (BV_ISSET(fields, 0)) {
72584 log_packet_detailed(" got field 'id'");
72585 #ifdef FREECIV_JSON_CONNECTION
72586 field_addr.name = "id";
72587 #endif /* FREECIV_JSON_CONNECTION */
72588 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
72589 RECEIVE_PACKET_FIELD_ERROR(id);
72590 }
72591 }
72592 if (BV_ISSET(fields, 1)) {
72593 log_packet_detailed(" got field 'name'");
72594 #ifdef FREECIV_JSON_CONNECTION
72595 field_addr.name = "name";
72596 #endif /* FREECIV_JSON_CONNECTION */
72597 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
72598 RECEIVE_PACKET_FIELD_ERROR(name);
72599 }
72600 }
72601 if (BV_ISSET(fields, 2)) {
72602 log_packet_detailed(" got field 'rule_name'");
72603 #ifdef FREECIV_JSON_CONNECTION
72604 field_addr.name = "rule_name";
72605 #endif /* FREECIV_JSON_CONNECTION */
72606 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
72607 RECEIVE_PACKET_FIELD_ERROR(rule_name);
72608 }
72609 }
72610 if (BV_ISSET(fields, 3)) {
72611 log_packet_detailed(" got field 'type'");
72612 #ifdef FREECIV_JSON_CONNECTION
72613 field_addr.name = "type";
72614 #endif /* FREECIV_JSON_CONNECTION */
72615 {
72616 int readin;
72617
72618 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
72619 RECEIVE_PACKET_FIELD_ERROR(type);
72620 }
72621 real_packet->type = readin;
72622 }
72623 }
72624 real_packet->unique = BV_ISSET(fields, 4);
72625 if (BV_ISSET(fields, 5)) {
72626 log_packet_detailed(" got field 'value'");
72627 #ifdef FREECIV_JSON_CONNECTION
72628 field_addr.name = "value";
72629 #endif /* FREECIV_JSON_CONNECTION */
72630 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->value)) {
72631 RECEIVE_PACKET_FIELD_ERROR(value);
72632 }
72633 }
72634
72635 if (NULL == old) {
72636 old = fc_malloc(sizeof(*old));
72637 *old = *real_packet;
72638 genhash_insert(*hash, old, old);
72639 } else {
72640 *old = *real_packet;
72641 }
72642
72643#endif /* FREECIV_DELTA_PROTOCOL */
72644 RECEIVE_PACKET_END(real_packet);
72645}
72646
72647 static int send_packet_ruleset_achievement_100(struct connection *pc, const struct packet_ruleset_achievement *packet)
72648{
72649 const struct packet_ruleset_achievement *real_packet = packet;
72650#ifdef FREECIV_DELTA_PROTOCOL
72651 packet_ruleset_achievement_100_fields fields;
72652 struct packet_ruleset_achievement *old;
72653 bool differ;
72654 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ACHIEVEMENT;
72655#endif /* FREECIV_DELTA_PROTOCOL */
72656 SEND_PACKET_START(PACKET_RULESET_ACHIEVEMENT);
72657#ifdef FREECIV_JSON_CONNECTION
72658 struct plocation field_addr;
72659 {
72660 struct plocation *field_addr_tmp = plocation_field_new(NULL);
72661 field_addr = *field_addr_tmp;
72662 FC_FREE(field_addr_tmp);
72663 }
72664#endif /* FREECIV_JSON_CONNECTION */
72665
72666 log_packet_detailed("packet_ruleset_achievement_100: sending info about ()");
72667
72668#ifdef FREECIV_DELTA_PROTOCOL
72669 if (NULL == *hash) {
72670 *hash = genhash_new_full(hash_packet_ruleset_achievement_100, cmp_packet_ruleset_achievement_100,
72671 NULL, NULL, NULL, free);
72672 }
72673 BV_CLR_ALL(fields);
72674
72675 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
72676 old = fc_malloc(sizeof(*old));
72677 *old = *real_packet;
72678 genhash_insert(*hash, old, old);
72679 memset(old, 0, sizeof(*old));
72680 }
72681 differ = (old->id != real_packet->id);
72682 if (differ) {
72683 BV_SET(fields, 0);
72684 }
72685
72686 differ = (strcmp(old->name, real_packet->name) != 0);
72687 if (differ) {
72688 BV_SET(fields, 1);
72689 }
72690
72691 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
72692 if (differ) {
72693 BV_SET(fields, 2);
72694 }
72695
72696 differ = (old->type != real_packet->type);
72697 if (differ) {
72698 BV_SET(fields, 3);
72699 }
72700
72701 if (packet->unique) {
72702 BV_SET(fields, 4);
72703 }
72704
72705 differ = (old->value != real_packet->value);
72706 if (differ) {
72707 BV_SET(fields, 5);
72708 }
72709
72710
72711#ifdef FREECIV_JSON_CONNECTION
72712 field_addr.name = "fields";
72713#endif /* FREECIV_JSON_CONNECTION */
72714 DIO_BV_PUT(&dout, &field_addr, fields);
72715
72716 if (BV_ISSET(fields, 0)) {
72717 log_packet_detailed(" field 'id' has changed");
72718 #ifdef FREECIV_JSON_CONNECTION
72719 field_addr.name = "id";
72720#endif /* FREECIV_JSON_CONNECTION */
72721 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
72722 }
72723 if (BV_ISSET(fields, 1)) {
72724 log_packet_detailed(" field 'name' has changed");
72725 #ifdef FREECIV_JSON_CONNECTION
72726 field_addr.name = "name";
72727#endif /* FREECIV_JSON_CONNECTION */
72728 DIO_PUT(string, &dout, &field_addr, real_packet->name);
72729 }
72730 if (BV_ISSET(fields, 2)) {
72731 log_packet_detailed(" field 'rule_name' has changed");
72732 #ifdef FREECIV_JSON_CONNECTION
72733 field_addr.name = "rule_name";
72734#endif /* FREECIV_JSON_CONNECTION */
72735 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
72736 }
72737 if (BV_ISSET(fields, 3)) {
72738 log_packet_detailed(" field 'type' has changed");
72739 #ifdef FREECIV_JSON_CONNECTION
72740 field_addr.name = "type";
72741#endif /* FREECIV_JSON_CONNECTION */
72742 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
72743 }
72744 /* field 4 is folded into the header */
72745 if (BV_ISSET(fields, 5)) {
72746 log_packet_detailed(" field 'value' has changed");
72747 #ifdef FREECIV_JSON_CONNECTION
72748 field_addr.name = "value";
72749#endif /* FREECIV_JSON_CONNECTION */
72750 DIO_PUT(uint16, &dout, &field_addr, real_packet->value);
72751 }
72752
72753 *old = *real_packet;
72754#endif /* FREECIV_DELTA_PROTOCOL */
72755#ifndef FREECIV_DELTA_PROTOCOL
72756#ifdef FREECIV_JSON_CONNECTION
72757 field_addr.name = "id";
72758#endif /* FREECIV_JSON_CONNECTION */
72759 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
72760#ifdef FREECIV_JSON_CONNECTION
72761 field_addr.name = "name";
72762#endif /* FREECIV_JSON_CONNECTION */
72763 DIO_PUT(string, &dout, &field_addr, real_packet->name);
72764#ifdef FREECIV_JSON_CONNECTION
72765 field_addr.name = "rule_name";
72766#endif /* FREECIV_JSON_CONNECTION */
72767 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
72768#ifdef FREECIV_JSON_CONNECTION
72769 field_addr.name = "type";
72770#endif /* FREECIV_JSON_CONNECTION */
72771 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
72772#ifdef FREECIV_JSON_CONNECTION
72773 field_addr.name = "unique";
72774#endif /* FREECIV_JSON_CONNECTION */
72775 DIO_PUT(bool8, &dout, &field_addr, real_packet->unique);
72776#ifdef FREECIV_JSON_CONNECTION
72777 field_addr.name = "value";
72778#endif /* FREECIV_JSON_CONNECTION */
72779 DIO_PUT(uint16, &dout, &field_addr, real_packet->value);
72780
72781#endif
72782 SEND_PACKET_END(PACKET_RULESET_ACHIEVEMENT);
72783}
72784
72785 int send_packet_ruleset_achievement(struct connection *pc, const struct packet_ruleset_achievement *packet)
72786{
72787 if (!pc->used) {
72788 log_error("WARNING: trying to send data to the closed connection %s",
72789 conn_description(pc));
72790 return -1;
72791 }
72792 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ACHIEVEMENT].packet != NULL, -1,
72793 "Handler for PACKET_RULESET_ACHIEVEMENT not installed");
72794 return pc->phs.handlers->send[PACKET_RULESET_ACHIEVEMENT].packet(pc, packet);
72795}
72796
72797 void lsend_packet_ruleset_achievement(struct conn_list *dest, const struct packet_ruleset_achievement *packet)
72798{
72799 conn_list_iterate(dest, pconn) {
72800 send_packet_ruleset_achievement(pconn, packet);
72801 } conn_list_iterate_end;
72802}
72803
72804#ifdef FREECIV_DELTA_PROTOCOL
72805#define hash_packet_ruleset_trade_100 hash_const
72806
72807#define cmp_packet_ruleset_trade_100 cmp_const
72808
72809 BV_DEFINE(packet_ruleset_trade_100_fields, 4);
72810#endif /* FREECIV_DELTA_PROTOCOL */
72811
72812 static struct packet_ruleset_trade *receive_packet_ruleset_trade_100(struct connection *pc)
72813{
72814#ifdef FREECIV_DELTA_PROTOCOL
72815 packet_ruleset_trade_100_fields fields;
72816 struct packet_ruleset_trade *old;
72817 struct genhash **hash = pc->phs.received + PACKET_RULESET_TRADE;
72818#endif /* FREECIV_DELTA_PROTOCOL */
72819 RECEIVE_PACKET_START(packet_ruleset_trade, real_packet);
72820#ifdef FREECIV_JSON_CONNECTION
72821 struct plocation field_addr;
72822 {
72823 struct plocation *field_addr_tmp = plocation_field_new(NULL);
72824 field_addr = *field_addr_tmp;
72825 FC_FREE(field_addr_tmp);
72826 }
72827#endif /* FREECIV_JSON_CONNECTION */
72828
72829#ifdef FREECIV_DELTA_PROTOCOL
72830#ifdef FREECIV_JSON_CONNECTION
72831 field_addr.name = "fields";
72832#endif /* FREECIV_JSON_CONNECTION */
72833 DIO_BV_GET(&din, &field_addr, fields);
72834
72835#else /* FREECIV_DELTA_PROTOCOL */
72836 #ifdef FREECIV_JSON_CONNECTION
72837 field_addr.name = "id";
72838 #endif /* FREECIV_JSON_CONNECTION */
72839 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
72840 RECEIVE_PACKET_FIELD_ERROR(id);
72841 }
72842 #ifdef FREECIV_JSON_CONNECTION
72843 field_addr.name = "trade_pct";
72844 #endif /* FREECIV_JSON_CONNECTION */
72845 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->trade_pct)) {
72846 RECEIVE_PACKET_FIELD_ERROR(trade_pct);
72847 }
72848 #ifdef FREECIV_JSON_CONNECTION
72849 field_addr.name = "cancelling";
72850 #endif /* FREECIV_JSON_CONNECTION */
72851 {
72852 int readin;
72853
72854 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
72855 RECEIVE_PACKET_FIELD_ERROR(cancelling);
72856 }
72857 real_packet->cancelling = readin;
72858 }
72859 #ifdef FREECIV_JSON_CONNECTION
72860 field_addr.name = "bonus_type";
72861 #endif /* FREECIV_JSON_CONNECTION */
72862 {
72863 int readin;
72864
72865 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
72866 RECEIVE_PACKET_FIELD_ERROR(bonus_type);
72867 }
72868 real_packet->bonus_type = readin;
72869 }
72870
72871#endif
72872 log_packet_detailed("packet_ruleset_trade_100: got info about ()");
72873
72874#ifdef FREECIV_DELTA_PROTOCOL
72875 if (NULL == *hash) {
72876 *hash = genhash_new_full(hash_packet_ruleset_trade_100, cmp_packet_ruleset_trade_100,
72877 NULL, NULL, NULL, free);
72878 }
72879
72880 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
72881 *real_packet = *old;
72882 } else {
72883 log_packet_detailed(" no old info");
72884 memset(real_packet, 0, sizeof(*real_packet));
72885 }
72886
72887 if (BV_ISSET(fields, 0)) {
72888 log_packet_detailed(" got field 'id'");
72889 #ifdef FREECIV_JSON_CONNECTION
72890 field_addr.name = "id";
72891 #endif /* FREECIV_JSON_CONNECTION */
72892 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
72893 RECEIVE_PACKET_FIELD_ERROR(id);
72894 }
72895 }
72896 if (BV_ISSET(fields, 1)) {
72897 log_packet_detailed(" got field 'trade_pct'");
72898 #ifdef FREECIV_JSON_CONNECTION
72899 field_addr.name = "trade_pct";
72900 #endif /* FREECIV_JSON_CONNECTION */
72901 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->trade_pct)) {
72902 RECEIVE_PACKET_FIELD_ERROR(trade_pct);
72903 }
72904 }
72905 if (BV_ISSET(fields, 2)) {
72906 log_packet_detailed(" got field 'cancelling'");
72907 #ifdef FREECIV_JSON_CONNECTION
72908 field_addr.name = "cancelling";
72909 #endif /* FREECIV_JSON_CONNECTION */
72910 {
72911 int readin;
72912
72913 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
72914 RECEIVE_PACKET_FIELD_ERROR(cancelling);
72915 }
72916 real_packet->cancelling = readin;
72917 }
72918 }
72919 if (BV_ISSET(fields, 3)) {
72920 log_packet_detailed(" got field 'bonus_type'");
72921 #ifdef FREECIV_JSON_CONNECTION
72922 field_addr.name = "bonus_type";
72923 #endif /* FREECIV_JSON_CONNECTION */
72924 {
72925 int readin;
72926
72927 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
72928 RECEIVE_PACKET_FIELD_ERROR(bonus_type);
72929 }
72930 real_packet->bonus_type = readin;
72931 }
72932 }
72933
72934 if (NULL == old) {
72935 old = fc_malloc(sizeof(*old));
72936 *old = *real_packet;
72937 genhash_insert(*hash, old, old);
72938 } else {
72939 *old = *real_packet;
72940 }
72941
72942#endif /* FREECIV_DELTA_PROTOCOL */
72943 RECEIVE_PACKET_END(real_packet);
72944}
72945
72946 static int send_packet_ruleset_trade_100(struct connection *pc, const struct packet_ruleset_trade *packet)
72947{
72948 const struct packet_ruleset_trade *real_packet = packet;
72949#ifdef FREECIV_DELTA_PROTOCOL
72950 packet_ruleset_trade_100_fields fields;
72951 struct packet_ruleset_trade *old;
72952 bool differ;
72953 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TRADE;
72954#endif /* FREECIV_DELTA_PROTOCOL */
72955 SEND_PACKET_START(PACKET_RULESET_TRADE);
72956#ifdef FREECIV_JSON_CONNECTION
72957 struct plocation field_addr;
72958 {
72959 struct plocation *field_addr_tmp = plocation_field_new(NULL);
72960 field_addr = *field_addr_tmp;
72961 FC_FREE(field_addr_tmp);
72962 }
72963#endif /* FREECIV_JSON_CONNECTION */
72964
72965 log_packet_detailed("packet_ruleset_trade_100: sending info about ()");
72966
72967#ifdef FREECIV_DELTA_PROTOCOL
72968 if (NULL == *hash) {
72969 *hash = genhash_new_full(hash_packet_ruleset_trade_100, cmp_packet_ruleset_trade_100,
72970 NULL, NULL, NULL, free);
72971 }
72972 BV_CLR_ALL(fields);
72973
72974 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
72975 old = fc_malloc(sizeof(*old));
72976 *old = *real_packet;
72977 genhash_insert(*hash, old, old);
72978 memset(old, 0, sizeof(*old));
72979 }
72980 differ = (old->id != real_packet->id);
72981 if (differ) {
72982 BV_SET(fields, 0);
72983 }
72984
72985 differ = (old->trade_pct != real_packet->trade_pct);
72986 if (differ) {
72987 BV_SET(fields, 1);
72988 }
72989
72990 differ = (old->cancelling != real_packet->cancelling);
72991 if (differ) {
72992 BV_SET(fields, 2);
72993 }
72994
72995 differ = (old->bonus_type != real_packet->bonus_type);
72996 if (differ) {
72997 BV_SET(fields, 3);
72998 }
72999
73000
73001#ifdef FREECIV_JSON_CONNECTION
73002 field_addr.name = "fields";
73003#endif /* FREECIV_JSON_CONNECTION */
73004 DIO_BV_PUT(&dout, &field_addr, fields);
73005
73006 if (BV_ISSET(fields, 0)) {
73007 log_packet_detailed(" field 'id' has changed");
73008 #ifdef FREECIV_JSON_CONNECTION
73009 field_addr.name = "id";
73010#endif /* FREECIV_JSON_CONNECTION */
73011 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
73012 }
73013 if (BV_ISSET(fields, 1)) {
73014 log_packet_detailed(" field 'trade_pct' has changed");
73015 #ifdef FREECIV_JSON_CONNECTION
73016 field_addr.name = "trade_pct";
73017#endif /* FREECIV_JSON_CONNECTION */
73018 DIO_PUT(uint16, &dout, &field_addr, real_packet->trade_pct);
73019 }
73020 if (BV_ISSET(fields, 2)) {
73021 log_packet_detailed(" field 'cancelling' has changed");
73022 #ifdef FREECIV_JSON_CONNECTION
73023 field_addr.name = "cancelling";
73024#endif /* FREECIV_JSON_CONNECTION */
73025 DIO_PUT(uint8, &dout, &field_addr, real_packet->cancelling);
73026 }
73027 if (BV_ISSET(fields, 3)) {
73028 log_packet_detailed(" field 'bonus_type' has changed");
73029 #ifdef FREECIV_JSON_CONNECTION
73030 field_addr.name = "bonus_type";
73031#endif /* FREECIV_JSON_CONNECTION */
73032 DIO_PUT(uint8, &dout, &field_addr, real_packet->bonus_type);
73033 }
73034
73035 *old = *real_packet;
73036#endif /* FREECIV_DELTA_PROTOCOL */
73037#ifndef FREECIV_DELTA_PROTOCOL
73038#ifdef FREECIV_JSON_CONNECTION
73039 field_addr.name = "id";
73040#endif /* FREECIV_JSON_CONNECTION */
73041 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
73042#ifdef FREECIV_JSON_CONNECTION
73043 field_addr.name = "trade_pct";
73044#endif /* FREECIV_JSON_CONNECTION */
73045 DIO_PUT(uint16, &dout, &field_addr, real_packet->trade_pct);
73046#ifdef FREECIV_JSON_CONNECTION
73047 field_addr.name = "cancelling";
73048#endif /* FREECIV_JSON_CONNECTION */
73049 DIO_PUT(uint8, &dout, &field_addr, real_packet->cancelling);
73050#ifdef FREECIV_JSON_CONNECTION
73051 field_addr.name = "bonus_type";
73052#endif /* FREECIV_JSON_CONNECTION */
73053 DIO_PUT(uint8, &dout, &field_addr, real_packet->bonus_type);
73054
73055#endif
73056 SEND_PACKET_END(PACKET_RULESET_TRADE);
73057}
73058
73059 int send_packet_ruleset_trade(struct connection *pc, const struct packet_ruleset_trade *packet)
73060{
73061 if (!pc->used) {
73062 log_error("WARNING: trying to send data to the closed connection %s",
73063 conn_description(pc));
73064 return -1;
73065 }
73066 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TRADE].packet != NULL, -1,
73067 "Handler for PACKET_RULESET_TRADE not installed");
73068 return pc->phs.handlers->send[PACKET_RULESET_TRADE].packet(pc, packet);
73069}
73070
73071 void lsend_packet_ruleset_trade(struct conn_list *dest, const struct packet_ruleset_trade *packet)
73072{
73073 conn_list_iterate(dest, pconn) {
73074 send_packet_ruleset_trade(pconn, packet);
73075 } conn_list_iterate_end;
73076}
73077
73078#ifdef FREECIV_DELTA_PROTOCOL
73079#define hash_packet_ruleset_action_100 hash_const
73080
73081#define cmp_packet_ruleset_action_100 cmp_const
73082
73083 BV_DEFINE(packet_ruleset_action_100_fields, 12);
73084#endif /* FREECIV_DELTA_PROTOCOL */
73085
73086 static struct packet_ruleset_action *receive_packet_ruleset_action_100(struct connection *pc)
73087{
73088#ifdef FREECIV_DELTA_PROTOCOL
73089 packet_ruleset_action_100_fields fields;
73090 struct packet_ruleset_action *old;
73091 struct genhash **hash = pc->phs.received + PACKET_RULESET_ACTION;
73092#endif /* FREECIV_DELTA_PROTOCOL */
73093 RECEIVE_PACKET_START(packet_ruleset_action, real_packet);
73094#ifdef FREECIV_JSON_CONNECTION
73095 struct plocation field_addr;
73096 {
73097 struct plocation *field_addr_tmp = plocation_field_new(NULL);
73098 field_addr = *field_addr_tmp;
73099 FC_FREE(field_addr_tmp);
73100 }
73101#endif /* FREECIV_JSON_CONNECTION */
73102
73103#ifdef FREECIV_DELTA_PROTOCOL
73104#ifdef FREECIV_JSON_CONNECTION
73105 field_addr.name = "fields";
73106#endif /* FREECIV_JSON_CONNECTION */
73107 DIO_BV_GET(&din, &field_addr, fields);
73108
73109#else /* FREECIV_DELTA_PROTOCOL */
73110 #ifdef FREECIV_JSON_CONNECTION
73111 field_addr.name = "id";
73112 #endif /* FREECIV_JSON_CONNECTION */
73113 {
73114 int readin;
73115
73116 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
73117 RECEIVE_PACKET_FIELD_ERROR(id);
73118 }
73119 real_packet->id = readin;
73120 }
73121 #ifdef FREECIV_JSON_CONNECTION
73122 field_addr.name = "ui_name";
73123 #endif /* FREECIV_JSON_CONNECTION */
73124 if (!DIO_GET(string, &din, &field_addr, real_packet->ui_name, sizeof(real_packet->ui_name))) {
73125 RECEIVE_PACKET_FIELD_ERROR(ui_name);
73126 }
73127 #ifdef FREECIV_JSON_CONNECTION
73128 field_addr.name = "quiet";
73129 #endif /* FREECIV_JSON_CONNECTION */
73130 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->quiet)) {
73131 RECEIVE_PACKET_FIELD_ERROR(quiet);
73132 }
73133 #ifdef FREECIV_JSON_CONNECTION
73134 field_addr.name = "result";
73135 #endif /* FREECIV_JSON_CONNECTION */
73136 {
73137 int readin;
73138
73139 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
73140 RECEIVE_PACKET_FIELD_ERROR(result);
73141 }
73142 real_packet->result = readin;
73143 }
73144 #ifdef FREECIV_JSON_CONNECTION
73145 field_addr.name = "sub_results";
73146 #endif /* FREECIV_JSON_CONNECTION */
73147 if (!DIO_BV_GET(&din, &field_addr, real_packet->sub_results)) {
73148 RECEIVE_PACKET_FIELD_ERROR(sub_results);
73149 }
73150 #ifdef FREECIV_JSON_CONNECTION
73151 field_addr.name = "actor_consuming_always";
73152 #endif /* FREECIV_JSON_CONNECTION */
73153 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->actor_consuming_always)) {
73154 RECEIVE_PACKET_FIELD_ERROR(actor_consuming_always);
73155 }
73156 #ifdef FREECIV_JSON_CONNECTION
73157 field_addr.name = "act_kind";
73158 #endif /* FREECIV_JSON_CONNECTION */
73159 {
73160 int readin;
73161
73162 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
73163 RECEIVE_PACKET_FIELD_ERROR(act_kind);
73164 }
73165 real_packet->act_kind = readin;
73166 }
73167 #ifdef FREECIV_JSON_CONNECTION
73168 field_addr.name = "tgt_kind";
73169 #endif /* FREECIV_JSON_CONNECTION */
73170 {
73171 int readin;
73172
73173 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
73174 RECEIVE_PACKET_FIELD_ERROR(tgt_kind);
73175 }
73176 real_packet->tgt_kind = readin;
73177 }
73178 #ifdef FREECIV_JSON_CONNECTION
73179 field_addr.name = "sub_tgt_kind";
73180 #endif /* FREECIV_JSON_CONNECTION */
73181 {
73182 int readin;
73183
73184 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
73185 RECEIVE_PACKET_FIELD_ERROR(sub_tgt_kind);
73186 }
73187 real_packet->sub_tgt_kind = readin;
73188 }
73189 #ifdef FREECIV_JSON_CONNECTION
73190 field_addr.name = "min_distance";
73191 #endif /* FREECIV_JSON_CONNECTION */
73192 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->min_distance)) {
73193 RECEIVE_PACKET_FIELD_ERROR(min_distance);
73194 }
73195 #ifdef FREECIV_JSON_CONNECTION
73196 field_addr.name = "max_distance";
73197 #endif /* FREECIV_JSON_CONNECTION */
73198 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->max_distance)) {
73199 RECEIVE_PACKET_FIELD_ERROR(max_distance);
73200 }
73201 #ifdef FREECIV_JSON_CONNECTION
73202 field_addr.name = "blocked_by";
73203 #endif /* FREECIV_JSON_CONNECTION */
73204 if (!DIO_BV_GET(&din, &field_addr, real_packet->blocked_by)) {
73205 RECEIVE_PACKET_FIELD_ERROR(blocked_by);
73206 }
73207
73208#endif
73209 log_packet_detailed("packet_ruleset_action_100: got info about ()");
73210
73211#ifdef FREECIV_DELTA_PROTOCOL
73212 if (NULL == *hash) {
73213 *hash = genhash_new_full(hash_packet_ruleset_action_100, cmp_packet_ruleset_action_100,
73214 NULL, NULL, NULL, free);
73215 }
73216
73217 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
73218 *real_packet = *old;
73219 } else {
73220 log_packet_detailed(" no old info");
73221 memset(real_packet, 0, sizeof(*real_packet));
73222 }
73223
73224 if (BV_ISSET(fields, 0)) {
73225 log_packet_detailed(" got field 'id'");
73226 #ifdef FREECIV_JSON_CONNECTION
73227 field_addr.name = "id";
73228 #endif /* FREECIV_JSON_CONNECTION */
73229 {
73230 int readin;
73231
73232 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
73233 RECEIVE_PACKET_FIELD_ERROR(id);
73234 }
73235 real_packet->id = readin;
73236 }
73237 }
73238 if (BV_ISSET(fields, 1)) {
73239 log_packet_detailed(" got field 'ui_name'");
73240 #ifdef FREECIV_JSON_CONNECTION
73241 field_addr.name = "ui_name";
73242 #endif /* FREECIV_JSON_CONNECTION */
73243 if (!DIO_GET(string, &din, &field_addr, real_packet->ui_name, sizeof(real_packet->ui_name))) {
73244 RECEIVE_PACKET_FIELD_ERROR(ui_name);
73245 }
73246 }
73247 real_packet->quiet = BV_ISSET(fields, 2);
73248 if (BV_ISSET(fields, 3)) {
73249 log_packet_detailed(" got field 'result'");
73250 #ifdef FREECIV_JSON_CONNECTION
73251 field_addr.name = "result";
73252 #endif /* FREECIV_JSON_CONNECTION */
73253 {
73254 int readin;
73255
73256 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
73257 RECEIVE_PACKET_FIELD_ERROR(result);
73258 }
73259 real_packet->result = readin;
73260 }
73261 }
73262 if (BV_ISSET(fields, 4)) {
73263 log_packet_detailed(" got field 'sub_results'");
73264 #ifdef FREECIV_JSON_CONNECTION
73265 field_addr.name = "sub_results";
73266 #endif /* FREECIV_JSON_CONNECTION */
73267 if (!DIO_BV_GET(&din, &field_addr, real_packet->sub_results)) {
73268 RECEIVE_PACKET_FIELD_ERROR(sub_results);
73269 }
73270 }
73271 real_packet->actor_consuming_always = BV_ISSET(fields, 5);
73272 if (BV_ISSET(fields, 6)) {
73273 log_packet_detailed(" got field 'act_kind'");
73274 #ifdef FREECIV_JSON_CONNECTION
73275 field_addr.name = "act_kind";
73276 #endif /* FREECIV_JSON_CONNECTION */
73277 {
73278 int readin;
73279
73280 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
73281 RECEIVE_PACKET_FIELD_ERROR(act_kind);
73282 }
73283 real_packet->act_kind = readin;
73284 }
73285 }
73286 if (BV_ISSET(fields, 7)) {
73287 log_packet_detailed(" got field 'tgt_kind'");
73288 #ifdef FREECIV_JSON_CONNECTION
73289 field_addr.name = "tgt_kind";
73290 #endif /* FREECIV_JSON_CONNECTION */
73291 {
73292 int readin;
73293
73294 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
73295 RECEIVE_PACKET_FIELD_ERROR(tgt_kind);
73296 }
73297 real_packet->tgt_kind = readin;
73298 }
73299 }
73300 if (BV_ISSET(fields, 8)) {
73301 log_packet_detailed(" got field 'sub_tgt_kind'");
73302 #ifdef FREECIV_JSON_CONNECTION
73303 field_addr.name = "sub_tgt_kind";
73304 #endif /* FREECIV_JSON_CONNECTION */
73305 {
73306 int readin;
73307
73308 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
73309 RECEIVE_PACKET_FIELD_ERROR(sub_tgt_kind);
73310 }
73311 real_packet->sub_tgt_kind = readin;
73312 }
73313 }
73314 if (BV_ISSET(fields, 9)) {
73315 log_packet_detailed(" got field 'min_distance'");
73316 #ifdef FREECIV_JSON_CONNECTION
73317 field_addr.name = "min_distance";
73318 #endif /* FREECIV_JSON_CONNECTION */
73319 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->min_distance)) {
73320 RECEIVE_PACKET_FIELD_ERROR(min_distance);
73321 }
73322 }
73323 if (BV_ISSET(fields, 10)) {
73324 log_packet_detailed(" got field 'max_distance'");
73325 #ifdef FREECIV_JSON_CONNECTION
73326 field_addr.name = "max_distance";
73327 #endif /* FREECIV_JSON_CONNECTION */
73328 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->max_distance)) {
73329 RECEIVE_PACKET_FIELD_ERROR(max_distance);
73330 }
73331 }
73332 if (BV_ISSET(fields, 11)) {
73333 log_packet_detailed(" got field 'blocked_by'");
73334 #ifdef FREECIV_JSON_CONNECTION
73335 field_addr.name = "blocked_by";
73336 #endif /* FREECIV_JSON_CONNECTION */
73337 if (!DIO_BV_GET(&din, &field_addr, real_packet->blocked_by)) {
73338 RECEIVE_PACKET_FIELD_ERROR(blocked_by);
73339 }
73340 }
73341
73342 if (NULL == old) {
73343 old = fc_malloc(sizeof(*old));
73344 *old = *real_packet;
73345 genhash_insert(*hash, old, old);
73346 } else {
73347 *old = *real_packet;
73348 }
73349
73350#endif /* FREECIV_DELTA_PROTOCOL */
73351 RECEIVE_PACKET_END(real_packet);
73352}
73353
73354 static int send_packet_ruleset_action_100(struct connection *pc, const struct packet_ruleset_action *packet)
73355{
73356 const struct packet_ruleset_action *real_packet = packet;
73357#ifdef FREECIV_DELTA_PROTOCOL
73358 packet_ruleset_action_100_fields fields;
73359 struct packet_ruleset_action *old;
73360 bool differ;
73361 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ACTION;
73362#endif /* FREECIV_DELTA_PROTOCOL */
73363 SEND_PACKET_START(PACKET_RULESET_ACTION);
73364#ifdef FREECIV_JSON_CONNECTION
73365 struct plocation field_addr;
73366 {
73367 struct plocation *field_addr_tmp = plocation_field_new(NULL);
73368 field_addr = *field_addr_tmp;
73369 FC_FREE(field_addr_tmp);
73370 }
73371#endif /* FREECIV_JSON_CONNECTION */
73372
73373 log_packet_detailed("packet_ruleset_action_100: sending info about ()");
73374
73375#ifdef FREECIV_DELTA_PROTOCOL
73376 if (NULL == *hash) {
73377 *hash = genhash_new_full(hash_packet_ruleset_action_100, cmp_packet_ruleset_action_100,
73378 NULL, NULL, NULL, free);
73379 }
73380 BV_CLR_ALL(fields);
73381
73382 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
73383 old = fc_malloc(sizeof(*old));
73384 *old = *real_packet;
73385 genhash_insert(*hash, old, old);
73386 memset(old, 0, sizeof(*old));
73387 }
73388 differ = (old->id != real_packet->id);
73389 if (differ) {
73390 BV_SET(fields, 0);
73391 }
73392
73393 differ = (strcmp(old->ui_name, real_packet->ui_name) != 0);
73394 if (differ) {
73395 BV_SET(fields, 1);
73396 }
73397
73398 if (packet->quiet) {
73399 BV_SET(fields, 2);
73400 }
73401
73402 differ = (old->result != real_packet->result);
73403 if (differ) {
73404 BV_SET(fields, 3);
73405 }
73406
73407 differ = !BV_ARE_EQUAL(old->sub_results, real_packet->sub_results);
73408 if (differ) {
73409 BV_SET(fields, 4);
73410 }
73411
73412 if (packet->actor_consuming_always) {
73413 BV_SET(fields, 5);
73414 }
73415
73416 differ = (old->act_kind != real_packet->act_kind);
73417 if (differ) {
73418 BV_SET(fields, 6);
73419 }
73420
73421 differ = (old->tgt_kind != real_packet->tgt_kind);
73422 if (differ) {
73423 BV_SET(fields, 7);
73424 }
73425
73426 differ = (old->sub_tgt_kind != real_packet->sub_tgt_kind);
73427 if (differ) {
73428 BV_SET(fields, 8);
73429 }
73430
73431 differ = (old->min_distance != real_packet->min_distance);
73432 if (differ) {
73433 BV_SET(fields, 9);
73434 }
73435
73436 differ = (old->max_distance != real_packet->max_distance);
73437 if (differ) {
73438 BV_SET(fields, 10);
73439 }
73440
73441 differ = !BV_ARE_EQUAL(old->blocked_by, real_packet->blocked_by);
73442 if (differ) {
73443 BV_SET(fields, 11);
73444 }
73445
73446
73447#ifdef FREECIV_JSON_CONNECTION
73448 field_addr.name = "fields";
73449#endif /* FREECIV_JSON_CONNECTION */
73450 DIO_BV_PUT(&dout, &field_addr, fields);
73451
73452 if (BV_ISSET(fields, 0)) {
73453 log_packet_detailed(" field 'id' has changed");
73454 #ifdef FREECIV_JSON_CONNECTION
73455 field_addr.name = "id";
73456#endif /* FREECIV_JSON_CONNECTION */
73457 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
73458 }
73459 if (BV_ISSET(fields, 1)) {
73460 log_packet_detailed(" field 'ui_name' has changed");
73461 #ifdef FREECIV_JSON_CONNECTION
73462 field_addr.name = "ui_name";
73463#endif /* FREECIV_JSON_CONNECTION */
73464 DIO_PUT(string, &dout, &field_addr, real_packet->ui_name);
73465 }
73466 /* field 2 is folded into the header */
73467 if (BV_ISSET(fields, 3)) {
73468 log_packet_detailed(" field 'result' has changed");
73469 #ifdef FREECIV_JSON_CONNECTION
73470 field_addr.name = "result";
73471#endif /* FREECIV_JSON_CONNECTION */
73472 DIO_PUT(uint8, &dout, &field_addr, real_packet->result);
73473 }
73474 if (BV_ISSET(fields, 4)) {
73475 log_packet_detailed(" field 'sub_results' has changed");
73476 #ifdef FREECIV_JSON_CONNECTION
73477 field_addr.name = "sub_results";
73478#endif /* FREECIV_JSON_CONNECTION */
73479 DIO_BV_PUT(&dout, &field_addr, packet->sub_results);
73480 }
73481 /* field 5 is folded into the header */
73482 if (BV_ISSET(fields, 6)) {
73483 log_packet_detailed(" field 'act_kind' has changed");
73484 #ifdef FREECIV_JSON_CONNECTION
73485 field_addr.name = "act_kind";
73486#endif /* FREECIV_JSON_CONNECTION */
73487 DIO_PUT(uint8, &dout, &field_addr, real_packet->act_kind);
73488 }
73489 if (BV_ISSET(fields, 7)) {
73490 log_packet_detailed(" field 'tgt_kind' has changed");
73491 #ifdef FREECIV_JSON_CONNECTION
73492 field_addr.name = "tgt_kind";
73493#endif /* FREECIV_JSON_CONNECTION */
73494 DIO_PUT(uint8, &dout, &field_addr, real_packet->tgt_kind);
73495 }
73496 if (BV_ISSET(fields, 8)) {
73497 log_packet_detailed(" field 'sub_tgt_kind' has changed");
73498 #ifdef FREECIV_JSON_CONNECTION
73499 field_addr.name = "sub_tgt_kind";
73500#endif /* FREECIV_JSON_CONNECTION */
73501 DIO_PUT(uint8, &dout, &field_addr, real_packet->sub_tgt_kind);
73502 }
73503 if (BV_ISSET(fields, 9)) {
73504 log_packet_detailed(" field 'min_distance' has changed");
73505 #ifdef FREECIV_JSON_CONNECTION
73506 field_addr.name = "min_distance";
73507#endif /* FREECIV_JSON_CONNECTION */
73508 DIO_PUT(sint32, &dout, &field_addr, real_packet->min_distance);
73509 }
73510 if (BV_ISSET(fields, 10)) {
73511 log_packet_detailed(" field 'max_distance' has changed");
73512 #ifdef FREECIV_JSON_CONNECTION
73513 field_addr.name = "max_distance";
73514#endif /* FREECIV_JSON_CONNECTION */
73515 DIO_PUT(sint32, &dout, &field_addr, real_packet->max_distance);
73516 }
73517 if (BV_ISSET(fields, 11)) {
73518 log_packet_detailed(" field 'blocked_by' has changed");
73519 #ifdef FREECIV_JSON_CONNECTION
73520 field_addr.name = "blocked_by";
73521#endif /* FREECIV_JSON_CONNECTION */
73522 DIO_BV_PUT(&dout, &field_addr, packet->blocked_by);
73523 }
73524
73525 *old = *real_packet;
73526#endif /* FREECIV_DELTA_PROTOCOL */
73527#ifndef FREECIV_DELTA_PROTOCOL
73528#ifdef FREECIV_JSON_CONNECTION
73529 field_addr.name = "id";
73530#endif /* FREECIV_JSON_CONNECTION */
73531 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
73532#ifdef FREECIV_JSON_CONNECTION
73533 field_addr.name = "ui_name";
73534#endif /* FREECIV_JSON_CONNECTION */
73535 DIO_PUT(string, &dout, &field_addr, real_packet->ui_name);
73536#ifdef FREECIV_JSON_CONNECTION
73537 field_addr.name = "quiet";
73538#endif /* FREECIV_JSON_CONNECTION */
73539 DIO_PUT(bool8, &dout, &field_addr, real_packet->quiet);
73540#ifdef FREECIV_JSON_CONNECTION
73541 field_addr.name = "result";
73542#endif /* FREECIV_JSON_CONNECTION */
73543 DIO_PUT(uint8, &dout, &field_addr, real_packet->result);
73544#ifdef FREECIV_JSON_CONNECTION
73545 field_addr.name = "sub_results";
73546#endif /* FREECIV_JSON_CONNECTION */
73547 DIO_BV_PUT(&dout, &field_addr, packet->sub_results);
73548#ifdef FREECIV_JSON_CONNECTION
73549 field_addr.name = "actor_consuming_always";
73550#endif /* FREECIV_JSON_CONNECTION */
73551 DIO_PUT(bool8, &dout, &field_addr, real_packet->actor_consuming_always);
73552#ifdef FREECIV_JSON_CONNECTION
73553 field_addr.name = "act_kind";
73554#endif /* FREECIV_JSON_CONNECTION */
73555 DIO_PUT(uint8, &dout, &field_addr, real_packet->act_kind);
73556#ifdef FREECIV_JSON_CONNECTION
73557 field_addr.name = "tgt_kind";
73558#endif /* FREECIV_JSON_CONNECTION */
73559 DIO_PUT(uint8, &dout, &field_addr, real_packet->tgt_kind);
73560#ifdef FREECIV_JSON_CONNECTION
73561 field_addr.name = "sub_tgt_kind";
73562#endif /* FREECIV_JSON_CONNECTION */
73563 DIO_PUT(uint8, &dout, &field_addr, real_packet->sub_tgt_kind);
73564#ifdef FREECIV_JSON_CONNECTION
73565 field_addr.name = "min_distance";
73566#endif /* FREECIV_JSON_CONNECTION */
73567 DIO_PUT(sint32, &dout, &field_addr, real_packet->min_distance);
73568#ifdef FREECIV_JSON_CONNECTION
73569 field_addr.name = "max_distance";
73570#endif /* FREECIV_JSON_CONNECTION */
73571 DIO_PUT(sint32, &dout, &field_addr, real_packet->max_distance);
73572#ifdef FREECIV_JSON_CONNECTION
73573 field_addr.name = "blocked_by";
73574#endif /* FREECIV_JSON_CONNECTION */
73575 DIO_BV_PUT(&dout, &field_addr, packet->blocked_by);
73576
73577#endif
73578 SEND_PACKET_END(PACKET_RULESET_ACTION);
73579}
73580
73581 int send_packet_ruleset_action(struct connection *pc, const struct packet_ruleset_action *packet)
73582{
73583 if (!pc->used) {
73584 log_error("WARNING: trying to send data to the closed connection %s",
73585 conn_description(pc));
73586 return -1;
73587 }
73588 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ACTION].packet != NULL, -1,
73589 "Handler for PACKET_RULESET_ACTION not installed");
73590 return pc->phs.handlers->send[PACKET_RULESET_ACTION].packet(pc, packet);
73591}
73592
73593 void lsend_packet_ruleset_action(struct conn_list *dest, const struct packet_ruleset_action *packet)
73594{
73595 conn_list_iterate(dest, pconn) {
73596 send_packet_ruleset_action(pconn, packet);
73597 } conn_list_iterate_end;
73598}
73599
73600#ifdef FREECIV_DELTA_PROTOCOL
73601#define hash_packet_ruleset_action_enabler_100 hash_const
73602
73603#define cmp_packet_ruleset_action_enabler_100 cmp_const
73604
73605 BV_DEFINE(packet_ruleset_action_enabler_100_fields, 5);
73606#endif /* FREECIV_DELTA_PROTOCOL */
73607
73608 static struct packet_ruleset_action_enabler *receive_packet_ruleset_action_enabler_100(struct connection *pc)
73609{
73610#ifdef FREECIV_DELTA_PROTOCOL
73611 packet_ruleset_action_enabler_100_fields fields;
73612 struct packet_ruleset_action_enabler *old;
73613 struct genhash **hash = pc->phs.received + PACKET_RULESET_ACTION_ENABLER;
73614#endif /* FREECIV_DELTA_PROTOCOL */
73615 RECEIVE_PACKET_START(packet_ruleset_action_enabler, real_packet);
73616#ifdef FREECIV_JSON_CONNECTION
73617 struct plocation field_addr;
73618 {
73619 struct plocation *field_addr_tmp = plocation_field_new(NULL);
73620 field_addr = *field_addr_tmp;
73621 FC_FREE(field_addr_tmp);
73622 }
73623#endif /* FREECIV_JSON_CONNECTION */
73624
73625#ifdef FREECIV_DELTA_PROTOCOL
73626#ifdef FREECIV_JSON_CONNECTION
73627 field_addr.name = "fields";
73628#endif /* FREECIV_JSON_CONNECTION */
73629 DIO_BV_GET(&din, &field_addr, fields);
73630
73631#else /* FREECIV_DELTA_PROTOCOL */
73632 #ifdef FREECIV_JSON_CONNECTION
73633 field_addr.name = "enabled_action";
73634 #endif /* FREECIV_JSON_CONNECTION */
73635 {
73636 int readin;
73637
73638 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
73639 RECEIVE_PACKET_FIELD_ERROR(enabled_action);
73640 }
73641 real_packet->enabled_action = readin;
73642 }
73643 #ifdef FREECIV_JSON_CONNECTION
73644 field_addr.name = "actor_reqs_count";
73645 #endif /* FREECIV_JSON_CONNECTION */
73646 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->actor_reqs_count)) {
73647 RECEIVE_PACKET_FIELD_ERROR(actor_reqs_count);
73648 }
73649 #ifdef FREECIV_JSON_CONNECTION
73650 field_addr.name = "actor_reqs";
73651 #endif /* FREECIV_JSON_CONNECTION */
73652
73653 {
73654 int i;
73655
73656 #ifdef FREECIV_JSON_CONNECTION
73657 /* Enter array. */
73658 field_addr.sub_location = plocation_elem_new(0);
73659 #endif /* FREECIV_JSON_CONNECTION */
73660
73661 if (real_packet->actor_reqs_count > MAX_NUM_REQS) {
73662 RECEIVE_PACKET_FIELD_ERROR(actor_reqs, ": truncation array");
73663 }
73664 for (i = 0; i < real_packet->actor_reqs_count; i++) {
73665 #ifdef FREECIV_JSON_CONNECTION
73666 field_addr.sub_location->number = i;
73667 #endif /* FREECIV_JSON_CONNECTION */
73668 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->actor_reqs[i])) {
73669 RECEIVE_PACKET_FIELD_ERROR(actor_reqs);
73670 }
73671 }
73672
73673 #ifdef FREECIV_JSON_CONNECTION
73674 /* Exit array. */
73675 free(field_addr.sub_location);
73676 field_addr.sub_location = NULL;
73677 #endif /* FREECIV_JSON_CONNECTION */
73678 }
73679 #ifdef FREECIV_JSON_CONNECTION
73680 field_addr.name = "target_reqs_count";
73681 #endif /* FREECIV_JSON_CONNECTION */
73682 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->target_reqs_count)) {
73683 RECEIVE_PACKET_FIELD_ERROR(target_reqs_count);
73684 }
73685 #ifdef FREECIV_JSON_CONNECTION
73686 field_addr.name = "target_reqs";
73687 #endif /* FREECIV_JSON_CONNECTION */
73688
73689 {
73690 int i;
73691
73692 #ifdef FREECIV_JSON_CONNECTION
73693 /* Enter array. */
73694 field_addr.sub_location = plocation_elem_new(0);
73695 #endif /* FREECIV_JSON_CONNECTION */
73696
73697 if (real_packet->target_reqs_count > MAX_NUM_REQS) {
73698 RECEIVE_PACKET_FIELD_ERROR(target_reqs, ": truncation array");
73699 }
73700 for (i = 0; i < real_packet->target_reqs_count; i++) {
73701 #ifdef FREECIV_JSON_CONNECTION
73702 field_addr.sub_location->number = i;
73703 #endif /* FREECIV_JSON_CONNECTION */
73704 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->target_reqs[i])) {
73705 RECEIVE_PACKET_FIELD_ERROR(target_reqs);
73706 }
73707 }
73708
73709 #ifdef FREECIV_JSON_CONNECTION
73710 /* Exit array. */
73711 free(field_addr.sub_location);
73712 field_addr.sub_location = NULL;
73713 #endif /* FREECIV_JSON_CONNECTION */
73714 }
73715
73716#endif
73717 log_packet_detailed("packet_ruleset_action_enabler_100: got info about ()");
73718
73719#ifdef FREECIV_DELTA_PROTOCOL
73720 if (NULL == *hash) {
73721 *hash = genhash_new_full(hash_packet_ruleset_action_enabler_100, cmp_packet_ruleset_action_enabler_100,
73722 NULL, NULL, NULL, free);
73723 }
73724
73725 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
73726 *real_packet = *old;
73727 } else {
73728 log_packet_detailed(" no old info");
73729 memset(real_packet, 0, sizeof(*real_packet));
73730 }
73731
73732 if (BV_ISSET(fields, 0)) {
73733 log_packet_detailed(" got field 'enabled_action'");
73734 #ifdef FREECIV_JSON_CONNECTION
73735 field_addr.name = "enabled_action";
73736 #endif /* FREECIV_JSON_CONNECTION */
73737 {
73738 int readin;
73739
73740 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
73741 RECEIVE_PACKET_FIELD_ERROR(enabled_action);
73742 }
73743 real_packet->enabled_action = readin;
73744 }
73745 }
73746 if (BV_ISSET(fields, 1)) {
73747 log_packet_detailed(" got field 'actor_reqs_count'");
73748 #ifdef FREECIV_JSON_CONNECTION
73749 field_addr.name = "actor_reqs_count";
73750 #endif /* FREECIV_JSON_CONNECTION */
73751 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->actor_reqs_count)) {
73752 RECEIVE_PACKET_FIELD_ERROR(actor_reqs_count);
73753 }
73754 }
73755 if (BV_ISSET(fields, 2)) {
73756 log_packet_detailed(" got field 'actor_reqs'");
73757 #ifdef FREECIV_JSON_CONNECTION
73758 field_addr.name = "actor_reqs";
73759 #endif /* FREECIV_JSON_CONNECTION */
73760
73761 {
73762 int i;
73763
73764 #ifdef FREECIV_JSON_CONNECTION
73765 /* Enter array. */
73766 field_addr.sub_location = plocation_elem_new(0);
73767 #endif /* FREECIV_JSON_CONNECTION */
73768
73769 if (real_packet->actor_reqs_count > MAX_NUM_REQS) {
73770 RECEIVE_PACKET_FIELD_ERROR(actor_reqs, ": truncation array");
73771 }
73772 for (i = 0; i < real_packet->actor_reqs_count; i++) {
73773 #ifdef FREECIV_JSON_CONNECTION
73774 field_addr.sub_location->number = i;
73775 #endif /* FREECIV_JSON_CONNECTION */
73776 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->actor_reqs[i])) {
73777 RECEIVE_PACKET_FIELD_ERROR(actor_reqs);
73778 }
73779 }
73780
73781 #ifdef FREECIV_JSON_CONNECTION
73782 /* Exit array. */
73783 free(field_addr.sub_location);
73784 field_addr.sub_location = NULL;
73785 #endif /* FREECIV_JSON_CONNECTION */
73786 }
73787 }
73788 if (BV_ISSET(fields, 3)) {
73789 log_packet_detailed(" got field 'target_reqs_count'");
73790 #ifdef FREECIV_JSON_CONNECTION
73791 field_addr.name = "target_reqs_count";
73792 #endif /* FREECIV_JSON_CONNECTION */
73793 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->target_reqs_count)) {
73794 RECEIVE_PACKET_FIELD_ERROR(target_reqs_count);
73795 }
73796 }
73797 if (BV_ISSET(fields, 4)) {
73798 log_packet_detailed(" got field 'target_reqs'");
73799 #ifdef FREECIV_JSON_CONNECTION
73800 field_addr.name = "target_reqs";
73801 #endif /* FREECIV_JSON_CONNECTION */
73802
73803 {
73804 int i;
73805
73806 #ifdef FREECIV_JSON_CONNECTION
73807 /* Enter array. */
73808 field_addr.sub_location = plocation_elem_new(0);
73809 #endif /* FREECIV_JSON_CONNECTION */
73810
73811 if (real_packet->target_reqs_count > MAX_NUM_REQS) {
73812 RECEIVE_PACKET_FIELD_ERROR(target_reqs, ": truncation array");
73813 }
73814 for (i = 0; i < real_packet->target_reqs_count; i++) {
73815 #ifdef FREECIV_JSON_CONNECTION
73816 field_addr.sub_location->number = i;
73817 #endif /* FREECIV_JSON_CONNECTION */
73818 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->target_reqs[i])) {
73819 RECEIVE_PACKET_FIELD_ERROR(target_reqs);
73820 }
73821 }
73822
73823 #ifdef FREECIV_JSON_CONNECTION
73824 /* Exit array. */
73825 free(field_addr.sub_location);
73826 field_addr.sub_location = NULL;
73827 #endif /* FREECIV_JSON_CONNECTION */
73828 }
73829 }
73830
73831 if (NULL == old) {
73832 old = fc_malloc(sizeof(*old));
73833 *old = *real_packet;
73834 genhash_insert(*hash, old, old);
73835 } else {
73836 *old = *real_packet;
73837 }
73838
73839#endif /* FREECIV_DELTA_PROTOCOL */
73840 RECEIVE_PACKET_END(real_packet);
73841}
73842
73843 static int send_packet_ruleset_action_enabler_100(struct connection *pc, const struct packet_ruleset_action_enabler *packet)
73844{
73845 const struct packet_ruleset_action_enabler *real_packet = packet;
73846#ifdef FREECIV_DELTA_PROTOCOL
73847 packet_ruleset_action_enabler_100_fields fields;
73848 struct packet_ruleset_action_enabler *old;
73849 bool differ;
73850 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ACTION_ENABLER;
73851#endif /* FREECIV_DELTA_PROTOCOL */
73852 SEND_PACKET_START(PACKET_RULESET_ACTION_ENABLER);
73853#ifdef FREECIV_JSON_CONNECTION
73854 struct plocation field_addr;
73855 {
73856 struct plocation *field_addr_tmp = plocation_field_new(NULL);
73857 field_addr = *field_addr_tmp;
73858 FC_FREE(field_addr_tmp);
73859 }
73860#endif /* FREECIV_JSON_CONNECTION */
73861
73862 log_packet_detailed("packet_ruleset_action_enabler_100: sending info about ()");
73863
73864#ifdef FREECIV_DELTA_PROTOCOL
73865 if (NULL == *hash) {
73866 *hash = genhash_new_full(hash_packet_ruleset_action_enabler_100, cmp_packet_ruleset_action_enabler_100,
73867 NULL, NULL, NULL, free);
73868 }
73869 BV_CLR_ALL(fields);
73870
73871 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
73872 old = fc_malloc(sizeof(*old));
73873 *old = *real_packet;
73874 genhash_insert(*hash, old, old);
73875 memset(old, 0, sizeof(*old));
73876 }
73877 differ = (old->enabled_action != real_packet->enabled_action);
73878 if (differ) {
73879 BV_SET(fields, 0);
73880 }
73881
73882 differ = (old->actor_reqs_count != real_packet->actor_reqs_count);
73883 if (differ) {
73884 BV_SET(fields, 1);
73885 }
73886
73887
73888 {
73889 differ = (old->actor_reqs_count != real_packet->actor_reqs_count);
73890 if (!differ) {
73891 int i;
73892
73893 for (i = 0; i < real_packet->actor_reqs_count; i++) {
73894 if (!are_requirements_equal(&old->actor_reqs[i], &real_packet->actor_reqs[i])) {
73895 differ = TRUE;
73896 break;
73897 }
73898 }
73899 }
73900 }
73901 if (differ) {
73902 BV_SET(fields, 2);
73903 }
73904
73905 differ = (old->target_reqs_count != real_packet->target_reqs_count);
73906 if (differ) {
73907 BV_SET(fields, 3);
73908 }
73909
73910
73911 {
73912 differ = (old->target_reqs_count != real_packet->target_reqs_count);
73913 if (!differ) {
73914 int i;
73915
73916 for (i = 0; i < real_packet->target_reqs_count; i++) {
73917 if (!are_requirements_equal(&old->target_reqs[i], &real_packet->target_reqs[i])) {
73918 differ = TRUE;
73919 break;
73920 }
73921 }
73922 }
73923 }
73924 if (differ) {
73925 BV_SET(fields, 4);
73926 }
73927
73928
73929#ifdef FREECIV_JSON_CONNECTION
73930 field_addr.name = "fields";
73931#endif /* FREECIV_JSON_CONNECTION */
73932 DIO_BV_PUT(&dout, &field_addr, fields);
73933
73934 if (BV_ISSET(fields, 0)) {
73935 log_packet_detailed(" field 'enabled_action' has changed");
73936 #ifdef FREECIV_JSON_CONNECTION
73937 field_addr.name = "enabled_action";
73938#endif /* FREECIV_JSON_CONNECTION */
73939 DIO_PUT(uint8, &dout, &field_addr, real_packet->enabled_action);
73940 }
73941 if (BV_ISSET(fields, 1)) {
73942 log_packet_detailed(" field 'actor_reqs_count' has changed");
73943 #ifdef FREECIV_JSON_CONNECTION
73944 field_addr.name = "actor_reqs_count";
73945#endif /* FREECIV_JSON_CONNECTION */
73946 DIO_PUT(uint8, &dout, &field_addr, real_packet->actor_reqs_count);
73947 }
73948 if (BV_ISSET(fields, 2)) {
73949 log_packet_detailed(" field 'actor_reqs' has changed");
73950 #ifdef FREECIV_JSON_CONNECTION
73951 field_addr.name = "actor_reqs";
73952#endif /* FREECIV_JSON_CONNECTION */
73953
73954 {
73955 int i;
73956
73957#ifdef FREECIV_JSON_CONNECTION
73958 /* Create the array. */
73959 DIO_PUT(farray, &dout, &field_addr, real_packet->actor_reqs_count);
73960
73961 /* Enter the array. */
73962 field_addr.sub_location = plocation_elem_new(0);
73963#endif /* FREECIV_JSON_CONNECTION */
73964
73965 for (i = 0; i < real_packet->actor_reqs_count; i++) {
73966#ifdef FREECIV_JSON_CONNECTION
73967 /* Next array element. */
73968 field_addr.sub_location->number = i;
73969#endif /* FREECIV_JSON_CONNECTION */
73970 DIO_PUT(requirement, &dout, &field_addr, &real_packet->actor_reqs[i]);
73971 }
73972
73973#ifdef FREECIV_JSON_CONNECTION
73974 /* Exit array. */
73975 free(field_addr.sub_location);
73976 field_addr.sub_location = NULL;
73977#endif /* FREECIV_JSON_CONNECTION */
73978 }
73979 }
73980 if (BV_ISSET(fields, 3)) {
73981 log_packet_detailed(" field 'target_reqs_count' has changed");
73982 #ifdef FREECIV_JSON_CONNECTION
73983 field_addr.name = "target_reqs_count";
73984#endif /* FREECIV_JSON_CONNECTION */
73985 DIO_PUT(uint8, &dout, &field_addr, real_packet->target_reqs_count);
73986 }
73987 if (BV_ISSET(fields, 4)) {
73988 log_packet_detailed(" field 'target_reqs' has changed");
73989 #ifdef FREECIV_JSON_CONNECTION
73990 field_addr.name = "target_reqs";
73991#endif /* FREECIV_JSON_CONNECTION */
73992
73993 {
73994 int i;
73995
73996#ifdef FREECIV_JSON_CONNECTION
73997 /* Create the array. */
73998 DIO_PUT(farray, &dout, &field_addr, real_packet->target_reqs_count);
73999
74000 /* Enter the array. */
74001 field_addr.sub_location = plocation_elem_new(0);
74002#endif /* FREECIV_JSON_CONNECTION */
74003
74004 for (i = 0; i < real_packet->target_reqs_count; i++) {
74005#ifdef FREECIV_JSON_CONNECTION
74006 /* Next array element. */
74007 field_addr.sub_location->number = i;
74008#endif /* FREECIV_JSON_CONNECTION */
74009 DIO_PUT(requirement, &dout, &field_addr, &real_packet->target_reqs[i]);
74010 }
74011
74012#ifdef FREECIV_JSON_CONNECTION
74013 /* Exit array. */
74014 free(field_addr.sub_location);
74015 field_addr.sub_location = NULL;
74016#endif /* FREECIV_JSON_CONNECTION */
74017 }
74018 }
74019
74020 *old = *real_packet;
74021#endif /* FREECIV_DELTA_PROTOCOL */
74022#ifndef FREECIV_DELTA_PROTOCOL
74023#ifdef FREECIV_JSON_CONNECTION
74024 field_addr.name = "enabled_action";
74025#endif /* FREECIV_JSON_CONNECTION */
74026 DIO_PUT(uint8, &dout, &field_addr, real_packet->enabled_action);
74027#ifdef FREECIV_JSON_CONNECTION
74028 field_addr.name = "actor_reqs_count";
74029#endif /* FREECIV_JSON_CONNECTION */
74030 DIO_PUT(uint8, &dout, &field_addr, real_packet->actor_reqs_count);
74031#ifdef FREECIV_JSON_CONNECTION
74032 field_addr.name = "actor_reqs";
74033#endif /* FREECIV_JSON_CONNECTION */
74034
74035 {
74036 int i;
74037
74038#ifdef FREECIV_JSON_CONNECTION
74039 /* Create the array. */
74040 DIO_PUT(farray, &dout, &field_addr, real_packet->actor_reqs_count);
74041
74042 /* Enter the array. */
74043 field_addr.sub_location = plocation_elem_new(0);
74044#endif /* FREECIV_JSON_CONNECTION */
74045
74046 for (i = 0; i < real_packet->actor_reqs_count; i++) {
74047#ifdef FREECIV_JSON_CONNECTION
74048 /* Next array element. */
74049 field_addr.sub_location->number = i;
74050#endif /* FREECIV_JSON_CONNECTION */
74051 DIO_PUT(requirement, &dout, &field_addr, &real_packet->actor_reqs[i]);
74052 }
74053
74054#ifdef FREECIV_JSON_CONNECTION
74055 /* Exit array. */
74056 free(field_addr.sub_location);
74057 field_addr.sub_location = NULL;
74058#endif /* FREECIV_JSON_CONNECTION */
74059 }
74060#ifdef FREECIV_JSON_CONNECTION
74061 field_addr.name = "target_reqs_count";
74062#endif /* FREECIV_JSON_CONNECTION */
74063 DIO_PUT(uint8, &dout, &field_addr, real_packet->target_reqs_count);
74064#ifdef FREECIV_JSON_CONNECTION
74065 field_addr.name = "target_reqs";
74066#endif /* FREECIV_JSON_CONNECTION */
74067
74068 {
74069 int i;
74070
74071#ifdef FREECIV_JSON_CONNECTION
74072 /* Create the array. */
74073 DIO_PUT(farray, &dout, &field_addr, real_packet->target_reqs_count);
74074
74075 /* Enter the array. */
74076 field_addr.sub_location = plocation_elem_new(0);
74077#endif /* FREECIV_JSON_CONNECTION */
74078
74079 for (i = 0; i < real_packet->target_reqs_count; i++) {
74080#ifdef FREECIV_JSON_CONNECTION
74081 /* Next array element. */
74082 field_addr.sub_location->number = i;
74083#endif /* FREECIV_JSON_CONNECTION */
74084 DIO_PUT(requirement, &dout, &field_addr, &real_packet->target_reqs[i]);
74085 }
74086
74087#ifdef FREECIV_JSON_CONNECTION
74088 /* Exit array. */
74089 free(field_addr.sub_location);
74090 field_addr.sub_location = NULL;
74091#endif /* FREECIV_JSON_CONNECTION */
74092 }
74093
74094#endif
74095 SEND_PACKET_END(PACKET_RULESET_ACTION_ENABLER);
74096}
74097
74098 int send_packet_ruleset_action_enabler(struct connection *pc, const struct packet_ruleset_action_enabler *packet)
74099{
74100 if (!pc->used) {
74101 log_error("WARNING: trying to send data to the closed connection %s",
74102 conn_description(pc));
74103 return -1;
74104 }
74105 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ACTION_ENABLER].packet != NULL, -1,
74106 "Handler for PACKET_RULESET_ACTION_ENABLER not installed");
74107 return pc->phs.handlers->send[PACKET_RULESET_ACTION_ENABLER].packet(pc, packet);
74108}
74109
74110 void lsend_packet_ruleset_action_enabler(struct conn_list *dest, const struct packet_ruleset_action_enabler *packet)
74111{
74112 conn_list_iterate(dest, pconn) {
74113 send_packet_ruleset_action_enabler(pconn, packet);
74114 } conn_list_iterate_end;
74115}
74116
74117#ifdef FREECIV_DELTA_PROTOCOL
74118#define hash_packet_ruleset_action_auto_100 hash_const
74119
74120#define cmp_packet_ruleset_action_auto_100 cmp_const
74121
74122 BV_DEFINE(packet_ruleset_action_auto_100_fields, 6);
74123#endif /* FREECIV_DELTA_PROTOCOL */
74124
74125 static struct packet_ruleset_action_auto *receive_packet_ruleset_action_auto_100(struct connection *pc)
74126{
74127#ifdef FREECIV_DELTA_PROTOCOL
74128 packet_ruleset_action_auto_100_fields fields;
74129 struct packet_ruleset_action_auto *old;
74130 struct genhash **hash = pc->phs.received + PACKET_RULESET_ACTION_AUTO;
74131#endif /* FREECIV_DELTA_PROTOCOL */
74132 RECEIVE_PACKET_START(packet_ruleset_action_auto, real_packet);
74133#ifdef FREECIV_JSON_CONNECTION
74134 struct plocation field_addr;
74135 {
74136 struct plocation *field_addr_tmp = plocation_field_new(NULL);
74137 field_addr = *field_addr_tmp;
74138 FC_FREE(field_addr_tmp);
74139 }
74140#endif /* FREECIV_JSON_CONNECTION */
74141
74142#ifdef FREECIV_DELTA_PROTOCOL
74143#ifdef FREECIV_JSON_CONNECTION
74144 field_addr.name = "fields";
74145#endif /* FREECIV_JSON_CONNECTION */
74146 DIO_BV_GET(&din, &field_addr, fields);
74147
74148#else /* FREECIV_DELTA_PROTOCOL */
74149 #ifdef FREECIV_JSON_CONNECTION
74150 field_addr.name = "id";
74151 #endif /* FREECIV_JSON_CONNECTION */
74152 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
74153 RECEIVE_PACKET_FIELD_ERROR(id);
74154 }
74155 #ifdef FREECIV_JSON_CONNECTION
74156 field_addr.name = "cause";
74157 #endif /* FREECIV_JSON_CONNECTION */
74158 {
74159 int readin;
74160
74161 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
74162 RECEIVE_PACKET_FIELD_ERROR(cause);
74163 }
74164 real_packet->cause = readin;
74165 }
74166 #ifdef FREECIV_JSON_CONNECTION
74167 field_addr.name = "reqs_count";
74168 #endif /* FREECIV_JSON_CONNECTION */
74169 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
74170 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
74171 }
74172 #ifdef FREECIV_JSON_CONNECTION
74173 field_addr.name = "reqs";
74174 #endif /* FREECIV_JSON_CONNECTION */
74175
74176 {
74177 int i;
74178
74179 #ifdef FREECIV_JSON_CONNECTION
74180 /* Enter array. */
74181 field_addr.sub_location = plocation_elem_new(0);
74182 #endif /* FREECIV_JSON_CONNECTION */
74183
74184 if (real_packet->reqs_count > MAX_NUM_REQS) {
74185 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
74186 }
74187 for (i = 0; i < real_packet->reqs_count; i++) {
74188 #ifdef FREECIV_JSON_CONNECTION
74189 field_addr.sub_location->number = i;
74190 #endif /* FREECIV_JSON_CONNECTION */
74191 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
74192 RECEIVE_PACKET_FIELD_ERROR(reqs);
74193 }
74194 }
74195
74196 #ifdef FREECIV_JSON_CONNECTION
74197 /* Exit array. */
74198 free(field_addr.sub_location);
74199 field_addr.sub_location = NULL;
74200 #endif /* FREECIV_JSON_CONNECTION */
74201 }
74202 #ifdef FREECIV_JSON_CONNECTION
74203 field_addr.name = "alternatives_count";
74204 #endif /* FREECIV_JSON_CONNECTION */
74205 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->alternatives_count)) {
74206 RECEIVE_PACKET_FIELD_ERROR(alternatives_count);
74207 }
74208 #ifdef FREECIV_JSON_CONNECTION
74209 field_addr.name = "alternatives";
74210 #endif /* FREECIV_JSON_CONNECTION */
74211
74212 {
74213 int i;
74214
74215 #ifdef FREECIV_JSON_CONNECTION
74216 /* Enter array. */
74217 field_addr.sub_location = plocation_elem_new(0);
74218 #endif /* FREECIV_JSON_CONNECTION */
74219
74220 if (real_packet->alternatives_count > MAX_NUM_ACTIONS) {
74221 RECEIVE_PACKET_FIELD_ERROR(alternatives, ": truncation array");
74222 }
74223 for (i = 0; i < real_packet->alternatives_count; i++) {
74224 #ifdef FREECIV_JSON_CONNECTION
74225 field_addr.sub_location->number = i;
74226 #endif /* FREECIV_JSON_CONNECTION */
74227 {
74228 int readin;
74229
74230 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
74231 RECEIVE_PACKET_FIELD_ERROR(alternatives);
74232 }
74233 real_packet->alternatives[i] = readin;
74234 }
74235 }
74236
74237 #ifdef FREECIV_JSON_CONNECTION
74238 /* Exit array. */
74239 free(field_addr.sub_location);
74240 field_addr.sub_location = NULL;
74241 #endif /* FREECIV_JSON_CONNECTION */
74242 }
74243
74244#endif
74245 log_packet_detailed("packet_ruleset_action_auto_100: got info about ()");
74246
74247#ifdef FREECIV_DELTA_PROTOCOL
74248 if (NULL == *hash) {
74249 *hash = genhash_new_full(hash_packet_ruleset_action_auto_100, cmp_packet_ruleset_action_auto_100,
74250 NULL, NULL, NULL, free);
74251 }
74252
74253 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
74254 *real_packet = *old;
74255 } else {
74256 log_packet_detailed(" no old info");
74257 memset(real_packet, 0, sizeof(*real_packet));
74258 }
74259
74260 if (BV_ISSET(fields, 0)) {
74261 log_packet_detailed(" got field 'id'");
74262 #ifdef FREECIV_JSON_CONNECTION
74263 field_addr.name = "id";
74264 #endif /* FREECIV_JSON_CONNECTION */
74265 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
74266 RECEIVE_PACKET_FIELD_ERROR(id);
74267 }
74268 }
74269 if (BV_ISSET(fields, 1)) {
74270 log_packet_detailed(" got field 'cause'");
74271 #ifdef FREECIV_JSON_CONNECTION
74272 field_addr.name = "cause";
74273 #endif /* FREECIV_JSON_CONNECTION */
74274 {
74275 int readin;
74276
74277 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
74278 RECEIVE_PACKET_FIELD_ERROR(cause);
74279 }
74280 real_packet->cause = readin;
74281 }
74282 }
74283 if (BV_ISSET(fields, 2)) {
74284 log_packet_detailed(" got field 'reqs_count'");
74285 #ifdef FREECIV_JSON_CONNECTION
74286 field_addr.name = "reqs_count";
74287 #endif /* FREECIV_JSON_CONNECTION */
74288 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
74289 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
74290 }
74291 }
74292 if (BV_ISSET(fields, 3)) {
74293 log_packet_detailed(" got field 'reqs'");
74294 #ifdef FREECIV_JSON_CONNECTION
74295 field_addr.name = "reqs";
74296 #endif /* FREECIV_JSON_CONNECTION */
74297
74298 {
74299 int i;
74300
74301 #ifdef FREECIV_JSON_CONNECTION
74302 /* Enter array. */
74303 field_addr.sub_location = plocation_elem_new(0);
74304 #endif /* FREECIV_JSON_CONNECTION */
74305
74306 if (real_packet->reqs_count > MAX_NUM_REQS) {
74307 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
74308 }
74309 for (i = 0; i < real_packet->reqs_count; i++) {
74310 #ifdef FREECIV_JSON_CONNECTION
74311 field_addr.sub_location->number = i;
74312 #endif /* FREECIV_JSON_CONNECTION */
74313 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
74314 RECEIVE_PACKET_FIELD_ERROR(reqs);
74315 }
74316 }
74317
74318 #ifdef FREECIV_JSON_CONNECTION
74319 /* Exit array. */
74320 free(field_addr.sub_location);
74321 field_addr.sub_location = NULL;
74322 #endif /* FREECIV_JSON_CONNECTION */
74323 }
74324 }
74325 if (BV_ISSET(fields, 4)) {
74326 log_packet_detailed(" got field 'alternatives_count'");
74327 #ifdef FREECIV_JSON_CONNECTION
74328 field_addr.name = "alternatives_count";
74329 #endif /* FREECIV_JSON_CONNECTION */
74330 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->alternatives_count)) {
74331 RECEIVE_PACKET_FIELD_ERROR(alternatives_count);
74332 }
74333 }
74334 if (BV_ISSET(fields, 5)) {
74335 log_packet_detailed(" got field 'alternatives'");
74336 #ifdef FREECIV_JSON_CONNECTION
74337 field_addr.name = "alternatives";
74338 #endif /* FREECIV_JSON_CONNECTION */
74339
74340 {
74341 int i;
74342
74343 #ifdef FREECIV_JSON_CONNECTION
74344 /* Enter array. */
74345 field_addr.sub_location = plocation_elem_new(0);
74346 #endif /* FREECIV_JSON_CONNECTION */
74347
74348 if (real_packet->alternatives_count > MAX_NUM_ACTIONS) {
74349 RECEIVE_PACKET_FIELD_ERROR(alternatives, ": truncation array");
74350 }
74351 for (i = 0; i < real_packet->alternatives_count; i++) {
74352 #ifdef FREECIV_JSON_CONNECTION
74353 field_addr.sub_location->number = i;
74354 #endif /* FREECIV_JSON_CONNECTION */
74355 {
74356 int readin;
74357
74358 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
74359 RECEIVE_PACKET_FIELD_ERROR(alternatives);
74360 }
74361 real_packet->alternatives[i] = readin;
74362 }
74363 }
74364
74365 #ifdef FREECIV_JSON_CONNECTION
74366 /* Exit array. */
74367 free(field_addr.sub_location);
74368 field_addr.sub_location = NULL;
74369 #endif /* FREECIV_JSON_CONNECTION */
74370 }
74371 }
74372
74373 if (NULL == old) {
74374 old = fc_malloc(sizeof(*old));
74375 *old = *real_packet;
74376 genhash_insert(*hash, old, old);
74377 } else {
74378 *old = *real_packet;
74379 }
74380
74381#endif /* FREECIV_DELTA_PROTOCOL */
74382 RECEIVE_PACKET_END(real_packet);
74383}
74384
74385 static int send_packet_ruleset_action_auto_100(struct connection *pc, const struct packet_ruleset_action_auto *packet)
74386{
74387 const struct packet_ruleset_action_auto *real_packet = packet;
74388#ifdef FREECIV_DELTA_PROTOCOL
74389 packet_ruleset_action_auto_100_fields fields;
74390 struct packet_ruleset_action_auto *old;
74391 bool differ;
74392 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ACTION_AUTO;
74393#endif /* FREECIV_DELTA_PROTOCOL */
74394 SEND_PACKET_START(PACKET_RULESET_ACTION_AUTO);
74395#ifdef FREECIV_JSON_CONNECTION
74396 struct plocation field_addr;
74397 {
74398 struct plocation *field_addr_tmp = plocation_field_new(NULL);
74399 field_addr = *field_addr_tmp;
74400 FC_FREE(field_addr_tmp);
74401 }
74402#endif /* FREECIV_JSON_CONNECTION */
74403
74404 log_packet_detailed("packet_ruleset_action_auto_100: sending info about ()");
74405
74406#ifdef FREECIV_DELTA_PROTOCOL
74407 if (NULL == *hash) {
74408 *hash = genhash_new_full(hash_packet_ruleset_action_auto_100, cmp_packet_ruleset_action_auto_100,
74409 NULL, NULL, NULL, free);
74410 }
74411 BV_CLR_ALL(fields);
74412
74413 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
74414 old = fc_malloc(sizeof(*old));
74415 *old = *real_packet;
74416 genhash_insert(*hash, old, old);
74417 memset(old, 0, sizeof(*old));
74418 }
74419 differ = (old->id != real_packet->id);
74420 if (differ) {
74421 BV_SET(fields, 0);
74422 }
74423
74424 differ = (old->cause != real_packet->cause);
74425 if (differ) {
74426 BV_SET(fields, 1);
74427 }
74428
74429 differ = (old->reqs_count != real_packet->reqs_count);
74430 if (differ) {
74431 BV_SET(fields, 2);
74432 }
74433
74434
74435 {
74436 differ = (old->reqs_count != real_packet->reqs_count);
74437 if (!differ) {
74438 int i;
74439
74440 for (i = 0; i < real_packet->reqs_count; i++) {
74441 if (!are_requirements_equal(&old->reqs[i], &real_packet->reqs[i])) {
74442 differ = TRUE;
74443 break;
74444 }
74445 }
74446 }
74447 }
74448 if (differ) {
74449 BV_SET(fields, 3);
74450 }
74451
74452 differ = (old->alternatives_count != real_packet->alternatives_count);
74453 if (differ) {
74454 BV_SET(fields, 4);
74455 }
74456
74457
74458 {
74459 differ = (old->alternatives_count != real_packet->alternatives_count);
74460 if (!differ) {
74461 int i;
74462
74463 for (i = 0; i < real_packet->alternatives_count; i++) {
74464 if (old->alternatives[i] != real_packet->alternatives[i]) {
74465 differ = TRUE;
74466 break;
74467 }
74468 }
74469 }
74470 }
74471 if (differ) {
74472 BV_SET(fields, 5);
74473 }
74474
74475
74476#ifdef FREECIV_JSON_CONNECTION
74477 field_addr.name = "fields";
74478#endif /* FREECIV_JSON_CONNECTION */
74479 DIO_BV_PUT(&dout, &field_addr, fields);
74480
74481 if (BV_ISSET(fields, 0)) {
74482 log_packet_detailed(" field 'id' has changed");
74483 #ifdef FREECIV_JSON_CONNECTION
74484 field_addr.name = "id";
74485#endif /* FREECIV_JSON_CONNECTION */
74486 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
74487 }
74488 if (BV_ISSET(fields, 1)) {
74489 log_packet_detailed(" field 'cause' has changed");
74490 #ifdef FREECIV_JSON_CONNECTION
74491 field_addr.name = "cause";
74492#endif /* FREECIV_JSON_CONNECTION */
74493 DIO_PUT(uint8, &dout, &field_addr, real_packet->cause);
74494 }
74495 if (BV_ISSET(fields, 2)) {
74496 log_packet_detailed(" field 'reqs_count' has changed");
74497 #ifdef FREECIV_JSON_CONNECTION
74498 field_addr.name = "reqs_count";
74499#endif /* FREECIV_JSON_CONNECTION */
74500 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
74501 }
74502 if (BV_ISSET(fields, 3)) {
74503 log_packet_detailed(" field 'reqs' has changed");
74504 #ifdef FREECIV_JSON_CONNECTION
74505 field_addr.name = "reqs";
74506#endif /* FREECIV_JSON_CONNECTION */
74507
74508 {
74509 int i;
74510
74511#ifdef FREECIV_JSON_CONNECTION
74512 /* Create the array. */
74513 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
74514
74515 /* Enter the array. */
74516 field_addr.sub_location = plocation_elem_new(0);
74517#endif /* FREECIV_JSON_CONNECTION */
74518
74519 for (i = 0; i < real_packet->reqs_count; i++) {
74520#ifdef FREECIV_JSON_CONNECTION
74521 /* Next array element. */
74522 field_addr.sub_location->number = i;
74523#endif /* FREECIV_JSON_CONNECTION */
74524 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
74525 }
74526
74527#ifdef FREECIV_JSON_CONNECTION
74528 /* Exit array. */
74529 free(field_addr.sub_location);
74530 field_addr.sub_location = NULL;
74531#endif /* FREECIV_JSON_CONNECTION */
74532 }
74533 }
74534 if (BV_ISSET(fields, 4)) {
74535 log_packet_detailed(" field 'alternatives_count' has changed");
74536 #ifdef FREECIV_JSON_CONNECTION
74537 field_addr.name = "alternatives_count";
74538#endif /* FREECIV_JSON_CONNECTION */
74539 DIO_PUT(uint8, &dout, &field_addr, real_packet->alternatives_count);
74540 }
74541 if (BV_ISSET(fields, 5)) {
74542 log_packet_detailed(" field 'alternatives' has changed");
74543 #ifdef FREECIV_JSON_CONNECTION
74544 field_addr.name = "alternatives";
74545#endif /* FREECIV_JSON_CONNECTION */
74546
74547 {
74548 int i;
74549
74550#ifdef FREECIV_JSON_CONNECTION
74551 /* Create the array. */
74552 DIO_PUT(farray, &dout, &field_addr, real_packet->alternatives_count);
74553
74554 /* Enter the array. */
74555 field_addr.sub_location = plocation_elem_new(0);
74556#endif /* FREECIV_JSON_CONNECTION */
74557
74558 for (i = 0; i < real_packet->alternatives_count; i++) {
74559#ifdef FREECIV_JSON_CONNECTION
74560 /* Next array element. */
74561 field_addr.sub_location->number = i;
74562#endif /* FREECIV_JSON_CONNECTION */
74563 DIO_PUT(uint8, &dout, &field_addr, real_packet->alternatives[i]);
74564 }
74565
74566#ifdef FREECIV_JSON_CONNECTION
74567 /* Exit array. */
74568 free(field_addr.sub_location);
74569 field_addr.sub_location = NULL;
74570#endif /* FREECIV_JSON_CONNECTION */
74571 }
74572 }
74573
74574 *old = *real_packet;
74575#endif /* FREECIV_DELTA_PROTOCOL */
74576#ifndef FREECIV_DELTA_PROTOCOL
74577#ifdef FREECIV_JSON_CONNECTION
74578 field_addr.name = "id";
74579#endif /* FREECIV_JSON_CONNECTION */
74580 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
74581#ifdef FREECIV_JSON_CONNECTION
74582 field_addr.name = "cause";
74583#endif /* FREECIV_JSON_CONNECTION */
74584 DIO_PUT(uint8, &dout, &field_addr, real_packet->cause);
74585#ifdef FREECIV_JSON_CONNECTION
74586 field_addr.name = "reqs_count";
74587#endif /* FREECIV_JSON_CONNECTION */
74588 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
74589#ifdef FREECIV_JSON_CONNECTION
74590 field_addr.name = "reqs";
74591#endif /* FREECIV_JSON_CONNECTION */
74592
74593 {
74594 int i;
74595
74596#ifdef FREECIV_JSON_CONNECTION
74597 /* Create the array. */
74598 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
74599
74600 /* Enter the array. */
74601 field_addr.sub_location = plocation_elem_new(0);
74602#endif /* FREECIV_JSON_CONNECTION */
74603
74604 for (i = 0; i < real_packet->reqs_count; i++) {
74605#ifdef FREECIV_JSON_CONNECTION
74606 /* Next array element. */
74607 field_addr.sub_location->number = i;
74608#endif /* FREECIV_JSON_CONNECTION */
74609 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
74610 }
74611
74612#ifdef FREECIV_JSON_CONNECTION
74613 /* Exit array. */
74614 free(field_addr.sub_location);
74615 field_addr.sub_location = NULL;
74616#endif /* FREECIV_JSON_CONNECTION */
74617 }
74618#ifdef FREECIV_JSON_CONNECTION
74619 field_addr.name = "alternatives_count";
74620#endif /* FREECIV_JSON_CONNECTION */
74621 DIO_PUT(uint8, &dout, &field_addr, real_packet->alternatives_count);
74622#ifdef FREECIV_JSON_CONNECTION
74623 field_addr.name = "alternatives";
74624#endif /* FREECIV_JSON_CONNECTION */
74625
74626 {
74627 int i;
74628
74629#ifdef FREECIV_JSON_CONNECTION
74630 /* Create the array. */
74631 DIO_PUT(farray, &dout, &field_addr, real_packet->alternatives_count);
74632
74633 /* Enter the array. */
74634 field_addr.sub_location = plocation_elem_new(0);
74635#endif /* FREECIV_JSON_CONNECTION */
74636
74637 for (i = 0; i < real_packet->alternatives_count; i++) {
74638#ifdef FREECIV_JSON_CONNECTION
74639 /* Next array element. */
74640 field_addr.sub_location->number = i;
74641#endif /* FREECIV_JSON_CONNECTION */
74642 DIO_PUT(uint8, &dout, &field_addr, real_packet->alternatives[i]);
74643 }
74644
74645#ifdef FREECIV_JSON_CONNECTION
74646 /* Exit array. */
74647 free(field_addr.sub_location);
74648 field_addr.sub_location = NULL;
74649#endif /* FREECIV_JSON_CONNECTION */
74650 }
74651
74652#endif
74653 SEND_PACKET_END(PACKET_RULESET_ACTION_AUTO);
74654}
74655
74656 int send_packet_ruleset_action_auto(struct connection *pc, const struct packet_ruleset_action_auto *packet)
74657{
74658 if (!pc->used) {
74659 log_error("WARNING: trying to send data to the closed connection %s",
74660 conn_description(pc));
74661 return -1;
74662 }
74663 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ACTION_AUTO].packet != NULL, -1,
74664 "Handler for PACKET_RULESET_ACTION_AUTO not installed");
74665 return pc->phs.handlers->send[PACKET_RULESET_ACTION_AUTO].packet(pc, packet);
74666}
74667
74668 void lsend_packet_ruleset_action_auto(struct conn_list *dest, const struct packet_ruleset_action_auto *packet)
74669{
74670 conn_list_iterate(dest, pconn) {
74671 send_packet_ruleset_action_auto(pconn, packet);
74672 } conn_list_iterate_end;
74673}
74674
74675#ifdef FREECIV_DELTA_PROTOCOL
74676#define hash_packet_ruleset_music_100 hash_const
74677
74678#define cmp_packet_ruleset_music_100 cmp_const
74679
74680 BV_DEFINE(packet_ruleset_music_100_fields, 5);
74681#endif /* FREECIV_DELTA_PROTOCOL */
74682
74683 static struct packet_ruleset_music *receive_packet_ruleset_music_100(struct connection *pc)
74684{
74685#ifdef FREECIV_DELTA_PROTOCOL
74686 packet_ruleset_music_100_fields fields;
74687 struct packet_ruleset_music *old;
74688 struct genhash **hash = pc->phs.received + PACKET_RULESET_MUSIC;
74689#endif /* FREECIV_DELTA_PROTOCOL */
74690 RECEIVE_PACKET_START(packet_ruleset_music, real_packet);
74691#ifdef FREECIV_JSON_CONNECTION
74692 struct plocation field_addr;
74693 {
74694 struct plocation *field_addr_tmp = plocation_field_new(NULL);
74695 field_addr = *field_addr_tmp;
74696 FC_FREE(field_addr_tmp);
74697 }
74698#endif /* FREECIV_JSON_CONNECTION */
74699
74700#ifdef FREECIV_DELTA_PROTOCOL
74701#ifdef FREECIV_JSON_CONNECTION
74702 field_addr.name = "fields";
74703#endif /* FREECIV_JSON_CONNECTION */
74704 DIO_BV_GET(&din, &field_addr, fields);
74705
74706#else /* FREECIV_DELTA_PROTOCOL */
74707 #ifdef FREECIV_JSON_CONNECTION
74708 field_addr.name = "id";
74709 #endif /* FREECIV_JSON_CONNECTION */
74710 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
74711 RECEIVE_PACKET_FIELD_ERROR(id);
74712 }
74713 #ifdef FREECIV_JSON_CONNECTION
74714 field_addr.name = "music_peaceful";
74715 #endif /* FREECIV_JSON_CONNECTION */
74716 if (!DIO_GET(string, &din, &field_addr, real_packet->music_peaceful, sizeof(real_packet->music_peaceful))) {
74717 RECEIVE_PACKET_FIELD_ERROR(music_peaceful);
74718 }
74719 #ifdef FREECIV_JSON_CONNECTION
74720 field_addr.name = "music_combat";
74721 #endif /* FREECIV_JSON_CONNECTION */
74722 if (!DIO_GET(string, &din, &field_addr, real_packet->music_combat, sizeof(real_packet->music_combat))) {
74723 RECEIVE_PACKET_FIELD_ERROR(music_combat);
74724 }
74725 #ifdef FREECIV_JSON_CONNECTION
74726 field_addr.name = "reqs_count";
74727 #endif /* FREECIV_JSON_CONNECTION */
74728 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
74729 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
74730 }
74731 #ifdef FREECIV_JSON_CONNECTION
74732 field_addr.name = "reqs";
74733 #endif /* FREECIV_JSON_CONNECTION */
74734
74735 {
74736 int i;
74737
74738 #ifdef FREECIV_JSON_CONNECTION
74739 /* Enter array. */
74740 field_addr.sub_location = plocation_elem_new(0);
74741 #endif /* FREECIV_JSON_CONNECTION */
74742
74743 if (real_packet->reqs_count > MAX_NUM_REQS) {
74744 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
74745 }
74746 for (i = 0; i < real_packet->reqs_count; i++) {
74747 #ifdef FREECIV_JSON_CONNECTION
74748 field_addr.sub_location->number = i;
74749 #endif /* FREECIV_JSON_CONNECTION */
74750 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
74751 RECEIVE_PACKET_FIELD_ERROR(reqs);
74752 }
74753 }
74754
74755 #ifdef FREECIV_JSON_CONNECTION
74756 /* Exit array. */
74757 free(field_addr.sub_location);
74758 field_addr.sub_location = NULL;
74759 #endif /* FREECIV_JSON_CONNECTION */
74760 }
74761
74762#endif
74763 log_packet_detailed("packet_ruleset_music_100: got info about ()");
74764
74765#ifdef FREECIV_DELTA_PROTOCOL
74766 if (NULL == *hash) {
74767 *hash = genhash_new_full(hash_packet_ruleset_music_100, cmp_packet_ruleset_music_100,
74768 NULL, NULL, NULL, free);
74769 }
74770
74771 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
74772 *real_packet = *old;
74773 } else {
74774 log_packet_detailed(" no old info");
74775 memset(real_packet, 0, sizeof(*real_packet));
74776 }
74777
74778 if (BV_ISSET(fields, 0)) {
74779 log_packet_detailed(" got field 'id'");
74780 #ifdef FREECIV_JSON_CONNECTION
74781 field_addr.name = "id";
74782 #endif /* FREECIV_JSON_CONNECTION */
74783 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
74784 RECEIVE_PACKET_FIELD_ERROR(id);
74785 }
74786 }
74787 if (BV_ISSET(fields, 1)) {
74788 log_packet_detailed(" got field 'music_peaceful'");
74789 #ifdef FREECIV_JSON_CONNECTION
74790 field_addr.name = "music_peaceful";
74791 #endif /* FREECIV_JSON_CONNECTION */
74792 if (!DIO_GET(string, &din, &field_addr, real_packet->music_peaceful, sizeof(real_packet->music_peaceful))) {
74793 RECEIVE_PACKET_FIELD_ERROR(music_peaceful);
74794 }
74795 }
74796 if (BV_ISSET(fields, 2)) {
74797 log_packet_detailed(" got field 'music_combat'");
74798 #ifdef FREECIV_JSON_CONNECTION
74799 field_addr.name = "music_combat";
74800 #endif /* FREECIV_JSON_CONNECTION */
74801 if (!DIO_GET(string, &din, &field_addr, real_packet->music_combat, sizeof(real_packet->music_combat))) {
74802 RECEIVE_PACKET_FIELD_ERROR(music_combat);
74803 }
74804 }
74805 if (BV_ISSET(fields, 3)) {
74806 log_packet_detailed(" got field 'reqs_count'");
74807 #ifdef FREECIV_JSON_CONNECTION
74808 field_addr.name = "reqs_count";
74809 #endif /* FREECIV_JSON_CONNECTION */
74810 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
74811 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
74812 }
74813 }
74814 if (BV_ISSET(fields, 4)) {
74815 log_packet_detailed(" got field 'reqs'");
74816 #ifdef FREECIV_JSON_CONNECTION
74817 field_addr.name = "reqs";
74818 #endif /* FREECIV_JSON_CONNECTION */
74819
74820 {
74821 int i;
74822
74823 #ifdef FREECIV_JSON_CONNECTION
74824 /* Enter array. */
74825 field_addr.sub_location = plocation_elem_new(0);
74826 #endif /* FREECIV_JSON_CONNECTION */
74827
74828 if (real_packet->reqs_count > MAX_NUM_REQS) {
74829 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
74830 }
74831 for (i = 0; i < real_packet->reqs_count; i++) {
74832 #ifdef FREECIV_JSON_CONNECTION
74833 field_addr.sub_location->number = i;
74834 #endif /* FREECIV_JSON_CONNECTION */
74835 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
74836 RECEIVE_PACKET_FIELD_ERROR(reqs);
74837 }
74838 }
74839
74840 #ifdef FREECIV_JSON_CONNECTION
74841 /* Exit array. */
74842 free(field_addr.sub_location);
74843 field_addr.sub_location = NULL;
74844 #endif /* FREECIV_JSON_CONNECTION */
74845 }
74846 }
74847
74848 if (NULL == old) {
74849 old = fc_malloc(sizeof(*old));
74850 *old = *real_packet;
74851 genhash_insert(*hash, old, old);
74852 } else {
74853 *old = *real_packet;
74854 }
74855
74856#endif /* FREECIV_DELTA_PROTOCOL */
74857 RECEIVE_PACKET_END(real_packet);
74858}
74859
74860 static int send_packet_ruleset_music_100(struct connection *pc, const struct packet_ruleset_music *packet)
74861{
74862 const struct packet_ruleset_music *real_packet = packet;
74863#ifdef FREECIV_DELTA_PROTOCOL
74864 packet_ruleset_music_100_fields fields;
74865 struct packet_ruleset_music *old;
74866 bool differ;
74867 struct genhash **hash = pc->phs.sent + PACKET_RULESET_MUSIC;
74868#endif /* FREECIV_DELTA_PROTOCOL */
74869 SEND_PACKET_START(PACKET_RULESET_MUSIC);
74870#ifdef FREECIV_JSON_CONNECTION
74871 struct plocation field_addr;
74872 {
74873 struct plocation *field_addr_tmp = plocation_field_new(NULL);
74874 field_addr = *field_addr_tmp;
74875 FC_FREE(field_addr_tmp);
74876 }
74877#endif /* FREECIV_JSON_CONNECTION */
74878
74879 log_packet_detailed("packet_ruleset_music_100: sending info about ()");
74880
74881#ifdef FREECIV_DELTA_PROTOCOL
74882 if (NULL == *hash) {
74883 *hash = genhash_new_full(hash_packet_ruleset_music_100, cmp_packet_ruleset_music_100,
74884 NULL, NULL, NULL, free);
74885 }
74886 BV_CLR_ALL(fields);
74887
74888 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
74889 old = fc_malloc(sizeof(*old));
74890 *old = *real_packet;
74891 genhash_insert(*hash, old, old);
74892 memset(old, 0, sizeof(*old));
74893 }
74894 differ = (old->id != real_packet->id);
74895 if (differ) {
74896 BV_SET(fields, 0);
74897 }
74898
74899 differ = (strcmp(old->music_peaceful, real_packet->music_peaceful) != 0);
74900 if (differ) {
74901 BV_SET(fields, 1);
74902 }
74903
74904 differ = (strcmp(old->music_combat, real_packet->music_combat) != 0);
74905 if (differ) {
74906 BV_SET(fields, 2);
74907 }
74908
74909 differ = (old->reqs_count != real_packet->reqs_count);
74910 if (differ) {
74911 BV_SET(fields, 3);
74912 }
74913
74914
74915 {
74916 differ = (old->reqs_count != real_packet->reqs_count);
74917 if (!differ) {
74918 int i;
74919
74920 for (i = 0; i < real_packet->reqs_count; i++) {
74921 if (!are_requirements_equal(&old->reqs[i], &real_packet->reqs[i])) {
74922 differ = TRUE;
74923 break;
74924 }
74925 }
74926 }
74927 }
74928 if (differ) {
74929 BV_SET(fields, 4);
74930 }
74931
74932
74933#ifdef FREECIV_JSON_CONNECTION
74934 field_addr.name = "fields";
74935#endif /* FREECIV_JSON_CONNECTION */
74936 DIO_BV_PUT(&dout, &field_addr, fields);
74937
74938 if (BV_ISSET(fields, 0)) {
74939 log_packet_detailed(" field 'id' has changed");
74940 #ifdef FREECIV_JSON_CONNECTION
74941 field_addr.name = "id";
74942#endif /* FREECIV_JSON_CONNECTION */
74943 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
74944 }
74945 if (BV_ISSET(fields, 1)) {
74946 log_packet_detailed(" field 'music_peaceful' has changed");
74947 #ifdef FREECIV_JSON_CONNECTION
74948 field_addr.name = "music_peaceful";
74949#endif /* FREECIV_JSON_CONNECTION */
74950 DIO_PUT(string, &dout, &field_addr, real_packet->music_peaceful);
74951 }
74952 if (BV_ISSET(fields, 2)) {
74953 log_packet_detailed(" field 'music_combat' has changed");
74954 #ifdef FREECIV_JSON_CONNECTION
74955 field_addr.name = "music_combat";
74956#endif /* FREECIV_JSON_CONNECTION */
74957 DIO_PUT(string, &dout, &field_addr, real_packet->music_combat);
74958 }
74959 if (BV_ISSET(fields, 3)) {
74960 log_packet_detailed(" field 'reqs_count' has changed");
74961 #ifdef FREECIV_JSON_CONNECTION
74962 field_addr.name = "reqs_count";
74963#endif /* FREECIV_JSON_CONNECTION */
74964 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
74965 }
74966 if (BV_ISSET(fields, 4)) {
74967 log_packet_detailed(" field 'reqs' has changed");
74968 #ifdef FREECIV_JSON_CONNECTION
74969 field_addr.name = "reqs";
74970#endif /* FREECIV_JSON_CONNECTION */
74971
74972 {
74973 int i;
74974
74975#ifdef FREECIV_JSON_CONNECTION
74976 /* Create the array. */
74977 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
74978
74979 /* Enter the array. */
74980 field_addr.sub_location = plocation_elem_new(0);
74981#endif /* FREECIV_JSON_CONNECTION */
74982
74983 for (i = 0; i < real_packet->reqs_count; i++) {
74984#ifdef FREECIV_JSON_CONNECTION
74985 /* Next array element. */
74986 field_addr.sub_location->number = i;
74987#endif /* FREECIV_JSON_CONNECTION */
74988 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
74989 }
74990
74991#ifdef FREECIV_JSON_CONNECTION
74992 /* Exit array. */
74993 free(field_addr.sub_location);
74994 field_addr.sub_location = NULL;
74995#endif /* FREECIV_JSON_CONNECTION */
74996 }
74997 }
74998
74999 *old = *real_packet;
75000#endif /* FREECIV_DELTA_PROTOCOL */
75001#ifndef FREECIV_DELTA_PROTOCOL
75002#ifdef FREECIV_JSON_CONNECTION
75003 field_addr.name = "id";
75004#endif /* FREECIV_JSON_CONNECTION */
75005 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
75006#ifdef FREECIV_JSON_CONNECTION
75007 field_addr.name = "music_peaceful";
75008#endif /* FREECIV_JSON_CONNECTION */
75009 DIO_PUT(string, &dout, &field_addr, real_packet->music_peaceful);
75010#ifdef FREECIV_JSON_CONNECTION
75011 field_addr.name = "music_combat";
75012#endif /* FREECIV_JSON_CONNECTION */
75013 DIO_PUT(string, &dout, &field_addr, real_packet->music_combat);
75014#ifdef FREECIV_JSON_CONNECTION
75015 field_addr.name = "reqs_count";
75016#endif /* FREECIV_JSON_CONNECTION */
75017 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
75018#ifdef FREECIV_JSON_CONNECTION
75019 field_addr.name = "reqs";
75020#endif /* FREECIV_JSON_CONNECTION */
75021
75022 {
75023 int i;
75024
75025#ifdef FREECIV_JSON_CONNECTION
75026 /* Create the array. */
75027 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
75028
75029 /* Enter the array. */
75030 field_addr.sub_location = plocation_elem_new(0);
75031#endif /* FREECIV_JSON_CONNECTION */
75032
75033 for (i = 0; i < real_packet->reqs_count; i++) {
75034#ifdef FREECIV_JSON_CONNECTION
75035 /* Next array element. */
75036 field_addr.sub_location->number = i;
75037#endif /* FREECIV_JSON_CONNECTION */
75038 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
75039 }
75040
75041#ifdef FREECIV_JSON_CONNECTION
75042 /* Exit array. */
75043 free(field_addr.sub_location);
75044 field_addr.sub_location = NULL;
75045#endif /* FREECIV_JSON_CONNECTION */
75046 }
75047
75048#endif
75049 SEND_PACKET_END(PACKET_RULESET_MUSIC);
75050}
75051
75052 int send_packet_ruleset_music(struct connection *pc, const struct packet_ruleset_music *packet)
75053{
75054 if (!pc->used) {
75055 log_error("WARNING: trying to send data to the closed connection %s",
75056 conn_description(pc));
75057 return -1;
75058 }
75059 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_MUSIC].packet != NULL, -1,
75060 "Handler for PACKET_RULESET_MUSIC not installed");
75061 return pc->phs.handlers->send[PACKET_RULESET_MUSIC].packet(pc, packet);
75062}
75063
75064 void lsend_packet_ruleset_music(struct conn_list *dest, const struct packet_ruleset_music *packet)
75065{
75066 conn_list_iterate(dest, pconn) {
75067 send_packet_ruleset_music(pconn, packet);
75068 } conn_list_iterate_end;
75069}
75070
75071#ifdef FREECIV_DELTA_PROTOCOL
75072#define hash_packet_ruleset_multiplier_100 hash_const
75073
75074#define cmp_packet_ruleset_multiplier_100 cmp_const
75075
75076 BV_DEFINE(packet_ruleset_multiplier_100_fields, 13);
75077#endif /* FREECIV_DELTA_PROTOCOL */
75078
75079 static struct packet_ruleset_multiplier *receive_packet_ruleset_multiplier_100(struct connection *pc)
75080{
75081#ifdef FREECIV_DELTA_PROTOCOL
75082 packet_ruleset_multiplier_100_fields fields;
75083 struct packet_ruleset_multiplier *old;
75084 struct genhash **hash = pc->phs.received + PACKET_RULESET_MULTIPLIER;
75085#endif /* FREECIV_DELTA_PROTOCOL */
75086 RECEIVE_PACKET_START(packet_ruleset_multiplier, real_packet);
75087#ifdef FREECIV_JSON_CONNECTION
75088 struct plocation field_addr;
75089 {
75090 struct plocation *field_addr_tmp = plocation_field_new(NULL);
75091 field_addr = *field_addr_tmp;
75092 FC_FREE(field_addr_tmp);
75093 }
75094#endif /* FREECIV_JSON_CONNECTION */
75095
75096#ifdef FREECIV_DELTA_PROTOCOL
75097#ifdef FREECIV_JSON_CONNECTION
75098 field_addr.name = "fields";
75099#endif /* FREECIV_JSON_CONNECTION */
75100 DIO_BV_GET(&din, &field_addr, fields);
75101
75102#else /* FREECIV_DELTA_PROTOCOL */
75103 #ifdef FREECIV_JSON_CONNECTION
75104 field_addr.name = "id";
75105 #endif /* FREECIV_JSON_CONNECTION */
75106 {
75107 int readin;
75108
75109 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
75110 RECEIVE_PACKET_FIELD_ERROR(id);
75111 }
75112 real_packet->id = readin;
75113 }
75114 #ifdef FREECIV_JSON_CONNECTION
75115 field_addr.name = "start";
75116 #endif /* FREECIV_JSON_CONNECTION */
75117 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->start)) {
75118 RECEIVE_PACKET_FIELD_ERROR(start);
75119 }
75120 #ifdef FREECIV_JSON_CONNECTION
75121 field_addr.name = "stop";
75122 #endif /* FREECIV_JSON_CONNECTION */
75123 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->stop)) {
75124 RECEIVE_PACKET_FIELD_ERROR(stop);
75125 }
75126 #ifdef FREECIV_JSON_CONNECTION
75127 field_addr.name = "step";
75128 #endif /* FREECIV_JSON_CONNECTION */
75129 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->step)) {
75130 RECEIVE_PACKET_FIELD_ERROR(step);
75131 }
75132 #ifdef FREECIV_JSON_CONNECTION
75133 field_addr.name = "def";
75134 #endif /* FREECIV_JSON_CONNECTION */
75135 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->def)) {
75136 RECEIVE_PACKET_FIELD_ERROR(def);
75137 }
75138 #ifdef FREECIV_JSON_CONNECTION
75139 field_addr.name = "offset";
75140 #endif /* FREECIV_JSON_CONNECTION */
75141 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->offset)) {
75142 RECEIVE_PACKET_FIELD_ERROR(offset);
75143 }
75144 #ifdef FREECIV_JSON_CONNECTION
75145 field_addr.name = "factor";
75146 #endif /* FREECIV_JSON_CONNECTION */
75147 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->factor)) {
75148 RECEIVE_PACKET_FIELD_ERROR(factor);
75149 }
75150 #ifdef FREECIV_JSON_CONNECTION
75151 field_addr.name = "minimum_turns";
75152 #endif /* FREECIV_JSON_CONNECTION */
75153 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->minimum_turns)) {
75154 RECEIVE_PACKET_FIELD_ERROR(minimum_turns);
75155 }
75156 #ifdef FREECIV_JSON_CONNECTION
75157 field_addr.name = "name";
75158 #endif /* FREECIV_JSON_CONNECTION */
75159 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
75160 RECEIVE_PACKET_FIELD_ERROR(name);
75161 }
75162 #ifdef FREECIV_JSON_CONNECTION
75163 field_addr.name = "rule_name";
75164 #endif /* FREECIV_JSON_CONNECTION */
75165 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
75166 RECEIVE_PACKET_FIELD_ERROR(rule_name);
75167 }
75168 #ifdef FREECIV_JSON_CONNECTION
75169 field_addr.name = "reqs_count";
75170 #endif /* FREECIV_JSON_CONNECTION */
75171 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
75172 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
75173 }
75174 #ifdef FREECIV_JSON_CONNECTION
75175 field_addr.name = "reqs";
75176 #endif /* FREECIV_JSON_CONNECTION */
75177
75178 {
75179 int i;
75180
75181 #ifdef FREECIV_JSON_CONNECTION
75182 /* Enter array. */
75183 field_addr.sub_location = plocation_elem_new(0);
75184 #endif /* FREECIV_JSON_CONNECTION */
75185
75186 if (real_packet->reqs_count > MAX_NUM_REQS) {
75187 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
75188 }
75189 for (i = 0; i < real_packet->reqs_count; i++) {
75190 #ifdef FREECIV_JSON_CONNECTION
75191 field_addr.sub_location->number = i;
75192 #endif /* FREECIV_JSON_CONNECTION */
75193 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
75194 RECEIVE_PACKET_FIELD_ERROR(reqs);
75195 }
75196 }
75197
75198 #ifdef FREECIV_JSON_CONNECTION
75199 /* Exit array. */
75200 free(field_addr.sub_location);
75201 field_addr.sub_location = NULL;
75202 #endif /* FREECIV_JSON_CONNECTION */
75203 }
75204 #ifdef FREECIV_JSON_CONNECTION
75205 field_addr.name = "helptext";
75206 #endif /* FREECIV_JSON_CONNECTION */
75207 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
75208 RECEIVE_PACKET_FIELD_ERROR(helptext);
75209 }
75210
75211#endif
75212 log_packet_detailed("packet_ruleset_multiplier_100: got info about ()");
75213
75214#ifdef FREECIV_DELTA_PROTOCOL
75215 if (NULL == *hash) {
75216 *hash = genhash_new_full(hash_packet_ruleset_multiplier_100, cmp_packet_ruleset_multiplier_100,
75217 NULL, NULL, NULL, free);
75218 }
75219
75220 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
75221 *real_packet = *old;
75222 } else {
75223 log_packet_detailed(" no old info");
75224 memset(real_packet, 0, sizeof(*real_packet));
75225 }
75226
75227 if (BV_ISSET(fields, 0)) {
75228 log_packet_detailed(" got field 'id'");
75229 #ifdef FREECIV_JSON_CONNECTION
75230 field_addr.name = "id";
75231 #endif /* FREECIV_JSON_CONNECTION */
75232 {
75233 int readin;
75234
75235 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
75236 RECEIVE_PACKET_FIELD_ERROR(id);
75237 }
75238 real_packet->id = readin;
75239 }
75240 }
75241 if (BV_ISSET(fields, 1)) {
75242 log_packet_detailed(" got field 'start'");
75243 #ifdef FREECIV_JSON_CONNECTION
75244 field_addr.name = "start";
75245 #endif /* FREECIV_JSON_CONNECTION */
75246 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->start)) {
75247 RECEIVE_PACKET_FIELD_ERROR(start);
75248 }
75249 }
75250 if (BV_ISSET(fields, 2)) {
75251 log_packet_detailed(" got field 'stop'");
75252 #ifdef FREECIV_JSON_CONNECTION
75253 field_addr.name = "stop";
75254 #endif /* FREECIV_JSON_CONNECTION */
75255 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->stop)) {
75256 RECEIVE_PACKET_FIELD_ERROR(stop);
75257 }
75258 }
75259 if (BV_ISSET(fields, 3)) {
75260 log_packet_detailed(" got field 'step'");
75261 #ifdef FREECIV_JSON_CONNECTION
75262 field_addr.name = "step";
75263 #endif /* FREECIV_JSON_CONNECTION */
75264 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->step)) {
75265 RECEIVE_PACKET_FIELD_ERROR(step);
75266 }
75267 }
75268 if (BV_ISSET(fields, 4)) {
75269 log_packet_detailed(" got field 'def'");
75270 #ifdef FREECIV_JSON_CONNECTION
75271 field_addr.name = "def";
75272 #endif /* FREECIV_JSON_CONNECTION */
75273 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->def)) {
75274 RECEIVE_PACKET_FIELD_ERROR(def);
75275 }
75276 }
75277 if (BV_ISSET(fields, 5)) {
75278 log_packet_detailed(" got field 'offset'");
75279 #ifdef FREECIV_JSON_CONNECTION
75280 field_addr.name = "offset";
75281 #endif /* FREECIV_JSON_CONNECTION */
75282 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->offset)) {
75283 RECEIVE_PACKET_FIELD_ERROR(offset);
75284 }
75285 }
75286 if (BV_ISSET(fields, 6)) {
75287 log_packet_detailed(" got field 'factor'");
75288 #ifdef FREECIV_JSON_CONNECTION
75289 field_addr.name = "factor";
75290 #endif /* FREECIV_JSON_CONNECTION */
75291 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->factor)) {
75292 RECEIVE_PACKET_FIELD_ERROR(factor);
75293 }
75294 }
75295 if (BV_ISSET(fields, 7)) {
75296 log_packet_detailed(" got field 'minimum_turns'");
75297 #ifdef FREECIV_JSON_CONNECTION
75298 field_addr.name = "minimum_turns";
75299 #endif /* FREECIV_JSON_CONNECTION */
75300 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->minimum_turns)) {
75301 RECEIVE_PACKET_FIELD_ERROR(minimum_turns);
75302 }
75303 }
75304 if (BV_ISSET(fields, 8)) {
75305 log_packet_detailed(" got field 'name'");
75306 #ifdef FREECIV_JSON_CONNECTION
75307 field_addr.name = "name";
75308 #endif /* FREECIV_JSON_CONNECTION */
75309 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
75310 RECEIVE_PACKET_FIELD_ERROR(name);
75311 }
75312 }
75313 if (BV_ISSET(fields, 9)) {
75314 log_packet_detailed(" got field 'rule_name'");
75315 #ifdef FREECIV_JSON_CONNECTION
75316 field_addr.name = "rule_name";
75317 #endif /* FREECIV_JSON_CONNECTION */
75318 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
75319 RECEIVE_PACKET_FIELD_ERROR(rule_name);
75320 }
75321 }
75322 if (BV_ISSET(fields, 10)) {
75323 log_packet_detailed(" got field 'reqs_count'");
75324 #ifdef FREECIV_JSON_CONNECTION
75325 field_addr.name = "reqs_count";
75326 #endif /* FREECIV_JSON_CONNECTION */
75327 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
75328 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
75329 }
75330 }
75331 if (BV_ISSET(fields, 11)) {
75332 log_packet_detailed(" got field 'reqs'");
75333 #ifdef FREECIV_JSON_CONNECTION
75334 field_addr.name = "reqs";
75335 #endif /* FREECIV_JSON_CONNECTION */
75336
75337 {
75338 int i;
75339
75340 #ifdef FREECIV_JSON_CONNECTION
75341 /* Enter array. */
75342 field_addr.sub_location = plocation_elem_new(0);
75343 #endif /* FREECIV_JSON_CONNECTION */
75344
75345 if (real_packet->reqs_count > MAX_NUM_REQS) {
75346 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
75347 }
75348 for (i = 0; i < real_packet->reqs_count; i++) {
75349 #ifdef FREECIV_JSON_CONNECTION
75350 field_addr.sub_location->number = i;
75351 #endif /* FREECIV_JSON_CONNECTION */
75352 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
75353 RECEIVE_PACKET_FIELD_ERROR(reqs);
75354 }
75355 }
75356
75357 #ifdef FREECIV_JSON_CONNECTION
75358 /* Exit array. */
75359 free(field_addr.sub_location);
75360 field_addr.sub_location = NULL;
75361 #endif /* FREECIV_JSON_CONNECTION */
75362 }
75363 }
75364 if (BV_ISSET(fields, 12)) {
75365 log_packet_detailed(" got field 'helptext'");
75366 #ifdef FREECIV_JSON_CONNECTION
75367 field_addr.name = "helptext";
75368 #endif /* FREECIV_JSON_CONNECTION */
75369 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
75370 RECEIVE_PACKET_FIELD_ERROR(helptext);
75371 }
75372 }
75373
75374 if (NULL == old) {
75375 old = fc_malloc(sizeof(*old));
75376 *old = *real_packet;
75377 genhash_insert(*hash, old, old);
75378 } else {
75379 *old = *real_packet;
75380 }
75381
75382#endif /* FREECIV_DELTA_PROTOCOL */
75383 RECEIVE_PACKET_END(real_packet);
75384}
75385
75386 static int send_packet_ruleset_multiplier_100(struct connection *pc, const struct packet_ruleset_multiplier *packet)
75387{
75388 const struct packet_ruleset_multiplier *real_packet = packet;
75389#ifdef FREECIV_DELTA_PROTOCOL
75390 packet_ruleset_multiplier_100_fields fields;
75391 struct packet_ruleset_multiplier *old;
75392 bool differ;
75393 struct genhash **hash = pc->phs.sent + PACKET_RULESET_MULTIPLIER;
75394#endif /* FREECIV_DELTA_PROTOCOL */
75395 SEND_PACKET_START(PACKET_RULESET_MULTIPLIER);
75396#ifdef FREECIV_JSON_CONNECTION
75397 struct plocation field_addr;
75398 {
75399 struct plocation *field_addr_tmp = plocation_field_new(NULL);
75400 field_addr = *field_addr_tmp;
75401 FC_FREE(field_addr_tmp);
75402 }
75403#endif /* FREECIV_JSON_CONNECTION */
75404
75405 log_packet_detailed("packet_ruleset_multiplier_100: sending info about ()");
75406
75407#ifdef FREECIV_DELTA_PROTOCOL
75408 if (NULL == *hash) {
75409 *hash = genhash_new_full(hash_packet_ruleset_multiplier_100, cmp_packet_ruleset_multiplier_100,
75410 NULL, NULL, NULL, free);
75411 }
75412 BV_CLR_ALL(fields);
75413
75414 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
75415 old = fc_malloc(sizeof(*old));
75416 *old = *real_packet;
75417 genhash_insert(*hash, old, old);
75418 memset(old, 0, sizeof(*old));
75419 }
75420 differ = (old->id != real_packet->id);
75421 if (differ) {
75422 BV_SET(fields, 0);
75423 }
75424
75425 differ = (old->start != real_packet->start);
75426 if (differ) {
75427 BV_SET(fields, 1);
75428 }
75429
75430 differ = (old->stop != real_packet->stop);
75431 if (differ) {
75432 BV_SET(fields, 2);
75433 }
75434
75435 differ = (old->step != real_packet->step);
75436 if (differ) {
75437 BV_SET(fields, 3);
75438 }
75439
75440 differ = (old->def != real_packet->def);
75441 if (differ) {
75442 BV_SET(fields, 4);
75443 }
75444
75445 differ = (old->offset != real_packet->offset);
75446 if (differ) {
75447 BV_SET(fields, 5);
75448 }
75449
75450 differ = (old->factor != real_packet->factor);
75451 if (differ) {
75452 BV_SET(fields, 6);
75453 }
75454
75455 differ = (old->minimum_turns != real_packet->minimum_turns);
75456 if (differ) {
75457 BV_SET(fields, 7);
75458 }
75459
75460 differ = (strcmp(old->name, real_packet->name) != 0);
75461 if (differ) {
75462 BV_SET(fields, 8);
75463 }
75464
75465 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
75466 if (differ) {
75467 BV_SET(fields, 9);
75468 }
75469
75470 differ = (old->reqs_count != real_packet->reqs_count);
75471 if (differ) {
75472 BV_SET(fields, 10);
75473 }
75474
75475
75476 {
75477 differ = (old->reqs_count != real_packet->reqs_count);
75478 if (!differ) {
75479 int i;
75480
75481 for (i = 0; i < real_packet->reqs_count; i++) {
75482 if (!are_requirements_equal(&old->reqs[i], &real_packet->reqs[i])) {
75483 differ = TRUE;
75484 break;
75485 }
75486 }
75487 }
75488 }
75489 if (differ) {
75490 BV_SET(fields, 11);
75491 }
75492
75493 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
75494 if (differ) {
75495 BV_SET(fields, 12);
75496 }
75497
75498
75499#ifdef FREECIV_JSON_CONNECTION
75500 field_addr.name = "fields";
75501#endif /* FREECIV_JSON_CONNECTION */
75502 DIO_BV_PUT(&dout, &field_addr, fields);
75503
75504 if (BV_ISSET(fields, 0)) {
75505 log_packet_detailed(" field 'id' has changed");
75506 #ifdef FREECIV_JSON_CONNECTION
75507 field_addr.name = "id";
75508#endif /* FREECIV_JSON_CONNECTION */
75509 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
75510 }
75511 if (BV_ISSET(fields, 1)) {
75512 log_packet_detailed(" field 'start' has changed");
75513 #ifdef FREECIV_JSON_CONNECTION
75514 field_addr.name = "start";
75515#endif /* FREECIV_JSON_CONNECTION */
75516 DIO_PUT(sint32, &dout, &field_addr, real_packet->start);
75517 }
75518 if (BV_ISSET(fields, 2)) {
75519 log_packet_detailed(" field 'stop' has changed");
75520 #ifdef FREECIV_JSON_CONNECTION
75521 field_addr.name = "stop";
75522#endif /* FREECIV_JSON_CONNECTION */
75523 DIO_PUT(sint32, &dout, &field_addr, real_packet->stop);
75524 }
75525 if (BV_ISSET(fields, 3)) {
75526 log_packet_detailed(" field 'step' has changed");
75527 #ifdef FREECIV_JSON_CONNECTION
75528 field_addr.name = "step";
75529#endif /* FREECIV_JSON_CONNECTION */
75530 DIO_PUT(uint32, &dout, &field_addr, real_packet->step);
75531 }
75532 if (BV_ISSET(fields, 4)) {
75533 log_packet_detailed(" field 'def' has changed");
75534 #ifdef FREECIV_JSON_CONNECTION
75535 field_addr.name = "def";
75536#endif /* FREECIV_JSON_CONNECTION */
75537 DIO_PUT(sint32, &dout, &field_addr, real_packet->def);
75538 }
75539 if (BV_ISSET(fields, 5)) {
75540 log_packet_detailed(" field 'offset' has changed");
75541 #ifdef FREECIV_JSON_CONNECTION
75542 field_addr.name = "offset";
75543#endif /* FREECIV_JSON_CONNECTION */
75544 DIO_PUT(sint32, &dout, &field_addr, real_packet->offset);
75545 }
75546 if (BV_ISSET(fields, 6)) {
75547 log_packet_detailed(" field 'factor' has changed");
75548 #ifdef FREECIV_JSON_CONNECTION
75549 field_addr.name = "factor";
75550#endif /* FREECIV_JSON_CONNECTION */
75551 DIO_PUT(sint32, &dout, &field_addr, real_packet->factor);
75552 }
75553 if (BV_ISSET(fields, 7)) {
75554 log_packet_detailed(" field 'minimum_turns' has changed");
75555 #ifdef FREECIV_JSON_CONNECTION
75556 field_addr.name = "minimum_turns";
75557#endif /* FREECIV_JSON_CONNECTION */
75558 DIO_PUT(uint16, &dout, &field_addr, real_packet->minimum_turns);
75559 }
75560 if (BV_ISSET(fields, 8)) {
75561 log_packet_detailed(" field 'name' has changed");
75562 #ifdef FREECIV_JSON_CONNECTION
75563 field_addr.name = "name";
75564#endif /* FREECIV_JSON_CONNECTION */
75565 DIO_PUT(string, &dout, &field_addr, real_packet->name);
75566 }
75567 if (BV_ISSET(fields, 9)) {
75568 log_packet_detailed(" field 'rule_name' has changed");
75569 #ifdef FREECIV_JSON_CONNECTION
75570 field_addr.name = "rule_name";
75571#endif /* FREECIV_JSON_CONNECTION */
75572 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
75573 }
75574 if (BV_ISSET(fields, 10)) {
75575 log_packet_detailed(" field 'reqs_count' has changed");
75576 #ifdef FREECIV_JSON_CONNECTION
75577 field_addr.name = "reqs_count";
75578#endif /* FREECIV_JSON_CONNECTION */
75579 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
75580 }
75581 if (BV_ISSET(fields, 11)) {
75582 log_packet_detailed(" field 'reqs' has changed");
75583 #ifdef FREECIV_JSON_CONNECTION
75584 field_addr.name = "reqs";
75585#endif /* FREECIV_JSON_CONNECTION */
75586
75587 {
75588 int i;
75589
75590#ifdef FREECIV_JSON_CONNECTION
75591 /* Create the array. */
75592 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
75593
75594 /* Enter the array. */
75595 field_addr.sub_location = plocation_elem_new(0);
75596#endif /* FREECIV_JSON_CONNECTION */
75597
75598 for (i = 0; i < real_packet->reqs_count; i++) {
75599#ifdef FREECIV_JSON_CONNECTION
75600 /* Next array element. */
75601 field_addr.sub_location->number = i;
75602#endif /* FREECIV_JSON_CONNECTION */
75603 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
75604 }
75605
75606#ifdef FREECIV_JSON_CONNECTION
75607 /* Exit array. */
75608 free(field_addr.sub_location);
75609 field_addr.sub_location = NULL;
75610#endif /* FREECIV_JSON_CONNECTION */
75611 }
75612 }
75613 if (BV_ISSET(fields, 12)) {
75614 log_packet_detailed(" field 'helptext' has changed");
75615 #ifdef FREECIV_JSON_CONNECTION
75616 field_addr.name = "helptext";
75617#endif /* FREECIV_JSON_CONNECTION */
75618 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
75619 }
75620
75621 *old = *real_packet;
75622#endif /* FREECIV_DELTA_PROTOCOL */
75623#ifndef FREECIV_DELTA_PROTOCOL
75624#ifdef FREECIV_JSON_CONNECTION
75625 field_addr.name = "id";
75626#endif /* FREECIV_JSON_CONNECTION */
75627 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
75628#ifdef FREECIV_JSON_CONNECTION
75629 field_addr.name = "start";
75630#endif /* FREECIV_JSON_CONNECTION */
75631 DIO_PUT(sint32, &dout, &field_addr, real_packet->start);
75632#ifdef FREECIV_JSON_CONNECTION
75633 field_addr.name = "stop";
75634#endif /* FREECIV_JSON_CONNECTION */
75635 DIO_PUT(sint32, &dout, &field_addr, real_packet->stop);
75636#ifdef FREECIV_JSON_CONNECTION
75637 field_addr.name = "step";
75638#endif /* FREECIV_JSON_CONNECTION */
75639 DIO_PUT(uint32, &dout, &field_addr, real_packet->step);
75640#ifdef FREECIV_JSON_CONNECTION
75641 field_addr.name = "def";
75642#endif /* FREECIV_JSON_CONNECTION */
75643 DIO_PUT(sint32, &dout, &field_addr, real_packet->def);
75644#ifdef FREECIV_JSON_CONNECTION
75645 field_addr.name = "offset";
75646#endif /* FREECIV_JSON_CONNECTION */
75647 DIO_PUT(sint32, &dout, &field_addr, real_packet->offset);
75648#ifdef FREECIV_JSON_CONNECTION
75649 field_addr.name = "factor";
75650#endif /* FREECIV_JSON_CONNECTION */
75651 DIO_PUT(sint32, &dout, &field_addr, real_packet->factor);
75652#ifdef FREECIV_JSON_CONNECTION
75653 field_addr.name = "minimum_turns";
75654#endif /* FREECIV_JSON_CONNECTION */
75655 DIO_PUT(uint16, &dout, &field_addr, real_packet->minimum_turns);
75656#ifdef FREECIV_JSON_CONNECTION
75657 field_addr.name = "name";
75658#endif /* FREECIV_JSON_CONNECTION */
75659 DIO_PUT(string, &dout, &field_addr, real_packet->name);
75660#ifdef FREECIV_JSON_CONNECTION
75661 field_addr.name = "rule_name";
75662#endif /* FREECIV_JSON_CONNECTION */
75663 DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
75664#ifdef FREECIV_JSON_CONNECTION
75665 field_addr.name = "reqs_count";
75666#endif /* FREECIV_JSON_CONNECTION */
75667 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
75668#ifdef FREECIV_JSON_CONNECTION
75669 field_addr.name = "reqs";
75670#endif /* FREECIV_JSON_CONNECTION */
75671
75672 {
75673 int i;
75674
75675#ifdef FREECIV_JSON_CONNECTION
75676 /* Create the array. */
75677 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
75678
75679 /* Enter the array. */
75680 field_addr.sub_location = plocation_elem_new(0);
75681#endif /* FREECIV_JSON_CONNECTION */
75682
75683 for (i = 0; i < real_packet->reqs_count; i++) {
75684#ifdef FREECIV_JSON_CONNECTION
75685 /* Next array element. */
75686 field_addr.sub_location->number = i;
75687#endif /* FREECIV_JSON_CONNECTION */
75688 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
75689 }
75690
75691#ifdef FREECIV_JSON_CONNECTION
75692 /* Exit array. */
75693 free(field_addr.sub_location);
75694 field_addr.sub_location = NULL;
75695#endif /* FREECIV_JSON_CONNECTION */
75696 }
75697#ifdef FREECIV_JSON_CONNECTION
75698 field_addr.name = "helptext";
75699#endif /* FREECIV_JSON_CONNECTION */
75700 DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
75701
75702#endif
75703 SEND_PACKET_END(PACKET_RULESET_MULTIPLIER);
75704}
75705
75706 int send_packet_ruleset_multiplier(struct connection *pc, const struct packet_ruleset_multiplier *packet)
75707{
75708 if (!pc->used) {
75709 log_error("WARNING: trying to send data to the closed connection %s",
75710 conn_description(pc));
75711 return -1;
75712 }
75713 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_MULTIPLIER].packet != NULL, -1,
75714 "Handler for PACKET_RULESET_MULTIPLIER not installed");
75715 return pc->phs.handlers->send[PACKET_RULESET_MULTIPLIER].packet(pc, packet);
75716}
75717
75718 void lsend_packet_ruleset_multiplier(struct conn_list *dest, const struct packet_ruleset_multiplier *packet)
75719{
75720 conn_list_iterate(dest, pconn) {
75721 send_packet_ruleset_multiplier(pconn, packet);
75722 } conn_list_iterate_end;
75723}
75724
75725 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)
75726{
75727 struct packet_ruleset_multiplier packet, *real_packet = &packet;
75728
75729 real_packet->id = id;
75730 real_packet->start = start;
75731 real_packet->stop = stop;
75732 real_packet->step = step;
75733 real_packet->def = def;
75734 real_packet->offset = offset;
75735 real_packet->factor = factor;
75736 real_packet->minimum_turns = minimum_turns;
75737 sz_strlcpy(real_packet->name, name);
75738 sz_strlcpy(real_packet->rule_name, rule_name);
75739 real_packet->reqs_count = reqs_count;
75740 {
75741 int i;
75742
75743 for (i = 0; i < real_packet->reqs_count; i++) {
75744 real_packet->reqs[i] = reqs[i];
75745 }
75746 }
75747 sz_strlcpy(real_packet->helptext, helptext);
75748
75749 return send_packet_ruleset_multiplier(pc, real_packet);
75750}
75751
75752 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)
75753{
75754 struct packet_ruleset_multiplier packet, *real_packet = &packet;
75755
75756 real_packet->id = id;
75757 real_packet->start = start;
75758 real_packet->stop = stop;
75759 real_packet->step = step;
75760 real_packet->def = def;
75761 real_packet->offset = offset;
75762 real_packet->factor = factor;
75763 real_packet->minimum_turns = minimum_turns;
75764 sz_strlcpy(real_packet->name, name);
75765 sz_strlcpy(real_packet->rule_name, rule_name);
75766 real_packet->reqs_count = reqs_count;
75767 {
75768 int i;
75769
75770 for (i = 0; i < real_packet->reqs_count; i++) {
75771 real_packet->reqs[i] = reqs[i];
75772 }
75773 }
75774 sz_strlcpy(real_packet->helptext, helptext);
75775
75776 lsend_packet_ruleset_multiplier(dest, real_packet);
75777}
75778
75779#ifdef FREECIV_DELTA_PROTOCOL
75780#define hash_packet_ruleset_clause_100 hash_const
75781
75782#define cmp_packet_ruleset_clause_100 cmp_const
75783
75784 BV_DEFINE(packet_ruleset_clause_100_fields, 6);
75785#endif /* FREECIV_DELTA_PROTOCOL */
75786
75787 static struct packet_ruleset_clause *receive_packet_ruleset_clause_100(struct connection *pc)
75788{
75789#ifdef FREECIV_DELTA_PROTOCOL
75790 packet_ruleset_clause_100_fields fields;
75791 struct packet_ruleset_clause *old;
75792 struct genhash **hash = pc->phs.received + PACKET_RULESET_CLAUSE;
75793#endif /* FREECIV_DELTA_PROTOCOL */
75794 RECEIVE_PACKET_START(packet_ruleset_clause, real_packet);
75795#ifdef FREECIV_JSON_CONNECTION
75796 struct plocation field_addr;
75797 {
75798 struct plocation *field_addr_tmp = plocation_field_new(NULL);
75799 field_addr = *field_addr_tmp;
75800 FC_FREE(field_addr_tmp);
75801 }
75802#endif /* FREECIV_JSON_CONNECTION */
75803
75804#ifdef FREECIV_DELTA_PROTOCOL
75805#ifdef FREECIV_JSON_CONNECTION
75806 field_addr.name = "fields";
75807#endif /* FREECIV_JSON_CONNECTION */
75808 DIO_BV_GET(&din, &field_addr, fields);
75809
75810#else /* FREECIV_DELTA_PROTOCOL */
75811 #ifdef FREECIV_JSON_CONNECTION
75812 field_addr.name = "type";
75813 #endif /* FREECIV_JSON_CONNECTION */
75814 {
75815 int readin;
75816
75817 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
75818 RECEIVE_PACKET_FIELD_ERROR(type);
75819 }
75820 real_packet->type = readin;
75821 }
75822 #ifdef FREECIV_JSON_CONNECTION
75823 field_addr.name = "enabled";
75824 #endif /* FREECIV_JSON_CONNECTION */
75825 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->enabled)) {
75826 RECEIVE_PACKET_FIELD_ERROR(enabled);
75827 }
75828 #ifdef FREECIV_JSON_CONNECTION
75829 field_addr.name = "giver_reqs_count";
75830 #endif /* FREECIV_JSON_CONNECTION */
75831 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->giver_reqs_count)) {
75832 RECEIVE_PACKET_FIELD_ERROR(giver_reqs_count);
75833 }
75834 #ifdef FREECIV_JSON_CONNECTION
75835 field_addr.name = "giver_reqs";
75836 #endif /* FREECIV_JSON_CONNECTION */
75837
75838 {
75839 int i;
75840
75841 #ifdef FREECIV_JSON_CONNECTION
75842 /* Enter array. */
75843 field_addr.sub_location = plocation_elem_new(0);
75844 #endif /* FREECIV_JSON_CONNECTION */
75845
75846 if (real_packet->giver_reqs_count > MAX_NUM_REQS) {
75847 RECEIVE_PACKET_FIELD_ERROR(giver_reqs, ": truncation array");
75848 }
75849 for (i = 0; i < real_packet->giver_reqs_count; i++) {
75850 #ifdef FREECIV_JSON_CONNECTION
75851 field_addr.sub_location->number = i;
75852 #endif /* FREECIV_JSON_CONNECTION */
75853 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->giver_reqs[i])) {
75854 RECEIVE_PACKET_FIELD_ERROR(giver_reqs);
75855 }
75856 }
75857
75858 #ifdef FREECIV_JSON_CONNECTION
75859 /* Exit array. */
75860 free(field_addr.sub_location);
75861 field_addr.sub_location = NULL;
75862 #endif /* FREECIV_JSON_CONNECTION */
75863 }
75864 #ifdef FREECIV_JSON_CONNECTION
75865 field_addr.name = "receiver_reqs_count";
75866 #endif /* FREECIV_JSON_CONNECTION */
75867 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->receiver_reqs_count)) {
75868 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs_count);
75869 }
75870 #ifdef FREECIV_JSON_CONNECTION
75871 field_addr.name = "receiver_reqs";
75872 #endif /* FREECIV_JSON_CONNECTION */
75873
75874 {
75875 int i;
75876
75877 #ifdef FREECIV_JSON_CONNECTION
75878 /* Enter array. */
75879 field_addr.sub_location = plocation_elem_new(0);
75880 #endif /* FREECIV_JSON_CONNECTION */
75881
75882 if (real_packet->receiver_reqs_count > MAX_NUM_REQS) {
75883 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs, ": truncation array");
75884 }
75885 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
75886 #ifdef FREECIV_JSON_CONNECTION
75887 field_addr.sub_location->number = i;
75888 #endif /* FREECIV_JSON_CONNECTION */
75889 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->receiver_reqs[i])) {
75890 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs);
75891 }
75892 }
75893
75894 #ifdef FREECIV_JSON_CONNECTION
75895 /* Exit array. */
75896 free(field_addr.sub_location);
75897 field_addr.sub_location = NULL;
75898 #endif /* FREECIV_JSON_CONNECTION */
75899 }
75900
75901#endif
75902 log_packet_detailed("packet_ruleset_clause_100: got info about ()");
75903
75904#ifdef FREECIV_DELTA_PROTOCOL
75905 if (NULL == *hash) {
75906 *hash = genhash_new_full(hash_packet_ruleset_clause_100, cmp_packet_ruleset_clause_100,
75907 NULL, NULL, NULL, free);
75908 }
75909
75910 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
75911 *real_packet = *old;
75912 } else {
75913 log_packet_detailed(" no old info");
75914 memset(real_packet, 0, sizeof(*real_packet));
75915 }
75916
75917 if (BV_ISSET(fields, 0)) {
75918 log_packet_detailed(" got field 'type'");
75919 #ifdef FREECIV_JSON_CONNECTION
75920 field_addr.name = "type";
75921 #endif /* FREECIV_JSON_CONNECTION */
75922 {
75923 int readin;
75924
75925 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
75926 RECEIVE_PACKET_FIELD_ERROR(type);
75927 }
75928 real_packet->type = readin;
75929 }
75930 }
75931 real_packet->enabled = BV_ISSET(fields, 1);
75932 if (BV_ISSET(fields, 2)) {
75933 log_packet_detailed(" got field 'giver_reqs_count'");
75934 #ifdef FREECIV_JSON_CONNECTION
75935 field_addr.name = "giver_reqs_count";
75936 #endif /* FREECIV_JSON_CONNECTION */
75937 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->giver_reqs_count)) {
75938 RECEIVE_PACKET_FIELD_ERROR(giver_reqs_count);
75939 }
75940 }
75941 if (BV_ISSET(fields, 3)) {
75942 log_packet_detailed(" got field 'giver_reqs'");
75943 #ifdef FREECIV_JSON_CONNECTION
75944 field_addr.name = "giver_reqs";
75945 #endif /* FREECIV_JSON_CONNECTION */
75946
75947 {
75948 int i;
75949
75950 #ifdef FREECIV_JSON_CONNECTION
75951 /* Enter array. */
75952 field_addr.sub_location = plocation_elem_new(0);
75953 #endif /* FREECIV_JSON_CONNECTION */
75954
75955 if (real_packet->giver_reqs_count > MAX_NUM_REQS) {
75956 RECEIVE_PACKET_FIELD_ERROR(giver_reqs, ": truncation array");
75957 }
75958 for (i = 0; i < real_packet->giver_reqs_count; i++) {
75959 #ifdef FREECIV_JSON_CONNECTION
75960 field_addr.sub_location->number = i;
75961 #endif /* FREECIV_JSON_CONNECTION */
75962 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->giver_reqs[i])) {
75963 RECEIVE_PACKET_FIELD_ERROR(giver_reqs);
75964 }
75965 }
75966
75967 #ifdef FREECIV_JSON_CONNECTION
75968 /* Exit array. */
75969 free(field_addr.sub_location);
75970 field_addr.sub_location = NULL;
75971 #endif /* FREECIV_JSON_CONNECTION */
75972 }
75973 }
75974 if (BV_ISSET(fields, 4)) {
75975 log_packet_detailed(" got field 'receiver_reqs_count'");
75976 #ifdef FREECIV_JSON_CONNECTION
75977 field_addr.name = "receiver_reqs_count";
75978 #endif /* FREECIV_JSON_CONNECTION */
75979 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->receiver_reqs_count)) {
75980 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs_count);
75981 }
75982 }
75983 if (BV_ISSET(fields, 5)) {
75984 log_packet_detailed(" got field 'receiver_reqs'");
75985 #ifdef FREECIV_JSON_CONNECTION
75986 field_addr.name = "receiver_reqs";
75987 #endif /* FREECIV_JSON_CONNECTION */
75988
75989 {
75990 int i;
75991
75992 #ifdef FREECIV_JSON_CONNECTION
75993 /* Enter array. */
75994 field_addr.sub_location = plocation_elem_new(0);
75995 #endif /* FREECIV_JSON_CONNECTION */
75996
75997 if (real_packet->receiver_reqs_count > MAX_NUM_REQS) {
75998 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs, ": truncation array");
75999 }
76000 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
76001 #ifdef FREECIV_JSON_CONNECTION
76002 field_addr.sub_location->number = i;
76003 #endif /* FREECIV_JSON_CONNECTION */
76004 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->receiver_reqs[i])) {
76005 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs);
76006 }
76007 }
76008
76009 #ifdef FREECIV_JSON_CONNECTION
76010 /* Exit array. */
76011 free(field_addr.sub_location);
76012 field_addr.sub_location = NULL;
76013 #endif /* FREECIV_JSON_CONNECTION */
76014 }
76015 }
76016
76017 if (NULL == old) {
76018 old = fc_malloc(sizeof(*old));
76019 *old = *real_packet;
76020 genhash_insert(*hash, old, old);
76021 } else {
76022 *old = *real_packet;
76023 }
76024
76025#endif /* FREECIV_DELTA_PROTOCOL */
76026 RECEIVE_PACKET_END(real_packet);
76027}
76028
76029 static int send_packet_ruleset_clause_100(struct connection *pc, const struct packet_ruleset_clause *packet)
76030{
76031 const struct packet_ruleset_clause *real_packet = packet;
76032#ifdef FREECIV_DELTA_PROTOCOL
76033 packet_ruleset_clause_100_fields fields;
76034 struct packet_ruleset_clause *old;
76035 bool differ;
76036 struct genhash **hash = pc->phs.sent + PACKET_RULESET_CLAUSE;
76037#endif /* FREECIV_DELTA_PROTOCOL */
76038 SEND_PACKET_START(PACKET_RULESET_CLAUSE);
76039#ifdef FREECIV_JSON_CONNECTION
76040 struct plocation field_addr;
76041 {
76042 struct plocation *field_addr_tmp = plocation_field_new(NULL);
76043 field_addr = *field_addr_tmp;
76044 FC_FREE(field_addr_tmp);
76045 }
76046#endif /* FREECIV_JSON_CONNECTION */
76047
76048 log_packet_detailed("packet_ruleset_clause_100: sending info about ()");
76049
76050#ifdef FREECIV_DELTA_PROTOCOL
76051 if (NULL == *hash) {
76052 *hash = genhash_new_full(hash_packet_ruleset_clause_100, cmp_packet_ruleset_clause_100,
76053 NULL, NULL, NULL, free);
76054 }
76055 BV_CLR_ALL(fields);
76056
76057 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
76058 old = fc_malloc(sizeof(*old));
76059 *old = *real_packet;
76060 genhash_insert(*hash, old, old);
76061 memset(old, 0, sizeof(*old));
76062 }
76063 differ = (old->type != real_packet->type);
76064 if (differ) {
76065 BV_SET(fields, 0);
76066 }
76067
76068 if (packet->enabled) {
76069 BV_SET(fields, 1);
76070 }
76071
76072 differ = (old->giver_reqs_count != real_packet->giver_reqs_count);
76073 if (differ) {
76074 BV_SET(fields, 2);
76075 }
76076
76077
76078 {
76079 differ = (old->giver_reqs_count != real_packet->giver_reqs_count);
76080 if (!differ) {
76081 int i;
76082
76083 for (i = 0; i < real_packet->giver_reqs_count; i++) {
76084 if (!are_requirements_equal(&old->giver_reqs[i], &real_packet->giver_reqs[i])) {
76085 differ = TRUE;
76086 break;
76087 }
76088 }
76089 }
76090 }
76091 if (differ) {
76092 BV_SET(fields, 3);
76093 }
76094
76095 differ = (old->receiver_reqs_count != real_packet->receiver_reqs_count);
76096 if (differ) {
76097 BV_SET(fields, 4);
76098 }
76099
76100
76101 {
76102 differ = (old->receiver_reqs_count != real_packet->receiver_reqs_count);
76103 if (!differ) {
76104 int i;
76105
76106 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
76107 if (!are_requirements_equal(&old->receiver_reqs[i], &real_packet->receiver_reqs[i])) {
76108 differ = TRUE;
76109 break;
76110 }
76111 }
76112 }
76113 }
76114 if (differ) {
76115 BV_SET(fields, 5);
76116 }
76117
76118
76119#ifdef FREECIV_JSON_CONNECTION
76120 field_addr.name = "fields";
76121#endif /* FREECIV_JSON_CONNECTION */
76122 DIO_BV_PUT(&dout, &field_addr, fields);
76123
76124 if (BV_ISSET(fields, 0)) {
76125 log_packet_detailed(" field 'type' has changed");
76126 #ifdef FREECIV_JSON_CONNECTION
76127 field_addr.name = "type";
76128#endif /* FREECIV_JSON_CONNECTION */
76129 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
76130 }
76131 /* field 1 is folded into the header */
76132 if (BV_ISSET(fields, 2)) {
76133 log_packet_detailed(" field 'giver_reqs_count' has changed");
76134 #ifdef FREECIV_JSON_CONNECTION
76135 field_addr.name = "giver_reqs_count";
76136#endif /* FREECIV_JSON_CONNECTION */
76137 DIO_PUT(uint8, &dout, &field_addr, real_packet->giver_reqs_count);
76138 }
76139 if (BV_ISSET(fields, 3)) {
76140 log_packet_detailed(" field 'giver_reqs' has changed");
76141 #ifdef FREECIV_JSON_CONNECTION
76142 field_addr.name = "giver_reqs";
76143#endif /* FREECIV_JSON_CONNECTION */
76144
76145 {
76146 int i;
76147
76148#ifdef FREECIV_JSON_CONNECTION
76149 /* Create the array. */
76150 DIO_PUT(farray, &dout, &field_addr, real_packet->giver_reqs_count);
76151
76152 /* Enter the array. */
76153 field_addr.sub_location = plocation_elem_new(0);
76154#endif /* FREECIV_JSON_CONNECTION */
76155
76156 for (i = 0; i < real_packet->giver_reqs_count; i++) {
76157#ifdef FREECIV_JSON_CONNECTION
76158 /* Next array element. */
76159 field_addr.sub_location->number = i;
76160#endif /* FREECIV_JSON_CONNECTION */
76161 DIO_PUT(requirement, &dout, &field_addr, &real_packet->giver_reqs[i]);
76162 }
76163
76164#ifdef FREECIV_JSON_CONNECTION
76165 /* Exit array. */
76166 free(field_addr.sub_location);
76167 field_addr.sub_location = NULL;
76168#endif /* FREECIV_JSON_CONNECTION */
76169 }
76170 }
76171 if (BV_ISSET(fields, 4)) {
76172 log_packet_detailed(" field 'receiver_reqs_count' has changed");
76173 #ifdef FREECIV_JSON_CONNECTION
76174 field_addr.name = "receiver_reqs_count";
76175#endif /* FREECIV_JSON_CONNECTION */
76176 DIO_PUT(uint8, &dout, &field_addr, real_packet->receiver_reqs_count);
76177 }
76178 if (BV_ISSET(fields, 5)) {
76179 log_packet_detailed(" field 'receiver_reqs' has changed");
76180 #ifdef FREECIV_JSON_CONNECTION
76181 field_addr.name = "receiver_reqs";
76182#endif /* FREECIV_JSON_CONNECTION */
76183
76184 {
76185 int i;
76186
76187#ifdef FREECIV_JSON_CONNECTION
76188 /* Create the array. */
76189 DIO_PUT(farray, &dout, &field_addr, real_packet->receiver_reqs_count);
76190
76191 /* Enter the array. */
76192 field_addr.sub_location = plocation_elem_new(0);
76193#endif /* FREECIV_JSON_CONNECTION */
76194
76195 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
76196#ifdef FREECIV_JSON_CONNECTION
76197 /* Next array element. */
76198 field_addr.sub_location->number = i;
76199#endif /* FREECIV_JSON_CONNECTION */
76200 DIO_PUT(requirement, &dout, &field_addr, &real_packet->receiver_reqs[i]);
76201 }
76202
76203#ifdef FREECIV_JSON_CONNECTION
76204 /* Exit array. */
76205 free(field_addr.sub_location);
76206 field_addr.sub_location = NULL;
76207#endif /* FREECIV_JSON_CONNECTION */
76208 }
76209 }
76210
76211 *old = *real_packet;
76212#endif /* FREECIV_DELTA_PROTOCOL */
76213#ifndef FREECIV_DELTA_PROTOCOL
76214#ifdef FREECIV_JSON_CONNECTION
76215 field_addr.name = "type";
76216#endif /* FREECIV_JSON_CONNECTION */
76217 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
76218#ifdef FREECIV_JSON_CONNECTION
76219 field_addr.name = "enabled";
76220#endif /* FREECIV_JSON_CONNECTION */
76221 DIO_PUT(bool8, &dout, &field_addr, real_packet->enabled);
76222#ifdef FREECIV_JSON_CONNECTION
76223 field_addr.name = "giver_reqs_count";
76224#endif /* FREECIV_JSON_CONNECTION */
76225 DIO_PUT(uint8, &dout, &field_addr, real_packet->giver_reqs_count);
76226#ifdef FREECIV_JSON_CONNECTION
76227 field_addr.name = "giver_reqs";
76228#endif /* FREECIV_JSON_CONNECTION */
76229
76230 {
76231 int i;
76232
76233#ifdef FREECIV_JSON_CONNECTION
76234 /* Create the array. */
76235 DIO_PUT(farray, &dout, &field_addr, real_packet->giver_reqs_count);
76236
76237 /* Enter the array. */
76238 field_addr.sub_location = plocation_elem_new(0);
76239#endif /* FREECIV_JSON_CONNECTION */
76240
76241 for (i = 0; i < real_packet->giver_reqs_count; i++) {
76242#ifdef FREECIV_JSON_CONNECTION
76243 /* Next array element. */
76244 field_addr.sub_location->number = i;
76245#endif /* FREECIV_JSON_CONNECTION */
76246 DIO_PUT(requirement, &dout, &field_addr, &real_packet->giver_reqs[i]);
76247 }
76248
76249#ifdef FREECIV_JSON_CONNECTION
76250 /* Exit array. */
76251 free(field_addr.sub_location);
76252 field_addr.sub_location = NULL;
76253#endif /* FREECIV_JSON_CONNECTION */
76254 }
76255#ifdef FREECIV_JSON_CONNECTION
76256 field_addr.name = "receiver_reqs_count";
76257#endif /* FREECIV_JSON_CONNECTION */
76258 DIO_PUT(uint8, &dout, &field_addr, real_packet->receiver_reqs_count);
76259#ifdef FREECIV_JSON_CONNECTION
76260 field_addr.name = "receiver_reqs";
76261#endif /* FREECIV_JSON_CONNECTION */
76262
76263 {
76264 int i;
76265
76266#ifdef FREECIV_JSON_CONNECTION
76267 /* Create the array. */
76268 DIO_PUT(farray, &dout, &field_addr, real_packet->receiver_reqs_count);
76269
76270 /* Enter the array. */
76271 field_addr.sub_location = plocation_elem_new(0);
76272#endif /* FREECIV_JSON_CONNECTION */
76273
76274 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
76275#ifdef FREECIV_JSON_CONNECTION
76276 /* Next array element. */
76277 field_addr.sub_location->number = i;
76278#endif /* FREECIV_JSON_CONNECTION */
76279 DIO_PUT(requirement, &dout, &field_addr, &real_packet->receiver_reqs[i]);
76280 }
76281
76282#ifdef FREECIV_JSON_CONNECTION
76283 /* Exit array. */
76284 free(field_addr.sub_location);
76285 field_addr.sub_location = NULL;
76286#endif /* FREECIV_JSON_CONNECTION */
76287 }
76288
76289#endif
76290 SEND_PACKET_END(PACKET_RULESET_CLAUSE);
76291}
76292
76293 int send_packet_ruleset_clause(struct connection *pc, const struct packet_ruleset_clause *packet)
76294{
76295 if (!pc->used) {
76296 log_error("WARNING: trying to send data to the closed connection %s",
76297 conn_description(pc));
76298 return -1;
76299 }
76300 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_CLAUSE].packet != NULL, -1,
76301 "Handler for PACKET_RULESET_CLAUSE not installed");
76302 return pc->phs.handlers->send[PACKET_RULESET_CLAUSE].packet(pc, packet);
76303}
76304
76305 void lsend_packet_ruleset_clause(struct conn_list *dest, const struct packet_ruleset_clause *packet)
76306{
76307 conn_list_iterate(dest, pconn) {
76308 send_packet_ruleset_clause(pconn, packet);
76309 } conn_list_iterate_end;
76310}
76311
76312#ifdef FREECIV_DELTA_PROTOCOL
76313#define hash_packet_ruleset_control_100 hash_const
76314
76315#define cmp_packet_ruleset_control_100 cmp_const
76316
76317 BV_DEFINE(packet_ruleset_control_100_fields, 30);
76318#endif /* FREECIV_DELTA_PROTOCOL */
76319
76320 static struct packet_ruleset_control *receive_packet_ruleset_control_100(struct connection *pc)
76321{
76322#ifdef FREECIV_DELTA_PROTOCOL
76323 packet_ruleset_control_100_fields fields;
76324 struct packet_ruleset_control *old;
76325 struct genhash **hash = pc->phs.received + PACKET_RULESET_CONTROL;
76326#endif /* FREECIV_DELTA_PROTOCOL */
76327 RECEIVE_PACKET_START(packet_ruleset_control, real_packet);
76328#ifdef FREECIV_JSON_CONNECTION
76329 struct plocation field_addr;
76330 {
76331 struct plocation *field_addr_tmp = plocation_field_new(NULL);
76332 field_addr = *field_addr_tmp;
76333 FC_FREE(field_addr_tmp);
76334 }
76335#endif /* FREECIV_JSON_CONNECTION */
76336
76337#ifdef FREECIV_DELTA_PROTOCOL
76338#ifdef FREECIV_JSON_CONNECTION
76339 field_addr.name = "fields";
76340#endif /* FREECIV_JSON_CONNECTION */
76341 DIO_BV_GET(&din, &field_addr, fields);
76342
76343#else /* FREECIV_DELTA_PROTOCOL */
76344 #ifdef FREECIV_JSON_CONNECTION
76345 field_addr.name = "num_unit_classes";
76346 #endif /* FREECIV_JSON_CONNECTION */
76347 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_classes)) {
76348 RECEIVE_PACKET_FIELD_ERROR(num_unit_classes);
76349 }
76350 #ifdef FREECIV_JSON_CONNECTION
76351 field_addr.name = "num_unit_types";
76352 #endif /* FREECIV_JSON_CONNECTION */
76353 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_types)) {
76354 RECEIVE_PACKET_FIELD_ERROR(num_unit_types);
76355 }
76356 #ifdef FREECIV_JSON_CONNECTION
76357 field_addr.name = "num_impr_types";
76358 #endif /* FREECIV_JSON_CONNECTION */
76359 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_impr_types)) {
76360 RECEIVE_PACKET_FIELD_ERROR(num_impr_types);
76361 }
76362 #ifdef FREECIV_JSON_CONNECTION
76363 field_addr.name = "num_tech_classes";
76364 #endif /* FREECIV_JSON_CONNECTION */
76365 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_classes)) {
76366 RECEIVE_PACKET_FIELD_ERROR(num_tech_classes);
76367 }
76368 #ifdef FREECIV_JSON_CONNECTION
76369 field_addr.name = "num_tech_types";
76370 #endif /* FREECIV_JSON_CONNECTION */
76371 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_types)) {
76372 RECEIVE_PACKET_FIELD_ERROR(num_tech_types);
76373 }
76374 #ifdef FREECIV_JSON_CONNECTION
76375 field_addr.name = "num_extra_types";
76376 #endif /* FREECIV_JSON_CONNECTION */
76377 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_extra_types)) {
76378 RECEIVE_PACKET_FIELD_ERROR(num_extra_types);
76379 }
76380 #ifdef FREECIV_JSON_CONNECTION
76381 field_addr.name = "num_base_types";
76382 #endif /* FREECIV_JSON_CONNECTION */
76383 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_base_types)) {
76384 RECEIVE_PACKET_FIELD_ERROR(num_base_types);
76385 }
76386 #ifdef FREECIV_JSON_CONNECTION
76387 field_addr.name = "num_road_types";
76388 #endif /* FREECIV_JSON_CONNECTION */
76389 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_road_types)) {
76390 RECEIVE_PACKET_FIELD_ERROR(num_road_types);
76391 }
76392 #ifdef FREECIV_JSON_CONNECTION
76393 field_addr.name = "num_resource_types";
76394 #endif /* FREECIV_JSON_CONNECTION */
76395 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_resource_types)) {
76396 RECEIVE_PACKET_FIELD_ERROR(num_resource_types);
76397 }
76398 #ifdef FREECIV_JSON_CONNECTION
76399 field_addr.name = "num_goods_types";
76400 #endif /* FREECIV_JSON_CONNECTION */
76401 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_goods_types)) {
76402 RECEIVE_PACKET_FIELD_ERROR(num_goods_types);
76403 }
76404 #ifdef FREECIV_JSON_CONNECTION
76405 field_addr.name = "num_disaster_types";
76406 #endif /* FREECIV_JSON_CONNECTION */
76407 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_disaster_types)) {
76408 RECEIVE_PACKET_FIELD_ERROR(num_disaster_types);
76409 }
76410 #ifdef FREECIV_JSON_CONNECTION
76411 field_addr.name = "num_achievement_types";
76412 #endif /* FREECIV_JSON_CONNECTION */
76413 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_achievement_types)) {
76414 RECEIVE_PACKET_FIELD_ERROR(num_achievement_types);
76415 }
76416 #ifdef FREECIV_JSON_CONNECTION
76417 field_addr.name = "num_multipliers";
76418 #endif /* FREECIV_JSON_CONNECTION */
76419 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_multipliers)) {
76420 RECEIVE_PACKET_FIELD_ERROR(num_multipliers);
76421 }
76422 #ifdef FREECIV_JSON_CONNECTION
76423 field_addr.name = "num_styles";
76424 #endif /* FREECIV_JSON_CONNECTION */
76425 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_styles)) {
76426 RECEIVE_PACKET_FIELD_ERROR(num_styles);
76427 }
76428 #ifdef FREECIV_JSON_CONNECTION
76429 field_addr.name = "num_music_styles";
76430 #endif /* FREECIV_JSON_CONNECTION */
76431 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_music_styles)) {
76432 RECEIVE_PACKET_FIELD_ERROR(num_music_styles);
76433 }
76434 #ifdef FREECIV_JSON_CONNECTION
76435 field_addr.name = "government_count";
76436 #endif /* FREECIV_JSON_CONNECTION */
76437 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->government_count)) {
76438 RECEIVE_PACKET_FIELD_ERROR(government_count);
76439 }
76440 #ifdef FREECIV_JSON_CONNECTION
76441 field_addr.name = "nation_count";
76442 #endif /* FREECIV_JSON_CONNECTION */
76443 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nation_count)) {
76444 RECEIVE_PACKET_FIELD_ERROR(nation_count);
76445 }
76446 #ifdef FREECIV_JSON_CONNECTION
76447 field_addr.name = "styles_count";
76448 #endif /* FREECIV_JSON_CONNECTION */
76449 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->styles_count)) {
76450 RECEIVE_PACKET_FIELD_ERROR(styles_count);
76451 }
76452 #ifdef FREECIV_JSON_CONNECTION
76453 field_addr.name = "terrain_count";
76454 #endif /* FREECIV_JSON_CONNECTION */
76455 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->terrain_count)) {
76456 RECEIVE_PACKET_FIELD_ERROR(terrain_count);
76457 }
76458 #ifdef FREECIV_JSON_CONNECTION
76459 field_addr.name = "num_specialist_types";
76460 #endif /* FREECIV_JSON_CONNECTION */
76461 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_specialist_types)) {
76462 RECEIVE_PACKET_FIELD_ERROR(num_specialist_types);
76463 }
76464 #ifdef FREECIV_JSON_CONNECTION
76465 field_addr.name = "num_nation_groups";
76466 #endif /* FREECIV_JSON_CONNECTION */
76467 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_groups)) {
76468 RECEIVE_PACKET_FIELD_ERROR(num_nation_groups);
76469 }
76470 #ifdef FREECIV_JSON_CONNECTION
76471 field_addr.name = "num_nation_sets";
76472 #endif /* FREECIV_JSON_CONNECTION */
76473 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_sets)) {
76474 RECEIVE_PACKET_FIELD_ERROR(num_nation_sets);
76475 }
76476 #ifdef FREECIV_JSON_CONNECTION
76477 field_addr.name = "preferred_tileset";
76478 #endif /* FREECIV_JSON_CONNECTION */
76479 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_tileset, sizeof(real_packet->preferred_tileset))) {
76480 RECEIVE_PACKET_FIELD_ERROR(preferred_tileset);
76481 }
76482 #ifdef FREECIV_JSON_CONNECTION
76483 field_addr.name = "preferred_soundset";
76484 #endif /* FREECIV_JSON_CONNECTION */
76485 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_soundset, sizeof(real_packet->preferred_soundset))) {
76486 RECEIVE_PACKET_FIELD_ERROR(preferred_soundset);
76487 }
76488 #ifdef FREECIV_JSON_CONNECTION
76489 field_addr.name = "preferred_musicset";
76490 #endif /* FREECIV_JSON_CONNECTION */
76491 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_musicset, sizeof(real_packet->preferred_musicset))) {
76492 RECEIVE_PACKET_FIELD_ERROR(preferred_musicset);
76493 }
76494 #ifdef FREECIV_JSON_CONNECTION
76495 field_addr.name = "popup_tech_help";
76496 #endif /* FREECIV_JSON_CONNECTION */
76497 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->popup_tech_help)) {
76498 RECEIVE_PACKET_FIELD_ERROR(popup_tech_help);
76499 }
76500 #ifdef FREECIV_JSON_CONNECTION
76501 field_addr.name = "name";
76502 #endif /* FREECIV_JSON_CONNECTION */
76503 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
76504 RECEIVE_PACKET_FIELD_ERROR(name);
76505 }
76506 #ifdef FREECIV_JSON_CONNECTION
76507 field_addr.name = "version";
76508 #endif /* FREECIV_JSON_CONNECTION */
76509 if (!DIO_GET(string, &din, &field_addr, real_packet->version, sizeof(real_packet->version))) {
76510 RECEIVE_PACKET_FIELD_ERROR(version);
76511 }
76512 #ifdef FREECIV_JSON_CONNECTION
76513 field_addr.name = "alt_dir";
76514 #endif /* FREECIV_JSON_CONNECTION */
76515 if (!DIO_GET(string, &din, &field_addr, real_packet->alt_dir, sizeof(real_packet->alt_dir))) {
76516 RECEIVE_PACKET_FIELD_ERROR(alt_dir);
76517 }
76518 #ifdef FREECIV_JSON_CONNECTION
76519 field_addr.name = "desc_length32";
76520 #endif /* FREECIV_JSON_CONNECTION */
76521 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->desc_length32)) {
76522 RECEIVE_PACKET_FIELD_ERROR(desc_length32);
76523 }
76524
76525#endif
76526 log_packet_detailed("packet_ruleset_control_100: got info about ()");
76527
76528#ifdef FREECIV_DELTA_PROTOCOL
76529 if (NULL == *hash) {
76530 *hash = genhash_new_full(hash_packet_ruleset_control_100, cmp_packet_ruleset_control_100,
76531 NULL, NULL, NULL, free);
76532 }
76533
76534 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
76535 *real_packet = *old;
76536 } else {
76537 log_packet_detailed(" no old info");
76538 memset(real_packet, 0, sizeof(*real_packet));
76539 }
76540
76541 if (BV_ISSET(fields, 0)) {
76542 log_packet_detailed(" got field 'num_unit_classes'");
76543 #ifdef FREECIV_JSON_CONNECTION
76544 field_addr.name = "num_unit_classes";
76545 #endif /* FREECIV_JSON_CONNECTION */
76546 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_classes)) {
76547 RECEIVE_PACKET_FIELD_ERROR(num_unit_classes);
76548 }
76549 }
76550 if (BV_ISSET(fields, 1)) {
76551 log_packet_detailed(" got field 'num_unit_types'");
76552 #ifdef FREECIV_JSON_CONNECTION
76553 field_addr.name = "num_unit_types";
76554 #endif /* FREECIV_JSON_CONNECTION */
76555 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_types)) {
76556 RECEIVE_PACKET_FIELD_ERROR(num_unit_types);
76557 }
76558 }
76559 if (BV_ISSET(fields, 2)) {
76560 log_packet_detailed(" got field 'num_impr_types'");
76561 #ifdef FREECIV_JSON_CONNECTION
76562 field_addr.name = "num_impr_types";
76563 #endif /* FREECIV_JSON_CONNECTION */
76564 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_impr_types)) {
76565 RECEIVE_PACKET_FIELD_ERROR(num_impr_types);
76566 }
76567 }
76568 if (BV_ISSET(fields, 3)) {
76569 log_packet_detailed(" got field 'num_tech_classes'");
76570 #ifdef FREECIV_JSON_CONNECTION
76571 field_addr.name = "num_tech_classes";
76572 #endif /* FREECIV_JSON_CONNECTION */
76573 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_classes)) {
76574 RECEIVE_PACKET_FIELD_ERROR(num_tech_classes);
76575 }
76576 }
76577 if (BV_ISSET(fields, 4)) {
76578 log_packet_detailed(" got field 'num_tech_types'");
76579 #ifdef FREECIV_JSON_CONNECTION
76580 field_addr.name = "num_tech_types";
76581 #endif /* FREECIV_JSON_CONNECTION */
76582 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_types)) {
76583 RECEIVE_PACKET_FIELD_ERROR(num_tech_types);
76584 }
76585 }
76586 if (BV_ISSET(fields, 5)) {
76587 log_packet_detailed(" got field 'num_extra_types'");
76588 #ifdef FREECIV_JSON_CONNECTION
76589 field_addr.name = "num_extra_types";
76590 #endif /* FREECIV_JSON_CONNECTION */
76591 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_extra_types)) {
76592 RECEIVE_PACKET_FIELD_ERROR(num_extra_types);
76593 }
76594 }
76595 if (BV_ISSET(fields, 6)) {
76596 log_packet_detailed(" got field 'num_base_types'");
76597 #ifdef FREECIV_JSON_CONNECTION
76598 field_addr.name = "num_base_types";
76599 #endif /* FREECIV_JSON_CONNECTION */
76600 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_base_types)) {
76601 RECEIVE_PACKET_FIELD_ERROR(num_base_types);
76602 }
76603 }
76604 if (BV_ISSET(fields, 7)) {
76605 log_packet_detailed(" got field 'num_road_types'");
76606 #ifdef FREECIV_JSON_CONNECTION
76607 field_addr.name = "num_road_types";
76608 #endif /* FREECIV_JSON_CONNECTION */
76609 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_road_types)) {
76610 RECEIVE_PACKET_FIELD_ERROR(num_road_types);
76611 }
76612 }
76613 if (BV_ISSET(fields, 8)) {
76614 log_packet_detailed(" got field 'num_resource_types'");
76615 #ifdef FREECIV_JSON_CONNECTION
76616 field_addr.name = "num_resource_types";
76617 #endif /* FREECIV_JSON_CONNECTION */
76618 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_resource_types)) {
76619 RECEIVE_PACKET_FIELD_ERROR(num_resource_types);
76620 }
76621 }
76622 if (BV_ISSET(fields, 9)) {
76623 log_packet_detailed(" got field 'num_goods_types'");
76624 #ifdef FREECIV_JSON_CONNECTION
76625 field_addr.name = "num_goods_types";
76626 #endif /* FREECIV_JSON_CONNECTION */
76627 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_goods_types)) {
76628 RECEIVE_PACKET_FIELD_ERROR(num_goods_types);
76629 }
76630 }
76631 if (BV_ISSET(fields, 10)) {
76632 log_packet_detailed(" got field 'num_disaster_types'");
76633 #ifdef FREECIV_JSON_CONNECTION
76634 field_addr.name = "num_disaster_types";
76635 #endif /* FREECIV_JSON_CONNECTION */
76636 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_disaster_types)) {
76637 RECEIVE_PACKET_FIELD_ERROR(num_disaster_types);
76638 }
76639 }
76640 if (BV_ISSET(fields, 11)) {
76641 log_packet_detailed(" got field 'num_achievement_types'");
76642 #ifdef FREECIV_JSON_CONNECTION
76643 field_addr.name = "num_achievement_types";
76644 #endif /* FREECIV_JSON_CONNECTION */
76645 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_achievement_types)) {
76646 RECEIVE_PACKET_FIELD_ERROR(num_achievement_types);
76647 }
76648 }
76649 if (BV_ISSET(fields, 12)) {
76650 log_packet_detailed(" got field 'num_multipliers'");
76651 #ifdef FREECIV_JSON_CONNECTION
76652 field_addr.name = "num_multipliers";
76653 #endif /* FREECIV_JSON_CONNECTION */
76654 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_multipliers)) {
76655 RECEIVE_PACKET_FIELD_ERROR(num_multipliers);
76656 }
76657 }
76658 if (BV_ISSET(fields, 13)) {
76659 log_packet_detailed(" got field 'num_styles'");
76660 #ifdef FREECIV_JSON_CONNECTION
76661 field_addr.name = "num_styles";
76662 #endif /* FREECIV_JSON_CONNECTION */
76663 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_styles)) {
76664 RECEIVE_PACKET_FIELD_ERROR(num_styles);
76665 }
76666 }
76667 if (BV_ISSET(fields, 14)) {
76668 log_packet_detailed(" got field 'num_music_styles'");
76669 #ifdef FREECIV_JSON_CONNECTION
76670 field_addr.name = "num_music_styles";
76671 #endif /* FREECIV_JSON_CONNECTION */
76672 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_music_styles)) {
76673 RECEIVE_PACKET_FIELD_ERROR(num_music_styles);
76674 }
76675 }
76676 if (BV_ISSET(fields, 15)) {
76677 log_packet_detailed(" got field 'government_count'");
76678 #ifdef FREECIV_JSON_CONNECTION
76679 field_addr.name = "government_count";
76680 #endif /* FREECIV_JSON_CONNECTION */
76681 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->government_count)) {
76682 RECEIVE_PACKET_FIELD_ERROR(government_count);
76683 }
76684 }
76685 if (BV_ISSET(fields, 16)) {
76686 log_packet_detailed(" got field 'nation_count'");
76687 #ifdef FREECIV_JSON_CONNECTION
76688 field_addr.name = "nation_count";
76689 #endif /* FREECIV_JSON_CONNECTION */
76690 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nation_count)) {
76691 RECEIVE_PACKET_FIELD_ERROR(nation_count);
76692 }
76693 }
76694 if (BV_ISSET(fields, 17)) {
76695 log_packet_detailed(" got field 'styles_count'");
76696 #ifdef FREECIV_JSON_CONNECTION
76697 field_addr.name = "styles_count";
76698 #endif /* FREECIV_JSON_CONNECTION */
76699 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->styles_count)) {
76700 RECEIVE_PACKET_FIELD_ERROR(styles_count);
76701 }
76702 }
76703 if (BV_ISSET(fields, 18)) {
76704 log_packet_detailed(" got field 'terrain_count'");
76705 #ifdef FREECIV_JSON_CONNECTION
76706 field_addr.name = "terrain_count";
76707 #endif /* FREECIV_JSON_CONNECTION */
76708 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->terrain_count)) {
76709 RECEIVE_PACKET_FIELD_ERROR(terrain_count);
76710 }
76711 }
76712 if (BV_ISSET(fields, 19)) {
76713 log_packet_detailed(" got field 'num_specialist_types'");
76714 #ifdef FREECIV_JSON_CONNECTION
76715 field_addr.name = "num_specialist_types";
76716 #endif /* FREECIV_JSON_CONNECTION */
76717 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_specialist_types)) {
76718 RECEIVE_PACKET_FIELD_ERROR(num_specialist_types);
76719 }
76720 }
76721 if (BV_ISSET(fields, 20)) {
76722 log_packet_detailed(" got field 'num_nation_groups'");
76723 #ifdef FREECIV_JSON_CONNECTION
76724 field_addr.name = "num_nation_groups";
76725 #endif /* FREECIV_JSON_CONNECTION */
76726 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_groups)) {
76727 RECEIVE_PACKET_FIELD_ERROR(num_nation_groups);
76728 }
76729 }
76730 if (BV_ISSET(fields, 21)) {
76731 log_packet_detailed(" got field 'num_nation_sets'");
76732 #ifdef FREECIV_JSON_CONNECTION
76733 field_addr.name = "num_nation_sets";
76734 #endif /* FREECIV_JSON_CONNECTION */
76735 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_sets)) {
76736 RECEIVE_PACKET_FIELD_ERROR(num_nation_sets);
76737 }
76738 }
76739 if (BV_ISSET(fields, 22)) {
76740 log_packet_detailed(" got field 'preferred_tileset'");
76741 #ifdef FREECIV_JSON_CONNECTION
76742 field_addr.name = "preferred_tileset";
76743 #endif /* FREECIV_JSON_CONNECTION */
76744 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_tileset, sizeof(real_packet->preferred_tileset))) {
76745 RECEIVE_PACKET_FIELD_ERROR(preferred_tileset);
76746 }
76747 }
76748 if (BV_ISSET(fields, 23)) {
76749 log_packet_detailed(" got field 'preferred_soundset'");
76750 #ifdef FREECIV_JSON_CONNECTION
76751 field_addr.name = "preferred_soundset";
76752 #endif /* FREECIV_JSON_CONNECTION */
76753 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_soundset, sizeof(real_packet->preferred_soundset))) {
76754 RECEIVE_PACKET_FIELD_ERROR(preferred_soundset);
76755 }
76756 }
76757 if (BV_ISSET(fields, 24)) {
76758 log_packet_detailed(" got field 'preferred_musicset'");
76759 #ifdef FREECIV_JSON_CONNECTION
76760 field_addr.name = "preferred_musicset";
76761 #endif /* FREECIV_JSON_CONNECTION */
76762 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_musicset, sizeof(real_packet->preferred_musicset))) {
76763 RECEIVE_PACKET_FIELD_ERROR(preferred_musicset);
76764 }
76765 }
76766 real_packet->popup_tech_help = BV_ISSET(fields, 25);
76767 if (BV_ISSET(fields, 26)) {
76768 log_packet_detailed(" got field 'name'");
76769 #ifdef FREECIV_JSON_CONNECTION
76770 field_addr.name = "name";
76771 #endif /* FREECIV_JSON_CONNECTION */
76772 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
76773 RECEIVE_PACKET_FIELD_ERROR(name);
76774 }
76775 }
76776 if (BV_ISSET(fields, 27)) {
76777 log_packet_detailed(" got field 'version'");
76778 #ifdef FREECIV_JSON_CONNECTION
76779 field_addr.name = "version";
76780 #endif /* FREECIV_JSON_CONNECTION */
76781 if (!DIO_GET(string, &din, &field_addr, real_packet->version, sizeof(real_packet->version))) {
76782 RECEIVE_PACKET_FIELD_ERROR(version);
76783 }
76784 }
76785 if (BV_ISSET(fields, 28)) {
76786 log_packet_detailed(" got field 'alt_dir'");
76787 #ifdef FREECIV_JSON_CONNECTION
76788 field_addr.name = "alt_dir";
76789 #endif /* FREECIV_JSON_CONNECTION */
76790 if (!DIO_GET(string, &din, &field_addr, real_packet->alt_dir, sizeof(real_packet->alt_dir))) {
76791 RECEIVE_PACKET_FIELD_ERROR(alt_dir);
76792 }
76793 }
76794 if (BV_ISSET(fields, 29)) {
76795 log_packet_detailed(" got field 'desc_length32'");
76796 #ifdef FREECIV_JSON_CONNECTION
76797 field_addr.name = "desc_length32";
76798 #endif /* FREECIV_JSON_CONNECTION */
76799 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->desc_length32)) {
76800 RECEIVE_PACKET_FIELD_ERROR(desc_length32);
76801 }
76802 }
76803
76804 if (NULL == old) {
76805 old = fc_malloc(sizeof(*old));
76806 *old = *real_packet;
76807 genhash_insert(*hash, old, old);
76808 } else {
76809 *old = *real_packet;
76810 }
76811
76812#endif /* FREECIV_DELTA_PROTOCOL */
76813 RECEIVE_PACKET_END(real_packet);
76814}
76815
76816 static int send_packet_ruleset_control_100(struct connection *pc, const struct packet_ruleset_control *packet)
76817{
76818 const struct packet_ruleset_control *real_packet = packet;
76819#ifdef FREECIV_DELTA_PROTOCOL
76820 packet_ruleset_control_100_fields fields;
76821 struct packet_ruleset_control *old;
76822 bool differ;
76823 struct genhash **hash = pc->phs.sent + PACKET_RULESET_CONTROL;
76824#endif /* FREECIV_DELTA_PROTOCOL */
76825 SEND_PACKET_START(PACKET_RULESET_CONTROL);
76826#ifdef FREECIV_JSON_CONNECTION
76827 struct plocation field_addr;
76828 {
76829 struct plocation *field_addr_tmp = plocation_field_new(NULL);
76830 field_addr = *field_addr_tmp;
76831 FC_FREE(field_addr_tmp);
76832 }
76833#endif /* FREECIV_JSON_CONNECTION */
76834
76835 log_packet_detailed("packet_ruleset_control_100: sending info about ()");
76836
76837#ifdef FREECIV_DELTA_PROTOCOL
76838 if (NULL == *hash) {
76839 *hash = genhash_new_full(hash_packet_ruleset_control_100, cmp_packet_ruleset_control_100,
76840 NULL, NULL, NULL, free);
76841 }
76842 BV_CLR_ALL(fields);
76843
76844 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
76845 old = fc_malloc(sizeof(*old));
76846 *old = *real_packet;
76847 genhash_insert(*hash, old, old);
76848 memset(old, 0, sizeof(*old));
76849 }
76850 differ = (old->num_unit_classes != real_packet->num_unit_classes);
76851 if (differ) {
76852 BV_SET(fields, 0);
76853 }
76854
76855 differ = (old->num_unit_types != real_packet->num_unit_types);
76856 if (differ) {
76857 BV_SET(fields, 1);
76858 }
76859
76860 differ = (old->num_impr_types != real_packet->num_impr_types);
76861 if (differ) {
76862 BV_SET(fields, 2);
76863 }
76864
76865 differ = (old->num_tech_classes != real_packet->num_tech_classes);
76866 if (differ) {
76867 BV_SET(fields, 3);
76868 }
76869
76870 differ = (old->num_tech_types != real_packet->num_tech_types);
76871 if (differ) {
76872 BV_SET(fields, 4);
76873 }
76874
76875 differ = (old->num_extra_types != real_packet->num_extra_types);
76876 if (differ) {
76877 BV_SET(fields, 5);
76878 }
76879
76880 differ = (old->num_base_types != real_packet->num_base_types);
76881 if (differ) {
76882 BV_SET(fields, 6);
76883 }
76884
76885 differ = (old->num_road_types != real_packet->num_road_types);
76886 if (differ) {
76887 BV_SET(fields, 7);
76888 }
76889
76890 differ = (old->num_resource_types != real_packet->num_resource_types);
76891 if (differ) {
76892 BV_SET(fields, 8);
76893 }
76894
76895 differ = (old->num_goods_types != real_packet->num_goods_types);
76896 if (differ) {
76897 BV_SET(fields, 9);
76898 }
76899
76900 differ = (old->num_disaster_types != real_packet->num_disaster_types);
76901 if (differ) {
76902 BV_SET(fields, 10);
76903 }
76904
76905 differ = (old->num_achievement_types != real_packet->num_achievement_types);
76906 if (differ) {
76907 BV_SET(fields, 11);
76908 }
76909
76910 differ = (old->num_multipliers != real_packet->num_multipliers);
76911 if (differ) {
76912 BV_SET(fields, 12);
76913 }
76914
76915 differ = (old->num_styles != real_packet->num_styles);
76916 if (differ) {
76917 BV_SET(fields, 13);
76918 }
76919
76920 differ = (old->num_music_styles != real_packet->num_music_styles);
76921 if (differ) {
76922 BV_SET(fields, 14);
76923 }
76924
76925 differ = (old->government_count != real_packet->government_count);
76926 if (differ) {
76927 BV_SET(fields, 15);
76928 }
76929
76930 differ = (old->nation_count != real_packet->nation_count);
76931 if (differ) {
76932 BV_SET(fields, 16);
76933 }
76934
76935 differ = (old->styles_count != real_packet->styles_count);
76936 if (differ) {
76937 BV_SET(fields, 17);
76938 }
76939
76940 differ = (old->terrain_count != real_packet->terrain_count);
76941 if (differ) {
76942 BV_SET(fields, 18);
76943 }
76944
76945 differ = (old->num_specialist_types != real_packet->num_specialist_types);
76946 if (differ) {
76947 BV_SET(fields, 19);
76948 }
76949
76950 differ = (old->num_nation_groups != real_packet->num_nation_groups);
76951 if (differ) {
76952 BV_SET(fields, 20);
76953 }
76954
76955 differ = (old->num_nation_sets != real_packet->num_nation_sets);
76956 if (differ) {
76957 BV_SET(fields, 21);
76958 }
76959
76960 differ = (strcmp(old->preferred_tileset, real_packet->preferred_tileset) != 0);
76961 if (differ) {
76962 BV_SET(fields, 22);
76963 }
76964
76965 differ = (strcmp(old->preferred_soundset, real_packet->preferred_soundset) != 0);
76966 if (differ) {
76967 BV_SET(fields, 23);
76968 }
76969
76970 differ = (strcmp(old->preferred_musicset, real_packet->preferred_musicset) != 0);
76971 if (differ) {
76972 BV_SET(fields, 24);
76973 }
76974
76975 if (packet->popup_tech_help) {
76976 BV_SET(fields, 25);
76977 }
76978
76979 differ = (strcmp(old->name, real_packet->name) != 0);
76980 if (differ) {
76981 BV_SET(fields, 26);
76982 }
76983
76984 differ = (strcmp(old->version, real_packet->version) != 0);
76985 if (differ) {
76986 BV_SET(fields, 27);
76987 }
76988
76989 differ = (strcmp(old->alt_dir, real_packet->alt_dir) != 0);
76990 if (differ) {
76991 BV_SET(fields, 28);
76992 }
76993
76994 differ = (old->desc_length32 != real_packet->desc_length32);
76995 if (differ) {
76996 BV_SET(fields, 29);
76997 }
76998
76999
77000#ifdef FREECIV_JSON_CONNECTION
77001 field_addr.name = "fields";
77002#endif /* FREECIV_JSON_CONNECTION */
77003 DIO_BV_PUT(&dout, &field_addr, fields);
77004
77005 if (BV_ISSET(fields, 0)) {
77006 log_packet_detailed(" field 'num_unit_classes' has changed");
77007 #ifdef FREECIV_JSON_CONNECTION
77008 field_addr.name = "num_unit_classes";
77009#endif /* FREECIV_JSON_CONNECTION */
77010 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_classes);
77011 }
77012 if (BV_ISSET(fields, 1)) {
77013 log_packet_detailed(" field 'num_unit_types' has changed");
77014 #ifdef FREECIV_JSON_CONNECTION
77015 field_addr.name = "num_unit_types";
77016#endif /* FREECIV_JSON_CONNECTION */
77017 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_types);
77018 }
77019 if (BV_ISSET(fields, 2)) {
77020 log_packet_detailed(" field 'num_impr_types' has changed");
77021 #ifdef FREECIV_JSON_CONNECTION
77022 field_addr.name = "num_impr_types";
77023#endif /* FREECIV_JSON_CONNECTION */
77024 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_impr_types);
77025 }
77026 if (BV_ISSET(fields, 3)) {
77027 log_packet_detailed(" field 'num_tech_classes' has changed");
77028 #ifdef FREECIV_JSON_CONNECTION
77029 field_addr.name = "num_tech_classes";
77030#endif /* FREECIV_JSON_CONNECTION */
77031 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_classes);
77032 }
77033 if (BV_ISSET(fields, 4)) {
77034 log_packet_detailed(" field 'num_tech_types' has changed");
77035 #ifdef FREECIV_JSON_CONNECTION
77036 field_addr.name = "num_tech_types";
77037#endif /* FREECIV_JSON_CONNECTION */
77038 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_types);
77039 }
77040 if (BV_ISSET(fields, 5)) {
77041 log_packet_detailed(" field 'num_extra_types' has changed");
77042 #ifdef FREECIV_JSON_CONNECTION
77043 field_addr.name = "num_extra_types";
77044#endif /* FREECIV_JSON_CONNECTION */
77045 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_extra_types);
77046 }
77047 if (BV_ISSET(fields, 6)) {
77048 log_packet_detailed(" field 'num_base_types' has changed");
77049 #ifdef FREECIV_JSON_CONNECTION
77050 field_addr.name = "num_base_types";
77051#endif /* FREECIV_JSON_CONNECTION */
77052 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_base_types);
77053 }
77054 if (BV_ISSET(fields, 7)) {
77055 log_packet_detailed(" field 'num_road_types' has changed");
77056 #ifdef FREECIV_JSON_CONNECTION
77057 field_addr.name = "num_road_types";
77058#endif /* FREECIV_JSON_CONNECTION */
77059 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_road_types);
77060 }
77061 if (BV_ISSET(fields, 8)) {
77062 log_packet_detailed(" field 'num_resource_types' has changed");
77063 #ifdef FREECIV_JSON_CONNECTION
77064 field_addr.name = "num_resource_types";
77065#endif /* FREECIV_JSON_CONNECTION */
77066 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_resource_types);
77067 }
77068 if (BV_ISSET(fields, 9)) {
77069 log_packet_detailed(" field 'num_goods_types' has changed");
77070 #ifdef FREECIV_JSON_CONNECTION
77071 field_addr.name = "num_goods_types";
77072#endif /* FREECIV_JSON_CONNECTION */
77073 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_goods_types);
77074 }
77075 if (BV_ISSET(fields, 10)) {
77076 log_packet_detailed(" field 'num_disaster_types' has changed");
77077 #ifdef FREECIV_JSON_CONNECTION
77078 field_addr.name = "num_disaster_types";
77079#endif /* FREECIV_JSON_CONNECTION */
77080 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_disaster_types);
77081 }
77082 if (BV_ISSET(fields, 11)) {
77083 log_packet_detailed(" field 'num_achievement_types' has changed");
77084 #ifdef FREECIV_JSON_CONNECTION
77085 field_addr.name = "num_achievement_types";
77086#endif /* FREECIV_JSON_CONNECTION */
77087 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_achievement_types);
77088 }
77089 if (BV_ISSET(fields, 12)) {
77090 log_packet_detailed(" field 'num_multipliers' has changed");
77091 #ifdef FREECIV_JSON_CONNECTION
77092 field_addr.name = "num_multipliers";
77093#endif /* FREECIV_JSON_CONNECTION */
77094 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_multipliers);
77095 }
77096 if (BV_ISSET(fields, 13)) {
77097 log_packet_detailed(" field 'num_styles' has changed");
77098 #ifdef FREECIV_JSON_CONNECTION
77099 field_addr.name = "num_styles";
77100#endif /* FREECIV_JSON_CONNECTION */
77101 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_styles);
77102 }
77103 if (BV_ISSET(fields, 14)) {
77104 log_packet_detailed(" field 'num_music_styles' has changed");
77105 #ifdef FREECIV_JSON_CONNECTION
77106 field_addr.name = "num_music_styles";
77107#endif /* FREECIV_JSON_CONNECTION */
77108 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_music_styles);
77109 }
77110 if (BV_ISSET(fields, 15)) {
77111 log_packet_detailed(" field 'government_count' has changed");
77112 #ifdef FREECIV_JSON_CONNECTION
77113 field_addr.name = "government_count";
77114#endif /* FREECIV_JSON_CONNECTION */
77115 DIO_PUT(uint16, &dout, &field_addr, real_packet->government_count);
77116 }
77117 if (BV_ISSET(fields, 16)) {
77118 log_packet_detailed(" field 'nation_count' has changed");
77119 #ifdef FREECIV_JSON_CONNECTION
77120 field_addr.name = "nation_count";
77121#endif /* FREECIV_JSON_CONNECTION */
77122 DIO_PUT(uint16, &dout, &field_addr, real_packet->nation_count);
77123 }
77124 if (BV_ISSET(fields, 17)) {
77125 log_packet_detailed(" field 'styles_count' has changed");
77126 #ifdef FREECIV_JSON_CONNECTION
77127 field_addr.name = "styles_count";
77128#endif /* FREECIV_JSON_CONNECTION */
77129 DIO_PUT(uint16, &dout, &field_addr, real_packet->styles_count);
77130 }
77131 if (BV_ISSET(fields, 18)) {
77132 log_packet_detailed(" field 'terrain_count' has changed");
77133 #ifdef FREECIV_JSON_CONNECTION
77134 field_addr.name = "terrain_count";
77135#endif /* FREECIV_JSON_CONNECTION */
77136 DIO_PUT(uint16, &dout, &field_addr, real_packet->terrain_count);
77137 }
77138 if (BV_ISSET(fields, 19)) {
77139 log_packet_detailed(" field 'num_specialist_types' has changed");
77140 #ifdef FREECIV_JSON_CONNECTION
77141 field_addr.name = "num_specialist_types";
77142#endif /* FREECIV_JSON_CONNECTION */
77143 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_specialist_types);
77144 }
77145 if (BV_ISSET(fields, 20)) {
77146 log_packet_detailed(" field 'num_nation_groups' has changed");
77147 #ifdef FREECIV_JSON_CONNECTION
77148 field_addr.name = "num_nation_groups";
77149#endif /* FREECIV_JSON_CONNECTION */
77150 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_groups);
77151 }
77152 if (BV_ISSET(fields, 21)) {
77153 log_packet_detailed(" field 'num_nation_sets' has changed");
77154 #ifdef FREECIV_JSON_CONNECTION
77155 field_addr.name = "num_nation_sets";
77156#endif /* FREECIV_JSON_CONNECTION */
77157 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_sets);
77158 }
77159 if (BV_ISSET(fields, 22)) {
77160 log_packet_detailed(" field 'preferred_tileset' has changed");
77161 #ifdef FREECIV_JSON_CONNECTION
77162 field_addr.name = "preferred_tileset";
77163#endif /* FREECIV_JSON_CONNECTION */
77164 DIO_PUT(string, &dout, &field_addr, real_packet->preferred_tileset);
77165 }
77166 if (BV_ISSET(fields, 23)) {
77167 log_packet_detailed(" field 'preferred_soundset' has changed");
77168 #ifdef FREECIV_JSON_CONNECTION
77169 field_addr.name = "preferred_soundset";
77170#endif /* FREECIV_JSON_CONNECTION */
77171 DIO_PUT(string, &dout, &field_addr, real_packet->preferred_soundset);
77172 }
77173 if (BV_ISSET(fields, 24)) {
77174 log_packet_detailed(" field 'preferred_musicset' has changed");
77175 #ifdef FREECIV_JSON_CONNECTION
77176 field_addr.name = "preferred_musicset";
77177#endif /* FREECIV_JSON_CONNECTION */
77178 DIO_PUT(string, &dout, &field_addr, real_packet->preferred_musicset);
77179 }
77180 /* field 25 is folded into the header */
77181 if (BV_ISSET(fields, 26)) {
77182 log_packet_detailed(" field 'name' has changed");
77183 #ifdef FREECIV_JSON_CONNECTION
77184 field_addr.name = "name";
77185#endif /* FREECIV_JSON_CONNECTION */
77186 DIO_PUT(string, &dout, &field_addr, real_packet->name);
77187 }
77188 if (BV_ISSET(fields, 27)) {
77189 log_packet_detailed(" field 'version' has changed");
77190 #ifdef FREECIV_JSON_CONNECTION
77191 field_addr.name = "version";
77192#endif /* FREECIV_JSON_CONNECTION */
77193 DIO_PUT(string, &dout, &field_addr, real_packet->version);
77194 }
77195 if (BV_ISSET(fields, 28)) {
77196 log_packet_detailed(" field 'alt_dir' has changed");
77197 #ifdef FREECIV_JSON_CONNECTION
77198 field_addr.name = "alt_dir";
77199#endif /* FREECIV_JSON_CONNECTION */
77200 DIO_PUT(string, &dout, &field_addr, real_packet->alt_dir);
77201 }
77202 if (BV_ISSET(fields, 29)) {
77203 log_packet_detailed(" field 'desc_length32' has changed");
77204 #ifdef FREECIV_JSON_CONNECTION
77205 field_addr.name = "desc_length32";
77206#endif /* FREECIV_JSON_CONNECTION */
77207 DIO_PUT(uint32, &dout, &field_addr, real_packet->desc_length32);
77208 }
77209
77210 *old = *real_packet;
77211#endif /* FREECIV_DELTA_PROTOCOL */
77212#ifndef FREECIV_DELTA_PROTOCOL
77213#ifdef FREECIV_JSON_CONNECTION
77214 field_addr.name = "num_unit_classes";
77215#endif /* FREECIV_JSON_CONNECTION */
77216 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_classes);
77217#ifdef FREECIV_JSON_CONNECTION
77218 field_addr.name = "num_unit_types";
77219#endif /* FREECIV_JSON_CONNECTION */
77220 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_types);
77221#ifdef FREECIV_JSON_CONNECTION
77222 field_addr.name = "num_impr_types";
77223#endif /* FREECIV_JSON_CONNECTION */
77224 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_impr_types);
77225#ifdef FREECIV_JSON_CONNECTION
77226 field_addr.name = "num_tech_classes";
77227#endif /* FREECIV_JSON_CONNECTION */
77228 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_classes);
77229#ifdef FREECIV_JSON_CONNECTION
77230 field_addr.name = "num_tech_types";
77231#endif /* FREECIV_JSON_CONNECTION */
77232 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_types);
77233#ifdef FREECIV_JSON_CONNECTION
77234 field_addr.name = "num_extra_types";
77235#endif /* FREECIV_JSON_CONNECTION */
77236 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_extra_types);
77237#ifdef FREECIV_JSON_CONNECTION
77238 field_addr.name = "num_base_types";
77239#endif /* FREECIV_JSON_CONNECTION */
77240 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_base_types);
77241#ifdef FREECIV_JSON_CONNECTION
77242 field_addr.name = "num_road_types";
77243#endif /* FREECIV_JSON_CONNECTION */
77244 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_road_types);
77245#ifdef FREECIV_JSON_CONNECTION
77246 field_addr.name = "num_resource_types";
77247#endif /* FREECIV_JSON_CONNECTION */
77248 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_resource_types);
77249#ifdef FREECIV_JSON_CONNECTION
77250 field_addr.name = "num_goods_types";
77251#endif /* FREECIV_JSON_CONNECTION */
77252 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_goods_types);
77253#ifdef FREECIV_JSON_CONNECTION
77254 field_addr.name = "num_disaster_types";
77255#endif /* FREECIV_JSON_CONNECTION */
77256 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_disaster_types);
77257#ifdef FREECIV_JSON_CONNECTION
77258 field_addr.name = "num_achievement_types";
77259#endif /* FREECIV_JSON_CONNECTION */
77260 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_achievement_types);
77261#ifdef FREECIV_JSON_CONNECTION
77262 field_addr.name = "num_multipliers";
77263#endif /* FREECIV_JSON_CONNECTION */
77264 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_multipliers);
77265#ifdef FREECIV_JSON_CONNECTION
77266 field_addr.name = "num_styles";
77267#endif /* FREECIV_JSON_CONNECTION */
77268 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_styles);
77269#ifdef FREECIV_JSON_CONNECTION
77270 field_addr.name = "num_music_styles";
77271#endif /* FREECIV_JSON_CONNECTION */
77272 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_music_styles);
77273#ifdef FREECIV_JSON_CONNECTION
77274 field_addr.name = "government_count";
77275#endif /* FREECIV_JSON_CONNECTION */
77276 DIO_PUT(uint16, &dout, &field_addr, real_packet->government_count);
77277#ifdef FREECIV_JSON_CONNECTION
77278 field_addr.name = "nation_count";
77279#endif /* FREECIV_JSON_CONNECTION */
77280 DIO_PUT(uint16, &dout, &field_addr, real_packet->nation_count);
77281#ifdef FREECIV_JSON_CONNECTION
77282 field_addr.name = "styles_count";
77283#endif /* FREECIV_JSON_CONNECTION */
77284 DIO_PUT(uint16, &dout, &field_addr, real_packet->styles_count);
77285#ifdef FREECIV_JSON_CONNECTION
77286 field_addr.name = "terrain_count";
77287#endif /* FREECIV_JSON_CONNECTION */
77288 DIO_PUT(uint16, &dout, &field_addr, real_packet->terrain_count);
77289#ifdef FREECIV_JSON_CONNECTION
77290 field_addr.name = "num_specialist_types";
77291#endif /* FREECIV_JSON_CONNECTION */
77292 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_specialist_types);
77293#ifdef FREECIV_JSON_CONNECTION
77294 field_addr.name = "num_nation_groups";
77295#endif /* FREECIV_JSON_CONNECTION */
77296 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_groups);
77297#ifdef FREECIV_JSON_CONNECTION
77298 field_addr.name = "num_nation_sets";
77299#endif /* FREECIV_JSON_CONNECTION */
77300 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_sets);
77301#ifdef FREECIV_JSON_CONNECTION
77302 field_addr.name = "preferred_tileset";
77303#endif /* FREECIV_JSON_CONNECTION */
77304 DIO_PUT(string, &dout, &field_addr, real_packet->preferred_tileset);
77305#ifdef FREECIV_JSON_CONNECTION
77306 field_addr.name = "preferred_soundset";
77307#endif /* FREECIV_JSON_CONNECTION */
77308 DIO_PUT(string, &dout, &field_addr, real_packet->preferred_soundset);
77309#ifdef FREECIV_JSON_CONNECTION
77310 field_addr.name = "preferred_musicset";
77311#endif /* FREECIV_JSON_CONNECTION */
77312 DIO_PUT(string, &dout, &field_addr, real_packet->preferred_musicset);
77313#ifdef FREECIV_JSON_CONNECTION
77314 field_addr.name = "popup_tech_help";
77315#endif /* FREECIV_JSON_CONNECTION */
77316 DIO_PUT(bool8, &dout, &field_addr, real_packet->popup_tech_help);
77317#ifdef FREECIV_JSON_CONNECTION
77318 field_addr.name = "name";
77319#endif /* FREECIV_JSON_CONNECTION */
77320 DIO_PUT(string, &dout, &field_addr, real_packet->name);
77321#ifdef FREECIV_JSON_CONNECTION
77322 field_addr.name = "version";
77323#endif /* FREECIV_JSON_CONNECTION */
77324 DIO_PUT(string, &dout, &field_addr, real_packet->version);
77325#ifdef FREECIV_JSON_CONNECTION
77326 field_addr.name = "alt_dir";
77327#endif /* FREECIV_JSON_CONNECTION */
77328 DIO_PUT(string, &dout, &field_addr, real_packet->alt_dir);
77329#ifdef FREECIV_JSON_CONNECTION
77330 field_addr.name = "desc_length32";
77331#endif /* FREECIV_JSON_CONNECTION */
77332 DIO_PUT(uint32, &dout, &field_addr, real_packet->desc_length32);
77333
77334#endif
77335 SEND_PACKET_END(PACKET_RULESET_CONTROL);
77336}
77337
77338#ifdef FREECIV_DELTA_PROTOCOL
77339#define hash_packet_ruleset_control_101 hash_const
77340
77341#define cmp_packet_ruleset_control_101 cmp_const
77342
77343 BV_DEFINE(packet_ruleset_control_101_fields, 30);
77344#endif /* FREECIV_DELTA_PROTOCOL */
77345
77346 static struct packet_ruleset_control *receive_packet_ruleset_control_101(struct connection *pc)
77347{
77348#ifdef FREECIV_DELTA_PROTOCOL
77349 packet_ruleset_control_101_fields fields;
77350 struct packet_ruleset_control *old;
77351 struct genhash **hash = pc->phs.received + PACKET_RULESET_CONTROL;
77352#endif /* FREECIV_DELTA_PROTOCOL */
77353 RECEIVE_PACKET_START(packet_ruleset_control, real_packet);
77354#ifdef FREECIV_JSON_CONNECTION
77355 struct plocation field_addr;
77356 {
77357 struct plocation *field_addr_tmp = plocation_field_new(NULL);
77358 field_addr = *field_addr_tmp;
77359 FC_FREE(field_addr_tmp);
77360 }
77361#endif /* FREECIV_JSON_CONNECTION */
77362
77363#ifdef FREECIV_DELTA_PROTOCOL
77364#ifdef FREECIV_JSON_CONNECTION
77365 field_addr.name = "fields";
77366#endif /* FREECIV_JSON_CONNECTION */
77367 DIO_BV_GET(&din, &field_addr, fields);
77368
77369#else /* FREECIV_DELTA_PROTOCOL */
77370 #ifdef FREECIV_JSON_CONNECTION
77371 field_addr.name = "num_unit_classes";
77372 #endif /* FREECIV_JSON_CONNECTION */
77373 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_classes)) {
77374 RECEIVE_PACKET_FIELD_ERROR(num_unit_classes);
77375 }
77376 #ifdef FREECIV_JSON_CONNECTION
77377 field_addr.name = "num_unit_types";
77378 #endif /* FREECIV_JSON_CONNECTION */
77379 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_types)) {
77380 RECEIVE_PACKET_FIELD_ERROR(num_unit_types);
77381 }
77382 #ifdef FREECIV_JSON_CONNECTION
77383 field_addr.name = "num_impr_types";
77384 #endif /* FREECIV_JSON_CONNECTION */
77385 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_impr_types)) {
77386 RECEIVE_PACKET_FIELD_ERROR(num_impr_types);
77387 }
77388 #ifdef FREECIV_JSON_CONNECTION
77389 field_addr.name = "num_tech_classes";
77390 #endif /* FREECIV_JSON_CONNECTION */
77391 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_classes)) {
77392 RECEIVE_PACKET_FIELD_ERROR(num_tech_classes);
77393 }
77394 #ifdef FREECIV_JSON_CONNECTION
77395 field_addr.name = "num_tech_types";
77396 #endif /* FREECIV_JSON_CONNECTION */
77397 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_types)) {
77398 RECEIVE_PACKET_FIELD_ERROR(num_tech_types);
77399 }
77400 #ifdef FREECIV_JSON_CONNECTION
77401 field_addr.name = "num_extra_types";
77402 #endif /* FREECIV_JSON_CONNECTION */
77403 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_extra_types)) {
77404 RECEIVE_PACKET_FIELD_ERROR(num_extra_types);
77405 }
77406 #ifdef FREECIV_JSON_CONNECTION
77407 field_addr.name = "num_base_types";
77408 #endif /* FREECIV_JSON_CONNECTION */
77409 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_base_types)) {
77410 RECEIVE_PACKET_FIELD_ERROR(num_base_types);
77411 }
77412 #ifdef FREECIV_JSON_CONNECTION
77413 field_addr.name = "num_road_types";
77414 #endif /* FREECIV_JSON_CONNECTION */
77415 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_road_types)) {
77416 RECEIVE_PACKET_FIELD_ERROR(num_road_types);
77417 }
77418 #ifdef FREECIV_JSON_CONNECTION
77419 field_addr.name = "num_resource_types";
77420 #endif /* FREECIV_JSON_CONNECTION */
77421 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_resource_types)) {
77422 RECEIVE_PACKET_FIELD_ERROR(num_resource_types);
77423 }
77424 #ifdef FREECIV_JSON_CONNECTION
77425 field_addr.name = "num_goods_types";
77426 #endif /* FREECIV_JSON_CONNECTION */
77427 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_goods_types)) {
77428 RECEIVE_PACKET_FIELD_ERROR(num_goods_types);
77429 }
77430 #ifdef FREECIV_JSON_CONNECTION
77431 field_addr.name = "num_disaster_types";
77432 #endif /* FREECIV_JSON_CONNECTION */
77433 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_disaster_types)) {
77434 RECEIVE_PACKET_FIELD_ERROR(num_disaster_types);
77435 }
77436 #ifdef FREECIV_JSON_CONNECTION
77437 field_addr.name = "num_achievement_types";
77438 #endif /* FREECIV_JSON_CONNECTION */
77439 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_achievement_types)) {
77440 RECEIVE_PACKET_FIELD_ERROR(num_achievement_types);
77441 }
77442 #ifdef FREECIV_JSON_CONNECTION
77443 field_addr.name = "num_multipliers";
77444 #endif /* FREECIV_JSON_CONNECTION */
77445 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_multipliers)) {
77446 RECEIVE_PACKET_FIELD_ERROR(num_multipliers);
77447 }
77448 #ifdef FREECIV_JSON_CONNECTION
77449 field_addr.name = "num_styles";
77450 #endif /* FREECIV_JSON_CONNECTION */
77451 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_styles)) {
77452 RECEIVE_PACKET_FIELD_ERROR(num_styles);
77453 }
77454 #ifdef FREECIV_JSON_CONNECTION
77455 field_addr.name = "num_music_styles";
77456 #endif /* FREECIV_JSON_CONNECTION */
77457 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_music_styles)) {
77458 RECEIVE_PACKET_FIELD_ERROR(num_music_styles);
77459 }
77460 #ifdef FREECIV_JSON_CONNECTION
77461 field_addr.name = "government_count";
77462 #endif /* FREECIV_JSON_CONNECTION */
77463 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->government_count)) {
77464 RECEIVE_PACKET_FIELD_ERROR(government_count);
77465 }
77466 #ifdef FREECIV_JSON_CONNECTION
77467 field_addr.name = "nation_count";
77468 #endif /* FREECIV_JSON_CONNECTION */
77469 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nation_count)) {
77470 RECEIVE_PACKET_FIELD_ERROR(nation_count);
77471 }
77472 #ifdef FREECIV_JSON_CONNECTION
77473 field_addr.name = "styles_count";
77474 #endif /* FREECIV_JSON_CONNECTION */
77475 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->styles_count)) {
77476 RECEIVE_PACKET_FIELD_ERROR(styles_count);
77477 }
77478 #ifdef FREECIV_JSON_CONNECTION
77479 field_addr.name = "terrain_count";
77480 #endif /* FREECIV_JSON_CONNECTION */
77481 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->terrain_count)) {
77482 RECEIVE_PACKET_FIELD_ERROR(terrain_count);
77483 }
77484 #ifdef FREECIV_JSON_CONNECTION
77485 field_addr.name = "num_specialist_types";
77486 #endif /* FREECIV_JSON_CONNECTION */
77487 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_specialist_types)) {
77488 RECEIVE_PACKET_FIELD_ERROR(num_specialist_types);
77489 }
77490 #ifdef FREECIV_JSON_CONNECTION
77491 field_addr.name = "num_nation_groups";
77492 #endif /* FREECIV_JSON_CONNECTION */
77493 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_groups)) {
77494 RECEIVE_PACKET_FIELD_ERROR(num_nation_groups);
77495 }
77496 #ifdef FREECIV_JSON_CONNECTION
77497 field_addr.name = "num_nation_sets";
77498 #endif /* FREECIV_JSON_CONNECTION */
77499 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_sets)) {
77500 RECEIVE_PACKET_FIELD_ERROR(num_nation_sets);
77501 }
77502 #ifdef FREECIV_JSON_CONNECTION
77503 field_addr.name = "preferred_tileset";
77504 #endif /* FREECIV_JSON_CONNECTION */
77505 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_tileset, sizeof(real_packet->preferred_tileset))) {
77506 RECEIVE_PACKET_FIELD_ERROR(preferred_tileset);
77507 }
77508 #ifdef FREECIV_JSON_CONNECTION
77509 field_addr.name = "preferred_soundset";
77510 #endif /* FREECIV_JSON_CONNECTION */
77511 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_soundset, sizeof(real_packet->preferred_soundset))) {
77512 RECEIVE_PACKET_FIELD_ERROR(preferred_soundset);
77513 }
77514 #ifdef FREECIV_JSON_CONNECTION
77515 field_addr.name = "preferred_musicset";
77516 #endif /* FREECIV_JSON_CONNECTION */
77517 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_musicset, sizeof(real_packet->preferred_musicset))) {
77518 RECEIVE_PACKET_FIELD_ERROR(preferred_musicset);
77519 }
77520 #ifdef FREECIV_JSON_CONNECTION
77521 field_addr.name = "popup_tech_help";
77522 #endif /* FREECIV_JSON_CONNECTION */
77523 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->popup_tech_help)) {
77524 RECEIVE_PACKET_FIELD_ERROR(popup_tech_help);
77525 }
77526 #ifdef FREECIV_JSON_CONNECTION
77527 field_addr.name = "name";
77528 #endif /* FREECIV_JSON_CONNECTION */
77529 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
77530 RECEIVE_PACKET_FIELD_ERROR(name);
77531 }
77532 #ifdef FREECIV_JSON_CONNECTION
77533 field_addr.name = "version";
77534 #endif /* FREECIV_JSON_CONNECTION */
77535 if (!DIO_GET(string, &din, &field_addr, real_packet->version, sizeof(real_packet->version))) {
77536 RECEIVE_PACKET_FIELD_ERROR(version);
77537 }
77538 #ifdef FREECIV_JSON_CONNECTION
77539 field_addr.name = "alt_dir";
77540 #endif /* FREECIV_JSON_CONNECTION */
77541 if (!DIO_GET(string, &din, &field_addr, real_packet->alt_dir, sizeof(real_packet->alt_dir))) {
77542 RECEIVE_PACKET_FIELD_ERROR(alt_dir);
77543 }
77544 #ifdef FREECIV_JSON_CONNECTION
77545 field_addr.name = "desc_length16";
77546 #endif /* FREECIV_JSON_CONNECTION */
77547 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->desc_length16)) {
77548 RECEIVE_PACKET_FIELD_ERROR(desc_length16);
77549 }
77550
77551#endif
77552 log_packet_detailed("packet_ruleset_control_101: got info about ()");
77553
77554#ifdef FREECIV_DELTA_PROTOCOL
77555 if (NULL == *hash) {
77556 *hash = genhash_new_full(hash_packet_ruleset_control_101, cmp_packet_ruleset_control_101,
77557 NULL, NULL, NULL, free);
77558 }
77559
77560 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
77561 *real_packet = *old;
77562 } else {
77563 log_packet_detailed(" no old info");
77564 memset(real_packet, 0, sizeof(*real_packet));
77565 }
77566
77567 if (BV_ISSET(fields, 0)) {
77568 log_packet_detailed(" got field 'num_unit_classes'");
77569 #ifdef FREECIV_JSON_CONNECTION
77570 field_addr.name = "num_unit_classes";
77571 #endif /* FREECIV_JSON_CONNECTION */
77572 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_classes)) {
77573 RECEIVE_PACKET_FIELD_ERROR(num_unit_classes);
77574 }
77575 }
77576 if (BV_ISSET(fields, 1)) {
77577 log_packet_detailed(" got field 'num_unit_types'");
77578 #ifdef FREECIV_JSON_CONNECTION
77579 field_addr.name = "num_unit_types";
77580 #endif /* FREECIV_JSON_CONNECTION */
77581 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_types)) {
77582 RECEIVE_PACKET_FIELD_ERROR(num_unit_types);
77583 }
77584 }
77585 if (BV_ISSET(fields, 2)) {
77586 log_packet_detailed(" got field 'num_impr_types'");
77587 #ifdef FREECIV_JSON_CONNECTION
77588 field_addr.name = "num_impr_types";
77589 #endif /* FREECIV_JSON_CONNECTION */
77590 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_impr_types)) {
77591 RECEIVE_PACKET_FIELD_ERROR(num_impr_types);
77592 }
77593 }
77594 if (BV_ISSET(fields, 3)) {
77595 log_packet_detailed(" got field 'num_tech_classes'");
77596 #ifdef FREECIV_JSON_CONNECTION
77597 field_addr.name = "num_tech_classes";
77598 #endif /* FREECIV_JSON_CONNECTION */
77599 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_classes)) {
77600 RECEIVE_PACKET_FIELD_ERROR(num_tech_classes);
77601 }
77602 }
77603 if (BV_ISSET(fields, 4)) {
77604 log_packet_detailed(" got field 'num_tech_types'");
77605 #ifdef FREECIV_JSON_CONNECTION
77606 field_addr.name = "num_tech_types";
77607 #endif /* FREECIV_JSON_CONNECTION */
77608 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_types)) {
77609 RECEIVE_PACKET_FIELD_ERROR(num_tech_types);
77610 }
77611 }
77612 if (BV_ISSET(fields, 5)) {
77613 log_packet_detailed(" got field 'num_extra_types'");
77614 #ifdef FREECIV_JSON_CONNECTION
77615 field_addr.name = "num_extra_types";
77616 #endif /* FREECIV_JSON_CONNECTION */
77617 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_extra_types)) {
77618 RECEIVE_PACKET_FIELD_ERROR(num_extra_types);
77619 }
77620 }
77621 if (BV_ISSET(fields, 6)) {
77622 log_packet_detailed(" got field 'num_base_types'");
77623 #ifdef FREECIV_JSON_CONNECTION
77624 field_addr.name = "num_base_types";
77625 #endif /* FREECIV_JSON_CONNECTION */
77626 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_base_types)) {
77627 RECEIVE_PACKET_FIELD_ERROR(num_base_types);
77628 }
77629 }
77630 if (BV_ISSET(fields, 7)) {
77631 log_packet_detailed(" got field 'num_road_types'");
77632 #ifdef FREECIV_JSON_CONNECTION
77633 field_addr.name = "num_road_types";
77634 #endif /* FREECIV_JSON_CONNECTION */
77635 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_road_types)) {
77636 RECEIVE_PACKET_FIELD_ERROR(num_road_types);
77637 }
77638 }
77639 if (BV_ISSET(fields, 8)) {
77640 log_packet_detailed(" got field 'num_resource_types'");
77641 #ifdef FREECIV_JSON_CONNECTION
77642 field_addr.name = "num_resource_types";
77643 #endif /* FREECIV_JSON_CONNECTION */
77644 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_resource_types)) {
77645 RECEIVE_PACKET_FIELD_ERROR(num_resource_types);
77646 }
77647 }
77648 if (BV_ISSET(fields, 9)) {
77649 log_packet_detailed(" got field 'num_goods_types'");
77650 #ifdef FREECIV_JSON_CONNECTION
77651 field_addr.name = "num_goods_types";
77652 #endif /* FREECIV_JSON_CONNECTION */
77653 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_goods_types)) {
77654 RECEIVE_PACKET_FIELD_ERROR(num_goods_types);
77655 }
77656 }
77657 if (BV_ISSET(fields, 10)) {
77658 log_packet_detailed(" got field 'num_disaster_types'");
77659 #ifdef FREECIV_JSON_CONNECTION
77660 field_addr.name = "num_disaster_types";
77661 #endif /* FREECIV_JSON_CONNECTION */
77662 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_disaster_types)) {
77663 RECEIVE_PACKET_FIELD_ERROR(num_disaster_types);
77664 }
77665 }
77666 if (BV_ISSET(fields, 11)) {
77667 log_packet_detailed(" got field 'num_achievement_types'");
77668 #ifdef FREECIV_JSON_CONNECTION
77669 field_addr.name = "num_achievement_types";
77670 #endif /* FREECIV_JSON_CONNECTION */
77671 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_achievement_types)) {
77672 RECEIVE_PACKET_FIELD_ERROR(num_achievement_types);
77673 }
77674 }
77675 if (BV_ISSET(fields, 12)) {
77676 log_packet_detailed(" got field 'num_multipliers'");
77677 #ifdef FREECIV_JSON_CONNECTION
77678 field_addr.name = "num_multipliers";
77679 #endif /* FREECIV_JSON_CONNECTION */
77680 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_multipliers)) {
77681 RECEIVE_PACKET_FIELD_ERROR(num_multipliers);
77682 }
77683 }
77684 if (BV_ISSET(fields, 13)) {
77685 log_packet_detailed(" got field 'num_styles'");
77686 #ifdef FREECIV_JSON_CONNECTION
77687 field_addr.name = "num_styles";
77688 #endif /* FREECIV_JSON_CONNECTION */
77689 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_styles)) {
77690 RECEIVE_PACKET_FIELD_ERROR(num_styles);
77691 }
77692 }
77693 if (BV_ISSET(fields, 14)) {
77694 log_packet_detailed(" got field 'num_music_styles'");
77695 #ifdef FREECIV_JSON_CONNECTION
77696 field_addr.name = "num_music_styles";
77697 #endif /* FREECIV_JSON_CONNECTION */
77698 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_music_styles)) {
77699 RECEIVE_PACKET_FIELD_ERROR(num_music_styles);
77700 }
77701 }
77702 if (BV_ISSET(fields, 15)) {
77703 log_packet_detailed(" got field 'government_count'");
77704 #ifdef FREECIV_JSON_CONNECTION
77705 field_addr.name = "government_count";
77706 #endif /* FREECIV_JSON_CONNECTION */
77707 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->government_count)) {
77708 RECEIVE_PACKET_FIELD_ERROR(government_count);
77709 }
77710 }
77711 if (BV_ISSET(fields, 16)) {
77712 log_packet_detailed(" got field 'nation_count'");
77713 #ifdef FREECIV_JSON_CONNECTION
77714 field_addr.name = "nation_count";
77715 #endif /* FREECIV_JSON_CONNECTION */
77716 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nation_count)) {
77717 RECEIVE_PACKET_FIELD_ERROR(nation_count);
77718 }
77719 }
77720 if (BV_ISSET(fields, 17)) {
77721 log_packet_detailed(" got field 'styles_count'");
77722 #ifdef FREECIV_JSON_CONNECTION
77723 field_addr.name = "styles_count";
77724 #endif /* FREECIV_JSON_CONNECTION */
77725 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->styles_count)) {
77726 RECEIVE_PACKET_FIELD_ERROR(styles_count);
77727 }
77728 }
77729 if (BV_ISSET(fields, 18)) {
77730 log_packet_detailed(" got field 'terrain_count'");
77731 #ifdef FREECIV_JSON_CONNECTION
77732 field_addr.name = "terrain_count";
77733 #endif /* FREECIV_JSON_CONNECTION */
77734 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->terrain_count)) {
77735 RECEIVE_PACKET_FIELD_ERROR(terrain_count);
77736 }
77737 }
77738 if (BV_ISSET(fields, 19)) {
77739 log_packet_detailed(" got field 'num_specialist_types'");
77740 #ifdef FREECIV_JSON_CONNECTION
77741 field_addr.name = "num_specialist_types";
77742 #endif /* FREECIV_JSON_CONNECTION */
77743 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_specialist_types)) {
77744 RECEIVE_PACKET_FIELD_ERROR(num_specialist_types);
77745 }
77746 }
77747 if (BV_ISSET(fields, 20)) {
77748 log_packet_detailed(" got field 'num_nation_groups'");
77749 #ifdef FREECIV_JSON_CONNECTION
77750 field_addr.name = "num_nation_groups";
77751 #endif /* FREECIV_JSON_CONNECTION */
77752 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_groups)) {
77753 RECEIVE_PACKET_FIELD_ERROR(num_nation_groups);
77754 }
77755 }
77756 if (BV_ISSET(fields, 21)) {
77757 log_packet_detailed(" got field 'num_nation_sets'");
77758 #ifdef FREECIV_JSON_CONNECTION
77759 field_addr.name = "num_nation_sets";
77760 #endif /* FREECIV_JSON_CONNECTION */
77761 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_sets)) {
77762 RECEIVE_PACKET_FIELD_ERROR(num_nation_sets);
77763 }
77764 }
77765 if (BV_ISSET(fields, 22)) {
77766 log_packet_detailed(" got field 'preferred_tileset'");
77767 #ifdef FREECIV_JSON_CONNECTION
77768 field_addr.name = "preferred_tileset";
77769 #endif /* FREECIV_JSON_CONNECTION */
77770 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_tileset, sizeof(real_packet->preferred_tileset))) {
77771 RECEIVE_PACKET_FIELD_ERROR(preferred_tileset);
77772 }
77773 }
77774 if (BV_ISSET(fields, 23)) {
77775 log_packet_detailed(" got field 'preferred_soundset'");
77776 #ifdef FREECIV_JSON_CONNECTION
77777 field_addr.name = "preferred_soundset";
77778 #endif /* FREECIV_JSON_CONNECTION */
77779 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_soundset, sizeof(real_packet->preferred_soundset))) {
77780 RECEIVE_PACKET_FIELD_ERROR(preferred_soundset);
77781 }
77782 }
77783 if (BV_ISSET(fields, 24)) {
77784 log_packet_detailed(" got field 'preferred_musicset'");
77785 #ifdef FREECIV_JSON_CONNECTION
77786 field_addr.name = "preferred_musicset";
77787 #endif /* FREECIV_JSON_CONNECTION */
77788 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_musicset, sizeof(real_packet->preferred_musicset))) {
77789 RECEIVE_PACKET_FIELD_ERROR(preferred_musicset);
77790 }
77791 }
77792 real_packet->popup_tech_help = BV_ISSET(fields, 25);
77793 if (BV_ISSET(fields, 26)) {
77794 log_packet_detailed(" got field 'name'");
77795 #ifdef FREECIV_JSON_CONNECTION
77796 field_addr.name = "name";
77797 #endif /* FREECIV_JSON_CONNECTION */
77798 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
77799 RECEIVE_PACKET_FIELD_ERROR(name);
77800 }
77801 }
77802 if (BV_ISSET(fields, 27)) {
77803 log_packet_detailed(" got field 'version'");
77804 #ifdef FREECIV_JSON_CONNECTION
77805 field_addr.name = "version";
77806 #endif /* FREECIV_JSON_CONNECTION */
77807 if (!DIO_GET(string, &din, &field_addr, real_packet->version, sizeof(real_packet->version))) {
77808 RECEIVE_PACKET_FIELD_ERROR(version);
77809 }
77810 }
77811 if (BV_ISSET(fields, 28)) {
77812 log_packet_detailed(" got field 'alt_dir'");
77813 #ifdef FREECIV_JSON_CONNECTION
77814 field_addr.name = "alt_dir";
77815 #endif /* FREECIV_JSON_CONNECTION */
77816 if (!DIO_GET(string, &din, &field_addr, real_packet->alt_dir, sizeof(real_packet->alt_dir))) {
77817 RECEIVE_PACKET_FIELD_ERROR(alt_dir);
77818 }
77819 }
77820 if (BV_ISSET(fields, 29)) {
77821 log_packet_detailed(" got field 'desc_length16'");
77822 #ifdef FREECIV_JSON_CONNECTION
77823 field_addr.name = "desc_length16";
77824 #endif /* FREECIV_JSON_CONNECTION */
77825 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->desc_length16)) {
77826 RECEIVE_PACKET_FIELD_ERROR(desc_length16);
77827 }
77828 }
77829
77830 if (NULL == old) {
77831 old = fc_malloc(sizeof(*old));
77832 *old = *real_packet;
77833 genhash_insert(*hash, old, old);
77834 } else {
77835 *old = *real_packet;
77836 }
77837
77838#endif /* FREECIV_DELTA_PROTOCOL */
77839 RECEIVE_PACKET_END(real_packet);
77840}
77841
77842 static int send_packet_ruleset_control_101(struct connection *pc, const struct packet_ruleset_control *packet)
77843{
77844 const struct packet_ruleset_control *real_packet = packet;
77845#ifdef FREECIV_DELTA_PROTOCOL
77846 packet_ruleset_control_101_fields fields;
77847 struct packet_ruleset_control *old;
77848 bool differ;
77849 struct genhash **hash = pc->phs.sent + PACKET_RULESET_CONTROL;
77850#endif /* FREECIV_DELTA_PROTOCOL */
77851 SEND_PACKET_START(PACKET_RULESET_CONTROL);
77852#ifdef FREECIV_JSON_CONNECTION
77853 struct plocation field_addr;
77854 {
77855 struct plocation *field_addr_tmp = plocation_field_new(NULL);
77856 field_addr = *field_addr_tmp;
77857 FC_FREE(field_addr_tmp);
77858 }
77859#endif /* FREECIV_JSON_CONNECTION */
77860
77861 log_packet_detailed("packet_ruleset_control_101: sending info about ()");
77862
77863#ifdef FREECIV_DELTA_PROTOCOL
77864 if (NULL == *hash) {
77865 *hash = genhash_new_full(hash_packet_ruleset_control_101, cmp_packet_ruleset_control_101,
77866 NULL, NULL, NULL, free);
77867 }
77868 BV_CLR_ALL(fields);
77869
77870 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
77871 old = fc_malloc(sizeof(*old));
77872 *old = *real_packet;
77873 genhash_insert(*hash, old, old);
77874 memset(old, 0, sizeof(*old));
77875 }
77876 differ = (old->num_unit_classes != real_packet->num_unit_classes);
77877 if (differ) {
77878 BV_SET(fields, 0);
77879 }
77880
77881 differ = (old->num_unit_types != real_packet->num_unit_types);
77882 if (differ) {
77883 BV_SET(fields, 1);
77884 }
77885
77886 differ = (old->num_impr_types != real_packet->num_impr_types);
77887 if (differ) {
77888 BV_SET(fields, 2);
77889 }
77890
77891 differ = (old->num_tech_classes != real_packet->num_tech_classes);
77892 if (differ) {
77893 BV_SET(fields, 3);
77894 }
77895
77896 differ = (old->num_tech_types != real_packet->num_tech_types);
77897 if (differ) {
77898 BV_SET(fields, 4);
77899 }
77900
77901 differ = (old->num_extra_types != real_packet->num_extra_types);
77902 if (differ) {
77903 BV_SET(fields, 5);
77904 }
77905
77906 differ = (old->num_base_types != real_packet->num_base_types);
77907 if (differ) {
77908 BV_SET(fields, 6);
77909 }
77910
77911 differ = (old->num_road_types != real_packet->num_road_types);
77912 if (differ) {
77913 BV_SET(fields, 7);
77914 }
77915
77916 differ = (old->num_resource_types != real_packet->num_resource_types);
77917 if (differ) {
77918 BV_SET(fields, 8);
77919 }
77920
77921 differ = (old->num_goods_types != real_packet->num_goods_types);
77922 if (differ) {
77923 BV_SET(fields, 9);
77924 }
77925
77926 differ = (old->num_disaster_types != real_packet->num_disaster_types);
77927 if (differ) {
77928 BV_SET(fields, 10);
77929 }
77930
77931 differ = (old->num_achievement_types != real_packet->num_achievement_types);
77932 if (differ) {
77933 BV_SET(fields, 11);
77934 }
77935
77936 differ = (old->num_multipliers != real_packet->num_multipliers);
77937 if (differ) {
77938 BV_SET(fields, 12);
77939 }
77940
77941 differ = (old->num_styles != real_packet->num_styles);
77942 if (differ) {
77943 BV_SET(fields, 13);
77944 }
77945
77946 differ = (old->num_music_styles != real_packet->num_music_styles);
77947 if (differ) {
77948 BV_SET(fields, 14);
77949 }
77950
77951 differ = (old->government_count != real_packet->government_count);
77952 if (differ) {
77953 BV_SET(fields, 15);
77954 }
77955
77956 differ = (old->nation_count != real_packet->nation_count);
77957 if (differ) {
77958 BV_SET(fields, 16);
77959 }
77960
77961 differ = (old->styles_count != real_packet->styles_count);
77962 if (differ) {
77963 BV_SET(fields, 17);
77964 }
77965
77966 differ = (old->terrain_count != real_packet->terrain_count);
77967 if (differ) {
77968 BV_SET(fields, 18);
77969 }
77970
77971 differ = (old->num_specialist_types != real_packet->num_specialist_types);
77972 if (differ) {
77973 BV_SET(fields, 19);
77974 }
77975
77976 differ = (old->num_nation_groups != real_packet->num_nation_groups);
77977 if (differ) {
77978 BV_SET(fields, 20);
77979 }
77980
77981 differ = (old->num_nation_sets != real_packet->num_nation_sets);
77982 if (differ) {
77983 BV_SET(fields, 21);
77984 }
77985
77986 differ = (strcmp(old->preferred_tileset, real_packet->preferred_tileset) != 0);
77987 if (differ) {
77988 BV_SET(fields, 22);
77989 }
77990
77991 differ = (strcmp(old->preferred_soundset, real_packet->preferred_soundset) != 0);
77992 if (differ) {
77993 BV_SET(fields, 23);
77994 }
77995
77996 differ = (strcmp(old->preferred_musicset, real_packet->preferred_musicset) != 0);
77997 if (differ) {
77998 BV_SET(fields, 24);
77999 }
78000
78001 if (packet->popup_tech_help) {
78002 BV_SET(fields, 25);
78003 }
78004
78005 differ = (strcmp(old->name, real_packet->name) != 0);
78006 if (differ) {
78007 BV_SET(fields, 26);
78008 }
78009
78010 differ = (strcmp(old->version, real_packet->version) != 0);
78011 if (differ) {
78012 BV_SET(fields, 27);
78013 }
78014
78015 differ = (strcmp(old->alt_dir, real_packet->alt_dir) != 0);
78016 if (differ) {
78017 BV_SET(fields, 28);
78018 }
78019
78020 differ = (old->desc_length16 != real_packet->desc_length16);
78021 if (differ) {
78022 BV_SET(fields, 29);
78023 }
78024
78025
78026#ifdef FREECIV_JSON_CONNECTION
78027 field_addr.name = "fields";
78028#endif /* FREECIV_JSON_CONNECTION */
78029 DIO_BV_PUT(&dout, &field_addr, fields);
78030
78031 if (BV_ISSET(fields, 0)) {
78032 log_packet_detailed(" field 'num_unit_classes' has changed");
78033 #ifdef FREECIV_JSON_CONNECTION
78034 field_addr.name = "num_unit_classes";
78035#endif /* FREECIV_JSON_CONNECTION */
78036 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_classes);
78037 }
78038 if (BV_ISSET(fields, 1)) {
78039 log_packet_detailed(" field 'num_unit_types' has changed");
78040 #ifdef FREECIV_JSON_CONNECTION
78041 field_addr.name = "num_unit_types";
78042#endif /* FREECIV_JSON_CONNECTION */
78043 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_types);
78044 }
78045 if (BV_ISSET(fields, 2)) {
78046 log_packet_detailed(" field 'num_impr_types' has changed");
78047 #ifdef FREECIV_JSON_CONNECTION
78048 field_addr.name = "num_impr_types";
78049#endif /* FREECIV_JSON_CONNECTION */
78050 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_impr_types);
78051 }
78052 if (BV_ISSET(fields, 3)) {
78053 log_packet_detailed(" field 'num_tech_classes' has changed");
78054 #ifdef FREECIV_JSON_CONNECTION
78055 field_addr.name = "num_tech_classes";
78056#endif /* FREECIV_JSON_CONNECTION */
78057 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_classes);
78058 }
78059 if (BV_ISSET(fields, 4)) {
78060 log_packet_detailed(" field 'num_tech_types' has changed");
78061 #ifdef FREECIV_JSON_CONNECTION
78062 field_addr.name = "num_tech_types";
78063#endif /* FREECIV_JSON_CONNECTION */
78064 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_types);
78065 }
78066 if (BV_ISSET(fields, 5)) {
78067 log_packet_detailed(" field 'num_extra_types' has changed");
78068 #ifdef FREECIV_JSON_CONNECTION
78069 field_addr.name = "num_extra_types";
78070#endif /* FREECIV_JSON_CONNECTION */
78071 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_extra_types);
78072 }
78073 if (BV_ISSET(fields, 6)) {
78074 log_packet_detailed(" field 'num_base_types' has changed");
78075 #ifdef FREECIV_JSON_CONNECTION
78076 field_addr.name = "num_base_types";
78077#endif /* FREECIV_JSON_CONNECTION */
78078 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_base_types);
78079 }
78080 if (BV_ISSET(fields, 7)) {
78081 log_packet_detailed(" field 'num_road_types' has changed");
78082 #ifdef FREECIV_JSON_CONNECTION
78083 field_addr.name = "num_road_types";
78084#endif /* FREECIV_JSON_CONNECTION */
78085 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_road_types);
78086 }
78087 if (BV_ISSET(fields, 8)) {
78088 log_packet_detailed(" field 'num_resource_types' has changed");
78089 #ifdef FREECIV_JSON_CONNECTION
78090 field_addr.name = "num_resource_types";
78091#endif /* FREECIV_JSON_CONNECTION */
78092 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_resource_types);
78093 }
78094 if (BV_ISSET(fields, 9)) {
78095 log_packet_detailed(" field 'num_goods_types' has changed");
78096 #ifdef FREECIV_JSON_CONNECTION
78097 field_addr.name = "num_goods_types";
78098#endif /* FREECIV_JSON_CONNECTION */
78099 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_goods_types);
78100 }
78101 if (BV_ISSET(fields, 10)) {
78102 log_packet_detailed(" field 'num_disaster_types' has changed");
78103 #ifdef FREECIV_JSON_CONNECTION
78104 field_addr.name = "num_disaster_types";
78105#endif /* FREECIV_JSON_CONNECTION */
78106 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_disaster_types);
78107 }
78108 if (BV_ISSET(fields, 11)) {
78109 log_packet_detailed(" field 'num_achievement_types' has changed");
78110 #ifdef FREECIV_JSON_CONNECTION
78111 field_addr.name = "num_achievement_types";
78112#endif /* FREECIV_JSON_CONNECTION */
78113 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_achievement_types);
78114 }
78115 if (BV_ISSET(fields, 12)) {
78116 log_packet_detailed(" field 'num_multipliers' has changed");
78117 #ifdef FREECIV_JSON_CONNECTION
78118 field_addr.name = "num_multipliers";
78119#endif /* FREECIV_JSON_CONNECTION */
78120 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_multipliers);
78121 }
78122 if (BV_ISSET(fields, 13)) {
78123 log_packet_detailed(" field 'num_styles' has changed");
78124 #ifdef FREECIV_JSON_CONNECTION
78125 field_addr.name = "num_styles";
78126#endif /* FREECIV_JSON_CONNECTION */
78127 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_styles);
78128 }
78129 if (BV_ISSET(fields, 14)) {
78130 log_packet_detailed(" field 'num_music_styles' has changed");
78131 #ifdef FREECIV_JSON_CONNECTION
78132 field_addr.name = "num_music_styles";
78133#endif /* FREECIV_JSON_CONNECTION */
78134 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_music_styles);
78135 }
78136 if (BV_ISSET(fields, 15)) {
78137 log_packet_detailed(" field 'government_count' has changed");
78138 #ifdef FREECIV_JSON_CONNECTION
78139 field_addr.name = "government_count";
78140#endif /* FREECIV_JSON_CONNECTION */
78141 DIO_PUT(uint16, &dout, &field_addr, real_packet->government_count);
78142 }
78143 if (BV_ISSET(fields, 16)) {
78144 log_packet_detailed(" field 'nation_count' has changed");
78145 #ifdef FREECIV_JSON_CONNECTION
78146 field_addr.name = "nation_count";
78147#endif /* FREECIV_JSON_CONNECTION */
78148 DIO_PUT(uint16, &dout, &field_addr, real_packet->nation_count);
78149 }
78150 if (BV_ISSET(fields, 17)) {
78151 log_packet_detailed(" field 'styles_count' has changed");
78152 #ifdef FREECIV_JSON_CONNECTION
78153 field_addr.name = "styles_count";
78154#endif /* FREECIV_JSON_CONNECTION */
78155 DIO_PUT(uint16, &dout, &field_addr, real_packet->styles_count);
78156 }
78157 if (BV_ISSET(fields, 18)) {
78158 log_packet_detailed(" field 'terrain_count' has changed");
78159 #ifdef FREECIV_JSON_CONNECTION
78160 field_addr.name = "terrain_count";
78161#endif /* FREECIV_JSON_CONNECTION */
78162 DIO_PUT(uint16, &dout, &field_addr, real_packet->terrain_count);
78163 }
78164 if (BV_ISSET(fields, 19)) {
78165 log_packet_detailed(" field 'num_specialist_types' has changed");
78166 #ifdef FREECIV_JSON_CONNECTION
78167 field_addr.name = "num_specialist_types";
78168#endif /* FREECIV_JSON_CONNECTION */
78169 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_specialist_types);
78170 }
78171 if (BV_ISSET(fields, 20)) {
78172 log_packet_detailed(" field 'num_nation_groups' has changed");
78173 #ifdef FREECIV_JSON_CONNECTION
78174 field_addr.name = "num_nation_groups";
78175#endif /* FREECIV_JSON_CONNECTION */
78176 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_groups);
78177 }
78178 if (BV_ISSET(fields, 21)) {
78179 log_packet_detailed(" field 'num_nation_sets' has changed");
78180 #ifdef FREECIV_JSON_CONNECTION
78181 field_addr.name = "num_nation_sets";
78182#endif /* FREECIV_JSON_CONNECTION */
78183 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_sets);
78184 }
78185 if (BV_ISSET(fields, 22)) {
78186 log_packet_detailed(" field 'preferred_tileset' has changed");
78187 #ifdef FREECIV_JSON_CONNECTION
78188 field_addr.name = "preferred_tileset";
78189#endif /* FREECIV_JSON_CONNECTION */
78190 DIO_PUT(string, &dout, &field_addr, real_packet->preferred_tileset);
78191 }
78192 if (BV_ISSET(fields, 23)) {
78193 log_packet_detailed(" field 'preferred_soundset' has changed");
78194 #ifdef FREECIV_JSON_CONNECTION
78195 field_addr.name = "preferred_soundset";
78196#endif /* FREECIV_JSON_CONNECTION */
78197 DIO_PUT(string, &dout, &field_addr, real_packet->preferred_soundset);
78198 }
78199 if (BV_ISSET(fields, 24)) {
78200 log_packet_detailed(" field 'preferred_musicset' has changed");
78201 #ifdef FREECIV_JSON_CONNECTION
78202 field_addr.name = "preferred_musicset";
78203#endif /* FREECIV_JSON_CONNECTION */
78204 DIO_PUT(string, &dout, &field_addr, real_packet->preferred_musicset);
78205 }
78206 /* field 25 is folded into the header */
78207 if (BV_ISSET(fields, 26)) {
78208 log_packet_detailed(" field 'name' has changed");
78209 #ifdef FREECIV_JSON_CONNECTION
78210 field_addr.name = "name";
78211#endif /* FREECIV_JSON_CONNECTION */
78212 DIO_PUT(string, &dout, &field_addr, real_packet->name);
78213 }
78214 if (BV_ISSET(fields, 27)) {
78215 log_packet_detailed(" field 'version' has changed");
78216 #ifdef FREECIV_JSON_CONNECTION
78217 field_addr.name = "version";
78218#endif /* FREECIV_JSON_CONNECTION */
78219 DIO_PUT(string, &dout, &field_addr, real_packet->version);
78220 }
78221 if (BV_ISSET(fields, 28)) {
78222 log_packet_detailed(" field 'alt_dir' has changed");
78223 #ifdef FREECIV_JSON_CONNECTION
78224 field_addr.name = "alt_dir";
78225#endif /* FREECIV_JSON_CONNECTION */
78226 DIO_PUT(string, &dout, &field_addr, real_packet->alt_dir);
78227 }
78228 if (BV_ISSET(fields, 29)) {
78229 log_packet_detailed(" field 'desc_length16' has changed");
78230 #ifdef FREECIV_JSON_CONNECTION
78231 field_addr.name = "desc_length16";
78232#endif /* FREECIV_JSON_CONNECTION */
78233 DIO_PUT(uint16, &dout, &field_addr, real_packet->desc_length16);
78234 }
78235
78236 *old = *real_packet;
78237#endif /* FREECIV_DELTA_PROTOCOL */
78238#ifndef FREECIV_DELTA_PROTOCOL
78239#ifdef FREECIV_JSON_CONNECTION
78240 field_addr.name = "num_unit_classes";
78241#endif /* FREECIV_JSON_CONNECTION */
78242 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_classes);
78243#ifdef FREECIV_JSON_CONNECTION
78244 field_addr.name = "num_unit_types";
78245#endif /* FREECIV_JSON_CONNECTION */
78246 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_types);
78247#ifdef FREECIV_JSON_CONNECTION
78248 field_addr.name = "num_impr_types";
78249#endif /* FREECIV_JSON_CONNECTION */
78250 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_impr_types);
78251#ifdef FREECIV_JSON_CONNECTION
78252 field_addr.name = "num_tech_classes";
78253#endif /* FREECIV_JSON_CONNECTION */
78254 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_classes);
78255#ifdef FREECIV_JSON_CONNECTION
78256 field_addr.name = "num_tech_types";
78257#endif /* FREECIV_JSON_CONNECTION */
78258 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_types);
78259#ifdef FREECIV_JSON_CONNECTION
78260 field_addr.name = "num_extra_types";
78261#endif /* FREECIV_JSON_CONNECTION */
78262 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_extra_types);
78263#ifdef FREECIV_JSON_CONNECTION
78264 field_addr.name = "num_base_types";
78265#endif /* FREECIV_JSON_CONNECTION */
78266 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_base_types);
78267#ifdef FREECIV_JSON_CONNECTION
78268 field_addr.name = "num_road_types";
78269#endif /* FREECIV_JSON_CONNECTION */
78270 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_road_types);
78271#ifdef FREECIV_JSON_CONNECTION
78272 field_addr.name = "num_resource_types";
78273#endif /* FREECIV_JSON_CONNECTION */
78274 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_resource_types);
78275#ifdef FREECIV_JSON_CONNECTION
78276 field_addr.name = "num_goods_types";
78277#endif /* FREECIV_JSON_CONNECTION */
78278 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_goods_types);
78279#ifdef FREECIV_JSON_CONNECTION
78280 field_addr.name = "num_disaster_types";
78281#endif /* FREECIV_JSON_CONNECTION */
78282 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_disaster_types);
78283#ifdef FREECIV_JSON_CONNECTION
78284 field_addr.name = "num_achievement_types";
78285#endif /* FREECIV_JSON_CONNECTION */
78286 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_achievement_types);
78287#ifdef FREECIV_JSON_CONNECTION
78288 field_addr.name = "num_multipliers";
78289#endif /* FREECIV_JSON_CONNECTION */
78290 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_multipliers);
78291#ifdef FREECIV_JSON_CONNECTION
78292 field_addr.name = "num_styles";
78293#endif /* FREECIV_JSON_CONNECTION */
78294 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_styles);
78295#ifdef FREECIV_JSON_CONNECTION
78296 field_addr.name = "num_music_styles";
78297#endif /* FREECIV_JSON_CONNECTION */
78298 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_music_styles);
78299#ifdef FREECIV_JSON_CONNECTION
78300 field_addr.name = "government_count";
78301#endif /* FREECIV_JSON_CONNECTION */
78302 DIO_PUT(uint16, &dout, &field_addr, real_packet->government_count);
78303#ifdef FREECIV_JSON_CONNECTION
78304 field_addr.name = "nation_count";
78305#endif /* FREECIV_JSON_CONNECTION */
78306 DIO_PUT(uint16, &dout, &field_addr, real_packet->nation_count);
78307#ifdef FREECIV_JSON_CONNECTION
78308 field_addr.name = "styles_count";
78309#endif /* FREECIV_JSON_CONNECTION */
78310 DIO_PUT(uint16, &dout, &field_addr, real_packet->styles_count);
78311#ifdef FREECIV_JSON_CONNECTION
78312 field_addr.name = "terrain_count";
78313#endif /* FREECIV_JSON_CONNECTION */
78314 DIO_PUT(uint16, &dout, &field_addr, real_packet->terrain_count);
78315#ifdef FREECIV_JSON_CONNECTION
78316 field_addr.name = "num_specialist_types";
78317#endif /* FREECIV_JSON_CONNECTION */
78318 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_specialist_types);
78319#ifdef FREECIV_JSON_CONNECTION
78320 field_addr.name = "num_nation_groups";
78321#endif /* FREECIV_JSON_CONNECTION */
78322 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_groups);
78323#ifdef FREECIV_JSON_CONNECTION
78324 field_addr.name = "num_nation_sets";
78325#endif /* FREECIV_JSON_CONNECTION */
78326 DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_sets);
78327#ifdef FREECIV_JSON_CONNECTION
78328 field_addr.name = "preferred_tileset";
78329#endif /* FREECIV_JSON_CONNECTION */
78330 DIO_PUT(string, &dout, &field_addr, real_packet->preferred_tileset);
78331#ifdef FREECIV_JSON_CONNECTION
78332 field_addr.name = "preferred_soundset";
78333#endif /* FREECIV_JSON_CONNECTION */
78334 DIO_PUT(string, &dout, &field_addr, real_packet->preferred_soundset);
78335#ifdef FREECIV_JSON_CONNECTION
78336 field_addr.name = "preferred_musicset";
78337#endif /* FREECIV_JSON_CONNECTION */
78338 DIO_PUT(string, &dout, &field_addr, real_packet->preferred_musicset);
78339#ifdef FREECIV_JSON_CONNECTION
78340 field_addr.name = "popup_tech_help";
78341#endif /* FREECIV_JSON_CONNECTION */
78342 DIO_PUT(bool8, &dout, &field_addr, real_packet->popup_tech_help);
78343#ifdef FREECIV_JSON_CONNECTION
78344 field_addr.name = "name";
78345#endif /* FREECIV_JSON_CONNECTION */
78346 DIO_PUT(string, &dout, &field_addr, real_packet->name);
78347#ifdef FREECIV_JSON_CONNECTION
78348 field_addr.name = "version";
78349#endif /* FREECIV_JSON_CONNECTION */
78350 DIO_PUT(string, &dout, &field_addr, real_packet->version);
78351#ifdef FREECIV_JSON_CONNECTION
78352 field_addr.name = "alt_dir";
78353#endif /* FREECIV_JSON_CONNECTION */
78354 DIO_PUT(string, &dout, &field_addr, real_packet->alt_dir);
78355#ifdef FREECIV_JSON_CONNECTION
78356 field_addr.name = "desc_length16";
78357#endif /* FREECIV_JSON_CONNECTION */
78358 DIO_PUT(uint16, &dout, &field_addr, real_packet->desc_length16);
78359
78360#endif
78361 SEND_PACKET_END(PACKET_RULESET_CONTROL);
78362}
78363
78364 int send_packet_ruleset_control(struct connection *pc, const struct packet_ruleset_control *packet)
78365{
78366 if (!pc->used) {
78367 log_error("WARNING: trying to send data to the closed connection %s",
78368 conn_description(pc));
78369 return -1;
78370 }
78371 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_CONTROL].packet != NULL, -1,
78372 "Handler for PACKET_RULESET_CONTROL not installed");
78373 return pc->phs.handlers->send[PACKET_RULESET_CONTROL].packet(pc, packet);
78374}
78375
78376 void lsend_packet_ruleset_control(struct conn_list *dest, const struct packet_ruleset_control *packet)
78377{
78378 conn_list_iterate(dest, pconn) {
78379 send_packet_ruleset_control(pconn, packet);
78380 } conn_list_iterate_end;
78381}
78382
78383#ifdef FREECIV_DELTA_PROTOCOL
78384#define hash_packet_ruleset_summary_100 hash_const
78385
78386#define cmp_packet_ruleset_summary_100 cmp_const
78387
78388 BV_DEFINE(packet_ruleset_summary_100_fields, 1);
78389#endif /* FREECIV_DELTA_PROTOCOL */
78390
78391 static struct packet_ruleset_summary *receive_packet_ruleset_summary_100(struct connection *pc)
78392{
78393#ifdef FREECIV_DELTA_PROTOCOL
78394 packet_ruleset_summary_100_fields fields;
78395 struct packet_ruleset_summary *old;
78396 struct genhash **hash = pc->phs.received + PACKET_RULESET_SUMMARY;
78397#endif /* FREECIV_DELTA_PROTOCOL */
78398 RECEIVE_PACKET_START(packet_ruleset_summary, real_packet);
78399#ifdef FREECIV_JSON_CONNECTION
78400 struct plocation field_addr;
78401 {
78402 struct plocation *field_addr_tmp = plocation_field_new(NULL);
78403 field_addr = *field_addr_tmp;
78404 FC_FREE(field_addr_tmp);
78405 }
78406#endif /* FREECIV_JSON_CONNECTION */
78407
78408#ifdef FREECIV_DELTA_PROTOCOL
78409#ifdef FREECIV_JSON_CONNECTION
78410 field_addr.name = "fields";
78411#endif /* FREECIV_JSON_CONNECTION */
78412 DIO_BV_GET(&din, &field_addr, fields);
78413
78414#else /* FREECIV_DELTA_PROTOCOL */
78415 #ifdef FREECIV_JSON_CONNECTION
78416 field_addr.name = "text";
78417 #endif /* FREECIV_JSON_CONNECTION */
78418 if (!DIO_GET(string, &din, &field_addr, real_packet->text, sizeof(real_packet->text))) {
78419 RECEIVE_PACKET_FIELD_ERROR(text);
78420 }
78421
78422#endif
78423 log_packet_detailed("packet_ruleset_summary_100: got info about ()");
78424
78425#ifdef FREECIV_DELTA_PROTOCOL
78426 if (NULL == *hash) {
78427 *hash = genhash_new_full(hash_packet_ruleset_summary_100, cmp_packet_ruleset_summary_100,
78428 NULL, NULL, NULL, free);
78429 }
78430
78431 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
78432 *real_packet = *old;
78433 } else {
78434 log_packet_detailed(" no old info");
78435 memset(real_packet, 0, sizeof(*real_packet));
78436 }
78437
78438 if (BV_ISSET(fields, 0)) {
78439 log_packet_detailed(" got field 'text'");
78440 #ifdef FREECIV_JSON_CONNECTION
78441 field_addr.name = "text";
78442 #endif /* FREECIV_JSON_CONNECTION */
78443 if (!DIO_GET(string, &din, &field_addr, real_packet->text, sizeof(real_packet->text))) {
78444 RECEIVE_PACKET_FIELD_ERROR(text);
78445 }
78446 }
78447
78448 if (NULL == old) {
78449 old = fc_malloc(sizeof(*old));
78450 *old = *real_packet;
78451 genhash_insert(*hash, old, old);
78452 } else {
78453 *old = *real_packet;
78454 }
78455
78456#endif /* FREECIV_DELTA_PROTOCOL */
78457 RECEIVE_PACKET_END(real_packet);
78458}
78459
78460 static int send_packet_ruleset_summary_100(struct connection *pc, const struct packet_ruleset_summary *packet)
78461{
78462 const struct packet_ruleset_summary *real_packet = packet;
78463#ifdef FREECIV_DELTA_PROTOCOL
78464 packet_ruleset_summary_100_fields fields;
78465 struct packet_ruleset_summary *old;
78466 bool differ;
78467 struct genhash **hash = pc->phs.sent + PACKET_RULESET_SUMMARY;
78468#endif /* FREECIV_DELTA_PROTOCOL */
78469 SEND_PACKET_START(PACKET_RULESET_SUMMARY);
78470#ifdef FREECIV_JSON_CONNECTION
78471 struct plocation field_addr;
78472 {
78473 struct plocation *field_addr_tmp = plocation_field_new(NULL);
78474 field_addr = *field_addr_tmp;
78475 FC_FREE(field_addr_tmp);
78476 }
78477#endif /* FREECIV_JSON_CONNECTION */
78478
78479 log_packet_detailed("packet_ruleset_summary_100: sending info about ()");
78480
78481#ifdef FREECIV_DELTA_PROTOCOL
78482 if (NULL == *hash) {
78483 *hash = genhash_new_full(hash_packet_ruleset_summary_100, cmp_packet_ruleset_summary_100,
78484 NULL, NULL, NULL, free);
78485 }
78486 BV_CLR_ALL(fields);
78487
78488 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
78489 old = fc_malloc(sizeof(*old));
78490 *old = *real_packet;
78491 genhash_insert(*hash, old, old);
78492 memset(old, 0, sizeof(*old));
78493 }
78494 differ = (strcmp(old->text, real_packet->text) != 0);
78495 if (differ) {
78496 BV_SET(fields, 0);
78497 }
78498
78499
78500#ifdef FREECIV_JSON_CONNECTION
78501 field_addr.name = "fields";
78502#endif /* FREECIV_JSON_CONNECTION */
78503 DIO_BV_PUT(&dout, &field_addr, fields);
78504
78505 if (BV_ISSET(fields, 0)) {
78506 log_packet_detailed(" field 'text' has changed");
78507 #ifdef FREECIV_JSON_CONNECTION
78508 field_addr.name = "text";
78509#endif /* FREECIV_JSON_CONNECTION */
78510 DIO_PUT(string, &dout, &field_addr, real_packet->text);
78511 }
78512
78513 *old = *real_packet;
78514#endif /* FREECIV_DELTA_PROTOCOL */
78515#ifndef FREECIV_DELTA_PROTOCOL
78516#ifdef FREECIV_JSON_CONNECTION
78517 field_addr.name = "text";
78518#endif /* FREECIV_JSON_CONNECTION */
78519 DIO_PUT(string, &dout, &field_addr, real_packet->text);
78520
78521#endif
78522 SEND_PACKET_END(PACKET_RULESET_SUMMARY);
78523}
78524
78525 int send_packet_ruleset_summary(struct connection *pc, const struct packet_ruleset_summary *packet)
78526{
78527 if (!pc->used) {
78528 log_error("WARNING: trying to send data to the closed connection %s",
78529 conn_description(pc));
78530 return -1;
78531 }
78532 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_SUMMARY].packet != NULL, -1,
78533 "Handler for PACKET_RULESET_SUMMARY not installed");
78534 return pc->phs.handlers->send[PACKET_RULESET_SUMMARY].packet(pc, packet);
78535}
78536
78537 void lsend_packet_ruleset_summary(struct conn_list *dest, const struct packet_ruleset_summary *packet)
78538{
78539 conn_list_iterate(dest, pconn) {
78540 send_packet_ruleset_summary(pconn, packet);
78541 } conn_list_iterate_end;
78542}
78543
78544#ifdef FREECIV_DELTA_PROTOCOL
78545#define hash_packet_ruleset_description_part_100 hash_const
78546
78547#define cmp_packet_ruleset_description_part_100 cmp_const
78548
78549 BV_DEFINE(packet_ruleset_description_part_100_fields, 1);
78550#endif /* FREECIV_DELTA_PROTOCOL */
78551
78552 static struct packet_ruleset_description_part *receive_packet_ruleset_description_part_100(struct connection *pc)
78553{
78554#ifdef FREECIV_DELTA_PROTOCOL
78555 packet_ruleset_description_part_100_fields fields;
78556 struct packet_ruleset_description_part *old;
78557 struct genhash **hash = pc->phs.received + PACKET_RULESET_DESCRIPTION_PART;
78558#endif /* FREECIV_DELTA_PROTOCOL */
78559 RECEIVE_PACKET_START(packet_ruleset_description_part, real_packet);
78560#ifdef FREECIV_JSON_CONNECTION
78561 struct plocation field_addr;
78562 {
78563 struct plocation *field_addr_tmp = plocation_field_new(NULL);
78564 field_addr = *field_addr_tmp;
78565 FC_FREE(field_addr_tmp);
78566 }
78567#endif /* FREECIV_JSON_CONNECTION */
78568
78569#ifdef FREECIV_DELTA_PROTOCOL
78570#ifdef FREECIV_JSON_CONNECTION
78571 field_addr.name = "fields";
78572#endif /* FREECIV_JSON_CONNECTION */
78573 DIO_BV_GET(&din, &field_addr, fields);
78574
78575#else /* FREECIV_DELTA_PROTOCOL */
78576 #ifdef FREECIV_JSON_CONNECTION
78577 field_addr.name = "text";
78578 #endif /* FREECIV_JSON_CONNECTION */
78579 if (!DIO_GET(string, &din, &field_addr, real_packet->text, sizeof(real_packet->text))) {
78580 RECEIVE_PACKET_FIELD_ERROR(text);
78581 }
78582
78583#endif
78584 log_packet_detailed("packet_ruleset_description_part_100: got info about ()");
78585
78586#ifdef FREECIV_DELTA_PROTOCOL
78587 if (NULL == *hash) {
78588 *hash = genhash_new_full(hash_packet_ruleset_description_part_100, cmp_packet_ruleset_description_part_100,
78589 NULL, NULL, NULL, free);
78590 }
78591
78592 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
78593 *real_packet = *old;
78594 } else {
78595 log_packet_detailed(" no old info");
78596 memset(real_packet, 0, sizeof(*real_packet));
78597 }
78598
78599 if (BV_ISSET(fields, 0)) {
78600 log_packet_detailed(" got field 'text'");
78601 #ifdef FREECIV_JSON_CONNECTION
78602 field_addr.name = "text";
78603 #endif /* FREECIV_JSON_CONNECTION */
78604 if (!DIO_GET(string, &din, &field_addr, real_packet->text, sizeof(real_packet->text))) {
78605 RECEIVE_PACKET_FIELD_ERROR(text);
78606 }
78607 }
78608
78609 if (NULL == old) {
78610 old = fc_malloc(sizeof(*old));
78611 *old = *real_packet;
78612 genhash_insert(*hash, old, old);
78613 } else {
78614 *old = *real_packet;
78615 }
78616
78617#endif /* FREECIV_DELTA_PROTOCOL */
78618 RECEIVE_PACKET_END(real_packet);
78619}
78620
78621 static int send_packet_ruleset_description_part_100(struct connection *pc, const struct packet_ruleset_description_part *packet)
78622{
78623 const struct packet_ruleset_description_part *real_packet = packet;
78624#ifdef FREECIV_DELTA_PROTOCOL
78625 packet_ruleset_description_part_100_fields fields;
78626 struct packet_ruleset_description_part *old;
78627 bool differ;
78628 struct genhash **hash = pc->phs.sent + PACKET_RULESET_DESCRIPTION_PART;
78629#endif /* FREECIV_DELTA_PROTOCOL */
78630 SEND_PACKET_START(PACKET_RULESET_DESCRIPTION_PART);
78631#ifdef FREECIV_JSON_CONNECTION
78632 struct plocation field_addr;
78633 {
78634 struct plocation *field_addr_tmp = plocation_field_new(NULL);
78635 field_addr = *field_addr_tmp;
78636 FC_FREE(field_addr_tmp);
78637 }
78638#endif /* FREECIV_JSON_CONNECTION */
78639
78640 log_packet_detailed("packet_ruleset_description_part_100: sending info about ()");
78641
78642#ifdef FREECIV_DELTA_PROTOCOL
78643 if (NULL == *hash) {
78644 *hash = genhash_new_full(hash_packet_ruleset_description_part_100, cmp_packet_ruleset_description_part_100,
78645 NULL, NULL, NULL, free);
78646 }
78647 BV_CLR_ALL(fields);
78648
78649 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
78650 old = fc_malloc(sizeof(*old));
78651 *old = *real_packet;
78652 genhash_insert(*hash, old, old);
78653 memset(old, 0, sizeof(*old));
78654 }
78655 differ = (strcmp(old->text, real_packet->text) != 0);
78656 if (differ) {
78657 BV_SET(fields, 0);
78658 }
78659
78660
78661#ifdef FREECIV_JSON_CONNECTION
78662 field_addr.name = "fields";
78663#endif /* FREECIV_JSON_CONNECTION */
78664 DIO_BV_PUT(&dout, &field_addr, fields);
78665
78666 if (BV_ISSET(fields, 0)) {
78667 log_packet_detailed(" field 'text' has changed");
78668 #ifdef FREECIV_JSON_CONNECTION
78669 field_addr.name = "text";
78670#endif /* FREECIV_JSON_CONNECTION */
78671 DIO_PUT(string, &dout, &field_addr, real_packet->text);
78672 }
78673
78674 *old = *real_packet;
78675#endif /* FREECIV_DELTA_PROTOCOL */
78676#ifndef FREECIV_DELTA_PROTOCOL
78677#ifdef FREECIV_JSON_CONNECTION
78678 field_addr.name = "text";
78679#endif /* FREECIV_JSON_CONNECTION */
78680 DIO_PUT(string, &dout, &field_addr, real_packet->text);
78681
78682#endif
78683 SEND_PACKET_END(PACKET_RULESET_DESCRIPTION_PART);
78684}
78685
78686 int send_packet_ruleset_description_part(struct connection *pc, const struct packet_ruleset_description_part *packet)
78687{
78688 if (!pc->used) {
78689 log_error("WARNING: trying to send data to the closed connection %s",
78690 conn_description(pc));
78691 return -1;
78692 }
78693 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_DESCRIPTION_PART].packet != NULL, -1,
78694 "Handler for PACKET_RULESET_DESCRIPTION_PART not installed");
78695 return pc->phs.handlers->send[PACKET_RULESET_DESCRIPTION_PART].packet(pc, packet);
78696}
78697
78698 void lsend_packet_ruleset_description_part(struct conn_list *dest, const struct packet_ruleset_description_part *packet)
78699{
78700 conn_list_iterate(dest, pconn) {
78701 send_packet_ruleset_description_part(pconn, packet);
78702 } conn_list_iterate_end;
78703}
78704
78705#ifdef FREECIV_DELTA_PROTOCOL
78706#define hash_packet_single_want_hack_req_100 hash_const
78707
78708#define cmp_packet_single_want_hack_req_100 cmp_const
78709
78710 BV_DEFINE(packet_single_want_hack_req_100_fields, 1);
78711#endif /* FREECIV_DELTA_PROTOCOL */
78712
78713 static struct packet_single_want_hack_req *receive_packet_single_want_hack_req_100(struct connection *pc)
78714{
78715#ifdef FREECIV_DELTA_PROTOCOL
78716 packet_single_want_hack_req_100_fields fields;
78717 struct packet_single_want_hack_req *old;
78718 struct genhash **hash = pc->phs.received + PACKET_SINGLE_WANT_HACK_REQ;
78719#endif /* FREECIV_DELTA_PROTOCOL */
78720 RECEIVE_PACKET_START(packet_single_want_hack_req, real_packet);
78721#ifdef FREECIV_JSON_CONNECTION
78722 struct plocation field_addr;
78723 {
78724 struct plocation *field_addr_tmp = plocation_field_new(NULL);
78725 field_addr = *field_addr_tmp;
78726 FC_FREE(field_addr_tmp);
78727 }
78728#endif /* FREECIV_JSON_CONNECTION */
78729
78730#ifdef FREECIV_DELTA_PROTOCOL
78731#ifdef FREECIV_JSON_CONNECTION
78732 field_addr.name = "fields";
78733#endif /* FREECIV_JSON_CONNECTION */
78734 DIO_BV_GET(&din, &field_addr, fields);
78735
78736#else /* FREECIV_DELTA_PROTOCOL */
78737 #ifdef FREECIV_JSON_CONNECTION
78738 field_addr.name = "token";
78739 #endif /* FREECIV_JSON_CONNECTION */
78740 if (!DIO_GET(string, &din, &field_addr, real_packet->token, sizeof(real_packet->token))) {
78741 RECEIVE_PACKET_FIELD_ERROR(token);
78742 }
78743
78744#endif
78745 log_packet_detailed("packet_single_want_hack_req_100: got info about ()");
78746
78747#ifdef FREECIV_DELTA_PROTOCOL
78748 if (NULL == *hash) {
78749 *hash = genhash_new_full(hash_packet_single_want_hack_req_100, cmp_packet_single_want_hack_req_100,
78750 NULL, NULL, NULL, free);
78751 }
78752
78753 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
78754 *real_packet = *old;
78755 } else {
78756 log_packet_detailed(" no old info");
78757 memset(real_packet, 0, sizeof(*real_packet));
78758 }
78759
78760 if (BV_ISSET(fields, 0)) {
78761 log_packet_detailed(" got field 'token'");
78762 #ifdef FREECIV_JSON_CONNECTION
78763 field_addr.name = "token";
78764 #endif /* FREECIV_JSON_CONNECTION */
78765 if (!DIO_GET(string, &din, &field_addr, real_packet->token, sizeof(real_packet->token))) {
78766 RECEIVE_PACKET_FIELD_ERROR(token);
78767 }
78768 }
78769
78770 if (NULL == old) {
78771 old = fc_malloc(sizeof(*old));
78772 *old = *real_packet;
78773 genhash_insert(*hash, old, old);
78774 } else {
78775 *old = *real_packet;
78776 }
78777
78778#endif /* FREECIV_DELTA_PROTOCOL */
78779 RECEIVE_PACKET_END(real_packet);
78780}
78781
78782 static int send_packet_single_want_hack_req_100(struct connection *pc, const struct packet_single_want_hack_req *packet)
78783{
78784 const struct packet_single_want_hack_req *real_packet = packet;
78785#ifdef FREECIV_DELTA_PROTOCOL
78786 packet_single_want_hack_req_100_fields fields;
78787 struct packet_single_want_hack_req *old;
78788 bool differ;
78789 struct genhash **hash = pc->phs.sent + PACKET_SINGLE_WANT_HACK_REQ;
78790#endif /* FREECIV_DELTA_PROTOCOL */
78791 SEND_PACKET_START(PACKET_SINGLE_WANT_HACK_REQ);
78792#ifdef FREECIV_JSON_CONNECTION
78793 struct plocation field_addr;
78794 {
78795 struct plocation *field_addr_tmp = plocation_field_new(NULL);
78796 field_addr = *field_addr_tmp;
78797 FC_FREE(field_addr_tmp);
78798 }
78799#endif /* FREECIV_JSON_CONNECTION */
78800
78801 log_packet_detailed("packet_single_want_hack_req_100: sending info about ()");
78802
78803#ifdef FREECIV_DELTA_PROTOCOL
78804 if (NULL == *hash) {
78805 *hash = genhash_new_full(hash_packet_single_want_hack_req_100, cmp_packet_single_want_hack_req_100,
78806 NULL, NULL, NULL, free);
78807 }
78808 BV_CLR_ALL(fields);
78809
78810 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
78811 old = fc_malloc(sizeof(*old));
78812 *old = *real_packet;
78813 genhash_insert(*hash, old, old);
78814 memset(old, 0, sizeof(*old));
78815 }
78816 differ = (strcmp(old->token, real_packet->token) != 0);
78817 if (differ) {
78818 BV_SET(fields, 0);
78819 }
78820
78821
78822#ifdef FREECIV_JSON_CONNECTION
78823 field_addr.name = "fields";
78824#endif /* FREECIV_JSON_CONNECTION */
78825 DIO_BV_PUT(&dout, &field_addr, fields);
78826
78827 if (BV_ISSET(fields, 0)) {
78828 log_packet_detailed(" field 'token' has changed");
78829 #ifdef FREECIV_JSON_CONNECTION
78830 field_addr.name = "token";
78831#endif /* FREECIV_JSON_CONNECTION */
78832 DIO_PUT(string, &dout, &field_addr, real_packet->token);
78833 }
78834
78835 *old = *real_packet;
78836#endif /* FREECIV_DELTA_PROTOCOL */
78837#ifndef FREECIV_DELTA_PROTOCOL
78838#ifdef FREECIV_JSON_CONNECTION
78839 field_addr.name = "token";
78840#endif /* FREECIV_JSON_CONNECTION */
78841 DIO_PUT(string, &dout, &field_addr, real_packet->token);
78842
78843#endif
78844 SEND_PACKET_END(PACKET_SINGLE_WANT_HACK_REQ);
78845}
78846
78847 int send_packet_single_want_hack_req(struct connection *pc, const struct packet_single_want_hack_req *packet)
78848{
78849 if (!pc->used) {
78850 log_error("WARNING: trying to send data to the closed connection %s",
78851 conn_description(pc));
78852 return -1;
78853 }
78854 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SINGLE_WANT_HACK_REQ].packet != NULL, -1,
78855 "Handler for PACKET_SINGLE_WANT_HACK_REQ not installed");
78856 return pc->phs.handlers->send[PACKET_SINGLE_WANT_HACK_REQ].packet(pc, packet);
78857}
78858
78859#ifdef FREECIV_DELTA_PROTOCOL
78860#define hash_packet_single_want_hack_reply_100 hash_const
78861
78862#define cmp_packet_single_want_hack_reply_100 cmp_const
78863
78864 BV_DEFINE(packet_single_want_hack_reply_100_fields, 1);
78865#endif /* FREECIV_DELTA_PROTOCOL */
78866
78867 static struct packet_single_want_hack_reply *receive_packet_single_want_hack_reply_100(struct connection *pc)
78868{
78869#ifdef FREECIV_DELTA_PROTOCOL
78870 packet_single_want_hack_reply_100_fields fields;
78871 struct packet_single_want_hack_reply *old;
78872 struct genhash **hash = pc->phs.received + PACKET_SINGLE_WANT_HACK_REPLY;
78873#endif /* FREECIV_DELTA_PROTOCOL */
78874 RECEIVE_PACKET_START(packet_single_want_hack_reply, real_packet);
78875#ifdef FREECIV_JSON_CONNECTION
78876 struct plocation field_addr;
78877 {
78878 struct plocation *field_addr_tmp = plocation_field_new(NULL);
78879 field_addr = *field_addr_tmp;
78880 FC_FREE(field_addr_tmp);
78881 }
78882#endif /* FREECIV_JSON_CONNECTION */
78883
78884#ifdef FREECIV_DELTA_PROTOCOL
78885#ifdef FREECIV_JSON_CONNECTION
78886 field_addr.name = "fields";
78887#endif /* FREECIV_JSON_CONNECTION */
78888 DIO_BV_GET(&din, &field_addr, fields);
78889
78890#else /* FREECIV_DELTA_PROTOCOL */
78891 #ifdef FREECIV_JSON_CONNECTION
78892 field_addr.name = "you_have_hack";
78893 #endif /* FREECIV_JSON_CONNECTION */
78894 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->you_have_hack)) {
78895 RECEIVE_PACKET_FIELD_ERROR(you_have_hack);
78896 }
78897
78898#endif
78899 log_packet_detailed("packet_single_want_hack_reply_100: got info about ()");
78900
78901#ifdef FREECIV_DELTA_PROTOCOL
78902 if (NULL == *hash) {
78903 *hash = genhash_new_full(hash_packet_single_want_hack_reply_100, cmp_packet_single_want_hack_reply_100,
78904 NULL, NULL, NULL, free);
78905 }
78906
78907 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
78908 *real_packet = *old;
78909 } else {
78910 log_packet_detailed(" no old info");
78911 memset(real_packet, 0, sizeof(*real_packet));
78912 }
78913
78914 real_packet->you_have_hack = BV_ISSET(fields, 0);
78915
78916 if (NULL == old) {
78917 old = fc_malloc(sizeof(*old));
78918 *old = *real_packet;
78919 genhash_insert(*hash, old, old);
78920 } else {
78921 *old = *real_packet;
78922 }
78923
78924#endif /* FREECIV_DELTA_PROTOCOL */
78925 RECEIVE_PACKET_END(real_packet);
78926}
78927
78928 static int send_packet_single_want_hack_reply_100(struct connection *pc, const struct packet_single_want_hack_reply *packet)
78929{
78930 const struct packet_single_want_hack_reply *real_packet = packet;
78931#ifdef FREECIV_DELTA_PROTOCOL
78932 packet_single_want_hack_reply_100_fields fields;
78933 struct packet_single_want_hack_reply *old;
78934 struct genhash **hash = pc->phs.sent + PACKET_SINGLE_WANT_HACK_REPLY;
78935#endif /* FREECIV_DELTA_PROTOCOL */
78936 SEND_PACKET_START(PACKET_SINGLE_WANT_HACK_REPLY);
78937#ifdef FREECIV_JSON_CONNECTION
78938 struct plocation field_addr;
78939 {
78940 struct plocation *field_addr_tmp = plocation_field_new(NULL);
78941 field_addr = *field_addr_tmp;
78942 FC_FREE(field_addr_tmp);
78943 }
78944#endif /* FREECIV_JSON_CONNECTION */
78945
78946 log_packet_detailed("packet_single_want_hack_reply_100: sending info about ()");
78947
78948#ifdef FREECIV_DELTA_PROTOCOL
78949 if (NULL == *hash) {
78950 *hash = genhash_new_full(hash_packet_single_want_hack_reply_100, cmp_packet_single_want_hack_reply_100,
78951 NULL, NULL, NULL, free);
78952 }
78953 BV_CLR_ALL(fields);
78954
78955 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
78956 old = fc_malloc(sizeof(*old));
78957 *old = *real_packet;
78958 genhash_insert(*hash, old, old);
78959 memset(old, 0, sizeof(*old));
78960 }
78961 if (packet->you_have_hack) {
78962 BV_SET(fields, 0);
78963 }
78964
78965
78966#ifdef FREECIV_JSON_CONNECTION
78967 field_addr.name = "fields";
78968#endif /* FREECIV_JSON_CONNECTION */
78969 DIO_BV_PUT(&dout, &field_addr, fields);
78970
78971 /* field 0 is folded into the header */
78972
78973 *old = *real_packet;
78974#endif /* FREECIV_DELTA_PROTOCOL */
78975#ifndef FREECIV_DELTA_PROTOCOL
78976#ifdef FREECIV_JSON_CONNECTION
78977 field_addr.name = "you_have_hack";
78978#endif /* FREECIV_JSON_CONNECTION */
78979 DIO_PUT(bool8, &dout, &field_addr, real_packet->you_have_hack);
78980
78981#endif
78982 SEND_PACKET_END(PACKET_SINGLE_WANT_HACK_REPLY);
78983}
78984
78985 int send_packet_single_want_hack_reply(struct connection *pc, const struct packet_single_want_hack_reply *packet)
78986{
78987 if (!pc->used) {
78988 log_error("WARNING: trying to send data to the closed connection %s",
78989 conn_description(pc));
78990 return -1;
78991 }
78992 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SINGLE_WANT_HACK_REPLY].packet != NULL, -1,
78993 "Handler for PACKET_SINGLE_WANT_HACK_REPLY not installed");
78994 return pc->phs.handlers->send[PACKET_SINGLE_WANT_HACK_REPLY].packet(pc, packet);
78995}
78996
78997 int dsend_packet_single_want_hack_reply(struct connection *pc, bool you_have_hack)
78998{
78999 struct packet_single_want_hack_reply packet, *real_packet = &packet;
79000
79001 real_packet->you_have_hack = you_have_hack;
79002
79003 return send_packet_single_want_hack_reply(pc, real_packet);
79004}
79005
79006#ifdef FREECIV_DELTA_PROTOCOL
79007#define hash_packet_ruleset_choices_100 hash_const
79008
79009#define cmp_packet_ruleset_choices_100 cmp_const
79010
79011 BV_DEFINE(packet_ruleset_choices_100_fields, 2);
79012#endif /* FREECIV_DELTA_PROTOCOL */
79013
79014 static struct packet_ruleset_choices *receive_packet_ruleset_choices_100(struct connection *pc)
79015{
79016#ifdef FREECIV_DELTA_PROTOCOL
79017 packet_ruleset_choices_100_fields fields;
79018 struct packet_ruleset_choices *old;
79019 struct genhash **hash = pc->phs.received + PACKET_RULESET_CHOICES;
79020#endif /* FREECIV_DELTA_PROTOCOL */
79021 RECEIVE_PACKET_START(packet_ruleset_choices, real_packet);
79022#ifdef FREECIV_JSON_CONNECTION
79023 struct plocation field_addr;
79024 {
79025 struct plocation *field_addr_tmp = plocation_field_new(NULL);
79026 field_addr = *field_addr_tmp;
79027 FC_FREE(field_addr_tmp);
79028 }
79029#endif /* FREECIV_JSON_CONNECTION */
79030
79031#ifdef FREECIV_DELTA_PROTOCOL
79032#ifdef FREECIV_JSON_CONNECTION
79033 field_addr.name = "fields";
79034#endif /* FREECIV_JSON_CONNECTION */
79035 DIO_BV_GET(&din, &field_addr, fields);
79036
79037#else /* FREECIV_DELTA_PROTOCOL */
79038 #ifdef FREECIV_JSON_CONNECTION
79039 field_addr.name = "ruleset_count";
79040 #endif /* FREECIV_JSON_CONNECTION */
79041 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ruleset_count)) {
79042 RECEIVE_PACKET_FIELD_ERROR(ruleset_count);
79043 }
79044 #ifdef FREECIV_JSON_CONNECTION
79045 field_addr.name = "rulesets";
79046 #endif /* FREECIV_JSON_CONNECTION */
79047
79048 {
79049 int i;
79050
79051 #ifdef FREECIV_JSON_CONNECTION
79052 /* Enter array. */
79053 field_addr.sub_location = plocation_elem_new(0);
79054 #endif /* FREECIV_JSON_CONNECTION */
79055
79056 if (real_packet->ruleset_count > MAX_NUM_RULESETS) {
79057 RECEIVE_PACKET_FIELD_ERROR(rulesets, ": truncation array");
79058 }
79059 for (i = 0; i < real_packet->ruleset_count; i++) {
79060 #ifdef FREECIV_JSON_CONNECTION
79061 field_addr.sub_location->number = i;
79062 #endif /* FREECIV_JSON_CONNECTION */
79063 if (!DIO_GET(string, &din, &field_addr, real_packet->rulesets[i], sizeof(real_packet->rulesets[i]))) {
79064 RECEIVE_PACKET_FIELD_ERROR(rulesets);
79065 }
79066 }
79067
79068 #ifdef FREECIV_JSON_CONNECTION
79069 /* Exit array. */
79070 free(field_addr.sub_location);
79071 field_addr.sub_location = NULL;
79072 #endif /* FREECIV_JSON_CONNECTION */
79073 }
79074
79075#endif
79076 log_packet_detailed("packet_ruleset_choices_100: got info about ()");
79077
79078#ifdef FREECIV_DELTA_PROTOCOL
79079 if (NULL == *hash) {
79080 *hash = genhash_new_full(hash_packet_ruleset_choices_100, cmp_packet_ruleset_choices_100,
79081 NULL, NULL, NULL, free);
79082 }
79083
79084 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
79085 *real_packet = *old;
79086 } else {
79087 log_packet_detailed(" no old info");
79088 memset(real_packet, 0, sizeof(*real_packet));
79089 }
79090
79091 if (BV_ISSET(fields, 0)) {
79092 log_packet_detailed(" got field 'ruleset_count'");
79093 #ifdef FREECIV_JSON_CONNECTION
79094 field_addr.name = "ruleset_count";
79095 #endif /* FREECIV_JSON_CONNECTION */
79096 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ruleset_count)) {
79097 RECEIVE_PACKET_FIELD_ERROR(ruleset_count);
79098 }
79099 }
79100 if (BV_ISSET(fields, 1)) {
79101 log_packet_detailed(" got field 'rulesets'");
79102 #ifdef FREECIV_JSON_CONNECTION
79103 field_addr.name = "rulesets";
79104 #endif /* FREECIV_JSON_CONNECTION */
79105
79106 {
79107 int i;
79108
79109 #ifdef FREECIV_JSON_CONNECTION
79110 /* Enter array. */
79111 field_addr.sub_location = plocation_elem_new(0);
79112 #endif /* FREECIV_JSON_CONNECTION */
79113
79114 if (real_packet->ruleset_count > MAX_NUM_RULESETS) {
79115 RECEIVE_PACKET_FIELD_ERROR(rulesets, ": truncation array");
79116 }
79117 for (i = 0; i < real_packet->ruleset_count; i++) {
79118 #ifdef FREECIV_JSON_CONNECTION
79119 field_addr.sub_location->number = i;
79120 #endif /* FREECIV_JSON_CONNECTION */
79121 if (!DIO_GET(string, &din, &field_addr, real_packet->rulesets[i], sizeof(real_packet->rulesets[i]))) {
79122 RECEIVE_PACKET_FIELD_ERROR(rulesets);
79123 }
79124 }
79125
79126 #ifdef FREECIV_JSON_CONNECTION
79127 /* Exit array. */
79128 free(field_addr.sub_location);
79129 field_addr.sub_location = NULL;
79130 #endif /* FREECIV_JSON_CONNECTION */
79131 }
79132 }
79133
79134 if (NULL == old) {
79135 old = fc_malloc(sizeof(*old));
79136 *old = *real_packet;
79137 genhash_insert(*hash, old, old);
79138 } else {
79139 *old = *real_packet;
79140 }
79141
79142#endif /* FREECIV_DELTA_PROTOCOL */
79143 RECEIVE_PACKET_END(real_packet);
79144}
79145
79146 static int send_packet_ruleset_choices_100(struct connection *pc, const struct packet_ruleset_choices *packet)
79147{
79148 const struct packet_ruleset_choices *real_packet = packet;
79149#ifdef FREECIV_DELTA_PROTOCOL
79150 packet_ruleset_choices_100_fields fields;
79151 struct packet_ruleset_choices *old;
79152 bool differ;
79153 struct genhash **hash = pc->phs.sent + PACKET_RULESET_CHOICES;
79154#endif /* FREECIV_DELTA_PROTOCOL */
79155 SEND_PACKET_START(PACKET_RULESET_CHOICES);
79156#ifdef FREECIV_JSON_CONNECTION
79157 struct plocation field_addr;
79158 {
79159 struct plocation *field_addr_tmp = plocation_field_new(NULL);
79160 field_addr = *field_addr_tmp;
79161 FC_FREE(field_addr_tmp);
79162 }
79163#endif /* FREECIV_JSON_CONNECTION */
79164
79165 log_packet_detailed("packet_ruleset_choices_100: sending info about ()");
79166
79167#ifdef FREECIV_DELTA_PROTOCOL
79168 if (NULL == *hash) {
79169 *hash = genhash_new_full(hash_packet_ruleset_choices_100, cmp_packet_ruleset_choices_100,
79170 NULL, NULL, NULL, free);
79171 }
79172 BV_CLR_ALL(fields);
79173
79174 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
79175 old = fc_malloc(sizeof(*old));
79176 *old = *real_packet;
79177 genhash_insert(*hash, old, old);
79178 memset(old, 0, sizeof(*old));
79179 }
79180 differ = (old->ruleset_count != real_packet->ruleset_count);
79181 if (differ) {
79182 BV_SET(fields, 0);
79183 }
79184
79185
79186 {
79187 differ = (old->ruleset_count != real_packet->ruleset_count);
79188 if (!differ) {
79189 int i;
79190
79191 for (i = 0; i < real_packet->ruleset_count; i++) {
79192 if (strcmp(old->rulesets[i], real_packet->rulesets[i]) != 0) {
79193 differ = TRUE;
79194 break;
79195 }
79196 }
79197 }
79198 }
79199 if (differ) {
79200 BV_SET(fields, 1);
79201 }
79202
79203
79204#ifdef FREECIV_JSON_CONNECTION
79205 field_addr.name = "fields";
79206#endif /* FREECIV_JSON_CONNECTION */
79207 DIO_BV_PUT(&dout, &field_addr, fields);
79208
79209 if (BV_ISSET(fields, 0)) {
79210 log_packet_detailed(" field 'ruleset_count' has changed");
79211 #ifdef FREECIV_JSON_CONNECTION
79212 field_addr.name = "ruleset_count";
79213#endif /* FREECIV_JSON_CONNECTION */
79214 DIO_PUT(uint8, &dout, &field_addr, real_packet->ruleset_count);
79215 }
79216 if (BV_ISSET(fields, 1)) {
79217 log_packet_detailed(" field 'rulesets' has changed");
79218 #ifdef FREECIV_JSON_CONNECTION
79219 field_addr.name = "rulesets";
79220#endif /* FREECIV_JSON_CONNECTION */
79221
79222 {
79223 int i;
79224
79225#ifdef FREECIV_JSON_CONNECTION
79226 /* Create the array. */
79227 DIO_PUT(farray, &dout, &field_addr, real_packet->ruleset_count);
79228
79229 /* Enter the array. */
79230 field_addr.sub_location = plocation_elem_new(0);
79231#endif /* FREECIV_JSON_CONNECTION */
79232
79233 for (i = 0; i < real_packet->ruleset_count; i++) {
79234#ifdef FREECIV_JSON_CONNECTION
79235 /* Next array element. */
79236 field_addr.sub_location->number = i;
79237#endif /* FREECIV_JSON_CONNECTION */
79238 DIO_PUT(string, &dout, &field_addr, real_packet->rulesets[i]);
79239 }
79240
79241#ifdef FREECIV_JSON_CONNECTION
79242 /* Exit array. */
79243 free(field_addr.sub_location);
79244 field_addr.sub_location = NULL;
79245#endif /* FREECIV_JSON_CONNECTION */
79246 }
79247 }
79248
79249 *old = *real_packet;
79250#endif /* FREECIV_DELTA_PROTOCOL */
79251#ifndef FREECIV_DELTA_PROTOCOL
79252#ifdef FREECIV_JSON_CONNECTION
79253 field_addr.name = "ruleset_count";
79254#endif /* FREECIV_JSON_CONNECTION */
79255 DIO_PUT(uint8, &dout, &field_addr, real_packet->ruleset_count);
79256#ifdef FREECIV_JSON_CONNECTION
79257 field_addr.name = "rulesets";
79258#endif /* FREECIV_JSON_CONNECTION */
79259
79260 {
79261 int i;
79262
79263#ifdef FREECIV_JSON_CONNECTION
79264 /* Create the array. */
79265 DIO_PUT(farray, &dout, &field_addr, real_packet->ruleset_count);
79266
79267 /* Enter the array. */
79268 field_addr.sub_location = plocation_elem_new(0);
79269#endif /* FREECIV_JSON_CONNECTION */
79270
79271 for (i = 0; i < real_packet->ruleset_count; i++) {
79272#ifdef FREECIV_JSON_CONNECTION
79273 /* Next array element. */
79274 field_addr.sub_location->number = i;
79275#endif /* FREECIV_JSON_CONNECTION */
79276 DIO_PUT(string, &dout, &field_addr, real_packet->rulesets[i]);
79277 }
79278
79279#ifdef FREECIV_JSON_CONNECTION
79280 /* Exit array. */
79281 free(field_addr.sub_location);
79282 field_addr.sub_location = NULL;
79283#endif /* FREECIV_JSON_CONNECTION */
79284 }
79285
79286#endif
79287 SEND_PACKET_END(PACKET_RULESET_CHOICES);
79288}
79289
79290 int send_packet_ruleset_choices(struct connection *pc, const struct packet_ruleset_choices *packet)
79291{
79292 if (!pc->used) {
79293 log_error("WARNING: trying to send data to the closed connection %s",
79294 conn_description(pc));
79295 return -1;
79296 }
79297 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_CHOICES].packet != NULL, -1,
79298 "Handler for PACKET_RULESET_CHOICES not installed");
79299 return pc->phs.handlers->send[PACKET_RULESET_CHOICES].packet(pc, packet);
79300}
79301
79302#ifdef FREECIV_DELTA_PROTOCOL
79303#define hash_packet_game_load_100 hash_const
79304
79305#define cmp_packet_game_load_100 cmp_const
79306
79307 BV_DEFINE(packet_game_load_100_fields, 2);
79308#endif /* FREECIV_DELTA_PROTOCOL */
79309
79310 static struct packet_game_load *receive_packet_game_load_100(struct connection *pc)
79311{
79312#ifdef FREECIV_DELTA_PROTOCOL
79313 packet_game_load_100_fields fields;
79314 struct packet_game_load *old;
79315 struct genhash **hash = pc->phs.received + PACKET_GAME_LOAD;
79316#endif /* FREECIV_DELTA_PROTOCOL */
79317 RECEIVE_PACKET_START(packet_game_load, real_packet);
79318#ifdef FREECIV_JSON_CONNECTION
79319 struct plocation field_addr;
79320 {
79321 struct plocation *field_addr_tmp = plocation_field_new(NULL);
79322 field_addr = *field_addr_tmp;
79323 FC_FREE(field_addr_tmp);
79324 }
79325#endif /* FREECIV_JSON_CONNECTION */
79326
79327#ifdef FREECIV_DELTA_PROTOCOL
79328#ifdef FREECIV_JSON_CONNECTION
79329 field_addr.name = "fields";
79330#endif /* FREECIV_JSON_CONNECTION */
79331 DIO_BV_GET(&din, &field_addr, fields);
79332
79333#else /* FREECIV_DELTA_PROTOCOL */
79334 #ifdef FREECIV_JSON_CONNECTION
79335 field_addr.name = "load_successful";
79336 #endif /* FREECIV_JSON_CONNECTION */
79337 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->load_successful)) {
79338 RECEIVE_PACKET_FIELD_ERROR(load_successful);
79339 }
79340 #ifdef FREECIV_JSON_CONNECTION
79341 field_addr.name = "load_filename";
79342 #endif /* FREECIV_JSON_CONNECTION */
79343 if (!DIO_GET(string, &din, &field_addr, real_packet->load_filename, sizeof(real_packet->load_filename))) {
79344 RECEIVE_PACKET_FIELD_ERROR(load_filename);
79345 }
79346
79347#endif
79348 log_packet_detailed("packet_game_load_100: got info about ()");
79349
79350#ifdef FREECIV_DELTA_PROTOCOL
79351 if (NULL == *hash) {
79352 *hash = genhash_new_full(hash_packet_game_load_100, cmp_packet_game_load_100,
79353 NULL, NULL, NULL, free);
79354 }
79355
79356 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
79357 *real_packet = *old;
79358 } else {
79359 log_packet_detailed(" no old info");
79360 memset(real_packet, 0, sizeof(*real_packet));
79361 }
79362
79363 real_packet->load_successful = BV_ISSET(fields, 0);
79364 if (BV_ISSET(fields, 1)) {
79365 log_packet_detailed(" got field 'load_filename'");
79366 #ifdef FREECIV_JSON_CONNECTION
79367 field_addr.name = "load_filename";
79368 #endif /* FREECIV_JSON_CONNECTION */
79369 if (!DIO_GET(string, &din, &field_addr, real_packet->load_filename, sizeof(real_packet->load_filename))) {
79370 RECEIVE_PACKET_FIELD_ERROR(load_filename);
79371 }
79372 }
79373
79374 if (NULL == old) {
79375 old = fc_malloc(sizeof(*old));
79376 *old = *real_packet;
79377 genhash_insert(*hash, old, old);
79378 } else {
79379 *old = *real_packet;
79380 }
79381
79382#endif /* FREECIV_DELTA_PROTOCOL */
79383 RECEIVE_PACKET_END(real_packet);
79384}
79385
79386 static int send_packet_game_load_100(struct connection *pc, const struct packet_game_load *packet)
79387{
79388 const struct packet_game_load *real_packet = packet;
79389#ifdef FREECIV_DELTA_PROTOCOL
79390 packet_game_load_100_fields fields;
79391 struct packet_game_load *old;
79392 bool differ;
79393 struct genhash **hash = pc->phs.sent + PACKET_GAME_LOAD;
79394#endif /* FREECIV_DELTA_PROTOCOL */
79395 SEND_PACKET_START(PACKET_GAME_LOAD);
79396#ifdef FREECIV_JSON_CONNECTION
79397 struct plocation field_addr;
79398 {
79399 struct plocation *field_addr_tmp = plocation_field_new(NULL);
79400 field_addr = *field_addr_tmp;
79401 FC_FREE(field_addr_tmp);
79402 }
79403#endif /* FREECIV_JSON_CONNECTION */
79404
79405 log_packet_detailed("packet_game_load_100: sending info about ()");
79406
79407#ifdef FREECIV_DELTA_PROTOCOL
79408 if (NULL == *hash) {
79409 *hash = genhash_new_full(hash_packet_game_load_100, cmp_packet_game_load_100,
79410 NULL, NULL, NULL, free);
79411 }
79412 BV_CLR_ALL(fields);
79413
79414 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
79415 old = fc_malloc(sizeof(*old));
79416 *old = *real_packet;
79417 genhash_insert(*hash, old, old);
79418 memset(old, 0, sizeof(*old));
79419 }
79420 if (packet->load_successful) {
79421 BV_SET(fields, 0);
79422 }
79423
79424 differ = (strcmp(old->load_filename, real_packet->load_filename) != 0);
79425 if (differ) {
79426 BV_SET(fields, 1);
79427 }
79428
79429
79430#ifdef FREECIV_JSON_CONNECTION
79431 field_addr.name = "fields";
79432#endif /* FREECIV_JSON_CONNECTION */
79433 DIO_BV_PUT(&dout, &field_addr, fields);
79434
79435 /* field 0 is folded into the header */
79436 if (BV_ISSET(fields, 1)) {
79437 log_packet_detailed(" field 'load_filename' has changed");
79438 #ifdef FREECIV_JSON_CONNECTION
79439 field_addr.name = "load_filename";
79440#endif /* FREECIV_JSON_CONNECTION */
79441 DIO_PUT(string, &dout, &field_addr, real_packet->load_filename);
79442 }
79443
79444 *old = *real_packet;
79445#endif /* FREECIV_DELTA_PROTOCOL */
79446#ifndef FREECIV_DELTA_PROTOCOL
79447#ifdef FREECIV_JSON_CONNECTION
79448 field_addr.name = "load_successful";
79449#endif /* FREECIV_JSON_CONNECTION */
79450 DIO_PUT(bool8, &dout, &field_addr, real_packet->load_successful);
79451#ifdef FREECIV_JSON_CONNECTION
79452 field_addr.name = "load_filename";
79453#endif /* FREECIV_JSON_CONNECTION */
79454 DIO_PUT(string, &dout, &field_addr, real_packet->load_filename);
79455
79456#endif
79457 SEND_PACKET_END(PACKET_GAME_LOAD);
79458}
79459
79460 int send_packet_game_load(struct connection *pc, const struct packet_game_load *packet)
79461{
79462 if (!pc->used) {
79463 log_error("WARNING: trying to send data to the closed connection %s",
79464 conn_description(pc));
79465 return -1;
79466 }
79467 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_GAME_LOAD].packet != NULL, -1,
79468 "Handler for PACKET_GAME_LOAD not installed");
79469 return pc->phs.handlers->send[PACKET_GAME_LOAD].packet(pc, packet);
79470}
79471
79472 void lsend_packet_game_load(struct conn_list *dest, const struct packet_game_load *packet)
79473{
79474 conn_list_iterate(dest, pconn) {
79475 send_packet_game_load(pconn, packet);
79476 } conn_list_iterate_end;
79477}
79478
79479 int dsend_packet_game_load(struct connection *pc, bool load_successful, const char *load_filename)
79480{
79481 struct packet_game_load packet, *real_packet = &packet;
79482
79483 real_packet->load_successful = load_successful;
79484 sz_strlcpy(real_packet->load_filename, load_filename);
79485
79486 return send_packet_game_load(pc, real_packet);
79487}
79488
79489 void dlsend_packet_game_load(struct conn_list *dest, bool load_successful, const char *load_filename)
79490{
79491 struct packet_game_load packet, *real_packet = &packet;
79492
79493 real_packet->load_successful = load_successful;
79494 sz_strlcpy(real_packet->load_filename, load_filename);
79495
79496 lsend_packet_game_load(dest, real_packet);
79497}
79498
79499#ifdef FREECIV_DELTA_PROTOCOL
79500#define hash_packet_server_setting_control_100 hash_const
79501
79502#define cmp_packet_server_setting_control_100 cmp_const
79503
79504 BV_DEFINE(packet_server_setting_control_100_fields, 3);
79505#endif /* FREECIV_DELTA_PROTOCOL */
79506
79507 static struct packet_server_setting_control *receive_packet_server_setting_control_100(struct connection *pc)
79508{
79509#ifdef FREECIV_DELTA_PROTOCOL
79510 packet_server_setting_control_100_fields fields;
79511 struct packet_server_setting_control *old;
79512 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_CONTROL;
79513#endif /* FREECIV_DELTA_PROTOCOL */
79514 RECEIVE_PACKET_START(packet_server_setting_control, real_packet);
79515#ifdef FREECIV_JSON_CONNECTION
79516 struct plocation field_addr;
79517 {
79518 struct plocation *field_addr_tmp = plocation_field_new(NULL);
79519 field_addr = *field_addr_tmp;
79520 FC_FREE(field_addr_tmp);
79521 }
79522#endif /* FREECIV_JSON_CONNECTION */
79523
79524#ifdef FREECIV_DELTA_PROTOCOL
79525#ifdef FREECIV_JSON_CONNECTION
79526 field_addr.name = "fields";
79527#endif /* FREECIV_JSON_CONNECTION */
79528 DIO_BV_GET(&din, &field_addr, fields);
79529
79530#else /* FREECIV_DELTA_PROTOCOL */
79531 #ifdef FREECIV_JSON_CONNECTION
79532 field_addr.name = "settings_num";
79533 #endif /* FREECIV_JSON_CONNECTION */
79534 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->settings_num)) {
79535 RECEIVE_PACKET_FIELD_ERROR(settings_num);
79536 }
79537 #ifdef FREECIV_JSON_CONNECTION
79538 field_addr.name = "categories_num";
79539 #endif /* FREECIV_JSON_CONNECTION */
79540 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->categories_num)) {
79541 RECEIVE_PACKET_FIELD_ERROR(categories_num);
79542 }
79543 #ifdef FREECIV_JSON_CONNECTION
79544 field_addr.name = "category_names";
79545 #endif /* FREECIV_JSON_CONNECTION */
79546
79547 {
79548 int i;
79549
79550 #ifdef FREECIV_JSON_CONNECTION
79551 /* Enter array. */
79552 field_addr.sub_location = plocation_elem_new(0);
79553 #endif /* FREECIV_JSON_CONNECTION */
79554
79555 if (real_packet->categories_num > 256) {
79556 RECEIVE_PACKET_FIELD_ERROR(category_names, ": truncation array");
79557 }
79558 for (i = 0; i < real_packet->categories_num; i++) {
79559 #ifdef FREECIV_JSON_CONNECTION
79560 field_addr.sub_location->number = i;
79561 #endif /* FREECIV_JSON_CONNECTION */
79562 if (!DIO_GET(string, &din, &field_addr, real_packet->category_names[i], sizeof(real_packet->category_names[i]))) {
79563 RECEIVE_PACKET_FIELD_ERROR(category_names);
79564 }
79565 }
79566
79567 #ifdef FREECIV_JSON_CONNECTION
79568 /* Exit array. */
79569 free(field_addr.sub_location);
79570 field_addr.sub_location = NULL;
79571 #endif /* FREECIV_JSON_CONNECTION */
79572 }
79573
79574#endif
79575 log_packet_detailed("packet_server_setting_control_100: got info about ()");
79576
79577#ifdef FREECIV_DELTA_PROTOCOL
79578 if (NULL == *hash) {
79579 *hash = genhash_new_full(hash_packet_server_setting_control_100, cmp_packet_server_setting_control_100,
79580 NULL, NULL, NULL, free);
79581 }
79582
79583 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
79584 *real_packet = *old;
79585 } else {
79586 log_packet_detailed(" no old info");
79587 memset(real_packet, 0, sizeof(*real_packet));
79588 }
79589
79590 if (BV_ISSET(fields, 0)) {
79591 log_packet_detailed(" got field 'settings_num'");
79592 #ifdef FREECIV_JSON_CONNECTION
79593 field_addr.name = "settings_num";
79594 #endif /* FREECIV_JSON_CONNECTION */
79595 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->settings_num)) {
79596 RECEIVE_PACKET_FIELD_ERROR(settings_num);
79597 }
79598 }
79599 if (BV_ISSET(fields, 1)) {
79600 log_packet_detailed(" got field 'categories_num'");
79601 #ifdef FREECIV_JSON_CONNECTION
79602 field_addr.name = "categories_num";
79603 #endif /* FREECIV_JSON_CONNECTION */
79604 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->categories_num)) {
79605 RECEIVE_PACKET_FIELD_ERROR(categories_num);
79606 }
79607 }
79608 if (BV_ISSET(fields, 2)) {
79609 log_packet_detailed(" got field 'category_names'");
79610 #ifdef FREECIV_JSON_CONNECTION
79611 field_addr.name = "category_names";
79612 #endif /* FREECIV_JSON_CONNECTION */
79613
79614 {
79615 int i;
79616
79617 #ifdef FREECIV_JSON_CONNECTION
79618 /* Enter array. */
79619 field_addr.sub_location = plocation_elem_new(0);
79620 #endif /* FREECIV_JSON_CONNECTION */
79621
79622 if (real_packet->categories_num > 256) {
79623 RECEIVE_PACKET_FIELD_ERROR(category_names, ": truncation array");
79624 }
79625 for (i = 0; i < real_packet->categories_num; i++) {
79626 #ifdef FREECIV_JSON_CONNECTION
79627 field_addr.sub_location->number = i;
79628 #endif /* FREECIV_JSON_CONNECTION */
79629 if (!DIO_GET(string, &din, &field_addr, real_packet->category_names[i], sizeof(real_packet->category_names[i]))) {
79630 RECEIVE_PACKET_FIELD_ERROR(category_names);
79631 }
79632 }
79633
79634 #ifdef FREECIV_JSON_CONNECTION
79635 /* Exit array. */
79636 free(field_addr.sub_location);
79637 field_addr.sub_location = NULL;
79638 #endif /* FREECIV_JSON_CONNECTION */
79639 }
79640 }
79641
79642 if (NULL == old) {
79643 old = fc_malloc(sizeof(*old));
79644 *old = *real_packet;
79645 genhash_insert(*hash, old, old);
79646 } else {
79647 *old = *real_packet;
79648 }
79649
79650#endif /* FREECIV_DELTA_PROTOCOL */
79651 RECEIVE_PACKET_END(real_packet);
79652}
79653
79654 static int send_packet_server_setting_control_100(struct connection *pc, const struct packet_server_setting_control *packet)
79655{
79656 const struct packet_server_setting_control *real_packet = packet;
79657#ifdef FREECIV_DELTA_PROTOCOL
79658 packet_server_setting_control_100_fields fields;
79659 struct packet_server_setting_control *old;
79660 bool differ;
79661 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_CONTROL;
79662 int different = 0;
79663#endif /* FREECIV_DELTA_PROTOCOL */
79664 SEND_PACKET_START(PACKET_SERVER_SETTING_CONTROL);
79665#ifdef FREECIV_JSON_CONNECTION
79666 struct plocation field_addr;
79667 {
79668 struct plocation *field_addr_tmp = plocation_field_new(NULL);
79669 field_addr = *field_addr_tmp;
79670 FC_FREE(field_addr_tmp);
79671 }
79672#endif /* FREECIV_JSON_CONNECTION */
79673
79674 log_packet_detailed("packet_server_setting_control_100: sending info about ()");
79675
79676#ifdef FREECIV_DELTA_PROTOCOL
79677 if (NULL == *hash) {
79678 *hash = genhash_new_full(hash_packet_server_setting_control_100, cmp_packet_server_setting_control_100,
79679 NULL, NULL, NULL, free);
79680 }
79681 BV_CLR_ALL(fields);
79682
79683 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
79684 old = fc_malloc(sizeof(*old));
79685 *old = *real_packet;
79686 genhash_insert(*hash, old, old);
79687 memset(old, 0, sizeof(*old));
79688 different = 1; /* Force to send. */
79689 }
79690 differ = (old->settings_num != real_packet->settings_num);
79691 if (differ) {
79692 different++;
79693 BV_SET(fields, 0);
79694 }
79695
79696 differ = (old->categories_num != real_packet->categories_num);
79697 if (differ) {
79698 different++;
79699 BV_SET(fields, 1);
79700 }
79701
79702
79703 {
79704 differ = (old->categories_num != real_packet->categories_num);
79705 if (!differ) {
79706 int i;
79707
79708 for (i = 0; i < real_packet->categories_num; i++) {
79709 if (strcmp(old->category_names[i], real_packet->category_names[i]) != 0) {
79710 differ = TRUE;
79711 break;
79712 }
79713 }
79714 }
79715 }
79716 if (differ) {
79717 different++;
79718 BV_SET(fields, 2);
79719 }
79720
79721
79722 if (different == 0) {
79723 log_packet_detailed(" no change -> discard");
79724 return 0;
79725 }
79726
79727#ifdef FREECIV_JSON_CONNECTION
79728 field_addr.name = "fields";
79729#endif /* FREECIV_JSON_CONNECTION */
79730 DIO_BV_PUT(&dout, &field_addr, fields);
79731
79732 if (BV_ISSET(fields, 0)) {
79733 log_packet_detailed(" field 'settings_num' has changed");
79734 #ifdef FREECIV_JSON_CONNECTION
79735 field_addr.name = "settings_num";
79736#endif /* FREECIV_JSON_CONNECTION */
79737 DIO_PUT(uint16, &dout, &field_addr, real_packet->settings_num);
79738 }
79739 if (BV_ISSET(fields, 1)) {
79740 log_packet_detailed(" field 'categories_num' has changed");
79741 #ifdef FREECIV_JSON_CONNECTION
79742 field_addr.name = "categories_num";
79743#endif /* FREECIV_JSON_CONNECTION */
79744 DIO_PUT(uint8, &dout, &field_addr, real_packet->categories_num);
79745 }
79746 if (BV_ISSET(fields, 2)) {
79747 log_packet_detailed(" field 'category_names' has changed");
79748 #ifdef FREECIV_JSON_CONNECTION
79749 field_addr.name = "category_names";
79750#endif /* FREECIV_JSON_CONNECTION */
79751
79752 {
79753 int i;
79754
79755#ifdef FREECIV_JSON_CONNECTION
79756 /* Create the array. */
79757 DIO_PUT(farray, &dout, &field_addr, real_packet->categories_num);
79758
79759 /* Enter the array. */
79760 field_addr.sub_location = plocation_elem_new(0);
79761#endif /* FREECIV_JSON_CONNECTION */
79762
79763 for (i = 0; i < real_packet->categories_num; i++) {
79764#ifdef FREECIV_JSON_CONNECTION
79765 /* Next array element. */
79766 field_addr.sub_location->number = i;
79767#endif /* FREECIV_JSON_CONNECTION */
79768 DIO_PUT(string, &dout, &field_addr, real_packet->category_names[i]);
79769 }
79770
79771#ifdef FREECIV_JSON_CONNECTION
79772 /* Exit array. */
79773 free(field_addr.sub_location);
79774 field_addr.sub_location = NULL;
79775#endif /* FREECIV_JSON_CONNECTION */
79776 }
79777 }
79778
79779 *old = *real_packet;
79780#endif /* FREECIV_DELTA_PROTOCOL */
79781#ifndef FREECIV_DELTA_PROTOCOL
79782#ifdef FREECIV_JSON_CONNECTION
79783 field_addr.name = "settings_num";
79784#endif /* FREECIV_JSON_CONNECTION */
79785 DIO_PUT(uint16, &dout, &field_addr, real_packet->settings_num);
79786#ifdef FREECIV_JSON_CONNECTION
79787 field_addr.name = "categories_num";
79788#endif /* FREECIV_JSON_CONNECTION */
79789 DIO_PUT(uint8, &dout, &field_addr, real_packet->categories_num);
79790#ifdef FREECIV_JSON_CONNECTION
79791 field_addr.name = "category_names";
79792#endif /* FREECIV_JSON_CONNECTION */
79793
79794 {
79795 int i;
79796
79797#ifdef FREECIV_JSON_CONNECTION
79798 /* Create the array. */
79799 DIO_PUT(farray, &dout, &field_addr, real_packet->categories_num);
79800
79801 /* Enter the array. */
79802 field_addr.sub_location = plocation_elem_new(0);
79803#endif /* FREECIV_JSON_CONNECTION */
79804
79805 for (i = 0; i < real_packet->categories_num; i++) {
79806#ifdef FREECIV_JSON_CONNECTION
79807 /* Next array element. */
79808 field_addr.sub_location->number = i;
79809#endif /* FREECIV_JSON_CONNECTION */
79810 DIO_PUT(string, &dout, &field_addr, real_packet->category_names[i]);
79811 }
79812
79813#ifdef FREECIV_JSON_CONNECTION
79814 /* Exit array. */
79815 free(field_addr.sub_location);
79816 field_addr.sub_location = NULL;
79817#endif /* FREECIV_JSON_CONNECTION */
79818 }
79819
79820#endif
79821 SEND_PACKET_END(PACKET_SERVER_SETTING_CONTROL);
79822}
79823
79824 int send_packet_server_setting_control(struct connection *pc, const struct packet_server_setting_control *packet)
79825{
79826 if (!pc->used) {
79827 log_error("WARNING: trying to send data to the closed connection %s",
79828 conn_description(pc));
79829 return -1;
79830 }
79831 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_CONTROL].packet != NULL, -1,
79832 "Handler for PACKET_SERVER_SETTING_CONTROL not installed");
79833 return pc->phs.handlers->send[PACKET_SERVER_SETTING_CONTROL].packet(pc, packet);
79834}
79835
79836#ifdef FREECIV_DELTA_PROTOCOL
79837static genhash_val_t hash_packet_server_setting_const_100(const void *vkey)
79838{
79839 const struct packet_server_setting_const *key = (const struct packet_server_setting_const *) vkey;
79840
79841 return key->id;
79842}
79843
79844static bool cmp_packet_server_setting_const_100(const void *vkey1, const void *vkey2)
79845{
79846 const struct packet_server_setting_const *key1 = (const struct packet_server_setting_const *) vkey1;
79847 const struct packet_server_setting_const *key2 = (const struct packet_server_setting_const *) vkey2;
79848
79849 return key1->id == key2->id;
79850}
79851 BV_DEFINE(packet_server_setting_const_100_fields, 4);
79852#endif /* FREECIV_DELTA_PROTOCOL */
79853
79854 static struct packet_server_setting_const *receive_packet_server_setting_const_100(struct connection *pc)
79855{
79856#ifdef FREECIV_DELTA_PROTOCOL
79857 packet_server_setting_const_100_fields fields;
79858 struct packet_server_setting_const *old;
79859 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_CONST;
79860#endif /* FREECIV_DELTA_PROTOCOL */
79861 RECEIVE_PACKET_START(packet_server_setting_const, real_packet);
79862#ifdef FREECIV_JSON_CONNECTION
79863 struct plocation field_addr;
79864 {
79865 struct plocation *field_addr_tmp = plocation_field_new(NULL);
79866 field_addr = *field_addr_tmp;
79867 FC_FREE(field_addr_tmp);
79868 }
79869#endif /* FREECIV_JSON_CONNECTION */
79870
79871#ifdef FREECIV_DELTA_PROTOCOL
79872#ifdef FREECIV_JSON_CONNECTION
79873 field_addr.name = "fields";
79874#endif /* FREECIV_JSON_CONNECTION */
79875 DIO_BV_GET(&din, &field_addr, fields);
79876 #ifdef FREECIV_JSON_CONNECTION
79877 field_addr.name = "id";
79878 #endif /* FREECIV_JSON_CONNECTION */
79879 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
79880 RECEIVE_PACKET_FIELD_ERROR(id);
79881 }
79882
79883#else /* FREECIV_DELTA_PROTOCOL */
79884 #ifdef FREECIV_JSON_CONNECTION
79885 field_addr.name = "id";
79886 #endif /* FREECIV_JSON_CONNECTION */
79887 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
79888 RECEIVE_PACKET_FIELD_ERROR(id);
79889 }
79890 #ifdef FREECIV_JSON_CONNECTION
79891 field_addr.name = "name";
79892 #endif /* FREECIV_JSON_CONNECTION */
79893 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
79894 RECEIVE_PACKET_FIELD_ERROR(name);
79895 }
79896 #ifdef FREECIV_JSON_CONNECTION
79897 field_addr.name = "short_help";
79898 #endif /* FREECIV_JSON_CONNECTION */
79899 if (!DIO_GET(string, &din, &field_addr, real_packet->short_help, sizeof(real_packet->short_help))) {
79900 RECEIVE_PACKET_FIELD_ERROR(short_help);
79901 }
79902 #ifdef FREECIV_JSON_CONNECTION
79903 field_addr.name = "extra_help";
79904 #endif /* FREECIV_JSON_CONNECTION */
79905 if (!DIO_GET(string, &din, &field_addr, real_packet->extra_help, sizeof(real_packet->extra_help))) {
79906 RECEIVE_PACKET_FIELD_ERROR(extra_help);
79907 }
79908 #ifdef FREECIV_JSON_CONNECTION
79909 field_addr.name = "category";
79910 #endif /* FREECIV_JSON_CONNECTION */
79911 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category)) {
79912 RECEIVE_PACKET_FIELD_ERROR(category);
79913 }
79914
79915#endif
79916 log_packet_detailed("packet_server_setting_const_100: got info about (%d)",
79917 real_packet->id);
79918
79919#ifdef FREECIV_DELTA_PROTOCOL
79920 if (NULL == *hash) {
79921 *hash = genhash_new_full(hash_packet_server_setting_const_100, cmp_packet_server_setting_const_100,
79922 NULL, NULL, NULL, free);
79923 }
79924
79925 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
79926 *real_packet = *old;
79927 } else {
79928 int id = real_packet->id;
79929
79930 log_packet_detailed(" no old info");
79931 memset(real_packet, 0, sizeof(*real_packet));
79932
79933 real_packet->id = id;
79934 }
79935
79936 if (BV_ISSET(fields, 0)) {
79937 log_packet_detailed(" got field 'name'");
79938 #ifdef FREECIV_JSON_CONNECTION
79939 field_addr.name = "name";
79940 #endif /* FREECIV_JSON_CONNECTION */
79941 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
79942 RECEIVE_PACKET_FIELD_ERROR(name);
79943 }
79944 }
79945 if (BV_ISSET(fields, 1)) {
79946 log_packet_detailed(" got field 'short_help'");
79947 #ifdef FREECIV_JSON_CONNECTION
79948 field_addr.name = "short_help";
79949 #endif /* FREECIV_JSON_CONNECTION */
79950 if (!DIO_GET(string, &din, &field_addr, real_packet->short_help, sizeof(real_packet->short_help))) {
79951 RECEIVE_PACKET_FIELD_ERROR(short_help);
79952 }
79953 }
79954 if (BV_ISSET(fields, 2)) {
79955 log_packet_detailed(" got field 'extra_help'");
79956 #ifdef FREECIV_JSON_CONNECTION
79957 field_addr.name = "extra_help";
79958 #endif /* FREECIV_JSON_CONNECTION */
79959 if (!DIO_GET(string, &din, &field_addr, real_packet->extra_help, sizeof(real_packet->extra_help))) {
79960 RECEIVE_PACKET_FIELD_ERROR(extra_help);
79961 }
79962 }
79963 if (BV_ISSET(fields, 3)) {
79964 log_packet_detailed(" got field 'category'");
79965 #ifdef FREECIV_JSON_CONNECTION
79966 field_addr.name = "category";
79967 #endif /* FREECIV_JSON_CONNECTION */
79968 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category)) {
79969 RECEIVE_PACKET_FIELD_ERROR(category);
79970 }
79971 }
79972
79973 if (NULL == old) {
79974 old = fc_malloc(sizeof(*old));
79975 *old = *real_packet;
79976 genhash_insert(*hash, old, old);
79977 } else {
79978 *old = *real_packet;
79979 }
79980
79981#endif /* FREECIV_DELTA_PROTOCOL */
79982 RECEIVE_PACKET_END(real_packet);
79983}
79984
79985 static int send_packet_server_setting_const_100(struct connection *pc, const struct packet_server_setting_const *packet)
79986{
79987 const struct packet_server_setting_const *real_packet = packet;
79988#ifdef FREECIV_DELTA_PROTOCOL
79989 packet_server_setting_const_100_fields fields;
79990 struct packet_server_setting_const *old;
79991 bool differ;
79992 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_CONST;
79993 int different = 0;
79994#endif /* FREECIV_DELTA_PROTOCOL */
79995 SEND_PACKET_START(PACKET_SERVER_SETTING_CONST);
79996#ifdef FREECIV_JSON_CONNECTION
79997 struct plocation field_addr;
79998 {
79999 struct plocation *field_addr_tmp = plocation_field_new(NULL);
80000 field_addr = *field_addr_tmp;
80001 FC_FREE(field_addr_tmp);
80002 }
80003#endif /* FREECIV_JSON_CONNECTION */
80004
80005 log_packet_detailed("packet_server_setting_const_100: sending info about (%d)",
80006 real_packet->id);
80007
80008#ifdef FREECIV_DELTA_PROTOCOL
80009 if (NULL == *hash) {
80010 *hash = genhash_new_full(hash_packet_server_setting_const_100, cmp_packet_server_setting_const_100,
80011 NULL, NULL, NULL, free);
80012 }
80013 BV_CLR_ALL(fields);
80014
80015 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
80016 old = fc_malloc(sizeof(*old));
80017 *old = *real_packet;
80018 genhash_insert(*hash, old, old);
80019 memset(old, 0, sizeof(*old));
80020 different = 1; /* Force to send. */
80021 }
80022 differ = (strcmp(old->name, real_packet->name) != 0);
80023 if (differ) {
80024 different++;
80025 BV_SET(fields, 0);
80026 }
80027
80028 differ = (strcmp(old->short_help, real_packet->short_help) != 0);
80029 if (differ) {
80030 different++;
80031 BV_SET(fields, 1);
80032 }
80033
80034 differ = (strcmp(old->extra_help, real_packet->extra_help) != 0);
80035 if (differ) {
80036 different++;
80037 BV_SET(fields, 2);
80038 }
80039
80040 differ = (old->category != real_packet->category);
80041 if (differ) {
80042 different++;
80043 BV_SET(fields, 3);
80044 }
80045
80046
80047 if (different == 0) {
80048 log_packet_detailed(" no change -> discard");
80049 return 0;
80050 }
80051
80052#ifdef FREECIV_JSON_CONNECTION
80053 field_addr.name = "fields";
80054#endif /* FREECIV_JSON_CONNECTION */
80055 DIO_BV_PUT(&dout, &field_addr, fields);
80056#ifdef FREECIV_JSON_CONNECTION
80057 field_addr.name = "id";
80058#endif /* FREECIV_JSON_CONNECTION */
80059 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
80060
80061 if (BV_ISSET(fields, 0)) {
80062 log_packet_detailed(" field 'name' has changed");
80063 #ifdef FREECIV_JSON_CONNECTION
80064 field_addr.name = "name";
80065#endif /* FREECIV_JSON_CONNECTION */
80066 DIO_PUT(string, &dout, &field_addr, real_packet->name);
80067 }
80068 if (BV_ISSET(fields, 1)) {
80069 log_packet_detailed(" field 'short_help' has changed");
80070 #ifdef FREECIV_JSON_CONNECTION
80071 field_addr.name = "short_help";
80072#endif /* FREECIV_JSON_CONNECTION */
80073 DIO_PUT(string, &dout, &field_addr, real_packet->short_help);
80074 }
80075 if (BV_ISSET(fields, 2)) {
80076 log_packet_detailed(" field 'extra_help' has changed");
80077 #ifdef FREECIV_JSON_CONNECTION
80078 field_addr.name = "extra_help";
80079#endif /* FREECIV_JSON_CONNECTION */
80080 DIO_PUT(string, &dout, &field_addr, real_packet->extra_help);
80081 }
80082 if (BV_ISSET(fields, 3)) {
80083 log_packet_detailed(" field 'category' has changed");
80084 #ifdef FREECIV_JSON_CONNECTION
80085 field_addr.name = "category";
80086#endif /* FREECIV_JSON_CONNECTION */
80087 DIO_PUT(uint8, &dout, &field_addr, real_packet->category);
80088 }
80089
80090 *old = *real_packet;
80091#endif /* FREECIV_DELTA_PROTOCOL */
80092#ifndef FREECIV_DELTA_PROTOCOL
80093#ifdef FREECIV_JSON_CONNECTION
80094 field_addr.name = "id";
80095#endif /* FREECIV_JSON_CONNECTION */
80096 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
80097#ifdef FREECIV_JSON_CONNECTION
80098 field_addr.name = "name";
80099#endif /* FREECIV_JSON_CONNECTION */
80100 DIO_PUT(string, &dout, &field_addr, real_packet->name);
80101#ifdef FREECIV_JSON_CONNECTION
80102 field_addr.name = "short_help";
80103#endif /* FREECIV_JSON_CONNECTION */
80104 DIO_PUT(string, &dout, &field_addr, real_packet->short_help);
80105#ifdef FREECIV_JSON_CONNECTION
80106 field_addr.name = "extra_help";
80107#endif /* FREECIV_JSON_CONNECTION */
80108 DIO_PUT(string, &dout, &field_addr, real_packet->extra_help);
80109#ifdef FREECIV_JSON_CONNECTION
80110 field_addr.name = "category";
80111#endif /* FREECIV_JSON_CONNECTION */
80112 DIO_PUT(uint8, &dout, &field_addr, real_packet->category);
80113
80114#endif
80115 SEND_PACKET_END(PACKET_SERVER_SETTING_CONST);
80116}
80117
80118 int send_packet_server_setting_const(struct connection *pc, const struct packet_server_setting_const *packet)
80119{
80120 if (!pc->used) {
80121 log_error("WARNING: trying to send data to the closed connection %s",
80122 conn_description(pc));
80123 return -1;
80124 }
80125 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_CONST].packet != NULL, -1,
80126 "Handler for PACKET_SERVER_SETTING_CONST not installed");
80127 return pc->phs.handlers->send[PACKET_SERVER_SETTING_CONST].packet(pc, packet);
80128}
80129
80130#ifdef FREECIV_DELTA_PROTOCOL
80131static genhash_val_t hash_packet_server_setting_bool_100(const void *vkey)
80132{
80133 const struct packet_server_setting_bool *key = (const struct packet_server_setting_bool *) vkey;
80134
80135 return key->id;
80136}
80137
80138static bool cmp_packet_server_setting_bool_100(const void *vkey1, const void *vkey2)
80139{
80140 const struct packet_server_setting_bool *key1 = (const struct packet_server_setting_bool *) vkey1;
80141 const struct packet_server_setting_bool *key2 = (const struct packet_server_setting_bool *) vkey2;
80142
80143 return key1->id == key2->id;
80144}
80145 BV_DEFINE(packet_server_setting_bool_100_fields, 6);
80146#endif /* FREECIV_DELTA_PROTOCOL */
80147
80148 static struct packet_server_setting_bool *receive_packet_server_setting_bool_100(struct connection *pc)
80149{
80150#ifdef FREECIV_DELTA_PROTOCOL
80151 packet_server_setting_bool_100_fields fields;
80152 struct packet_server_setting_bool *old;
80153 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_BOOL;
80154#endif /* FREECIV_DELTA_PROTOCOL */
80155 RECEIVE_PACKET_START(packet_server_setting_bool, real_packet);
80156#ifdef FREECIV_JSON_CONNECTION
80157 struct plocation field_addr;
80158 {
80159 struct plocation *field_addr_tmp = plocation_field_new(NULL);
80160 field_addr = *field_addr_tmp;
80161 FC_FREE(field_addr_tmp);
80162 }
80163#endif /* FREECIV_JSON_CONNECTION */
80164
80165#ifdef FREECIV_DELTA_PROTOCOL
80166#ifdef FREECIV_JSON_CONNECTION
80167 field_addr.name = "fields";
80168#endif /* FREECIV_JSON_CONNECTION */
80169 DIO_BV_GET(&din, &field_addr, fields);
80170 #ifdef FREECIV_JSON_CONNECTION
80171 field_addr.name = "id";
80172 #endif /* FREECIV_JSON_CONNECTION */
80173 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
80174 RECEIVE_PACKET_FIELD_ERROR(id);
80175 }
80176
80177#else /* FREECIV_DELTA_PROTOCOL */
80178 #ifdef FREECIV_JSON_CONNECTION
80179 field_addr.name = "id";
80180 #endif /* FREECIV_JSON_CONNECTION */
80181 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
80182 RECEIVE_PACKET_FIELD_ERROR(id);
80183 }
80184 #ifdef FREECIV_JSON_CONNECTION
80185 field_addr.name = "is_visible";
80186 #endif /* FREECIV_JSON_CONNECTION */
80187 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
80188 RECEIVE_PACKET_FIELD_ERROR(is_visible);
80189 }
80190 #ifdef FREECIV_JSON_CONNECTION
80191 field_addr.name = "is_changeable";
80192 #endif /* FREECIV_JSON_CONNECTION */
80193 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
80194 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
80195 }
80196 #ifdef FREECIV_JSON_CONNECTION
80197 field_addr.name = "initial_setting";
80198 #endif /* FREECIV_JSON_CONNECTION */
80199 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
80200 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
80201 }
80202 #ifdef FREECIV_JSON_CONNECTION
80203 field_addr.name = "setdef";
80204 #endif /* FREECIV_JSON_CONNECTION */
80205 {
80206 int readin;
80207
80208 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
80209 RECEIVE_PACKET_FIELD_ERROR(setdef);
80210 }
80211 real_packet->setdef = readin;
80212 }
80213 #ifdef FREECIV_JSON_CONNECTION
80214 field_addr.name = "val";
80215 #endif /* FREECIV_JSON_CONNECTION */
80216 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->val)) {
80217 RECEIVE_PACKET_FIELD_ERROR(val);
80218 }
80219 #ifdef FREECIV_JSON_CONNECTION
80220 field_addr.name = "default_val";
80221 #endif /* FREECIV_JSON_CONNECTION */
80222 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->default_val)) {
80223 RECEIVE_PACKET_FIELD_ERROR(default_val);
80224 }
80225
80226#endif
80227 log_packet_detailed("packet_server_setting_bool_100: got info about (%d)",
80228 real_packet->id);
80229
80230#ifdef FREECIV_DELTA_PROTOCOL
80231 if (NULL == *hash) {
80232 *hash = genhash_new_full(hash_packet_server_setting_bool_100, cmp_packet_server_setting_bool_100,
80233 NULL, NULL, NULL, free);
80234 }
80235
80236 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
80237 *real_packet = *old;
80238 } else {
80239 int id = real_packet->id;
80240
80241 log_packet_detailed(" no old info");
80242 memset(real_packet, 0, sizeof(*real_packet));
80243
80244 real_packet->id = id;
80245 }
80246
80247 real_packet->is_visible = BV_ISSET(fields, 0);
80248 real_packet->is_changeable = BV_ISSET(fields, 1);
80249 real_packet->initial_setting = BV_ISSET(fields, 2);
80250 if (BV_ISSET(fields, 3)) {
80251 log_packet_detailed(" got field 'setdef'");
80252 #ifdef FREECIV_JSON_CONNECTION
80253 field_addr.name = "setdef";
80254 #endif /* FREECIV_JSON_CONNECTION */
80255 {
80256 int readin;
80257
80258 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
80259 RECEIVE_PACKET_FIELD_ERROR(setdef);
80260 }
80261 real_packet->setdef = readin;
80262 }
80263 }
80264 real_packet->val = BV_ISSET(fields, 4);
80265 real_packet->default_val = BV_ISSET(fields, 5);
80266
80267 if (NULL == old) {
80268 old = fc_malloc(sizeof(*old));
80269 *old = *real_packet;
80270 genhash_insert(*hash, old, old);
80271 } else {
80272 *old = *real_packet;
80273 }
80274
80275#endif /* FREECIV_DELTA_PROTOCOL */
80276 RECEIVE_PACKET_END(real_packet);
80277}
80278
80279 static int send_packet_server_setting_bool_100(struct connection *pc, const struct packet_server_setting_bool *packet)
80280{
80281 const struct packet_server_setting_bool *real_packet = packet;
80282#ifdef FREECIV_DELTA_PROTOCOL
80283 packet_server_setting_bool_100_fields fields;
80284 struct packet_server_setting_bool *old;
80285 bool differ;
80286 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_BOOL;
80287 int different = 0;
80288#endif /* FREECIV_DELTA_PROTOCOL */
80289 SEND_PACKET_START(PACKET_SERVER_SETTING_BOOL);
80290#ifdef FREECIV_JSON_CONNECTION
80291 struct plocation field_addr;
80292 {
80293 struct plocation *field_addr_tmp = plocation_field_new(NULL);
80294 field_addr = *field_addr_tmp;
80295 FC_FREE(field_addr_tmp);
80296 }
80297#endif /* FREECIV_JSON_CONNECTION */
80298
80299 log_packet_detailed("packet_server_setting_bool_100: sending info about (%d)",
80300 real_packet->id);
80301
80302#ifdef FREECIV_DELTA_PROTOCOL
80303 if (NULL == *hash) {
80304 *hash = genhash_new_full(hash_packet_server_setting_bool_100, cmp_packet_server_setting_bool_100,
80305 NULL, NULL, NULL, free);
80306 }
80307 BV_CLR_ALL(fields);
80308
80309 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
80310 old = fc_malloc(sizeof(*old));
80311 *old = *real_packet;
80312 genhash_insert(*hash, old, old);
80313 memset(old, 0, sizeof(*old));
80314 different = 1; /* Force to send. */
80315 }
80316 differ = (old->is_visible != real_packet->is_visible);
80317 if (differ) {
80318 different++;
80319 }
80320 if (packet->is_visible) {
80321 BV_SET(fields, 0);
80322 }
80323
80324 differ = (old->is_changeable != real_packet->is_changeable);
80325 if (differ) {
80326 different++;
80327 }
80328 if (packet->is_changeable) {
80329 BV_SET(fields, 1);
80330 }
80331
80332 differ = (old->initial_setting != real_packet->initial_setting);
80333 if (differ) {
80334 different++;
80335 }
80336 if (packet->initial_setting) {
80337 BV_SET(fields, 2);
80338 }
80339
80340 differ = (old->setdef != real_packet->setdef);
80341 if (differ) {
80342 different++;
80343 BV_SET(fields, 3);
80344 }
80345
80346 differ = (old->val != real_packet->val);
80347 if (differ) {
80348 different++;
80349 }
80350 if (packet->val) {
80351 BV_SET(fields, 4);
80352 }
80353
80354 differ = (old->default_val != real_packet->default_val);
80355 if (differ) {
80356 different++;
80357 }
80358 if (packet->default_val) {
80359 BV_SET(fields, 5);
80360 }
80361
80362
80363 if (different == 0) {
80364 log_packet_detailed(" no change -> discard");
80365 return 0;
80366 }
80367
80368#ifdef FREECIV_JSON_CONNECTION
80369 field_addr.name = "fields";
80370#endif /* FREECIV_JSON_CONNECTION */
80371 DIO_BV_PUT(&dout, &field_addr, fields);
80372#ifdef FREECIV_JSON_CONNECTION
80373 field_addr.name = "id";
80374#endif /* FREECIV_JSON_CONNECTION */
80375 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
80376
80377 /* field 0 is folded into the header */
80378 /* field 1 is folded into the header */
80379 /* field 2 is folded into the header */
80380 if (BV_ISSET(fields, 3)) {
80381 log_packet_detailed(" field 'setdef' has changed");
80382 #ifdef FREECIV_JSON_CONNECTION
80383 field_addr.name = "setdef";
80384#endif /* FREECIV_JSON_CONNECTION */
80385 DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
80386 }
80387 /* field 4 is folded into the header */
80388 /* field 5 is folded into the header */
80389
80390 *old = *real_packet;
80391#endif /* FREECIV_DELTA_PROTOCOL */
80392#ifndef FREECIV_DELTA_PROTOCOL
80393#ifdef FREECIV_JSON_CONNECTION
80394 field_addr.name = "id";
80395#endif /* FREECIV_JSON_CONNECTION */
80396 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
80397#ifdef FREECIV_JSON_CONNECTION
80398 field_addr.name = "is_visible";
80399#endif /* FREECIV_JSON_CONNECTION */
80400 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
80401#ifdef FREECIV_JSON_CONNECTION
80402 field_addr.name = "is_changeable";
80403#endif /* FREECIV_JSON_CONNECTION */
80404 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
80405#ifdef FREECIV_JSON_CONNECTION
80406 field_addr.name = "initial_setting";
80407#endif /* FREECIV_JSON_CONNECTION */
80408 DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
80409#ifdef FREECIV_JSON_CONNECTION
80410 field_addr.name = "setdef";
80411#endif /* FREECIV_JSON_CONNECTION */
80412 DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
80413#ifdef FREECIV_JSON_CONNECTION
80414 field_addr.name = "val";
80415#endif /* FREECIV_JSON_CONNECTION */
80416 DIO_PUT(bool8, &dout, &field_addr, real_packet->val);
80417#ifdef FREECIV_JSON_CONNECTION
80418 field_addr.name = "default_val";
80419#endif /* FREECIV_JSON_CONNECTION */
80420 DIO_PUT(bool8, &dout, &field_addr, real_packet->default_val);
80421
80422#endif
80423 SEND_PACKET_END(PACKET_SERVER_SETTING_BOOL);
80424}
80425
80426 int send_packet_server_setting_bool(struct connection *pc, const struct packet_server_setting_bool *packet)
80427{
80428 if (!pc->used) {
80429 log_error("WARNING: trying to send data to the closed connection %s",
80430 conn_description(pc));
80431 return -1;
80432 }
80433 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_BOOL].packet != NULL, -1,
80434 "Handler for PACKET_SERVER_SETTING_BOOL not installed");
80435 return pc->phs.handlers->send[PACKET_SERVER_SETTING_BOOL].packet(pc, packet);
80436}
80437
80438#ifdef FREECIV_DELTA_PROTOCOL
80439static genhash_val_t hash_packet_server_setting_int_100(const void *vkey)
80440{
80441 const struct packet_server_setting_int *key = (const struct packet_server_setting_int *) vkey;
80442
80443 return key->id;
80444}
80445
80446static bool cmp_packet_server_setting_int_100(const void *vkey1, const void *vkey2)
80447{
80448 const struct packet_server_setting_int *key1 = (const struct packet_server_setting_int *) vkey1;
80449 const struct packet_server_setting_int *key2 = (const struct packet_server_setting_int *) vkey2;
80450
80451 return key1->id == key2->id;
80452}
80453 BV_DEFINE(packet_server_setting_int_100_fields, 8);
80454#endif /* FREECIV_DELTA_PROTOCOL */
80455
80456 static struct packet_server_setting_int *receive_packet_server_setting_int_100(struct connection *pc)
80457{
80458#ifdef FREECIV_DELTA_PROTOCOL
80459 packet_server_setting_int_100_fields fields;
80460 struct packet_server_setting_int *old;
80461 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_INT;
80462#endif /* FREECIV_DELTA_PROTOCOL */
80463 RECEIVE_PACKET_START(packet_server_setting_int, real_packet);
80464#ifdef FREECIV_JSON_CONNECTION
80465 struct plocation field_addr;
80466 {
80467 struct plocation *field_addr_tmp = plocation_field_new(NULL);
80468 field_addr = *field_addr_tmp;
80469 FC_FREE(field_addr_tmp);
80470 }
80471#endif /* FREECIV_JSON_CONNECTION */
80472
80473#ifdef FREECIV_DELTA_PROTOCOL
80474#ifdef FREECIV_JSON_CONNECTION
80475 field_addr.name = "fields";
80476#endif /* FREECIV_JSON_CONNECTION */
80477 DIO_BV_GET(&din, &field_addr, fields);
80478 #ifdef FREECIV_JSON_CONNECTION
80479 field_addr.name = "id";
80480 #endif /* FREECIV_JSON_CONNECTION */
80481 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
80482 RECEIVE_PACKET_FIELD_ERROR(id);
80483 }
80484
80485#else /* FREECIV_DELTA_PROTOCOL */
80486 #ifdef FREECIV_JSON_CONNECTION
80487 field_addr.name = "id";
80488 #endif /* FREECIV_JSON_CONNECTION */
80489 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
80490 RECEIVE_PACKET_FIELD_ERROR(id);
80491 }
80492 #ifdef FREECIV_JSON_CONNECTION
80493 field_addr.name = "is_visible";
80494 #endif /* FREECIV_JSON_CONNECTION */
80495 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
80496 RECEIVE_PACKET_FIELD_ERROR(is_visible);
80497 }
80498 #ifdef FREECIV_JSON_CONNECTION
80499 field_addr.name = "is_changeable";
80500 #endif /* FREECIV_JSON_CONNECTION */
80501 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
80502 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
80503 }
80504 #ifdef FREECIV_JSON_CONNECTION
80505 field_addr.name = "initial_setting";
80506 #endif /* FREECIV_JSON_CONNECTION */
80507 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
80508 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
80509 }
80510 #ifdef FREECIV_JSON_CONNECTION
80511 field_addr.name = "setdef";
80512 #endif /* FREECIV_JSON_CONNECTION */
80513 {
80514 int readin;
80515
80516 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
80517 RECEIVE_PACKET_FIELD_ERROR(setdef);
80518 }
80519 real_packet->setdef = readin;
80520 }
80521 #ifdef FREECIV_JSON_CONNECTION
80522 field_addr.name = "val";
80523 #endif /* FREECIV_JSON_CONNECTION */
80524 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->val)) {
80525 RECEIVE_PACKET_FIELD_ERROR(val);
80526 }
80527 #ifdef FREECIV_JSON_CONNECTION
80528 field_addr.name = "default_val";
80529 #endif /* FREECIV_JSON_CONNECTION */
80530 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->default_val)) {
80531 RECEIVE_PACKET_FIELD_ERROR(default_val);
80532 }
80533 #ifdef FREECIV_JSON_CONNECTION
80534 field_addr.name = "min_val";
80535 #endif /* FREECIV_JSON_CONNECTION */
80536 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->min_val)) {
80537 RECEIVE_PACKET_FIELD_ERROR(min_val);
80538 }
80539 #ifdef FREECIV_JSON_CONNECTION
80540 field_addr.name = "max_val";
80541 #endif /* FREECIV_JSON_CONNECTION */
80542 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->max_val)) {
80543 RECEIVE_PACKET_FIELD_ERROR(max_val);
80544 }
80545
80546#endif
80547 log_packet_detailed("packet_server_setting_int_100: got info about (%d)",
80548 real_packet->id);
80549
80550#ifdef FREECIV_DELTA_PROTOCOL
80551 if (NULL == *hash) {
80552 *hash = genhash_new_full(hash_packet_server_setting_int_100, cmp_packet_server_setting_int_100,
80553 NULL, NULL, NULL, free);
80554 }
80555
80556 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
80557 *real_packet = *old;
80558 } else {
80559 int id = real_packet->id;
80560
80561 log_packet_detailed(" no old info");
80562 memset(real_packet, 0, sizeof(*real_packet));
80563
80564 real_packet->id = id;
80565 }
80566
80567 real_packet->is_visible = BV_ISSET(fields, 0);
80568 real_packet->is_changeable = BV_ISSET(fields, 1);
80569 real_packet->initial_setting = BV_ISSET(fields, 2);
80570 if (BV_ISSET(fields, 3)) {
80571 log_packet_detailed(" got field 'setdef'");
80572 #ifdef FREECIV_JSON_CONNECTION
80573 field_addr.name = "setdef";
80574 #endif /* FREECIV_JSON_CONNECTION */
80575 {
80576 int readin;
80577
80578 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
80579 RECEIVE_PACKET_FIELD_ERROR(setdef);
80580 }
80581 real_packet->setdef = readin;
80582 }
80583 }
80584 if (BV_ISSET(fields, 4)) {
80585 log_packet_detailed(" got field 'val'");
80586 #ifdef FREECIV_JSON_CONNECTION
80587 field_addr.name = "val";
80588 #endif /* FREECIV_JSON_CONNECTION */
80589 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->val)) {
80590 RECEIVE_PACKET_FIELD_ERROR(val);
80591 }
80592 }
80593 if (BV_ISSET(fields, 5)) {
80594 log_packet_detailed(" got field 'default_val'");
80595 #ifdef FREECIV_JSON_CONNECTION
80596 field_addr.name = "default_val";
80597 #endif /* FREECIV_JSON_CONNECTION */
80598 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->default_val)) {
80599 RECEIVE_PACKET_FIELD_ERROR(default_val);
80600 }
80601 }
80602 if (BV_ISSET(fields, 6)) {
80603 log_packet_detailed(" got field 'min_val'");
80604 #ifdef FREECIV_JSON_CONNECTION
80605 field_addr.name = "min_val";
80606 #endif /* FREECIV_JSON_CONNECTION */
80607 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->min_val)) {
80608 RECEIVE_PACKET_FIELD_ERROR(min_val);
80609 }
80610 }
80611 if (BV_ISSET(fields, 7)) {
80612 log_packet_detailed(" got field 'max_val'");
80613 #ifdef FREECIV_JSON_CONNECTION
80614 field_addr.name = "max_val";
80615 #endif /* FREECIV_JSON_CONNECTION */
80616 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->max_val)) {
80617 RECEIVE_PACKET_FIELD_ERROR(max_val);
80618 }
80619 }
80620
80621 if (NULL == old) {
80622 old = fc_malloc(sizeof(*old));
80623 *old = *real_packet;
80624 genhash_insert(*hash, old, old);
80625 } else {
80626 *old = *real_packet;
80627 }
80628
80629#endif /* FREECIV_DELTA_PROTOCOL */
80630 RECEIVE_PACKET_END(real_packet);
80631}
80632
80633 static int send_packet_server_setting_int_100(struct connection *pc, const struct packet_server_setting_int *packet)
80634{
80635 const struct packet_server_setting_int *real_packet = packet;
80636#ifdef FREECIV_DELTA_PROTOCOL
80637 packet_server_setting_int_100_fields fields;
80638 struct packet_server_setting_int *old;
80639 bool differ;
80640 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_INT;
80641 int different = 0;
80642#endif /* FREECIV_DELTA_PROTOCOL */
80643 SEND_PACKET_START(PACKET_SERVER_SETTING_INT);
80644#ifdef FREECIV_JSON_CONNECTION
80645 struct plocation field_addr;
80646 {
80647 struct plocation *field_addr_tmp = plocation_field_new(NULL);
80648 field_addr = *field_addr_tmp;
80649 FC_FREE(field_addr_tmp);
80650 }
80651#endif /* FREECIV_JSON_CONNECTION */
80652
80653 log_packet_detailed("packet_server_setting_int_100: sending info about (%d)",
80654 real_packet->id);
80655
80656#ifdef FREECIV_DELTA_PROTOCOL
80657 if (NULL == *hash) {
80658 *hash = genhash_new_full(hash_packet_server_setting_int_100, cmp_packet_server_setting_int_100,
80659 NULL, NULL, NULL, free);
80660 }
80661 BV_CLR_ALL(fields);
80662
80663 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
80664 old = fc_malloc(sizeof(*old));
80665 *old = *real_packet;
80666 genhash_insert(*hash, old, old);
80667 memset(old, 0, sizeof(*old));
80668 different = 1; /* Force to send. */
80669 }
80670 differ = (old->is_visible != real_packet->is_visible);
80671 if (differ) {
80672 different++;
80673 }
80674 if (packet->is_visible) {
80675 BV_SET(fields, 0);
80676 }
80677
80678 differ = (old->is_changeable != real_packet->is_changeable);
80679 if (differ) {
80680 different++;
80681 }
80682 if (packet->is_changeable) {
80683 BV_SET(fields, 1);
80684 }
80685
80686 differ = (old->initial_setting != real_packet->initial_setting);
80687 if (differ) {
80688 different++;
80689 }
80690 if (packet->initial_setting) {
80691 BV_SET(fields, 2);
80692 }
80693
80694 differ = (old->setdef != real_packet->setdef);
80695 if (differ) {
80696 different++;
80697 BV_SET(fields, 3);
80698 }
80699
80700 differ = (old->val != real_packet->val);
80701 if (differ) {
80702 different++;
80703 BV_SET(fields, 4);
80704 }
80705
80706 differ = (old->default_val != real_packet->default_val);
80707 if (differ) {
80708 different++;
80709 BV_SET(fields, 5);
80710 }
80711
80712 differ = (old->min_val != real_packet->min_val);
80713 if (differ) {
80714 different++;
80715 BV_SET(fields, 6);
80716 }
80717
80718 differ = (old->max_val != real_packet->max_val);
80719 if (differ) {
80720 different++;
80721 BV_SET(fields, 7);
80722 }
80723
80724
80725 if (different == 0) {
80726 log_packet_detailed(" no change -> discard");
80727 return 0;
80728 }
80729
80730#ifdef FREECIV_JSON_CONNECTION
80731 field_addr.name = "fields";
80732#endif /* FREECIV_JSON_CONNECTION */
80733 DIO_BV_PUT(&dout, &field_addr, fields);
80734#ifdef FREECIV_JSON_CONNECTION
80735 field_addr.name = "id";
80736#endif /* FREECIV_JSON_CONNECTION */
80737 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
80738
80739 /* field 0 is folded into the header */
80740 /* field 1 is folded into the header */
80741 /* field 2 is folded into the header */
80742 if (BV_ISSET(fields, 3)) {
80743 log_packet_detailed(" field 'setdef' has changed");
80744 #ifdef FREECIV_JSON_CONNECTION
80745 field_addr.name = "setdef";
80746#endif /* FREECIV_JSON_CONNECTION */
80747 DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
80748 }
80749 if (BV_ISSET(fields, 4)) {
80750 log_packet_detailed(" field 'val' has changed");
80751 #ifdef FREECIV_JSON_CONNECTION
80752 field_addr.name = "val";
80753#endif /* FREECIV_JSON_CONNECTION */
80754 DIO_PUT(sint32, &dout, &field_addr, real_packet->val);
80755 }
80756 if (BV_ISSET(fields, 5)) {
80757 log_packet_detailed(" field 'default_val' has changed");
80758 #ifdef FREECIV_JSON_CONNECTION
80759 field_addr.name = "default_val";
80760#endif /* FREECIV_JSON_CONNECTION */
80761 DIO_PUT(sint32, &dout, &field_addr, real_packet->default_val);
80762 }
80763 if (BV_ISSET(fields, 6)) {
80764 log_packet_detailed(" field 'min_val' has changed");
80765 #ifdef FREECIV_JSON_CONNECTION
80766 field_addr.name = "min_val";
80767#endif /* FREECIV_JSON_CONNECTION */
80768 DIO_PUT(sint32, &dout, &field_addr, real_packet->min_val);
80769 }
80770 if (BV_ISSET(fields, 7)) {
80771 log_packet_detailed(" field 'max_val' has changed");
80772 #ifdef FREECIV_JSON_CONNECTION
80773 field_addr.name = "max_val";
80774#endif /* FREECIV_JSON_CONNECTION */
80775 DIO_PUT(sint32, &dout, &field_addr, real_packet->max_val);
80776 }
80777
80778 *old = *real_packet;
80779#endif /* FREECIV_DELTA_PROTOCOL */
80780#ifndef FREECIV_DELTA_PROTOCOL
80781#ifdef FREECIV_JSON_CONNECTION
80782 field_addr.name = "id";
80783#endif /* FREECIV_JSON_CONNECTION */
80784 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
80785#ifdef FREECIV_JSON_CONNECTION
80786 field_addr.name = "is_visible";
80787#endif /* FREECIV_JSON_CONNECTION */
80788 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
80789#ifdef FREECIV_JSON_CONNECTION
80790 field_addr.name = "is_changeable";
80791#endif /* FREECIV_JSON_CONNECTION */
80792 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
80793#ifdef FREECIV_JSON_CONNECTION
80794 field_addr.name = "initial_setting";
80795#endif /* FREECIV_JSON_CONNECTION */
80796 DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
80797#ifdef FREECIV_JSON_CONNECTION
80798 field_addr.name = "setdef";
80799#endif /* FREECIV_JSON_CONNECTION */
80800 DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
80801#ifdef FREECIV_JSON_CONNECTION
80802 field_addr.name = "val";
80803#endif /* FREECIV_JSON_CONNECTION */
80804 DIO_PUT(sint32, &dout, &field_addr, real_packet->val);
80805#ifdef FREECIV_JSON_CONNECTION
80806 field_addr.name = "default_val";
80807#endif /* FREECIV_JSON_CONNECTION */
80808 DIO_PUT(sint32, &dout, &field_addr, real_packet->default_val);
80809#ifdef FREECIV_JSON_CONNECTION
80810 field_addr.name = "min_val";
80811#endif /* FREECIV_JSON_CONNECTION */
80812 DIO_PUT(sint32, &dout, &field_addr, real_packet->min_val);
80813#ifdef FREECIV_JSON_CONNECTION
80814 field_addr.name = "max_val";
80815#endif /* FREECIV_JSON_CONNECTION */
80816 DIO_PUT(sint32, &dout, &field_addr, real_packet->max_val);
80817
80818#endif
80819 SEND_PACKET_END(PACKET_SERVER_SETTING_INT);
80820}
80821
80822 int send_packet_server_setting_int(struct connection *pc, const struct packet_server_setting_int *packet)
80823{
80824 if (!pc->used) {
80825 log_error("WARNING: trying to send data to the closed connection %s",
80826 conn_description(pc));
80827 return -1;
80828 }
80829 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_INT].packet != NULL, -1,
80830 "Handler for PACKET_SERVER_SETTING_INT not installed");
80831 return pc->phs.handlers->send[PACKET_SERVER_SETTING_INT].packet(pc, packet);
80832}
80833
80834#ifdef FREECIV_DELTA_PROTOCOL
80835static genhash_val_t hash_packet_server_setting_str_100(const void *vkey)
80836{
80837 const struct packet_server_setting_str *key = (const struct packet_server_setting_str *) vkey;
80838
80839 return key->id;
80840}
80841
80842static bool cmp_packet_server_setting_str_100(const void *vkey1, const void *vkey2)
80843{
80844 const struct packet_server_setting_str *key1 = (const struct packet_server_setting_str *) vkey1;
80845 const struct packet_server_setting_str *key2 = (const struct packet_server_setting_str *) vkey2;
80846
80847 return key1->id == key2->id;
80848}
80849 BV_DEFINE(packet_server_setting_str_100_fields, 6);
80850#endif /* FREECIV_DELTA_PROTOCOL */
80851
80852 static struct packet_server_setting_str *receive_packet_server_setting_str_100(struct connection *pc)
80853{
80854#ifdef FREECIV_DELTA_PROTOCOL
80855 packet_server_setting_str_100_fields fields;
80856 struct packet_server_setting_str *old;
80857 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_STR;
80858#endif /* FREECIV_DELTA_PROTOCOL */
80859 RECEIVE_PACKET_START(packet_server_setting_str, real_packet);
80860#ifdef FREECIV_JSON_CONNECTION
80861 struct plocation field_addr;
80862 {
80863 struct plocation *field_addr_tmp = plocation_field_new(NULL);
80864 field_addr = *field_addr_tmp;
80865 FC_FREE(field_addr_tmp);
80866 }
80867#endif /* FREECIV_JSON_CONNECTION */
80868
80869#ifdef FREECIV_DELTA_PROTOCOL
80870#ifdef FREECIV_JSON_CONNECTION
80871 field_addr.name = "fields";
80872#endif /* FREECIV_JSON_CONNECTION */
80873 DIO_BV_GET(&din, &field_addr, fields);
80874 #ifdef FREECIV_JSON_CONNECTION
80875 field_addr.name = "id";
80876 #endif /* FREECIV_JSON_CONNECTION */
80877 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
80878 RECEIVE_PACKET_FIELD_ERROR(id);
80879 }
80880
80881#else /* FREECIV_DELTA_PROTOCOL */
80882 #ifdef FREECIV_JSON_CONNECTION
80883 field_addr.name = "id";
80884 #endif /* FREECIV_JSON_CONNECTION */
80885 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
80886 RECEIVE_PACKET_FIELD_ERROR(id);
80887 }
80888 #ifdef FREECIV_JSON_CONNECTION
80889 field_addr.name = "is_visible";
80890 #endif /* FREECIV_JSON_CONNECTION */
80891 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
80892 RECEIVE_PACKET_FIELD_ERROR(is_visible);
80893 }
80894 #ifdef FREECIV_JSON_CONNECTION
80895 field_addr.name = "is_changeable";
80896 #endif /* FREECIV_JSON_CONNECTION */
80897 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
80898 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
80899 }
80900 #ifdef FREECIV_JSON_CONNECTION
80901 field_addr.name = "initial_setting";
80902 #endif /* FREECIV_JSON_CONNECTION */
80903 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
80904 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
80905 }
80906 #ifdef FREECIV_JSON_CONNECTION
80907 field_addr.name = "setdef";
80908 #endif /* FREECIV_JSON_CONNECTION */
80909 {
80910 int readin;
80911
80912 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
80913 RECEIVE_PACKET_FIELD_ERROR(setdef);
80914 }
80915 real_packet->setdef = readin;
80916 }
80917 #ifdef FREECIV_JSON_CONNECTION
80918 field_addr.name = "val";
80919 #endif /* FREECIV_JSON_CONNECTION */
80920 if (!DIO_GET(string, &din, &field_addr, real_packet->val, sizeof(real_packet->val))) {
80921 RECEIVE_PACKET_FIELD_ERROR(val);
80922 }
80923 #ifdef FREECIV_JSON_CONNECTION
80924 field_addr.name = "default_val";
80925 #endif /* FREECIV_JSON_CONNECTION */
80926 if (!DIO_GET(string, &din, &field_addr, real_packet->default_val, sizeof(real_packet->default_val))) {
80927 RECEIVE_PACKET_FIELD_ERROR(default_val);
80928 }
80929
80930#endif
80931 log_packet_detailed("packet_server_setting_str_100: got info about (%d)",
80932 real_packet->id);
80933
80934#ifdef FREECIV_DELTA_PROTOCOL
80935 if (NULL == *hash) {
80936 *hash = genhash_new_full(hash_packet_server_setting_str_100, cmp_packet_server_setting_str_100,
80937 NULL, NULL, NULL, free);
80938 }
80939
80940 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
80941 *real_packet = *old;
80942 } else {
80943 int id = real_packet->id;
80944
80945 log_packet_detailed(" no old info");
80946 memset(real_packet, 0, sizeof(*real_packet));
80947
80948 real_packet->id = id;
80949 }
80950
80951 real_packet->is_visible = BV_ISSET(fields, 0);
80952 real_packet->is_changeable = BV_ISSET(fields, 1);
80953 real_packet->initial_setting = BV_ISSET(fields, 2);
80954 if (BV_ISSET(fields, 3)) {
80955 log_packet_detailed(" got field 'setdef'");
80956 #ifdef FREECIV_JSON_CONNECTION
80957 field_addr.name = "setdef";
80958 #endif /* FREECIV_JSON_CONNECTION */
80959 {
80960 int readin;
80961
80962 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
80963 RECEIVE_PACKET_FIELD_ERROR(setdef);
80964 }
80965 real_packet->setdef = readin;
80966 }
80967 }
80968 if (BV_ISSET(fields, 4)) {
80969 log_packet_detailed(" got field 'val'");
80970 #ifdef FREECIV_JSON_CONNECTION
80971 field_addr.name = "val";
80972 #endif /* FREECIV_JSON_CONNECTION */
80973 if (!DIO_GET(string, &din, &field_addr, real_packet->val, sizeof(real_packet->val))) {
80974 RECEIVE_PACKET_FIELD_ERROR(val);
80975 }
80976 }
80977 if (BV_ISSET(fields, 5)) {
80978 log_packet_detailed(" got field 'default_val'");
80979 #ifdef FREECIV_JSON_CONNECTION
80980 field_addr.name = "default_val";
80981 #endif /* FREECIV_JSON_CONNECTION */
80982 if (!DIO_GET(string, &din, &field_addr, real_packet->default_val, sizeof(real_packet->default_val))) {
80983 RECEIVE_PACKET_FIELD_ERROR(default_val);
80984 }
80985 }
80986
80987 if (NULL == old) {
80988 old = fc_malloc(sizeof(*old));
80989 *old = *real_packet;
80990 genhash_insert(*hash, old, old);
80991 } else {
80992 *old = *real_packet;
80993 }
80994
80995#endif /* FREECIV_DELTA_PROTOCOL */
80996 RECEIVE_PACKET_END(real_packet);
80997}
80998
80999 static int send_packet_server_setting_str_100(struct connection *pc, const struct packet_server_setting_str *packet)
81000{
81001 const struct packet_server_setting_str *real_packet = packet;
81002#ifdef FREECIV_DELTA_PROTOCOL
81003 packet_server_setting_str_100_fields fields;
81004 struct packet_server_setting_str *old;
81005 bool differ;
81006 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_STR;
81007 int different = 0;
81008#endif /* FREECIV_DELTA_PROTOCOL */
81009 SEND_PACKET_START(PACKET_SERVER_SETTING_STR);
81010#ifdef FREECIV_JSON_CONNECTION
81011 struct plocation field_addr;
81012 {
81013 struct plocation *field_addr_tmp = plocation_field_new(NULL);
81014 field_addr = *field_addr_tmp;
81015 FC_FREE(field_addr_tmp);
81016 }
81017#endif /* FREECIV_JSON_CONNECTION */
81018
81019 log_packet_detailed("packet_server_setting_str_100: sending info about (%d)",
81020 real_packet->id);
81021
81022#ifdef FREECIV_DELTA_PROTOCOL
81023 if (NULL == *hash) {
81024 *hash = genhash_new_full(hash_packet_server_setting_str_100, cmp_packet_server_setting_str_100,
81025 NULL, NULL, NULL, free);
81026 }
81027 BV_CLR_ALL(fields);
81028
81029 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
81030 old = fc_malloc(sizeof(*old));
81031 *old = *real_packet;
81032 genhash_insert(*hash, old, old);
81033 memset(old, 0, sizeof(*old));
81034 different = 1; /* Force to send. */
81035 }
81036 differ = (old->is_visible != real_packet->is_visible);
81037 if (differ) {
81038 different++;
81039 }
81040 if (packet->is_visible) {
81041 BV_SET(fields, 0);
81042 }
81043
81044 differ = (old->is_changeable != real_packet->is_changeable);
81045 if (differ) {
81046 different++;
81047 }
81048 if (packet->is_changeable) {
81049 BV_SET(fields, 1);
81050 }
81051
81052 differ = (old->initial_setting != real_packet->initial_setting);
81053 if (differ) {
81054 different++;
81055 }
81056 if (packet->initial_setting) {
81057 BV_SET(fields, 2);
81058 }
81059
81060 differ = (old->setdef != real_packet->setdef);
81061 if (differ) {
81062 different++;
81063 BV_SET(fields, 3);
81064 }
81065
81066 differ = (strcmp(old->val, real_packet->val) != 0);
81067 if (differ) {
81068 different++;
81069 BV_SET(fields, 4);
81070 }
81071
81072 differ = (strcmp(old->default_val, real_packet->default_val) != 0);
81073 if (differ) {
81074 different++;
81075 BV_SET(fields, 5);
81076 }
81077
81078
81079 if (different == 0) {
81080 log_packet_detailed(" no change -> discard");
81081 return 0;
81082 }
81083
81084#ifdef FREECIV_JSON_CONNECTION
81085 field_addr.name = "fields";
81086#endif /* FREECIV_JSON_CONNECTION */
81087 DIO_BV_PUT(&dout, &field_addr, fields);
81088#ifdef FREECIV_JSON_CONNECTION
81089 field_addr.name = "id";
81090#endif /* FREECIV_JSON_CONNECTION */
81091 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
81092
81093 /* field 0 is folded into the header */
81094 /* field 1 is folded into the header */
81095 /* field 2 is folded into the header */
81096 if (BV_ISSET(fields, 3)) {
81097 log_packet_detailed(" field 'setdef' has changed");
81098 #ifdef FREECIV_JSON_CONNECTION
81099 field_addr.name = "setdef";
81100#endif /* FREECIV_JSON_CONNECTION */
81101 DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
81102 }
81103 if (BV_ISSET(fields, 4)) {
81104 log_packet_detailed(" field 'val' has changed");
81105 #ifdef FREECIV_JSON_CONNECTION
81106 field_addr.name = "val";
81107#endif /* FREECIV_JSON_CONNECTION */
81108 DIO_PUT(string, &dout, &field_addr, real_packet->val);
81109 }
81110 if (BV_ISSET(fields, 5)) {
81111 log_packet_detailed(" field 'default_val' has changed");
81112 #ifdef FREECIV_JSON_CONNECTION
81113 field_addr.name = "default_val";
81114#endif /* FREECIV_JSON_CONNECTION */
81115 DIO_PUT(string, &dout, &field_addr, real_packet->default_val);
81116 }
81117
81118 *old = *real_packet;
81119#endif /* FREECIV_DELTA_PROTOCOL */
81120#ifndef FREECIV_DELTA_PROTOCOL
81121#ifdef FREECIV_JSON_CONNECTION
81122 field_addr.name = "id";
81123#endif /* FREECIV_JSON_CONNECTION */
81124 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
81125#ifdef FREECIV_JSON_CONNECTION
81126 field_addr.name = "is_visible";
81127#endif /* FREECIV_JSON_CONNECTION */
81128 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
81129#ifdef FREECIV_JSON_CONNECTION
81130 field_addr.name = "is_changeable";
81131#endif /* FREECIV_JSON_CONNECTION */
81132 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
81133#ifdef FREECIV_JSON_CONNECTION
81134 field_addr.name = "initial_setting";
81135#endif /* FREECIV_JSON_CONNECTION */
81136 DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
81137#ifdef FREECIV_JSON_CONNECTION
81138 field_addr.name = "setdef";
81139#endif /* FREECIV_JSON_CONNECTION */
81140 DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
81141#ifdef FREECIV_JSON_CONNECTION
81142 field_addr.name = "val";
81143#endif /* FREECIV_JSON_CONNECTION */
81144 DIO_PUT(string, &dout, &field_addr, real_packet->val);
81145#ifdef FREECIV_JSON_CONNECTION
81146 field_addr.name = "default_val";
81147#endif /* FREECIV_JSON_CONNECTION */
81148 DIO_PUT(string, &dout, &field_addr, real_packet->default_val);
81149
81150#endif
81151 SEND_PACKET_END(PACKET_SERVER_SETTING_STR);
81152}
81153
81154 int send_packet_server_setting_str(struct connection *pc, const struct packet_server_setting_str *packet)
81155{
81156 if (!pc->used) {
81157 log_error("WARNING: trying to send data to the closed connection %s",
81158 conn_description(pc));
81159 return -1;
81160 }
81161 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_STR].packet != NULL, -1,
81162 "Handler for PACKET_SERVER_SETTING_STR not installed");
81163 return pc->phs.handlers->send[PACKET_SERVER_SETTING_STR].packet(pc, packet);
81164}
81165
81166#ifdef FREECIV_DELTA_PROTOCOL
81167static genhash_val_t hash_packet_server_setting_enum_100(const void *vkey)
81168{
81169 const struct packet_server_setting_enum *key = (const struct packet_server_setting_enum *) vkey;
81170
81171 return key->id;
81172}
81173
81174static bool cmp_packet_server_setting_enum_100(const void *vkey1, const void *vkey2)
81175{
81176 const struct packet_server_setting_enum *key1 = (const struct packet_server_setting_enum *) vkey1;
81177 const struct packet_server_setting_enum *key2 = (const struct packet_server_setting_enum *) vkey2;
81178
81179 return key1->id == key2->id;
81180}
81181 BV_DEFINE(packet_server_setting_enum_100_fields, 9);
81182#endif /* FREECIV_DELTA_PROTOCOL */
81183
81184 static struct packet_server_setting_enum *receive_packet_server_setting_enum_100(struct connection *pc)
81185{
81186#ifdef FREECIV_DELTA_PROTOCOL
81187 packet_server_setting_enum_100_fields fields;
81188 struct packet_server_setting_enum *old;
81189 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_ENUM;
81190#endif /* FREECIV_DELTA_PROTOCOL */
81191 RECEIVE_PACKET_START(packet_server_setting_enum, real_packet);
81192#ifdef FREECIV_JSON_CONNECTION
81193 struct plocation field_addr;
81194 {
81195 struct plocation *field_addr_tmp = plocation_field_new(NULL);
81196 field_addr = *field_addr_tmp;
81197 FC_FREE(field_addr_tmp);
81198 }
81199#endif /* FREECIV_JSON_CONNECTION */
81200
81201#ifdef FREECIV_DELTA_PROTOCOL
81202#ifdef FREECIV_JSON_CONNECTION
81203 field_addr.name = "fields";
81204#endif /* FREECIV_JSON_CONNECTION */
81205 DIO_BV_GET(&din, &field_addr, fields);
81206 #ifdef FREECIV_JSON_CONNECTION
81207 field_addr.name = "id";
81208 #endif /* FREECIV_JSON_CONNECTION */
81209 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
81210 RECEIVE_PACKET_FIELD_ERROR(id);
81211 }
81212
81213#else /* FREECIV_DELTA_PROTOCOL */
81214 #ifdef FREECIV_JSON_CONNECTION
81215 field_addr.name = "id";
81216 #endif /* FREECIV_JSON_CONNECTION */
81217 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
81218 RECEIVE_PACKET_FIELD_ERROR(id);
81219 }
81220 #ifdef FREECIV_JSON_CONNECTION
81221 field_addr.name = "is_visible";
81222 #endif /* FREECIV_JSON_CONNECTION */
81223 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
81224 RECEIVE_PACKET_FIELD_ERROR(is_visible);
81225 }
81226 #ifdef FREECIV_JSON_CONNECTION
81227 field_addr.name = "is_changeable";
81228 #endif /* FREECIV_JSON_CONNECTION */
81229 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
81230 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
81231 }
81232 #ifdef FREECIV_JSON_CONNECTION
81233 field_addr.name = "initial_setting";
81234 #endif /* FREECIV_JSON_CONNECTION */
81235 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
81236 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
81237 }
81238 #ifdef FREECIV_JSON_CONNECTION
81239 field_addr.name = "setdef";
81240 #endif /* FREECIV_JSON_CONNECTION */
81241 {
81242 int readin;
81243
81244 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
81245 RECEIVE_PACKET_FIELD_ERROR(setdef);
81246 }
81247 real_packet->setdef = readin;
81248 }
81249 #ifdef FREECIV_JSON_CONNECTION
81250 field_addr.name = "val";
81251 #endif /* FREECIV_JSON_CONNECTION */
81252 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->val)) {
81253 RECEIVE_PACKET_FIELD_ERROR(val);
81254 }
81255 #ifdef FREECIV_JSON_CONNECTION
81256 field_addr.name = "default_val";
81257 #endif /* FREECIV_JSON_CONNECTION */
81258 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->default_val)) {
81259 RECEIVE_PACKET_FIELD_ERROR(default_val);
81260 }
81261 #ifdef FREECIV_JSON_CONNECTION
81262 field_addr.name = "values_num";
81263 #endif /* FREECIV_JSON_CONNECTION */
81264 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->values_num)) {
81265 RECEIVE_PACKET_FIELD_ERROR(values_num);
81266 }
81267 #ifdef FREECIV_JSON_CONNECTION
81268 field_addr.name = "support_names";
81269 #endif /* FREECIV_JSON_CONNECTION */
81270
81271 {
81272 int i;
81273
81274 #ifdef FREECIV_JSON_CONNECTION
81275 /* Enter array. */
81276 field_addr.sub_location = plocation_elem_new(0);
81277 #endif /* FREECIV_JSON_CONNECTION */
81278
81279 if (real_packet->values_num > 64) {
81280 RECEIVE_PACKET_FIELD_ERROR(support_names, ": truncation array");
81281 }
81282 for (i = 0; i < real_packet->values_num; i++) {
81283 #ifdef FREECIV_JSON_CONNECTION
81284 field_addr.sub_location->number = i;
81285 #endif /* FREECIV_JSON_CONNECTION */
81286 if (!DIO_GET(string, &din, &field_addr, real_packet->support_names[i], sizeof(real_packet->support_names[i]))) {
81287 RECEIVE_PACKET_FIELD_ERROR(support_names);
81288 }
81289 }
81290
81291 #ifdef FREECIV_JSON_CONNECTION
81292 /* Exit array. */
81293 free(field_addr.sub_location);
81294 field_addr.sub_location = NULL;
81295 #endif /* FREECIV_JSON_CONNECTION */
81296 }
81297 #ifdef FREECIV_JSON_CONNECTION
81298 field_addr.name = "pretty_names";
81299 #endif /* FREECIV_JSON_CONNECTION */
81300
81301 {
81302 int i;
81303
81304 #ifdef FREECIV_JSON_CONNECTION
81305 /* Enter array. */
81306 field_addr.sub_location = plocation_elem_new(0);
81307 #endif /* FREECIV_JSON_CONNECTION */
81308
81309 if (real_packet->values_num > 64) {
81310 RECEIVE_PACKET_FIELD_ERROR(pretty_names, ": truncation array");
81311 }
81312 for (i = 0; i < real_packet->values_num; i++) {
81313 #ifdef FREECIV_JSON_CONNECTION
81314 field_addr.sub_location->number = i;
81315 #endif /* FREECIV_JSON_CONNECTION */
81316 if (!DIO_GET(string, &din, &field_addr, real_packet->pretty_names[i], sizeof(real_packet->pretty_names[i]))) {
81317 RECEIVE_PACKET_FIELD_ERROR(pretty_names);
81318 }
81319 }
81320
81321 #ifdef FREECIV_JSON_CONNECTION
81322 /* Exit array. */
81323 free(field_addr.sub_location);
81324 field_addr.sub_location = NULL;
81325 #endif /* FREECIV_JSON_CONNECTION */
81326 }
81327
81328#endif
81329 log_packet_detailed("packet_server_setting_enum_100: got info about (%d)",
81330 real_packet->id);
81331
81332#ifdef FREECIV_DELTA_PROTOCOL
81333 if (NULL == *hash) {
81334 *hash = genhash_new_full(hash_packet_server_setting_enum_100, cmp_packet_server_setting_enum_100,
81335 NULL, NULL, NULL, free);
81336 }
81337
81338 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
81339 *real_packet = *old;
81340 } else {
81341 int id = real_packet->id;
81342
81343 log_packet_detailed(" no old info");
81344 memset(real_packet, 0, sizeof(*real_packet));
81345
81346 real_packet->id = id;
81347 }
81348
81349 real_packet->is_visible = BV_ISSET(fields, 0);
81350 real_packet->is_changeable = BV_ISSET(fields, 1);
81351 real_packet->initial_setting = BV_ISSET(fields, 2);
81352 if (BV_ISSET(fields, 3)) {
81353 log_packet_detailed(" got field 'setdef'");
81354 #ifdef FREECIV_JSON_CONNECTION
81355 field_addr.name = "setdef";
81356 #endif /* FREECIV_JSON_CONNECTION */
81357 {
81358 int readin;
81359
81360 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
81361 RECEIVE_PACKET_FIELD_ERROR(setdef);
81362 }
81363 real_packet->setdef = readin;
81364 }
81365 }
81366 if (BV_ISSET(fields, 4)) {
81367 log_packet_detailed(" got field 'val'");
81368 #ifdef FREECIV_JSON_CONNECTION
81369 field_addr.name = "val";
81370 #endif /* FREECIV_JSON_CONNECTION */
81371 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->val)) {
81372 RECEIVE_PACKET_FIELD_ERROR(val);
81373 }
81374 }
81375 if (BV_ISSET(fields, 5)) {
81376 log_packet_detailed(" got field 'default_val'");
81377 #ifdef FREECIV_JSON_CONNECTION
81378 field_addr.name = "default_val";
81379 #endif /* FREECIV_JSON_CONNECTION */
81380 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->default_val)) {
81381 RECEIVE_PACKET_FIELD_ERROR(default_val);
81382 }
81383 }
81384 if (BV_ISSET(fields, 6)) {
81385 log_packet_detailed(" got field 'values_num'");
81386 #ifdef FREECIV_JSON_CONNECTION
81387 field_addr.name = "values_num";
81388 #endif /* FREECIV_JSON_CONNECTION */
81389 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->values_num)) {
81390 RECEIVE_PACKET_FIELD_ERROR(values_num);
81391 }
81392 }
81393 if (BV_ISSET(fields, 7)) {
81394 log_packet_detailed(" got field 'support_names'");
81395 #ifdef FREECIV_JSON_CONNECTION
81396 field_addr.name = "support_names";
81397 #endif /* FREECIV_JSON_CONNECTION */
81398
81399 {
81400 int i;
81401
81402 #ifdef FREECIV_JSON_CONNECTION
81403 /* Enter array. */
81404 field_addr.sub_location = plocation_elem_new(0);
81405 #endif /* FREECIV_JSON_CONNECTION */
81406
81407 if (real_packet->values_num > 64) {
81408 RECEIVE_PACKET_FIELD_ERROR(support_names, ": truncation array");
81409 }
81410 for (i = 0; i < real_packet->values_num; i++) {
81411 #ifdef FREECIV_JSON_CONNECTION
81412 field_addr.sub_location->number = i;
81413 #endif /* FREECIV_JSON_CONNECTION */
81414 if (!DIO_GET(string, &din, &field_addr, real_packet->support_names[i], sizeof(real_packet->support_names[i]))) {
81415 RECEIVE_PACKET_FIELD_ERROR(support_names);
81416 }
81417 }
81418
81419 #ifdef FREECIV_JSON_CONNECTION
81420 /* Exit array. */
81421 free(field_addr.sub_location);
81422 field_addr.sub_location = NULL;
81423 #endif /* FREECIV_JSON_CONNECTION */
81424 }
81425 }
81426 if (BV_ISSET(fields, 8)) {
81427 log_packet_detailed(" got field 'pretty_names'");
81428 #ifdef FREECIV_JSON_CONNECTION
81429 field_addr.name = "pretty_names";
81430 #endif /* FREECIV_JSON_CONNECTION */
81431
81432 {
81433 int i;
81434
81435 #ifdef FREECIV_JSON_CONNECTION
81436 /* Enter array. */
81437 field_addr.sub_location = plocation_elem_new(0);
81438 #endif /* FREECIV_JSON_CONNECTION */
81439
81440 if (real_packet->values_num > 64) {
81441 RECEIVE_PACKET_FIELD_ERROR(pretty_names, ": truncation array");
81442 }
81443 for (i = 0; i < real_packet->values_num; i++) {
81444 #ifdef FREECIV_JSON_CONNECTION
81445 field_addr.sub_location->number = i;
81446 #endif /* FREECIV_JSON_CONNECTION */
81447 if (!DIO_GET(string, &din, &field_addr, real_packet->pretty_names[i], sizeof(real_packet->pretty_names[i]))) {
81448 RECEIVE_PACKET_FIELD_ERROR(pretty_names);
81449 }
81450 }
81451
81452 #ifdef FREECIV_JSON_CONNECTION
81453 /* Exit array. */
81454 free(field_addr.sub_location);
81455 field_addr.sub_location = NULL;
81456 #endif /* FREECIV_JSON_CONNECTION */
81457 }
81458 }
81459
81460 if (NULL == old) {
81461 old = fc_malloc(sizeof(*old));
81462 *old = *real_packet;
81463 genhash_insert(*hash, old, old);
81464 } else {
81465 *old = *real_packet;
81466 }
81467
81468#endif /* FREECIV_DELTA_PROTOCOL */
81469 RECEIVE_PACKET_END(real_packet);
81470}
81471
81472 static int send_packet_server_setting_enum_100(struct connection *pc, const struct packet_server_setting_enum *packet)
81473{
81474 const struct packet_server_setting_enum *real_packet = packet;
81475#ifdef FREECIV_DELTA_PROTOCOL
81476 packet_server_setting_enum_100_fields fields;
81477 struct packet_server_setting_enum *old;
81478 bool differ;
81479 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_ENUM;
81480 int different = 0;
81481#endif /* FREECIV_DELTA_PROTOCOL */
81482 SEND_PACKET_START(PACKET_SERVER_SETTING_ENUM);
81483#ifdef FREECIV_JSON_CONNECTION
81484 struct plocation field_addr;
81485 {
81486 struct plocation *field_addr_tmp = plocation_field_new(NULL);
81487 field_addr = *field_addr_tmp;
81488 FC_FREE(field_addr_tmp);
81489 }
81490#endif /* FREECIV_JSON_CONNECTION */
81491
81492 log_packet_detailed("packet_server_setting_enum_100: sending info about (%d)",
81493 real_packet->id);
81494
81495#ifdef FREECIV_DELTA_PROTOCOL
81496 if (NULL == *hash) {
81497 *hash = genhash_new_full(hash_packet_server_setting_enum_100, cmp_packet_server_setting_enum_100,
81498 NULL, NULL, NULL, free);
81499 }
81500 BV_CLR_ALL(fields);
81501
81502 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
81503 old = fc_malloc(sizeof(*old));
81504 *old = *real_packet;
81505 genhash_insert(*hash, old, old);
81506 memset(old, 0, sizeof(*old));
81507 different = 1; /* Force to send. */
81508 }
81509 differ = (old->is_visible != real_packet->is_visible);
81510 if (differ) {
81511 different++;
81512 }
81513 if (packet->is_visible) {
81514 BV_SET(fields, 0);
81515 }
81516
81517 differ = (old->is_changeable != real_packet->is_changeable);
81518 if (differ) {
81519 different++;
81520 }
81521 if (packet->is_changeable) {
81522 BV_SET(fields, 1);
81523 }
81524
81525 differ = (old->initial_setting != real_packet->initial_setting);
81526 if (differ) {
81527 different++;
81528 }
81529 if (packet->initial_setting) {
81530 BV_SET(fields, 2);
81531 }
81532
81533 differ = (old->setdef != real_packet->setdef);
81534 if (differ) {
81535 different++;
81536 BV_SET(fields, 3);
81537 }
81538
81539 differ = (old->val != real_packet->val);
81540 if (differ) {
81541 different++;
81542 BV_SET(fields, 4);
81543 }
81544
81545 differ = (old->default_val != real_packet->default_val);
81546 if (differ) {
81547 different++;
81548 BV_SET(fields, 5);
81549 }
81550
81551 differ = (old->values_num != real_packet->values_num);
81552 if (differ) {
81553 different++;
81554 BV_SET(fields, 6);
81555 }
81556
81557
81558 {
81559 differ = (old->values_num != real_packet->values_num);
81560 if (!differ) {
81561 int i;
81562
81563 for (i = 0; i < real_packet->values_num; i++) {
81564 if (strcmp(old->support_names[i], real_packet->support_names[i]) != 0) {
81565 differ = TRUE;
81566 break;
81567 }
81568 }
81569 }
81570 }
81571 if (differ) {
81572 different++;
81573 BV_SET(fields, 7);
81574 }
81575
81576
81577 {
81578 differ = (old->values_num != real_packet->values_num);
81579 if (!differ) {
81580 int i;
81581
81582 for (i = 0; i < real_packet->values_num; i++) {
81583 if (strcmp(old->pretty_names[i], real_packet->pretty_names[i]) != 0) {
81584 differ = TRUE;
81585 break;
81586 }
81587 }
81588 }
81589 }
81590 if (differ) {
81591 different++;
81592 BV_SET(fields, 8);
81593 }
81594
81595
81596 if (different == 0) {
81597 log_packet_detailed(" no change -> discard");
81598 return 0;
81599 }
81600
81601#ifdef FREECIV_JSON_CONNECTION
81602 field_addr.name = "fields";
81603#endif /* FREECIV_JSON_CONNECTION */
81604 DIO_BV_PUT(&dout, &field_addr, fields);
81605#ifdef FREECIV_JSON_CONNECTION
81606 field_addr.name = "id";
81607#endif /* FREECIV_JSON_CONNECTION */
81608 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
81609
81610 /* field 0 is folded into the header */
81611 /* field 1 is folded into the header */
81612 /* field 2 is folded into the header */
81613 if (BV_ISSET(fields, 3)) {
81614 log_packet_detailed(" field 'setdef' has changed");
81615 #ifdef FREECIV_JSON_CONNECTION
81616 field_addr.name = "setdef";
81617#endif /* FREECIV_JSON_CONNECTION */
81618 DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
81619 }
81620 if (BV_ISSET(fields, 4)) {
81621 log_packet_detailed(" field 'val' has changed");
81622 #ifdef FREECIV_JSON_CONNECTION
81623 field_addr.name = "val";
81624#endif /* FREECIV_JSON_CONNECTION */
81625 DIO_PUT(sint8, &dout, &field_addr, real_packet->val);
81626 }
81627 if (BV_ISSET(fields, 5)) {
81628 log_packet_detailed(" field 'default_val' has changed");
81629 #ifdef FREECIV_JSON_CONNECTION
81630 field_addr.name = "default_val";
81631#endif /* FREECIV_JSON_CONNECTION */
81632 DIO_PUT(sint8, &dout, &field_addr, real_packet->default_val);
81633 }
81634 if (BV_ISSET(fields, 6)) {
81635 log_packet_detailed(" field 'values_num' has changed");
81636 #ifdef FREECIV_JSON_CONNECTION
81637 field_addr.name = "values_num";
81638#endif /* FREECIV_JSON_CONNECTION */
81639 DIO_PUT(sint8, &dout, &field_addr, real_packet->values_num);
81640 }
81641 if (BV_ISSET(fields, 7)) {
81642 log_packet_detailed(" field 'support_names' has changed");
81643 #ifdef FREECIV_JSON_CONNECTION
81644 field_addr.name = "support_names";
81645#endif /* FREECIV_JSON_CONNECTION */
81646
81647 {
81648 int i;
81649
81650#ifdef FREECIV_JSON_CONNECTION
81651 /* Create the array. */
81652 DIO_PUT(farray, &dout, &field_addr, real_packet->values_num);
81653
81654 /* Enter the array. */
81655 field_addr.sub_location = plocation_elem_new(0);
81656#endif /* FREECIV_JSON_CONNECTION */
81657
81658 for (i = 0; i < real_packet->values_num; i++) {
81659#ifdef FREECIV_JSON_CONNECTION
81660 /* Next array element. */
81661 field_addr.sub_location->number = i;
81662#endif /* FREECIV_JSON_CONNECTION */
81663 DIO_PUT(string, &dout, &field_addr, real_packet->support_names[i]);
81664 }
81665
81666#ifdef FREECIV_JSON_CONNECTION
81667 /* Exit array. */
81668 free(field_addr.sub_location);
81669 field_addr.sub_location = NULL;
81670#endif /* FREECIV_JSON_CONNECTION */
81671 }
81672 }
81673 if (BV_ISSET(fields, 8)) {
81674 log_packet_detailed(" field 'pretty_names' has changed");
81675 #ifdef FREECIV_JSON_CONNECTION
81676 field_addr.name = "pretty_names";
81677#endif /* FREECIV_JSON_CONNECTION */
81678
81679 {
81680 int i;
81681
81682#ifdef FREECIV_JSON_CONNECTION
81683 /* Create the array. */
81684 DIO_PUT(farray, &dout, &field_addr, real_packet->values_num);
81685
81686 /* Enter the array. */
81687 field_addr.sub_location = plocation_elem_new(0);
81688#endif /* FREECIV_JSON_CONNECTION */
81689
81690 for (i = 0; i < real_packet->values_num; i++) {
81691#ifdef FREECIV_JSON_CONNECTION
81692 /* Next array element. */
81693 field_addr.sub_location->number = i;
81694#endif /* FREECIV_JSON_CONNECTION */
81695 DIO_PUT(string, &dout, &field_addr, real_packet->pretty_names[i]);
81696 }
81697
81698#ifdef FREECIV_JSON_CONNECTION
81699 /* Exit array. */
81700 free(field_addr.sub_location);
81701 field_addr.sub_location = NULL;
81702#endif /* FREECIV_JSON_CONNECTION */
81703 }
81704 }
81705
81706 *old = *real_packet;
81707#endif /* FREECIV_DELTA_PROTOCOL */
81708#ifndef FREECIV_DELTA_PROTOCOL
81709#ifdef FREECIV_JSON_CONNECTION
81710 field_addr.name = "id";
81711#endif /* FREECIV_JSON_CONNECTION */
81712 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
81713#ifdef FREECIV_JSON_CONNECTION
81714 field_addr.name = "is_visible";
81715#endif /* FREECIV_JSON_CONNECTION */
81716 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
81717#ifdef FREECIV_JSON_CONNECTION
81718 field_addr.name = "is_changeable";
81719#endif /* FREECIV_JSON_CONNECTION */
81720 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
81721#ifdef FREECIV_JSON_CONNECTION
81722 field_addr.name = "initial_setting";
81723#endif /* FREECIV_JSON_CONNECTION */
81724 DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
81725#ifdef FREECIV_JSON_CONNECTION
81726 field_addr.name = "setdef";
81727#endif /* FREECIV_JSON_CONNECTION */
81728 DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
81729#ifdef FREECIV_JSON_CONNECTION
81730 field_addr.name = "val";
81731#endif /* FREECIV_JSON_CONNECTION */
81732 DIO_PUT(sint8, &dout, &field_addr, real_packet->val);
81733#ifdef FREECIV_JSON_CONNECTION
81734 field_addr.name = "default_val";
81735#endif /* FREECIV_JSON_CONNECTION */
81736 DIO_PUT(sint8, &dout, &field_addr, real_packet->default_val);
81737#ifdef FREECIV_JSON_CONNECTION
81738 field_addr.name = "values_num";
81739#endif /* FREECIV_JSON_CONNECTION */
81740 DIO_PUT(sint8, &dout, &field_addr, real_packet->values_num);
81741#ifdef FREECIV_JSON_CONNECTION
81742 field_addr.name = "support_names";
81743#endif /* FREECIV_JSON_CONNECTION */
81744
81745 {
81746 int i;
81747
81748#ifdef FREECIV_JSON_CONNECTION
81749 /* Create the array. */
81750 DIO_PUT(farray, &dout, &field_addr, real_packet->values_num);
81751
81752 /* Enter the array. */
81753 field_addr.sub_location = plocation_elem_new(0);
81754#endif /* FREECIV_JSON_CONNECTION */
81755
81756 for (i = 0; i < real_packet->values_num; i++) {
81757#ifdef FREECIV_JSON_CONNECTION
81758 /* Next array element. */
81759 field_addr.sub_location->number = i;
81760#endif /* FREECIV_JSON_CONNECTION */
81761 DIO_PUT(string, &dout, &field_addr, real_packet->support_names[i]);
81762 }
81763
81764#ifdef FREECIV_JSON_CONNECTION
81765 /* Exit array. */
81766 free(field_addr.sub_location);
81767 field_addr.sub_location = NULL;
81768#endif /* FREECIV_JSON_CONNECTION */
81769 }
81770#ifdef FREECIV_JSON_CONNECTION
81771 field_addr.name = "pretty_names";
81772#endif /* FREECIV_JSON_CONNECTION */
81773
81774 {
81775 int i;
81776
81777#ifdef FREECIV_JSON_CONNECTION
81778 /* Create the array. */
81779 DIO_PUT(farray, &dout, &field_addr, real_packet->values_num);
81780
81781 /* Enter the array. */
81782 field_addr.sub_location = plocation_elem_new(0);
81783#endif /* FREECIV_JSON_CONNECTION */
81784
81785 for (i = 0; i < real_packet->values_num; i++) {
81786#ifdef FREECIV_JSON_CONNECTION
81787 /* Next array element. */
81788 field_addr.sub_location->number = i;
81789#endif /* FREECIV_JSON_CONNECTION */
81790 DIO_PUT(string, &dout, &field_addr, real_packet->pretty_names[i]);
81791 }
81792
81793#ifdef FREECIV_JSON_CONNECTION
81794 /* Exit array. */
81795 free(field_addr.sub_location);
81796 field_addr.sub_location = NULL;
81797#endif /* FREECIV_JSON_CONNECTION */
81798 }
81799
81800#endif
81801 SEND_PACKET_END(PACKET_SERVER_SETTING_ENUM);
81802}
81803
81804 int send_packet_server_setting_enum(struct connection *pc, const struct packet_server_setting_enum *packet)
81805{
81806 if (!pc->used) {
81807 log_error("WARNING: trying to send data to the closed connection %s",
81808 conn_description(pc));
81809 return -1;
81810 }
81811 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_ENUM].packet != NULL, -1,
81812 "Handler for PACKET_SERVER_SETTING_ENUM not installed");
81813 return pc->phs.handlers->send[PACKET_SERVER_SETTING_ENUM].packet(pc, packet);
81814}
81815
81816#ifdef FREECIV_DELTA_PROTOCOL
81817static genhash_val_t hash_packet_server_setting_bitwise_100(const void *vkey)
81818{
81819 const struct packet_server_setting_bitwise *key = (const struct packet_server_setting_bitwise *) vkey;
81820
81821 return key->id;
81822}
81823
81824static bool cmp_packet_server_setting_bitwise_100(const void *vkey1, const void *vkey2)
81825{
81826 const struct packet_server_setting_bitwise *key1 = (const struct packet_server_setting_bitwise *) vkey1;
81827 const struct packet_server_setting_bitwise *key2 = (const struct packet_server_setting_bitwise *) vkey2;
81828
81829 return key1->id == key2->id;
81830}
81831 BV_DEFINE(packet_server_setting_bitwise_100_fields, 9);
81832#endif /* FREECIV_DELTA_PROTOCOL */
81833
81834 static struct packet_server_setting_bitwise *receive_packet_server_setting_bitwise_100(struct connection *pc)
81835{
81836#ifdef FREECIV_DELTA_PROTOCOL
81837 packet_server_setting_bitwise_100_fields fields;
81838 struct packet_server_setting_bitwise *old;
81839 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_BITWISE;
81840#endif /* FREECIV_DELTA_PROTOCOL */
81841 RECEIVE_PACKET_START(packet_server_setting_bitwise, real_packet);
81842#ifdef FREECIV_JSON_CONNECTION
81843 struct plocation field_addr;
81844 {
81845 struct plocation *field_addr_tmp = plocation_field_new(NULL);
81846 field_addr = *field_addr_tmp;
81847 FC_FREE(field_addr_tmp);
81848 }
81849#endif /* FREECIV_JSON_CONNECTION */
81850
81851#ifdef FREECIV_DELTA_PROTOCOL
81852#ifdef FREECIV_JSON_CONNECTION
81853 field_addr.name = "fields";
81854#endif /* FREECIV_JSON_CONNECTION */
81855 DIO_BV_GET(&din, &field_addr, fields);
81856 #ifdef FREECIV_JSON_CONNECTION
81857 field_addr.name = "id";
81858 #endif /* FREECIV_JSON_CONNECTION */
81859 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
81860 RECEIVE_PACKET_FIELD_ERROR(id);
81861 }
81862
81863#else /* FREECIV_DELTA_PROTOCOL */
81864 #ifdef FREECIV_JSON_CONNECTION
81865 field_addr.name = "id";
81866 #endif /* FREECIV_JSON_CONNECTION */
81867 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
81868 RECEIVE_PACKET_FIELD_ERROR(id);
81869 }
81870 #ifdef FREECIV_JSON_CONNECTION
81871 field_addr.name = "is_visible";
81872 #endif /* FREECIV_JSON_CONNECTION */
81873 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
81874 RECEIVE_PACKET_FIELD_ERROR(is_visible);
81875 }
81876 #ifdef FREECIV_JSON_CONNECTION
81877 field_addr.name = "is_changeable";
81878 #endif /* FREECIV_JSON_CONNECTION */
81879 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
81880 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
81881 }
81882 #ifdef FREECIV_JSON_CONNECTION
81883 field_addr.name = "initial_setting";
81884 #endif /* FREECIV_JSON_CONNECTION */
81885 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
81886 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
81887 }
81888 #ifdef FREECIV_JSON_CONNECTION
81889 field_addr.name = "setdef";
81890 #endif /* FREECIV_JSON_CONNECTION */
81891 {
81892 int readin;
81893
81894 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
81895 RECEIVE_PACKET_FIELD_ERROR(setdef);
81896 }
81897 real_packet->setdef = readin;
81898 }
81899 #ifdef FREECIV_JSON_CONNECTION
81900 field_addr.name = "val";
81901 #endif /* FREECIV_JSON_CONNECTION */
81902 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->val)) {
81903 RECEIVE_PACKET_FIELD_ERROR(val);
81904 }
81905 #ifdef FREECIV_JSON_CONNECTION
81906 field_addr.name = "default_val";
81907 #endif /* FREECIV_JSON_CONNECTION */
81908 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->default_val)) {
81909 RECEIVE_PACKET_FIELD_ERROR(default_val);
81910 }
81911 #ifdef FREECIV_JSON_CONNECTION
81912 field_addr.name = "bits_num";
81913 #endif /* FREECIV_JSON_CONNECTION */
81914 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->bits_num)) {
81915 RECEIVE_PACKET_FIELD_ERROR(bits_num);
81916 }
81917 #ifdef FREECIV_JSON_CONNECTION
81918 field_addr.name = "support_names";
81919 #endif /* FREECIV_JSON_CONNECTION */
81920
81921 {
81922 int i;
81923
81924 #ifdef FREECIV_JSON_CONNECTION
81925 /* Enter array. */
81926 field_addr.sub_location = plocation_elem_new(0);
81927 #endif /* FREECIV_JSON_CONNECTION */
81928
81929 if (real_packet->bits_num > 64) {
81930 RECEIVE_PACKET_FIELD_ERROR(support_names, ": truncation array");
81931 }
81932 for (i = 0; i < real_packet->bits_num; i++) {
81933 #ifdef FREECIV_JSON_CONNECTION
81934 field_addr.sub_location->number = i;
81935 #endif /* FREECIV_JSON_CONNECTION */
81936 if (!DIO_GET(string, &din, &field_addr, real_packet->support_names[i], sizeof(real_packet->support_names[i]))) {
81937 RECEIVE_PACKET_FIELD_ERROR(support_names);
81938 }
81939 }
81940
81941 #ifdef FREECIV_JSON_CONNECTION
81942 /* Exit array. */
81943 free(field_addr.sub_location);
81944 field_addr.sub_location = NULL;
81945 #endif /* FREECIV_JSON_CONNECTION */
81946 }
81947 #ifdef FREECIV_JSON_CONNECTION
81948 field_addr.name = "pretty_names";
81949 #endif /* FREECIV_JSON_CONNECTION */
81950
81951 {
81952 int i;
81953
81954 #ifdef FREECIV_JSON_CONNECTION
81955 /* Enter array. */
81956 field_addr.sub_location = plocation_elem_new(0);
81957 #endif /* FREECIV_JSON_CONNECTION */
81958
81959 if (real_packet->bits_num > 64) {
81960 RECEIVE_PACKET_FIELD_ERROR(pretty_names, ": truncation array");
81961 }
81962 for (i = 0; i < real_packet->bits_num; i++) {
81963 #ifdef FREECIV_JSON_CONNECTION
81964 field_addr.sub_location->number = i;
81965 #endif /* FREECIV_JSON_CONNECTION */
81966 if (!DIO_GET(string, &din, &field_addr, real_packet->pretty_names[i], sizeof(real_packet->pretty_names[i]))) {
81967 RECEIVE_PACKET_FIELD_ERROR(pretty_names);
81968 }
81969 }
81970
81971 #ifdef FREECIV_JSON_CONNECTION
81972 /* Exit array. */
81973 free(field_addr.sub_location);
81974 field_addr.sub_location = NULL;
81975 #endif /* FREECIV_JSON_CONNECTION */
81976 }
81977
81978#endif
81979 log_packet_detailed("packet_server_setting_bitwise_100: got info about (%d)",
81980 real_packet->id);
81981
81982#ifdef FREECIV_DELTA_PROTOCOL
81983 if (NULL == *hash) {
81984 *hash = genhash_new_full(hash_packet_server_setting_bitwise_100, cmp_packet_server_setting_bitwise_100,
81985 NULL, NULL, NULL, free);
81986 }
81987
81988 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
81989 *real_packet = *old;
81990 } else {
81991 int id = real_packet->id;
81992
81993 log_packet_detailed(" no old info");
81994 memset(real_packet, 0, sizeof(*real_packet));
81995
81996 real_packet->id = id;
81997 }
81998
81999 real_packet->is_visible = BV_ISSET(fields, 0);
82000 real_packet->is_changeable = BV_ISSET(fields, 1);
82001 real_packet->initial_setting = BV_ISSET(fields, 2);
82002 if (BV_ISSET(fields, 3)) {
82003 log_packet_detailed(" got field 'setdef'");
82004 #ifdef FREECIV_JSON_CONNECTION
82005 field_addr.name = "setdef";
82006 #endif /* FREECIV_JSON_CONNECTION */
82007 {
82008 int readin;
82009
82010 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
82011 RECEIVE_PACKET_FIELD_ERROR(setdef);
82012 }
82013 real_packet->setdef = readin;
82014 }
82015 }
82016 if (BV_ISSET(fields, 4)) {
82017 log_packet_detailed(" got field 'val'");
82018 #ifdef FREECIV_JSON_CONNECTION
82019 field_addr.name = "val";
82020 #endif /* FREECIV_JSON_CONNECTION */
82021 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->val)) {
82022 RECEIVE_PACKET_FIELD_ERROR(val);
82023 }
82024 }
82025 if (BV_ISSET(fields, 5)) {
82026 log_packet_detailed(" got field 'default_val'");
82027 #ifdef FREECIV_JSON_CONNECTION
82028 field_addr.name = "default_val";
82029 #endif /* FREECIV_JSON_CONNECTION */
82030 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->default_val)) {
82031 RECEIVE_PACKET_FIELD_ERROR(default_val);
82032 }
82033 }
82034 if (BV_ISSET(fields, 6)) {
82035 log_packet_detailed(" got field 'bits_num'");
82036 #ifdef FREECIV_JSON_CONNECTION
82037 field_addr.name = "bits_num";
82038 #endif /* FREECIV_JSON_CONNECTION */
82039 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->bits_num)) {
82040 RECEIVE_PACKET_FIELD_ERROR(bits_num);
82041 }
82042 }
82043 if (BV_ISSET(fields, 7)) {
82044 log_packet_detailed(" got field 'support_names'");
82045 #ifdef FREECIV_JSON_CONNECTION
82046 field_addr.name = "support_names";
82047 #endif /* FREECIV_JSON_CONNECTION */
82048
82049 {
82050 int i;
82051
82052 #ifdef FREECIV_JSON_CONNECTION
82053 /* Enter array. */
82054 field_addr.sub_location = plocation_elem_new(0);
82055 #endif /* FREECIV_JSON_CONNECTION */
82056
82057 if (real_packet->bits_num > 64) {
82058 RECEIVE_PACKET_FIELD_ERROR(support_names, ": truncation array");
82059 }
82060 for (i = 0; i < real_packet->bits_num; i++) {
82061 #ifdef FREECIV_JSON_CONNECTION
82062 field_addr.sub_location->number = i;
82063 #endif /* FREECIV_JSON_CONNECTION */
82064 if (!DIO_GET(string, &din, &field_addr, real_packet->support_names[i], sizeof(real_packet->support_names[i]))) {
82065 RECEIVE_PACKET_FIELD_ERROR(support_names);
82066 }
82067 }
82068
82069 #ifdef FREECIV_JSON_CONNECTION
82070 /* Exit array. */
82071 free(field_addr.sub_location);
82072 field_addr.sub_location = NULL;
82073 #endif /* FREECIV_JSON_CONNECTION */
82074 }
82075 }
82076 if (BV_ISSET(fields, 8)) {
82077 log_packet_detailed(" got field 'pretty_names'");
82078 #ifdef FREECIV_JSON_CONNECTION
82079 field_addr.name = "pretty_names";
82080 #endif /* FREECIV_JSON_CONNECTION */
82081
82082 {
82083 int i;
82084
82085 #ifdef FREECIV_JSON_CONNECTION
82086 /* Enter array. */
82087 field_addr.sub_location = plocation_elem_new(0);
82088 #endif /* FREECIV_JSON_CONNECTION */
82089
82090 if (real_packet->bits_num > 64) {
82091 RECEIVE_PACKET_FIELD_ERROR(pretty_names, ": truncation array");
82092 }
82093 for (i = 0; i < real_packet->bits_num; i++) {
82094 #ifdef FREECIV_JSON_CONNECTION
82095 field_addr.sub_location->number = i;
82096 #endif /* FREECIV_JSON_CONNECTION */
82097 if (!DIO_GET(string, &din, &field_addr, real_packet->pretty_names[i], sizeof(real_packet->pretty_names[i]))) {
82098 RECEIVE_PACKET_FIELD_ERROR(pretty_names);
82099 }
82100 }
82101
82102 #ifdef FREECIV_JSON_CONNECTION
82103 /* Exit array. */
82104 free(field_addr.sub_location);
82105 field_addr.sub_location = NULL;
82106 #endif /* FREECIV_JSON_CONNECTION */
82107 }
82108 }
82109
82110 if (NULL == old) {
82111 old = fc_malloc(sizeof(*old));
82112 *old = *real_packet;
82113 genhash_insert(*hash, old, old);
82114 } else {
82115 *old = *real_packet;
82116 }
82117
82118#endif /* FREECIV_DELTA_PROTOCOL */
82119 RECEIVE_PACKET_END(real_packet);
82120}
82121
82122 static int send_packet_server_setting_bitwise_100(struct connection *pc, const struct packet_server_setting_bitwise *packet)
82123{
82124 const struct packet_server_setting_bitwise *real_packet = packet;
82125#ifdef FREECIV_DELTA_PROTOCOL
82126 packet_server_setting_bitwise_100_fields fields;
82127 struct packet_server_setting_bitwise *old;
82128 bool differ;
82129 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_BITWISE;
82130 int different = 0;
82131#endif /* FREECIV_DELTA_PROTOCOL */
82132 SEND_PACKET_START(PACKET_SERVER_SETTING_BITWISE);
82133#ifdef FREECIV_JSON_CONNECTION
82134 struct plocation field_addr;
82135 {
82136 struct plocation *field_addr_tmp = plocation_field_new(NULL);
82137 field_addr = *field_addr_tmp;
82138 FC_FREE(field_addr_tmp);
82139 }
82140#endif /* FREECIV_JSON_CONNECTION */
82141
82142 log_packet_detailed("packet_server_setting_bitwise_100: sending info about (%d)",
82143 real_packet->id);
82144
82145#ifdef FREECIV_DELTA_PROTOCOL
82146 if (NULL == *hash) {
82147 *hash = genhash_new_full(hash_packet_server_setting_bitwise_100, cmp_packet_server_setting_bitwise_100,
82148 NULL, NULL, NULL, free);
82149 }
82150 BV_CLR_ALL(fields);
82151
82152 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
82153 old = fc_malloc(sizeof(*old));
82154 *old = *real_packet;
82155 genhash_insert(*hash, old, old);
82156 memset(old, 0, sizeof(*old));
82157 different = 1; /* Force to send. */
82158 }
82159 differ = (old->is_visible != real_packet->is_visible);
82160 if (differ) {
82161 different++;
82162 }
82163 if (packet->is_visible) {
82164 BV_SET(fields, 0);
82165 }
82166
82167 differ = (old->is_changeable != real_packet->is_changeable);
82168 if (differ) {
82169 different++;
82170 }
82171 if (packet->is_changeable) {
82172 BV_SET(fields, 1);
82173 }
82174
82175 differ = (old->initial_setting != real_packet->initial_setting);
82176 if (differ) {
82177 different++;
82178 }
82179 if (packet->initial_setting) {
82180 BV_SET(fields, 2);
82181 }
82182
82183 differ = (old->setdef != real_packet->setdef);
82184 if (differ) {
82185 different++;
82186 BV_SET(fields, 3);
82187 }
82188
82189 differ = (old->val != real_packet->val);
82190 if (differ) {
82191 different++;
82192 BV_SET(fields, 4);
82193 }
82194
82195 differ = (old->default_val != real_packet->default_val);
82196 if (differ) {
82197 different++;
82198 BV_SET(fields, 5);
82199 }
82200
82201 differ = (old->bits_num != real_packet->bits_num);
82202 if (differ) {
82203 different++;
82204 BV_SET(fields, 6);
82205 }
82206
82207
82208 {
82209 differ = (old->bits_num != real_packet->bits_num);
82210 if (!differ) {
82211 int i;
82212
82213 for (i = 0; i < real_packet->bits_num; i++) {
82214 if (strcmp(old->support_names[i], real_packet->support_names[i]) != 0) {
82215 differ = TRUE;
82216 break;
82217 }
82218 }
82219 }
82220 }
82221 if (differ) {
82222 different++;
82223 BV_SET(fields, 7);
82224 }
82225
82226
82227 {
82228 differ = (old->bits_num != real_packet->bits_num);
82229 if (!differ) {
82230 int i;
82231
82232 for (i = 0; i < real_packet->bits_num; i++) {
82233 if (strcmp(old->pretty_names[i], real_packet->pretty_names[i]) != 0) {
82234 differ = TRUE;
82235 break;
82236 }
82237 }
82238 }
82239 }
82240 if (differ) {
82241 different++;
82242 BV_SET(fields, 8);
82243 }
82244
82245
82246 if (different == 0) {
82247 log_packet_detailed(" no change -> discard");
82248 return 0;
82249 }
82250
82251#ifdef FREECIV_JSON_CONNECTION
82252 field_addr.name = "fields";
82253#endif /* FREECIV_JSON_CONNECTION */
82254 DIO_BV_PUT(&dout, &field_addr, fields);
82255#ifdef FREECIV_JSON_CONNECTION
82256 field_addr.name = "id";
82257#endif /* FREECIV_JSON_CONNECTION */
82258 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
82259
82260 /* field 0 is folded into the header */
82261 /* field 1 is folded into the header */
82262 /* field 2 is folded into the header */
82263 if (BV_ISSET(fields, 3)) {
82264 log_packet_detailed(" field 'setdef' has changed");
82265 #ifdef FREECIV_JSON_CONNECTION
82266 field_addr.name = "setdef";
82267#endif /* FREECIV_JSON_CONNECTION */
82268 DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
82269 }
82270 if (BV_ISSET(fields, 4)) {
82271 log_packet_detailed(" field 'val' has changed");
82272 #ifdef FREECIV_JSON_CONNECTION
82273 field_addr.name = "val";
82274#endif /* FREECIV_JSON_CONNECTION */
82275 DIO_PUT(uint16, &dout, &field_addr, real_packet->val);
82276 }
82277 if (BV_ISSET(fields, 5)) {
82278 log_packet_detailed(" field 'default_val' has changed");
82279 #ifdef FREECIV_JSON_CONNECTION
82280 field_addr.name = "default_val";
82281#endif /* FREECIV_JSON_CONNECTION */
82282 DIO_PUT(uint16, &dout, &field_addr, real_packet->default_val);
82283 }
82284 if (BV_ISSET(fields, 6)) {
82285 log_packet_detailed(" field 'bits_num' has changed");
82286 #ifdef FREECIV_JSON_CONNECTION
82287 field_addr.name = "bits_num";
82288#endif /* FREECIV_JSON_CONNECTION */
82289 DIO_PUT(uint8, &dout, &field_addr, real_packet->bits_num);
82290 }
82291 if (BV_ISSET(fields, 7)) {
82292 log_packet_detailed(" field 'support_names' has changed");
82293 #ifdef FREECIV_JSON_CONNECTION
82294 field_addr.name = "support_names";
82295#endif /* FREECIV_JSON_CONNECTION */
82296
82297 {
82298 int i;
82299
82300#ifdef FREECIV_JSON_CONNECTION
82301 /* Create the array. */
82302 DIO_PUT(farray, &dout, &field_addr, real_packet->bits_num);
82303
82304 /* Enter the array. */
82305 field_addr.sub_location = plocation_elem_new(0);
82306#endif /* FREECIV_JSON_CONNECTION */
82307
82308 for (i = 0; i < real_packet->bits_num; i++) {
82309#ifdef FREECIV_JSON_CONNECTION
82310 /* Next array element. */
82311 field_addr.sub_location->number = i;
82312#endif /* FREECIV_JSON_CONNECTION */
82313 DIO_PUT(string, &dout, &field_addr, real_packet->support_names[i]);
82314 }
82315
82316#ifdef FREECIV_JSON_CONNECTION
82317 /* Exit array. */
82318 free(field_addr.sub_location);
82319 field_addr.sub_location = NULL;
82320#endif /* FREECIV_JSON_CONNECTION */
82321 }
82322 }
82323 if (BV_ISSET(fields, 8)) {
82324 log_packet_detailed(" field 'pretty_names' has changed");
82325 #ifdef FREECIV_JSON_CONNECTION
82326 field_addr.name = "pretty_names";
82327#endif /* FREECIV_JSON_CONNECTION */
82328
82329 {
82330 int i;
82331
82332#ifdef FREECIV_JSON_CONNECTION
82333 /* Create the array. */
82334 DIO_PUT(farray, &dout, &field_addr, real_packet->bits_num);
82335
82336 /* Enter the array. */
82337 field_addr.sub_location = plocation_elem_new(0);
82338#endif /* FREECIV_JSON_CONNECTION */
82339
82340 for (i = 0; i < real_packet->bits_num; i++) {
82341#ifdef FREECIV_JSON_CONNECTION
82342 /* Next array element. */
82343 field_addr.sub_location->number = i;
82344#endif /* FREECIV_JSON_CONNECTION */
82345 DIO_PUT(string, &dout, &field_addr, real_packet->pretty_names[i]);
82346 }
82347
82348#ifdef FREECIV_JSON_CONNECTION
82349 /* Exit array. */
82350 free(field_addr.sub_location);
82351 field_addr.sub_location = NULL;
82352#endif /* FREECIV_JSON_CONNECTION */
82353 }
82354 }
82355
82356 *old = *real_packet;
82357#endif /* FREECIV_DELTA_PROTOCOL */
82358#ifndef FREECIV_DELTA_PROTOCOL
82359#ifdef FREECIV_JSON_CONNECTION
82360 field_addr.name = "id";
82361#endif /* FREECIV_JSON_CONNECTION */
82362 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
82363#ifdef FREECIV_JSON_CONNECTION
82364 field_addr.name = "is_visible";
82365#endif /* FREECIV_JSON_CONNECTION */
82366 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
82367#ifdef FREECIV_JSON_CONNECTION
82368 field_addr.name = "is_changeable";
82369#endif /* FREECIV_JSON_CONNECTION */
82370 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
82371#ifdef FREECIV_JSON_CONNECTION
82372 field_addr.name = "initial_setting";
82373#endif /* FREECIV_JSON_CONNECTION */
82374 DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
82375#ifdef FREECIV_JSON_CONNECTION
82376 field_addr.name = "setdef";
82377#endif /* FREECIV_JSON_CONNECTION */
82378 DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
82379#ifdef FREECIV_JSON_CONNECTION
82380 field_addr.name = "val";
82381#endif /* FREECIV_JSON_CONNECTION */
82382 DIO_PUT(uint16, &dout, &field_addr, real_packet->val);
82383#ifdef FREECIV_JSON_CONNECTION
82384 field_addr.name = "default_val";
82385#endif /* FREECIV_JSON_CONNECTION */
82386 DIO_PUT(uint16, &dout, &field_addr, real_packet->default_val);
82387#ifdef FREECIV_JSON_CONNECTION
82388 field_addr.name = "bits_num";
82389#endif /* FREECIV_JSON_CONNECTION */
82390 DIO_PUT(uint8, &dout, &field_addr, real_packet->bits_num);
82391#ifdef FREECIV_JSON_CONNECTION
82392 field_addr.name = "support_names";
82393#endif /* FREECIV_JSON_CONNECTION */
82394
82395 {
82396 int i;
82397
82398#ifdef FREECIV_JSON_CONNECTION
82399 /* Create the array. */
82400 DIO_PUT(farray, &dout, &field_addr, real_packet->bits_num);
82401
82402 /* Enter the array. */
82403 field_addr.sub_location = plocation_elem_new(0);
82404#endif /* FREECIV_JSON_CONNECTION */
82405
82406 for (i = 0; i < real_packet->bits_num; i++) {
82407#ifdef FREECIV_JSON_CONNECTION
82408 /* Next array element. */
82409 field_addr.sub_location->number = i;
82410#endif /* FREECIV_JSON_CONNECTION */
82411 DIO_PUT(string, &dout, &field_addr, real_packet->support_names[i]);
82412 }
82413
82414#ifdef FREECIV_JSON_CONNECTION
82415 /* Exit array. */
82416 free(field_addr.sub_location);
82417 field_addr.sub_location = NULL;
82418#endif /* FREECIV_JSON_CONNECTION */
82419 }
82420#ifdef FREECIV_JSON_CONNECTION
82421 field_addr.name = "pretty_names";
82422#endif /* FREECIV_JSON_CONNECTION */
82423
82424 {
82425 int i;
82426
82427#ifdef FREECIV_JSON_CONNECTION
82428 /* Create the array. */
82429 DIO_PUT(farray, &dout, &field_addr, real_packet->bits_num);
82430
82431 /* Enter the array. */
82432 field_addr.sub_location = plocation_elem_new(0);
82433#endif /* FREECIV_JSON_CONNECTION */
82434
82435 for (i = 0; i < real_packet->bits_num; i++) {
82436#ifdef FREECIV_JSON_CONNECTION
82437 /* Next array element. */
82438 field_addr.sub_location->number = i;
82439#endif /* FREECIV_JSON_CONNECTION */
82440 DIO_PUT(string, &dout, &field_addr, real_packet->pretty_names[i]);
82441 }
82442
82443#ifdef FREECIV_JSON_CONNECTION
82444 /* Exit array. */
82445 free(field_addr.sub_location);
82446 field_addr.sub_location = NULL;
82447#endif /* FREECIV_JSON_CONNECTION */
82448 }
82449
82450#endif
82451 SEND_PACKET_END(PACKET_SERVER_SETTING_BITWISE);
82452}
82453
82454 int send_packet_server_setting_bitwise(struct connection *pc, const struct packet_server_setting_bitwise *packet)
82455{
82456 if (!pc->used) {
82457 log_error("WARNING: trying to send data to the closed connection %s",
82458 conn_description(pc));
82459 return -1;
82460 }
82461 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_BITWISE].packet != NULL, -1,
82462 "Handler for PACKET_SERVER_SETTING_BITWISE not installed");
82463 return pc->phs.handlers->send[PACKET_SERVER_SETTING_BITWISE].packet(pc, packet);
82464}
82465
82466#ifdef FREECIV_DELTA_PROTOCOL
82467#define hash_packet_set_topology_100 hash_const
82468
82469#define cmp_packet_set_topology_100 cmp_const
82470
82471 BV_DEFINE(packet_set_topology_100_fields, 1);
82472#endif /* FREECIV_DELTA_PROTOCOL */
82473
82474 static struct packet_set_topology *receive_packet_set_topology_100(struct connection *pc)
82475{
82476#ifdef FREECIV_DELTA_PROTOCOL
82477 packet_set_topology_100_fields fields;
82478 struct packet_set_topology *old;
82479 struct genhash **hash = pc->phs.received + PACKET_SET_TOPOLOGY;
82480#endif /* FREECIV_DELTA_PROTOCOL */
82481 RECEIVE_PACKET_START(packet_set_topology, real_packet);
82482#ifdef FREECIV_JSON_CONNECTION
82483 struct plocation field_addr;
82484 {
82485 struct plocation *field_addr_tmp = plocation_field_new(NULL);
82486 field_addr = *field_addr_tmp;
82487 FC_FREE(field_addr_tmp);
82488 }
82489#endif /* FREECIV_JSON_CONNECTION */
82490
82491#ifdef FREECIV_DELTA_PROTOCOL
82492#ifdef FREECIV_JSON_CONNECTION
82493 field_addr.name = "fields";
82494#endif /* FREECIV_JSON_CONNECTION */
82495 DIO_BV_GET(&din, &field_addr, fields);
82496
82497#else /* FREECIV_DELTA_PROTOCOL */
82498 #ifdef FREECIV_JSON_CONNECTION
82499 field_addr.name = "topology_id";
82500 #endif /* FREECIV_JSON_CONNECTION */
82501 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->topology_id)) {
82502 RECEIVE_PACKET_FIELD_ERROR(topology_id);
82503 }
82504
82505#endif
82506 log_packet_detailed("packet_set_topology_100: got info about ()");
82507
82508#ifdef FREECIV_DELTA_PROTOCOL
82509 if (NULL == *hash) {
82510 *hash = genhash_new_full(hash_packet_set_topology_100, cmp_packet_set_topology_100,
82511 NULL, NULL, NULL, free);
82512 }
82513
82514 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
82515 *real_packet = *old;
82516 } else {
82517 log_packet_detailed(" no old info");
82518 memset(real_packet, 0, sizeof(*real_packet));
82519 }
82520
82521 if (BV_ISSET(fields, 0)) {
82522 log_packet_detailed(" got field 'topology_id'");
82523 #ifdef FREECIV_JSON_CONNECTION
82524 field_addr.name = "topology_id";
82525 #endif /* FREECIV_JSON_CONNECTION */
82526 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->topology_id)) {
82527 RECEIVE_PACKET_FIELD_ERROR(topology_id);
82528 }
82529 }
82530
82531 if (NULL == old) {
82532 old = fc_malloc(sizeof(*old));
82533 *old = *real_packet;
82534 genhash_insert(*hash, old, old);
82535 } else {
82536 *old = *real_packet;
82537 }
82538
82539#endif /* FREECIV_DELTA_PROTOCOL */
82540 RECEIVE_PACKET_END(real_packet);
82541}
82542
82543 static int send_packet_set_topology_100(struct connection *pc, const struct packet_set_topology *packet)
82544{
82545 const struct packet_set_topology *real_packet = packet;
82546#ifdef FREECIV_DELTA_PROTOCOL
82547 packet_set_topology_100_fields fields;
82548 struct packet_set_topology *old;
82549 bool differ;
82550 struct genhash **hash = pc->phs.sent + PACKET_SET_TOPOLOGY;
82551#endif /* FREECIV_DELTA_PROTOCOL */
82552 SEND_PACKET_START(PACKET_SET_TOPOLOGY);
82553#ifdef FREECIV_JSON_CONNECTION
82554 struct plocation field_addr;
82555 {
82556 struct plocation *field_addr_tmp = plocation_field_new(NULL);
82557 field_addr = *field_addr_tmp;
82558 FC_FREE(field_addr_tmp);
82559 }
82560#endif /* FREECIV_JSON_CONNECTION */
82561
82562 log_packet_detailed("packet_set_topology_100: sending info about ()");
82563
82564#ifdef FREECIV_DELTA_PROTOCOL
82565 if (NULL == *hash) {
82566 *hash = genhash_new_full(hash_packet_set_topology_100, cmp_packet_set_topology_100,
82567 NULL, NULL, NULL, free);
82568 }
82569 BV_CLR_ALL(fields);
82570
82571 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
82572 old = fc_malloc(sizeof(*old));
82573 *old = *real_packet;
82574 genhash_insert(*hash, old, old);
82575 memset(old, 0, sizeof(*old));
82576 }
82577 differ = (old->topology_id != real_packet->topology_id);
82578 if (differ) {
82579 BV_SET(fields, 0);
82580 }
82581
82582
82583#ifdef FREECIV_JSON_CONNECTION
82584 field_addr.name = "fields";
82585#endif /* FREECIV_JSON_CONNECTION */
82586 DIO_BV_PUT(&dout, &field_addr, fields);
82587
82588 if (BV_ISSET(fields, 0)) {
82589 log_packet_detailed(" field 'topology_id' has changed");
82590 #ifdef FREECIV_JSON_CONNECTION
82591 field_addr.name = "topology_id";
82592#endif /* FREECIV_JSON_CONNECTION */
82593 DIO_PUT(uint8, &dout, &field_addr, real_packet->topology_id);
82594 }
82595
82596 *old = *real_packet;
82597#endif /* FREECIV_DELTA_PROTOCOL */
82598#ifndef FREECIV_DELTA_PROTOCOL
82599#ifdef FREECIV_JSON_CONNECTION
82600 field_addr.name = "topology_id";
82601#endif /* FREECIV_JSON_CONNECTION */
82602 DIO_PUT(uint8, &dout, &field_addr, real_packet->topology_id);
82603
82604#endif
82605 SEND_PACKET_END(PACKET_SET_TOPOLOGY);
82606}
82607
82608 int send_packet_set_topology(struct connection *pc, const struct packet_set_topology *packet)
82609{
82610 if (!pc->used) {
82611 log_error("WARNING: trying to send data to the closed connection %s",
82612 conn_description(pc));
82613 return -1;
82614 }
82615 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SET_TOPOLOGY].packet != NULL, -1,
82616 "Handler for PACKET_SET_TOPOLOGY not installed");
82617 return pc->phs.handlers->send[PACKET_SET_TOPOLOGY].packet(pc, packet);
82618}
82619
82620#ifdef FREECIV_DELTA_PROTOCOL
82621#define hash_packet_ruleset_effect_100 hash_const
82622
82623#define cmp_packet_ruleset_effect_100 cmp_const
82624
82625 BV_DEFINE(packet_ruleset_effect_100_fields, 6);
82626#endif /* FREECIV_DELTA_PROTOCOL */
82627
82628 static struct packet_ruleset_effect *receive_packet_ruleset_effect_100(struct connection *pc)
82629{
82630#ifdef FREECIV_DELTA_PROTOCOL
82631 packet_ruleset_effect_100_fields fields;
82632 struct packet_ruleset_effect *old;
82633 struct genhash **hash = pc->phs.received + PACKET_RULESET_EFFECT;
82634#endif /* FREECIV_DELTA_PROTOCOL */
82635 RECEIVE_PACKET_START(packet_ruleset_effect, real_packet);
82636#ifdef FREECIV_JSON_CONNECTION
82637 struct plocation field_addr;
82638 {
82639 struct plocation *field_addr_tmp = plocation_field_new(NULL);
82640 field_addr = *field_addr_tmp;
82641 FC_FREE(field_addr_tmp);
82642 }
82643#endif /* FREECIV_JSON_CONNECTION */
82644
82645#ifdef FREECIV_DELTA_PROTOCOL
82646#ifdef FREECIV_JSON_CONNECTION
82647 field_addr.name = "fields";
82648#endif /* FREECIV_JSON_CONNECTION */
82649 DIO_BV_GET(&din, &field_addr, fields);
82650
82651#else /* FREECIV_DELTA_PROTOCOL */
82652 #ifdef FREECIV_JSON_CONNECTION
82653 field_addr.name = "effect_type";
82654 #endif /* FREECIV_JSON_CONNECTION */
82655 {
82656 int readin;
82657
82658 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
82659 RECEIVE_PACKET_FIELD_ERROR(effect_type);
82660 }
82661 real_packet->effect_type = readin;
82662 }
82663 #ifdef FREECIV_JSON_CONNECTION
82664 field_addr.name = "effect_value";
82665 #endif /* FREECIV_JSON_CONNECTION */
82666 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->effect_value)) {
82667 RECEIVE_PACKET_FIELD_ERROR(effect_value);
82668 }
82669 #ifdef FREECIV_JSON_CONNECTION
82670 field_addr.name = "has_multiplier";
82671 #endif /* FREECIV_JSON_CONNECTION */
82672 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->has_multiplier)) {
82673 RECEIVE_PACKET_FIELD_ERROR(has_multiplier);
82674 }
82675 #ifdef FREECIV_JSON_CONNECTION
82676 field_addr.name = "multiplier";
82677 #endif /* FREECIV_JSON_CONNECTION */
82678 {
82679 int readin;
82680
82681 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
82682 RECEIVE_PACKET_FIELD_ERROR(multiplier);
82683 }
82684 real_packet->multiplier = readin;
82685 }
82686 #ifdef FREECIV_JSON_CONNECTION
82687 field_addr.name = "reqs_count";
82688 #endif /* FREECIV_JSON_CONNECTION */
82689 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
82690 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
82691 }
82692 #ifdef FREECIV_JSON_CONNECTION
82693 field_addr.name = "reqs";
82694 #endif /* FREECIV_JSON_CONNECTION */
82695
82696 {
82697 int i;
82698
82699 #ifdef FREECIV_JSON_CONNECTION
82700 /* Enter array. */
82701 field_addr.sub_location = plocation_elem_new(0);
82702 #endif /* FREECIV_JSON_CONNECTION */
82703
82704 if (real_packet->reqs_count > MAX_NUM_REQS) {
82705 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
82706 }
82707 for (i = 0; i < real_packet->reqs_count; i++) {
82708 #ifdef FREECIV_JSON_CONNECTION
82709 field_addr.sub_location->number = i;
82710 #endif /* FREECIV_JSON_CONNECTION */
82711 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
82712 RECEIVE_PACKET_FIELD_ERROR(reqs);
82713 }
82714 }
82715
82716 #ifdef FREECIV_JSON_CONNECTION
82717 /* Exit array. */
82718 free(field_addr.sub_location);
82719 field_addr.sub_location = NULL;
82720 #endif /* FREECIV_JSON_CONNECTION */
82721 }
82722
82723#endif
82724 log_packet_detailed("packet_ruleset_effect_100: got info about ()");
82725
82726#ifdef FREECIV_DELTA_PROTOCOL
82727 if (NULL == *hash) {
82728 *hash = genhash_new_full(hash_packet_ruleset_effect_100, cmp_packet_ruleset_effect_100,
82729 NULL, NULL, NULL, free);
82730 }
82731
82732 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
82733 *real_packet = *old;
82734 } else {
82735 log_packet_detailed(" no old info");
82736 memset(real_packet, 0, sizeof(*real_packet));
82737 }
82738
82739 if (BV_ISSET(fields, 0)) {
82740 log_packet_detailed(" got field 'effect_type'");
82741 #ifdef FREECIV_JSON_CONNECTION
82742 field_addr.name = "effect_type";
82743 #endif /* FREECIV_JSON_CONNECTION */
82744 {
82745 int readin;
82746
82747 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
82748 RECEIVE_PACKET_FIELD_ERROR(effect_type);
82749 }
82750 real_packet->effect_type = readin;
82751 }
82752 }
82753 if (BV_ISSET(fields, 1)) {
82754 log_packet_detailed(" got field 'effect_value'");
82755 #ifdef FREECIV_JSON_CONNECTION
82756 field_addr.name = "effect_value";
82757 #endif /* FREECIV_JSON_CONNECTION */
82758 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->effect_value)) {
82759 RECEIVE_PACKET_FIELD_ERROR(effect_value);
82760 }
82761 }
82762 real_packet->has_multiplier = BV_ISSET(fields, 2);
82763 if (BV_ISSET(fields, 3)) {
82764 log_packet_detailed(" got field 'multiplier'");
82765 #ifdef FREECIV_JSON_CONNECTION
82766 field_addr.name = "multiplier";
82767 #endif /* FREECIV_JSON_CONNECTION */
82768 {
82769 int readin;
82770
82771 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
82772 RECEIVE_PACKET_FIELD_ERROR(multiplier);
82773 }
82774 real_packet->multiplier = readin;
82775 }
82776 }
82777 if (BV_ISSET(fields, 4)) {
82778 log_packet_detailed(" got field 'reqs_count'");
82779 #ifdef FREECIV_JSON_CONNECTION
82780 field_addr.name = "reqs_count";
82781 #endif /* FREECIV_JSON_CONNECTION */
82782 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
82783 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
82784 }
82785 }
82786 if (BV_ISSET(fields, 5)) {
82787 log_packet_detailed(" got field 'reqs'");
82788 #ifdef FREECIV_JSON_CONNECTION
82789 field_addr.name = "reqs";
82790 #endif /* FREECIV_JSON_CONNECTION */
82791
82792 {
82793 int i;
82794
82795 #ifdef FREECIV_JSON_CONNECTION
82796 /* Enter array. */
82797 field_addr.sub_location = plocation_elem_new(0);
82798 #endif /* FREECIV_JSON_CONNECTION */
82799
82800 if (real_packet->reqs_count > MAX_NUM_REQS) {
82801 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
82802 }
82803 for (i = 0; i < real_packet->reqs_count; i++) {
82804 #ifdef FREECIV_JSON_CONNECTION
82805 field_addr.sub_location->number = i;
82806 #endif /* FREECIV_JSON_CONNECTION */
82807 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
82808 RECEIVE_PACKET_FIELD_ERROR(reqs);
82809 }
82810 }
82811
82812 #ifdef FREECIV_JSON_CONNECTION
82813 /* Exit array. */
82814 free(field_addr.sub_location);
82815 field_addr.sub_location = NULL;
82816 #endif /* FREECIV_JSON_CONNECTION */
82817 }
82818 }
82819
82820 if (NULL == old) {
82821 old = fc_malloc(sizeof(*old));
82822 *old = *real_packet;
82823 genhash_insert(*hash, old, old);
82824 } else {
82825 *old = *real_packet;
82826 }
82827
82828#endif /* FREECIV_DELTA_PROTOCOL */
82829 RECEIVE_PACKET_END(real_packet);
82830}
82831
82832 static int send_packet_ruleset_effect_100(struct connection *pc, const struct packet_ruleset_effect *packet)
82833{
82834 const struct packet_ruleset_effect *real_packet = packet;
82835#ifdef FREECIV_DELTA_PROTOCOL
82836 packet_ruleset_effect_100_fields fields;
82837 struct packet_ruleset_effect *old;
82838 bool differ;
82839 struct genhash **hash = pc->phs.sent + PACKET_RULESET_EFFECT;
82840#endif /* FREECIV_DELTA_PROTOCOL */
82841 SEND_PACKET_START(PACKET_RULESET_EFFECT);
82842#ifdef FREECIV_JSON_CONNECTION
82843 struct plocation field_addr;
82844 {
82845 struct plocation *field_addr_tmp = plocation_field_new(NULL);
82846 field_addr = *field_addr_tmp;
82847 FC_FREE(field_addr_tmp);
82848 }
82849#endif /* FREECIV_JSON_CONNECTION */
82850
82851 log_packet_detailed("packet_ruleset_effect_100: sending info about ()");
82852
82853#ifdef FREECIV_DELTA_PROTOCOL
82854 if (NULL == *hash) {
82855 *hash = genhash_new_full(hash_packet_ruleset_effect_100, cmp_packet_ruleset_effect_100,
82856 NULL, NULL, NULL, free);
82857 }
82858 BV_CLR_ALL(fields);
82859
82860 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
82861 old = fc_malloc(sizeof(*old));
82862 *old = *real_packet;
82863 genhash_insert(*hash, old, old);
82864 memset(old, 0, sizeof(*old));
82865 }
82866 differ = (old->effect_type != real_packet->effect_type);
82867 if (differ) {
82868 BV_SET(fields, 0);
82869 }
82870
82871 differ = (old->effect_value != real_packet->effect_value);
82872 if (differ) {
82873 BV_SET(fields, 1);
82874 }
82875
82876 if (packet->has_multiplier) {
82877 BV_SET(fields, 2);
82878 }
82879
82880 differ = (old->multiplier != real_packet->multiplier);
82881 if (differ) {
82882 BV_SET(fields, 3);
82883 }
82884
82885 differ = (old->reqs_count != real_packet->reqs_count);
82886 if (differ) {
82887 BV_SET(fields, 4);
82888 }
82889
82890
82891 {
82892 differ = (old->reqs_count != real_packet->reqs_count);
82893 if (!differ) {
82894 int i;
82895
82896 for (i = 0; i < real_packet->reqs_count; i++) {
82897 if (!are_requirements_equal(&old->reqs[i], &real_packet->reqs[i])) {
82898 differ = TRUE;
82899 break;
82900 }
82901 }
82902 }
82903 }
82904 if (differ) {
82905 BV_SET(fields, 5);
82906 }
82907
82908
82909#ifdef FREECIV_JSON_CONNECTION
82910 field_addr.name = "fields";
82911#endif /* FREECIV_JSON_CONNECTION */
82912 DIO_BV_PUT(&dout, &field_addr, fields);
82913
82914 if (BV_ISSET(fields, 0)) {
82915 log_packet_detailed(" field 'effect_type' has changed");
82916 #ifdef FREECIV_JSON_CONNECTION
82917 field_addr.name = "effect_type";
82918#endif /* FREECIV_JSON_CONNECTION */
82919 DIO_PUT(uint8, &dout, &field_addr, real_packet->effect_type);
82920 }
82921 if (BV_ISSET(fields, 1)) {
82922 log_packet_detailed(" field 'effect_value' has changed");
82923 #ifdef FREECIV_JSON_CONNECTION
82924 field_addr.name = "effect_value";
82925#endif /* FREECIV_JSON_CONNECTION */
82926 DIO_PUT(sint32, &dout, &field_addr, real_packet->effect_value);
82927 }
82928 /* field 2 is folded into the header */
82929 if (BV_ISSET(fields, 3)) {
82930 log_packet_detailed(" field 'multiplier' has changed");
82931 #ifdef FREECIV_JSON_CONNECTION
82932 field_addr.name = "multiplier";
82933#endif /* FREECIV_JSON_CONNECTION */
82934 DIO_PUT(uint8, &dout, &field_addr, real_packet->multiplier);
82935 }
82936 if (BV_ISSET(fields, 4)) {
82937 log_packet_detailed(" field 'reqs_count' has changed");
82938 #ifdef FREECIV_JSON_CONNECTION
82939 field_addr.name = "reqs_count";
82940#endif /* FREECIV_JSON_CONNECTION */
82941 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
82942 }
82943 if (BV_ISSET(fields, 5)) {
82944 log_packet_detailed(" field 'reqs' has changed");
82945 #ifdef FREECIV_JSON_CONNECTION
82946 field_addr.name = "reqs";
82947#endif /* FREECIV_JSON_CONNECTION */
82948
82949 {
82950 int i;
82951
82952#ifdef FREECIV_JSON_CONNECTION
82953 /* Create the array. */
82954 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
82955
82956 /* Enter the array. */
82957 field_addr.sub_location = plocation_elem_new(0);
82958#endif /* FREECIV_JSON_CONNECTION */
82959
82960 for (i = 0; i < real_packet->reqs_count; i++) {
82961#ifdef FREECIV_JSON_CONNECTION
82962 /* Next array element. */
82963 field_addr.sub_location->number = i;
82964#endif /* FREECIV_JSON_CONNECTION */
82965 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
82966 }
82967
82968#ifdef FREECIV_JSON_CONNECTION
82969 /* Exit array. */
82970 free(field_addr.sub_location);
82971 field_addr.sub_location = NULL;
82972#endif /* FREECIV_JSON_CONNECTION */
82973 }
82974 }
82975
82976 *old = *real_packet;
82977#endif /* FREECIV_DELTA_PROTOCOL */
82978#ifndef FREECIV_DELTA_PROTOCOL
82979#ifdef FREECIV_JSON_CONNECTION
82980 field_addr.name = "effect_type";
82981#endif /* FREECIV_JSON_CONNECTION */
82982 DIO_PUT(uint8, &dout, &field_addr, real_packet->effect_type);
82983#ifdef FREECIV_JSON_CONNECTION
82984 field_addr.name = "effect_value";
82985#endif /* FREECIV_JSON_CONNECTION */
82986 DIO_PUT(sint32, &dout, &field_addr, real_packet->effect_value);
82987#ifdef FREECIV_JSON_CONNECTION
82988 field_addr.name = "has_multiplier";
82989#endif /* FREECIV_JSON_CONNECTION */
82990 DIO_PUT(bool8, &dout, &field_addr, real_packet->has_multiplier);
82991#ifdef FREECIV_JSON_CONNECTION
82992 field_addr.name = "multiplier";
82993#endif /* FREECIV_JSON_CONNECTION */
82994 DIO_PUT(uint8, &dout, &field_addr, real_packet->multiplier);
82995#ifdef FREECIV_JSON_CONNECTION
82996 field_addr.name = "reqs_count";
82997#endif /* FREECIV_JSON_CONNECTION */
82998 DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
82999#ifdef FREECIV_JSON_CONNECTION
83000 field_addr.name = "reqs";
83001#endif /* FREECIV_JSON_CONNECTION */
83002
83003 {
83004 int i;
83005
83006#ifdef FREECIV_JSON_CONNECTION
83007 /* Create the array. */
83008 DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
83009
83010 /* Enter the array. */
83011 field_addr.sub_location = plocation_elem_new(0);
83012#endif /* FREECIV_JSON_CONNECTION */
83013
83014 for (i = 0; i < real_packet->reqs_count; i++) {
83015#ifdef FREECIV_JSON_CONNECTION
83016 /* Next array element. */
83017 field_addr.sub_location->number = i;
83018#endif /* FREECIV_JSON_CONNECTION */
83019 DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
83020 }
83021
83022#ifdef FREECIV_JSON_CONNECTION
83023 /* Exit array. */
83024 free(field_addr.sub_location);
83025 field_addr.sub_location = NULL;
83026#endif /* FREECIV_JSON_CONNECTION */
83027 }
83028
83029#endif
83030 SEND_PACKET_END(PACKET_RULESET_EFFECT);
83031}
83032
83033 int send_packet_ruleset_effect(struct connection *pc, const struct packet_ruleset_effect *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_RULESET_EFFECT].packet != NULL, -1,
83041 "Handler for PACKET_RULESET_EFFECT not installed");
83042 return pc->phs.handlers->send[PACKET_RULESET_EFFECT].packet(pc, packet);
83043}
83044
83045 void lsend_packet_ruleset_effect(struct conn_list *dest, const struct packet_ruleset_effect *packet)
83046{
83047 conn_list_iterate(dest, pconn) {
83048 send_packet_ruleset_effect(pconn, packet);
83049 } conn_list_iterate_end;
83050}
83051
83052#ifdef FREECIV_DELTA_PROTOCOL
83053#define hash_packet_ruleset_resource_100 hash_const
83054
83055#define cmp_packet_ruleset_resource_100 cmp_const
83056
83057 BV_DEFINE(packet_ruleset_resource_100_fields, 2);
83058#endif /* FREECIV_DELTA_PROTOCOL */
83059
83060 static struct packet_ruleset_resource *receive_packet_ruleset_resource_100(struct connection *pc)
83061{
83062#ifdef FREECIV_DELTA_PROTOCOL
83063 packet_ruleset_resource_100_fields fields;
83064 struct packet_ruleset_resource *old;
83065 struct genhash **hash = pc->phs.received + PACKET_RULESET_RESOURCE;
83066#endif /* FREECIV_DELTA_PROTOCOL */
83067 RECEIVE_PACKET_START(packet_ruleset_resource, real_packet);
83068#ifdef FREECIV_JSON_CONNECTION
83069 struct plocation field_addr;
83070 {
83071 struct plocation *field_addr_tmp = plocation_field_new(NULL);
83072 field_addr = *field_addr_tmp;
83073 FC_FREE(field_addr_tmp);
83074 }
83075#endif /* FREECIV_JSON_CONNECTION */
83076
83077#ifdef FREECIV_DELTA_PROTOCOL
83078#ifdef FREECIV_JSON_CONNECTION
83079 field_addr.name = "fields";
83080#endif /* FREECIV_JSON_CONNECTION */
83081 DIO_BV_GET(&din, &field_addr, fields);
83082
83083#else /* FREECIV_DELTA_PROTOCOL */
83084 #ifdef FREECIV_JSON_CONNECTION
83085 field_addr.name = "id";
83086 #endif /* FREECIV_JSON_CONNECTION */
83087 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
83088 RECEIVE_PACKET_FIELD_ERROR(id);
83089 }
83090 #ifdef FREECIV_JSON_CONNECTION
83091 field_addr.name = "output";
83092 #endif /* FREECIV_JSON_CONNECTION */
83093
83094 {
83095 int i;
83096
83097 #ifdef FREECIV_JSON_CONNECTION
83098 /* Enter array. */
83099 field_addr.sub_location = plocation_elem_new(0);
83100 #endif /* FREECIV_JSON_CONNECTION */
83101
83102 for (i = 0; i < O_LAST; i++) {
83103 #ifdef FREECIV_JSON_CONNECTION
83104 field_addr.sub_location->number = i;
83105 #endif /* FREECIV_JSON_CONNECTION */
83106 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output[i])) {
83107 RECEIVE_PACKET_FIELD_ERROR(output);
83108 }
83109 }
83110
83111 #ifdef FREECIV_JSON_CONNECTION
83112 /* Exit array. */
83113 free(field_addr.sub_location);
83114 field_addr.sub_location = NULL;
83115 #endif /* FREECIV_JSON_CONNECTION */
83116 }
83117
83118#endif
83119 log_packet_detailed("packet_ruleset_resource_100: got info about ()");
83120
83121#ifdef FREECIV_DELTA_PROTOCOL
83122 if (NULL == *hash) {
83123 *hash = genhash_new_full(hash_packet_ruleset_resource_100, cmp_packet_ruleset_resource_100,
83124 NULL, NULL, NULL, free);
83125 }
83126
83127 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
83128 *real_packet = *old;
83129 } else {
83130 log_packet_detailed(" no old info");
83131 memset(real_packet, 0, sizeof(*real_packet));
83132 }
83133
83134 if (BV_ISSET(fields, 0)) {
83135 log_packet_detailed(" got field 'id'");
83136 #ifdef FREECIV_JSON_CONNECTION
83137 field_addr.name = "id";
83138 #endif /* FREECIV_JSON_CONNECTION */
83139 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
83140 RECEIVE_PACKET_FIELD_ERROR(id);
83141 }
83142 }
83143 if (BV_ISSET(fields, 1)) {
83144 log_packet_detailed(" got field 'output'");
83145 #ifdef FREECIV_JSON_CONNECTION
83146 field_addr.name = "output";
83147 #endif /* FREECIV_JSON_CONNECTION */
83148
83149 {
83150 int i;
83151
83152 #ifdef FREECIV_JSON_CONNECTION
83153 /* Enter array. */
83154 field_addr.sub_location = plocation_elem_new(0);
83155 #endif /* FREECIV_JSON_CONNECTION */
83156
83157 for (i = 0; i < O_LAST; i++) {
83158 #ifdef FREECIV_JSON_CONNECTION
83159 field_addr.sub_location->number = i;
83160 #endif /* FREECIV_JSON_CONNECTION */
83161 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output[i])) {
83162 RECEIVE_PACKET_FIELD_ERROR(output);
83163 }
83164 }
83165
83166 #ifdef FREECIV_JSON_CONNECTION
83167 /* Exit array. */
83168 free(field_addr.sub_location);
83169 field_addr.sub_location = NULL;
83170 #endif /* FREECIV_JSON_CONNECTION */
83171 }
83172 }
83173
83174 if (NULL == old) {
83175 old = fc_malloc(sizeof(*old));
83176 *old = *real_packet;
83177 genhash_insert(*hash, old, old);
83178 } else {
83179 *old = *real_packet;
83180 }
83181
83182#endif /* FREECIV_DELTA_PROTOCOL */
83183 RECEIVE_PACKET_END(real_packet);
83184}
83185
83186 static int send_packet_ruleset_resource_100(struct connection *pc, const struct packet_ruleset_resource *packet)
83187{
83188 const struct packet_ruleset_resource *real_packet = packet;
83189#ifdef FREECIV_DELTA_PROTOCOL
83190 packet_ruleset_resource_100_fields fields;
83191 struct packet_ruleset_resource *old;
83192 bool differ;
83193 struct genhash **hash = pc->phs.sent + PACKET_RULESET_RESOURCE;
83194#endif /* FREECIV_DELTA_PROTOCOL */
83195 SEND_PACKET_START(PACKET_RULESET_RESOURCE);
83196#ifdef FREECIV_JSON_CONNECTION
83197 struct plocation field_addr;
83198 {
83199 struct plocation *field_addr_tmp = plocation_field_new(NULL);
83200 field_addr = *field_addr_tmp;
83201 FC_FREE(field_addr_tmp);
83202 }
83203#endif /* FREECIV_JSON_CONNECTION */
83204
83205 log_packet_detailed("packet_ruleset_resource_100: sending info about ()");
83206
83207#ifdef FREECIV_DELTA_PROTOCOL
83208 if (NULL == *hash) {
83209 *hash = genhash_new_full(hash_packet_ruleset_resource_100, cmp_packet_ruleset_resource_100,
83210 NULL, NULL, NULL, free);
83211 }
83212 BV_CLR_ALL(fields);
83213
83214 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
83215 old = fc_malloc(sizeof(*old));
83216 *old = *real_packet;
83217 genhash_insert(*hash, old, old);
83218 memset(old, 0, sizeof(*old));
83219 }
83220 differ = (old->id != real_packet->id);
83221 if (differ) {
83222 BV_SET(fields, 0);
83223 }
83224
83225
83226 {
83227 differ = FALSE;
83228 {
83229 int i;
83230
83231 for (i = 0; i < O_LAST; i++) {
83232 if (old->output[i] != real_packet->output[i]) {
83233 differ = TRUE;
83234 break;
83235 }
83236 }
83237 }
83238 }
83239 if (differ) {
83240 BV_SET(fields, 1);
83241 }
83242
83243
83244#ifdef FREECIV_JSON_CONNECTION
83245 field_addr.name = "fields";
83246#endif /* FREECIV_JSON_CONNECTION */
83247 DIO_BV_PUT(&dout, &field_addr, fields);
83248
83249 if (BV_ISSET(fields, 0)) {
83250 log_packet_detailed(" field 'id' has changed");
83251 #ifdef FREECIV_JSON_CONNECTION
83252 field_addr.name = "id";
83253#endif /* FREECIV_JSON_CONNECTION */
83254 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
83255 }
83256 if (BV_ISSET(fields, 1)) {
83257 log_packet_detailed(" field 'output' has changed");
83258 #ifdef FREECIV_JSON_CONNECTION
83259 field_addr.name = "output";
83260#endif /* FREECIV_JSON_CONNECTION */
83261
83262 {
83263 int i;
83264
83265#ifdef FREECIV_JSON_CONNECTION
83266 /* Create the array. */
83267 DIO_PUT(farray, &dout, &field_addr, O_LAST);
83268
83269 /* Enter the array. */
83270 field_addr.sub_location = plocation_elem_new(0);
83271#endif /* FREECIV_JSON_CONNECTION */
83272
83273 for (i = 0; i < O_LAST; i++) {
83274#ifdef FREECIV_JSON_CONNECTION
83275 /* Next array element. */
83276 field_addr.sub_location->number = i;
83277#endif /* FREECIV_JSON_CONNECTION */
83278 DIO_PUT(uint8, &dout, &field_addr, real_packet->output[i]);
83279 }
83280
83281#ifdef FREECIV_JSON_CONNECTION
83282 /* Exit array. */
83283 free(field_addr.sub_location);
83284 field_addr.sub_location = NULL;
83285#endif /* FREECIV_JSON_CONNECTION */
83286 }
83287 }
83288
83289 *old = *real_packet;
83290#endif /* FREECIV_DELTA_PROTOCOL */
83291#ifndef FREECIV_DELTA_PROTOCOL
83292#ifdef FREECIV_JSON_CONNECTION
83293 field_addr.name = "id";
83294#endif /* FREECIV_JSON_CONNECTION */
83295 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
83296#ifdef FREECIV_JSON_CONNECTION
83297 field_addr.name = "output";
83298#endif /* FREECIV_JSON_CONNECTION */
83299
83300 {
83301 int i;
83302
83303#ifdef FREECIV_JSON_CONNECTION
83304 /* Create the array. */
83305 DIO_PUT(farray, &dout, &field_addr, O_LAST);
83306
83307 /* Enter the array. */
83308 field_addr.sub_location = plocation_elem_new(0);
83309#endif /* FREECIV_JSON_CONNECTION */
83310
83311 for (i = 0; i < O_LAST; i++) {
83312#ifdef FREECIV_JSON_CONNECTION
83313 /* Next array element. */
83314 field_addr.sub_location->number = i;
83315#endif /* FREECIV_JSON_CONNECTION */
83316 DIO_PUT(uint8, &dout, &field_addr, real_packet->output[i]);
83317 }
83318
83319#ifdef FREECIV_JSON_CONNECTION
83320 /* Exit array. */
83321 free(field_addr.sub_location);
83322 field_addr.sub_location = NULL;
83323#endif /* FREECIV_JSON_CONNECTION */
83324 }
83325
83326#endif
83327 SEND_PACKET_END(PACKET_RULESET_RESOURCE);
83328}
83329
83330 int send_packet_ruleset_resource(struct connection *pc, const struct packet_ruleset_resource *packet)
83331{
83332 if (!pc->used) {
83333 log_error("WARNING: trying to send data to the closed connection %s",
83334 conn_description(pc));
83335 return -1;
83336 }
83337 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_RESOURCE].packet != NULL, -1,
83338 "Handler for PACKET_RULESET_RESOURCE not installed");
83339 return pc->phs.handlers->send[PACKET_RULESET_RESOURCE].packet(pc, packet);
83340}
83341
83342 void lsend_packet_ruleset_resource(struct conn_list *dest, const struct packet_ruleset_resource *packet)
83343{
83344 conn_list_iterate(dest, pconn) {
83345 send_packet_ruleset_resource(pconn, packet);
83346 } conn_list_iterate_end;
83347}
83348
83349#ifdef FREECIV_DELTA_PROTOCOL
83350#define hash_packet_scenario_info_100 hash_const
83351
83352#define cmp_packet_scenario_info_100 cmp_const
83353
83354 BV_DEFINE(packet_scenario_info_100_fields, 14);
83355#endif /* FREECIV_DELTA_PROTOCOL */
83356
83357 static struct packet_scenario_info *receive_packet_scenario_info_100(struct connection *pc)
83358{
83359#ifdef FREECIV_DELTA_PROTOCOL
83360 packet_scenario_info_100_fields fields;
83361 struct packet_scenario_info *old;
83362 struct genhash **hash = pc->phs.received + PACKET_SCENARIO_INFO;
83363#endif /* FREECIV_DELTA_PROTOCOL */
83364 RECEIVE_PACKET_START(packet_scenario_info, real_packet);
83365#ifdef FREECIV_JSON_CONNECTION
83366 struct plocation field_addr;
83367 {
83368 struct plocation *field_addr_tmp = plocation_field_new(NULL);
83369 field_addr = *field_addr_tmp;
83370 FC_FREE(field_addr_tmp);
83371 }
83372#endif /* FREECIV_JSON_CONNECTION */
83373
83374#ifdef FREECIV_DELTA_PROTOCOL
83375#ifdef FREECIV_JSON_CONNECTION
83376 field_addr.name = "fields";
83377#endif /* FREECIV_JSON_CONNECTION */
83378 DIO_BV_GET(&din, &field_addr, fields);
83379
83380#else /* FREECIV_DELTA_PROTOCOL */
83381 #ifdef FREECIV_JSON_CONNECTION
83382 field_addr.name = "is_scenario";
83383 #endif /* FREECIV_JSON_CONNECTION */
83384 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_scenario)) {
83385 RECEIVE_PACKET_FIELD_ERROR(is_scenario);
83386 }
83387 #ifdef FREECIV_JSON_CONNECTION
83388 field_addr.name = "name";
83389 #endif /* FREECIV_JSON_CONNECTION */
83390 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
83391 RECEIVE_PACKET_FIELD_ERROR(name);
83392 }
83393 #ifdef FREECIV_JSON_CONNECTION
83394 field_addr.name = "authors";
83395 #endif /* FREECIV_JSON_CONNECTION */
83396 if (!DIO_GET(string, &din, &field_addr, real_packet->authors, sizeof(real_packet->authors))) {
83397 RECEIVE_PACKET_FIELD_ERROR(authors);
83398 }
83399 #ifdef FREECIV_JSON_CONNECTION
83400 field_addr.name = "players";
83401 #endif /* FREECIV_JSON_CONNECTION */
83402 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->players)) {
83403 RECEIVE_PACKET_FIELD_ERROR(players);
83404 }
83405 #ifdef FREECIV_JSON_CONNECTION
83406 field_addr.name = "startpos_nations";
83407 #endif /* FREECIV_JSON_CONNECTION */
83408 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->startpos_nations)) {
83409 RECEIVE_PACKET_FIELD_ERROR(startpos_nations);
83410 }
83411 #ifdef FREECIV_JSON_CONNECTION
83412 field_addr.name = "save_random";
83413 #endif /* FREECIV_JSON_CONNECTION */
83414 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->save_random)) {
83415 RECEIVE_PACKET_FIELD_ERROR(save_random);
83416 }
83417 #ifdef FREECIV_JSON_CONNECTION
83418 field_addr.name = "prevent_new_cities";
83419 #endif /* FREECIV_JSON_CONNECTION */
83420 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->prevent_new_cities)) {
83421 RECEIVE_PACKET_FIELD_ERROR(prevent_new_cities);
83422 }
83423 #ifdef FREECIV_JSON_CONNECTION
83424 field_addr.name = "lake_flooding";
83425 #endif /* FREECIV_JSON_CONNECTION */
83426 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->lake_flooding)) {
83427 RECEIVE_PACKET_FIELD_ERROR(lake_flooding);
83428 }
83429 #ifdef FREECIV_JSON_CONNECTION
83430 field_addr.name = "handmade";
83431 #endif /* FREECIV_JSON_CONNECTION */
83432 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->handmade)) {
83433 RECEIVE_PACKET_FIELD_ERROR(handmade);
83434 }
83435 #ifdef FREECIV_JSON_CONNECTION
83436 field_addr.name = "allow_ai_type_fallback";
83437 #endif /* FREECIV_JSON_CONNECTION */
83438 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->allow_ai_type_fallback)) {
83439 RECEIVE_PACKET_FIELD_ERROR(allow_ai_type_fallback);
83440 }
83441 #ifdef FREECIV_JSON_CONNECTION
83442 field_addr.name = "ruleset_locked";
83443 #endif /* FREECIV_JSON_CONNECTION */
83444 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->ruleset_locked)) {
83445 RECEIVE_PACKET_FIELD_ERROR(ruleset_locked);
83446 }
83447 #ifdef FREECIV_JSON_CONNECTION
83448 field_addr.name = "datafile";
83449 #endif /* FREECIV_JSON_CONNECTION */
83450 if (!DIO_GET(string, &din, &field_addr, real_packet->datafile, sizeof(real_packet->datafile))) {
83451 RECEIVE_PACKET_FIELD_ERROR(datafile);
83452 }
83453 #ifdef FREECIV_JSON_CONNECTION
83454 field_addr.name = "have_resources";
83455 #endif /* FREECIV_JSON_CONNECTION */
83456 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->have_resources)) {
83457 RECEIVE_PACKET_FIELD_ERROR(have_resources);
83458 }
83459 #ifdef FREECIV_JSON_CONNECTION
83460 field_addr.name = "req_caps";
83461 #endif /* FREECIV_JSON_CONNECTION */
83462 if (!DIO_GET(string, &din, &field_addr, real_packet->req_caps, sizeof(real_packet->req_caps))) {
83463 RECEIVE_PACKET_FIELD_ERROR(req_caps);
83464 }
83465
83466#endif
83467 log_packet_detailed("packet_scenario_info_100: got info about ()");
83468
83469#ifdef FREECIV_DELTA_PROTOCOL
83470 if (NULL == *hash) {
83471 *hash = genhash_new_full(hash_packet_scenario_info_100, cmp_packet_scenario_info_100,
83472 NULL, NULL, NULL, free);
83473 }
83474
83475 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
83476 *real_packet = *old;
83477 } else {
83478 log_packet_detailed(" no old info");
83479 memset(real_packet, 0, sizeof(*real_packet));
83480 }
83481
83482 real_packet->is_scenario = BV_ISSET(fields, 0);
83483 if (BV_ISSET(fields, 1)) {
83484 log_packet_detailed(" got field 'name'");
83485 #ifdef FREECIV_JSON_CONNECTION
83486 field_addr.name = "name";
83487 #endif /* FREECIV_JSON_CONNECTION */
83488 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
83489 RECEIVE_PACKET_FIELD_ERROR(name);
83490 }
83491 }
83492 if (BV_ISSET(fields, 2)) {
83493 log_packet_detailed(" got field 'authors'");
83494 #ifdef FREECIV_JSON_CONNECTION
83495 field_addr.name = "authors";
83496 #endif /* FREECIV_JSON_CONNECTION */
83497 if (!DIO_GET(string, &din, &field_addr, real_packet->authors, sizeof(real_packet->authors))) {
83498 RECEIVE_PACKET_FIELD_ERROR(authors);
83499 }
83500 }
83501 real_packet->players = BV_ISSET(fields, 3);
83502 real_packet->startpos_nations = BV_ISSET(fields, 4);
83503 real_packet->save_random = BV_ISSET(fields, 5);
83504 real_packet->prevent_new_cities = BV_ISSET(fields, 6);
83505 real_packet->lake_flooding = BV_ISSET(fields, 7);
83506 real_packet->handmade = BV_ISSET(fields, 8);
83507 real_packet->allow_ai_type_fallback = BV_ISSET(fields, 9);
83508 real_packet->ruleset_locked = BV_ISSET(fields, 10);
83509 if (BV_ISSET(fields, 11)) {
83510 log_packet_detailed(" got field 'datafile'");
83511 #ifdef FREECIV_JSON_CONNECTION
83512 field_addr.name = "datafile";
83513 #endif /* FREECIV_JSON_CONNECTION */
83514 if (!DIO_GET(string, &din, &field_addr, real_packet->datafile, sizeof(real_packet->datafile))) {
83515 RECEIVE_PACKET_FIELD_ERROR(datafile);
83516 }
83517 }
83518 real_packet->have_resources = BV_ISSET(fields, 12);
83519 if (BV_ISSET(fields, 13)) {
83520 log_packet_detailed(" got field 'req_caps'");
83521 #ifdef FREECIV_JSON_CONNECTION
83522 field_addr.name = "req_caps";
83523 #endif /* FREECIV_JSON_CONNECTION */
83524 if (!DIO_GET(string, &din, &field_addr, real_packet->req_caps, sizeof(real_packet->req_caps))) {
83525 RECEIVE_PACKET_FIELD_ERROR(req_caps);
83526 }
83527 }
83528
83529 if (NULL == old) {
83530 old = fc_malloc(sizeof(*old));
83531 *old = *real_packet;
83532 genhash_insert(*hash, old, old);
83533 } else {
83534 *old = *real_packet;
83535 }
83536
83537#endif /* FREECIV_DELTA_PROTOCOL */
83538 RECEIVE_PACKET_END(real_packet);
83539}
83540
83541 static int send_packet_scenario_info_100(struct connection *pc, const struct packet_scenario_info *packet)
83542{
83543 const struct packet_scenario_info *real_packet = packet;
83544#ifdef FREECIV_DELTA_PROTOCOL
83545 packet_scenario_info_100_fields fields;
83546 struct packet_scenario_info *old;
83547 bool differ;
83548 struct genhash **hash = pc->phs.sent + PACKET_SCENARIO_INFO;
83549#endif /* FREECIV_DELTA_PROTOCOL */
83550 SEND_PACKET_START(PACKET_SCENARIO_INFO);
83551#ifdef FREECIV_JSON_CONNECTION
83552 struct plocation field_addr;
83553 {
83554 struct plocation *field_addr_tmp = plocation_field_new(NULL);
83555 field_addr = *field_addr_tmp;
83556 FC_FREE(field_addr_tmp);
83557 }
83558#endif /* FREECIV_JSON_CONNECTION */
83559
83560 log_packet_detailed("packet_scenario_info_100: sending info about ()");
83561
83562#ifdef FREECIV_DELTA_PROTOCOL
83563 if (NULL == *hash) {
83564 *hash = genhash_new_full(hash_packet_scenario_info_100, cmp_packet_scenario_info_100,
83565 NULL, NULL, NULL, free);
83566 }
83567 BV_CLR_ALL(fields);
83568
83569 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
83570 old = fc_malloc(sizeof(*old));
83571 *old = *real_packet;
83572 genhash_insert(*hash, old, old);
83573 memset(old, 0, sizeof(*old));
83574 }
83575 if (packet->is_scenario) {
83576 BV_SET(fields, 0);
83577 }
83578
83579 differ = (strcmp(old->name, real_packet->name) != 0);
83580 if (differ) {
83581 BV_SET(fields, 1);
83582 }
83583
83584 differ = (strcmp(old->authors, real_packet->authors) != 0);
83585 if (differ) {
83586 BV_SET(fields, 2);
83587 }
83588
83589 if (packet->players) {
83590 BV_SET(fields, 3);
83591 }
83592
83593 if (packet->startpos_nations) {
83594 BV_SET(fields, 4);
83595 }
83596
83597 if (packet->save_random) {
83598 BV_SET(fields, 5);
83599 }
83600
83601 if (packet->prevent_new_cities) {
83602 BV_SET(fields, 6);
83603 }
83604
83605 if (packet->lake_flooding) {
83606 BV_SET(fields, 7);
83607 }
83608
83609 if (packet->handmade) {
83610 BV_SET(fields, 8);
83611 }
83612
83613 if (packet->allow_ai_type_fallback) {
83614 BV_SET(fields, 9);
83615 }
83616
83617 if (packet->ruleset_locked) {
83618 BV_SET(fields, 10);
83619 }
83620
83621 differ = (strcmp(old->datafile, real_packet->datafile) != 0);
83622 if (differ) {
83623 BV_SET(fields, 11);
83624 }
83625
83626 if (packet->have_resources) {
83627 BV_SET(fields, 12);
83628 }
83629
83630 differ = (strcmp(old->req_caps, real_packet->req_caps) != 0);
83631 if (differ) {
83632 BV_SET(fields, 13);
83633 }
83634
83635
83636#ifdef FREECIV_JSON_CONNECTION
83637 field_addr.name = "fields";
83638#endif /* FREECIV_JSON_CONNECTION */
83639 DIO_BV_PUT(&dout, &field_addr, fields);
83640
83641 /* field 0 is folded into the header */
83642 if (BV_ISSET(fields, 1)) {
83643 log_packet_detailed(" field 'name' has changed");
83644 #ifdef FREECIV_JSON_CONNECTION
83645 field_addr.name = "name";
83646#endif /* FREECIV_JSON_CONNECTION */
83647 DIO_PUT(string, &dout, &field_addr, real_packet->name);
83648 }
83649 if (BV_ISSET(fields, 2)) {
83650 log_packet_detailed(" field 'authors' has changed");
83651 #ifdef FREECIV_JSON_CONNECTION
83652 field_addr.name = "authors";
83653#endif /* FREECIV_JSON_CONNECTION */
83654 DIO_PUT(string, &dout, &field_addr, real_packet->authors);
83655 }
83656 /* field 3 is folded into the header */
83657 /* field 4 is folded into the header */
83658 /* field 5 is folded into the header */
83659 /* field 6 is folded into the header */
83660 /* field 7 is folded into the header */
83661 /* field 8 is folded into the header */
83662 /* field 9 is folded into the header */
83663 /* field 10 is folded into the header */
83664 if (BV_ISSET(fields, 11)) {
83665 log_packet_detailed(" field 'datafile' has changed");
83666 #ifdef FREECIV_JSON_CONNECTION
83667 field_addr.name = "datafile";
83668#endif /* FREECIV_JSON_CONNECTION */
83669 DIO_PUT(string, &dout, &field_addr, real_packet->datafile);
83670 }
83671 /* field 12 is folded into the header */
83672 if (BV_ISSET(fields, 13)) {
83673 log_packet_detailed(" field 'req_caps' has changed");
83674 #ifdef FREECIV_JSON_CONNECTION
83675 field_addr.name = "req_caps";
83676#endif /* FREECIV_JSON_CONNECTION */
83677 DIO_PUT(string, &dout, &field_addr, real_packet->req_caps);
83678 }
83679
83680 *old = *real_packet;
83681#endif /* FREECIV_DELTA_PROTOCOL */
83682#ifndef FREECIV_DELTA_PROTOCOL
83683#ifdef FREECIV_JSON_CONNECTION
83684 field_addr.name = "is_scenario";
83685#endif /* FREECIV_JSON_CONNECTION */
83686 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_scenario);
83687#ifdef FREECIV_JSON_CONNECTION
83688 field_addr.name = "name";
83689#endif /* FREECIV_JSON_CONNECTION */
83690 DIO_PUT(string, &dout, &field_addr, real_packet->name);
83691#ifdef FREECIV_JSON_CONNECTION
83692 field_addr.name = "authors";
83693#endif /* FREECIV_JSON_CONNECTION */
83694 DIO_PUT(string, &dout, &field_addr, real_packet->authors);
83695#ifdef FREECIV_JSON_CONNECTION
83696 field_addr.name = "players";
83697#endif /* FREECIV_JSON_CONNECTION */
83698 DIO_PUT(bool8, &dout, &field_addr, real_packet->players);
83699#ifdef FREECIV_JSON_CONNECTION
83700 field_addr.name = "startpos_nations";
83701#endif /* FREECIV_JSON_CONNECTION */
83702 DIO_PUT(bool8, &dout, &field_addr, real_packet->startpos_nations);
83703#ifdef FREECIV_JSON_CONNECTION
83704 field_addr.name = "save_random";
83705#endif /* FREECIV_JSON_CONNECTION */
83706 DIO_PUT(bool8, &dout, &field_addr, real_packet->save_random);
83707#ifdef FREECIV_JSON_CONNECTION
83708 field_addr.name = "prevent_new_cities";
83709#endif /* FREECIV_JSON_CONNECTION */
83710 DIO_PUT(bool8, &dout, &field_addr, real_packet->prevent_new_cities);
83711#ifdef FREECIV_JSON_CONNECTION
83712 field_addr.name = "lake_flooding";
83713#endif /* FREECIV_JSON_CONNECTION */
83714 DIO_PUT(bool8, &dout, &field_addr, real_packet->lake_flooding);
83715#ifdef FREECIV_JSON_CONNECTION
83716 field_addr.name = "handmade";
83717#endif /* FREECIV_JSON_CONNECTION */
83718 DIO_PUT(bool8, &dout, &field_addr, real_packet->handmade);
83719#ifdef FREECIV_JSON_CONNECTION
83720 field_addr.name = "allow_ai_type_fallback";
83721#endif /* FREECIV_JSON_CONNECTION */
83722 DIO_PUT(bool8, &dout, &field_addr, real_packet->allow_ai_type_fallback);
83723#ifdef FREECIV_JSON_CONNECTION
83724 field_addr.name = "ruleset_locked";
83725#endif /* FREECIV_JSON_CONNECTION */
83726 DIO_PUT(bool8, &dout, &field_addr, real_packet->ruleset_locked);
83727#ifdef FREECIV_JSON_CONNECTION
83728 field_addr.name = "datafile";
83729#endif /* FREECIV_JSON_CONNECTION */
83730 DIO_PUT(string, &dout, &field_addr, real_packet->datafile);
83731#ifdef FREECIV_JSON_CONNECTION
83732 field_addr.name = "have_resources";
83733#endif /* FREECIV_JSON_CONNECTION */
83734 DIO_PUT(bool8, &dout, &field_addr, real_packet->have_resources);
83735#ifdef FREECIV_JSON_CONNECTION
83736 field_addr.name = "req_caps";
83737#endif /* FREECIV_JSON_CONNECTION */
83738 DIO_PUT(string, &dout, &field_addr, real_packet->req_caps);
83739
83740#endif
83741 SEND_PACKET_END(PACKET_SCENARIO_INFO);
83742}
83743
83744 int send_packet_scenario_info(struct connection *pc, const struct packet_scenario_info *packet)
83745{
83746 if (!pc->used) {
83747 log_error("WARNING: trying to send data to the closed connection %s",
83748 conn_description(pc));
83749 return -1;
83750 }
83751 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SCENARIO_INFO].packet != NULL, -1,
83752 "Handler for PACKET_SCENARIO_INFO not installed");
83753 return pc->phs.handlers->send[PACKET_SCENARIO_INFO].packet(pc, packet);
83754}
83755
83756#ifdef FREECIV_DELTA_PROTOCOL
83757#define hash_packet_scenario_description_100 hash_const
83758
83759#define cmp_packet_scenario_description_100 cmp_const
83760
83761 BV_DEFINE(packet_scenario_description_100_fields, 1);
83762#endif /* FREECIV_DELTA_PROTOCOL */
83763
83764 static struct packet_scenario_description *receive_packet_scenario_description_100(struct connection *pc)
83765{
83766#ifdef FREECIV_DELTA_PROTOCOL
83767 packet_scenario_description_100_fields fields;
83768 struct packet_scenario_description *old;
83769 struct genhash **hash = pc->phs.received + PACKET_SCENARIO_DESCRIPTION;
83770#endif /* FREECIV_DELTA_PROTOCOL */
83771 RECEIVE_PACKET_START(packet_scenario_description, real_packet);
83772#ifdef FREECIV_JSON_CONNECTION
83773 struct plocation field_addr;
83774 {
83775 struct plocation *field_addr_tmp = plocation_field_new(NULL);
83776 field_addr = *field_addr_tmp;
83777 FC_FREE(field_addr_tmp);
83778 }
83779#endif /* FREECIV_JSON_CONNECTION */
83780
83781#ifdef FREECIV_DELTA_PROTOCOL
83782#ifdef FREECIV_JSON_CONNECTION
83783 field_addr.name = "fields";
83784#endif /* FREECIV_JSON_CONNECTION */
83785 DIO_BV_GET(&din, &field_addr, fields);
83786
83787#else /* FREECIV_DELTA_PROTOCOL */
83788 #ifdef FREECIV_JSON_CONNECTION
83789 field_addr.name = "description";
83790 #endif /* FREECIV_JSON_CONNECTION */
83791 if (!DIO_GET(string, &din, &field_addr, real_packet->description, sizeof(real_packet->description))) {
83792 RECEIVE_PACKET_FIELD_ERROR(description);
83793 }
83794
83795#endif
83796 log_packet_detailed("packet_scenario_description_100: got info about ()");
83797
83798#ifdef FREECIV_DELTA_PROTOCOL
83799 if (NULL == *hash) {
83800 *hash = genhash_new_full(hash_packet_scenario_description_100, cmp_packet_scenario_description_100,
83801 NULL, NULL, NULL, free);
83802 }
83803
83804 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
83805 *real_packet = *old;
83806 } else {
83807 log_packet_detailed(" no old info");
83808 memset(real_packet, 0, sizeof(*real_packet));
83809 }
83810
83811 if (BV_ISSET(fields, 0)) {
83812 log_packet_detailed(" got field 'description'");
83813 #ifdef FREECIV_JSON_CONNECTION
83814 field_addr.name = "description";
83815 #endif /* FREECIV_JSON_CONNECTION */
83816 if (!DIO_GET(string, &din, &field_addr, real_packet->description, sizeof(real_packet->description))) {
83817 RECEIVE_PACKET_FIELD_ERROR(description);
83818 }
83819 }
83820
83821 if (NULL == old) {
83822 old = fc_malloc(sizeof(*old));
83823 *old = *real_packet;
83824 genhash_insert(*hash, old, old);
83825 } else {
83826 *old = *real_packet;
83827 }
83828
83829#endif /* FREECIV_DELTA_PROTOCOL */
83830 RECEIVE_PACKET_END(real_packet);
83831}
83832
83833 static int send_packet_scenario_description_100(struct connection *pc, const struct packet_scenario_description *packet)
83834{
83835 const struct packet_scenario_description *real_packet = packet;
83836#ifdef FREECIV_DELTA_PROTOCOL
83837 packet_scenario_description_100_fields fields;
83838 struct packet_scenario_description *old;
83839 bool differ;
83840 struct genhash **hash = pc->phs.sent + PACKET_SCENARIO_DESCRIPTION;
83841#endif /* FREECIV_DELTA_PROTOCOL */
83842 SEND_PACKET_START(PACKET_SCENARIO_DESCRIPTION);
83843#ifdef FREECIV_JSON_CONNECTION
83844 struct plocation field_addr;
83845 {
83846 struct plocation *field_addr_tmp = plocation_field_new(NULL);
83847 field_addr = *field_addr_tmp;
83848 FC_FREE(field_addr_tmp);
83849 }
83850#endif /* FREECIV_JSON_CONNECTION */
83851
83852 log_packet_detailed("packet_scenario_description_100: sending info about ()");
83853
83854#ifdef FREECIV_DELTA_PROTOCOL
83855 if (NULL == *hash) {
83856 *hash = genhash_new_full(hash_packet_scenario_description_100, cmp_packet_scenario_description_100,
83857 NULL, NULL, NULL, free);
83858 }
83859 BV_CLR_ALL(fields);
83860
83861 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
83862 old = fc_malloc(sizeof(*old));
83863 *old = *real_packet;
83864 genhash_insert(*hash, old, old);
83865 memset(old, 0, sizeof(*old));
83866 }
83867 differ = (strcmp(old->description, real_packet->description) != 0);
83868 if (differ) {
83869 BV_SET(fields, 0);
83870 }
83871
83872
83873#ifdef FREECIV_JSON_CONNECTION
83874 field_addr.name = "fields";
83875#endif /* FREECIV_JSON_CONNECTION */
83876 DIO_BV_PUT(&dout, &field_addr, fields);
83877
83878 if (BV_ISSET(fields, 0)) {
83879 log_packet_detailed(" field 'description' has changed");
83880 #ifdef FREECIV_JSON_CONNECTION
83881 field_addr.name = "description";
83882#endif /* FREECIV_JSON_CONNECTION */
83883 DIO_PUT(string, &dout, &field_addr, real_packet->description);
83884 }
83885
83886 *old = *real_packet;
83887#endif /* FREECIV_DELTA_PROTOCOL */
83888#ifndef FREECIV_DELTA_PROTOCOL
83889#ifdef FREECIV_JSON_CONNECTION
83890 field_addr.name = "description";
83891#endif /* FREECIV_JSON_CONNECTION */
83892 DIO_PUT(string, &dout, &field_addr, real_packet->description);
83893
83894#endif
83895 SEND_PACKET_END(PACKET_SCENARIO_DESCRIPTION);
83896}
83897
83898 int send_packet_scenario_description(struct connection *pc, const struct packet_scenario_description *packet)
83899{
83900 if (!pc->used) {
83901 log_error("WARNING: trying to send data to the closed connection %s",
83902 conn_description(pc));
83903 return -1;
83904 }
83905 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SCENARIO_DESCRIPTION].packet != NULL, -1,
83906 "Handler for PACKET_SCENARIO_DESCRIPTION not installed");
83907 return pc->phs.handlers->send[PACKET_SCENARIO_DESCRIPTION].packet(pc, packet);
83908}
83909
83910#ifdef FREECIV_DELTA_PROTOCOL
83911#define hash_packet_save_scenario_100 hash_const
83912
83913#define cmp_packet_save_scenario_100 cmp_const
83914
83915 BV_DEFINE(packet_save_scenario_100_fields, 1);
83916#endif /* FREECIV_DELTA_PROTOCOL */
83917
83918 static struct packet_save_scenario *receive_packet_save_scenario_100(struct connection *pc)
83919{
83920#ifdef FREECIV_DELTA_PROTOCOL
83921 packet_save_scenario_100_fields fields;
83922 struct packet_save_scenario *old;
83923 struct genhash **hash = pc->phs.received + PACKET_SAVE_SCENARIO;
83924#endif /* FREECIV_DELTA_PROTOCOL */
83925 RECEIVE_PACKET_START(packet_save_scenario, real_packet);
83926#ifdef FREECIV_JSON_CONNECTION
83927 struct plocation field_addr;
83928 {
83929 struct plocation *field_addr_tmp = plocation_field_new(NULL);
83930 field_addr = *field_addr_tmp;
83931 FC_FREE(field_addr_tmp);
83932 }
83933#endif /* FREECIV_JSON_CONNECTION */
83934
83935#ifdef FREECIV_DELTA_PROTOCOL
83936#ifdef FREECIV_JSON_CONNECTION
83937 field_addr.name = "fields";
83938#endif /* FREECIV_JSON_CONNECTION */
83939 DIO_BV_GET(&din, &field_addr, fields);
83940
83941#else /* FREECIV_DELTA_PROTOCOL */
83942 #ifdef FREECIV_JSON_CONNECTION
83943 field_addr.name = "name";
83944 #endif /* FREECIV_JSON_CONNECTION */
83945 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
83946 RECEIVE_PACKET_FIELD_ERROR(name);
83947 }
83948
83949#endif
83950 log_packet_detailed("packet_save_scenario_100: got info about ()");
83951
83952#ifdef FREECIV_DELTA_PROTOCOL
83953 if (NULL == *hash) {
83954 *hash = genhash_new_full(hash_packet_save_scenario_100, cmp_packet_save_scenario_100,
83955 NULL, NULL, NULL, free);
83956 }
83957
83958 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
83959 *real_packet = *old;
83960 } else {
83961 log_packet_detailed(" no old info");
83962 memset(real_packet, 0, sizeof(*real_packet));
83963 }
83964
83965 if (BV_ISSET(fields, 0)) {
83966 log_packet_detailed(" got field 'name'");
83967 #ifdef FREECIV_JSON_CONNECTION
83968 field_addr.name = "name";
83969 #endif /* FREECIV_JSON_CONNECTION */
83970 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
83971 RECEIVE_PACKET_FIELD_ERROR(name);
83972 }
83973 }
83974
83975 if (NULL == old) {
83976 old = fc_malloc(sizeof(*old));
83977 *old = *real_packet;
83978 genhash_insert(*hash, old, old);
83979 } else {
83980 *old = *real_packet;
83981 }
83982
83983#endif /* FREECIV_DELTA_PROTOCOL */
83984 RECEIVE_PACKET_END(real_packet);
83985}
83986
83987 static int send_packet_save_scenario_100(struct connection *pc, const struct packet_save_scenario *packet)
83988{
83989 const struct packet_save_scenario *real_packet = packet;
83990#ifdef FREECIV_DELTA_PROTOCOL
83991 packet_save_scenario_100_fields fields;
83992 struct packet_save_scenario *old;
83993 bool differ;
83994 struct genhash **hash = pc->phs.sent + PACKET_SAVE_SCENARIO;
83995#endif /* FREECIV_DELTA_PROTOCOL */
83996 SEND_PACKET_START(PACKET_SAVE_SCENARIO);
83997#ifdef FREECIV_JSON_CONNECTION
83998 struct plocation field_addr;
83999 {
84000 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84001 field_addr = *field_addr_tmp;
84002 FC_FREE(field_addr_tmp);
84003 }
84004#endif /* FREECIV_JSON_CONNECTION */
84005
84006 log_packet_detailed("packet_save_scenario_100: sending info about ()");
84007
84008#ifdef FREECIV_DELTA_PROTOCOL
84009 if (NULL == *hash) {
84010 *hash = genhash_new_full(hash_packet_save_scenario_100, cmp_packet_save_scenario_100,
84011 NULL, NULL, NULL, free);
84012 }
84013 BV_CLR_ALL(fields);
84014
84015 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
84016 old = fc_malloc(sizeof(*old));
84017 *old = *real_packet;
84018 genhash_insert(*hash, old, old);
84019 memset(old, 0, sizeof(*old));
84020 }
84021 differ = (strcmp(old->name, real_packet->name) != 0);
84022 if (differ) {
84023 BV_SET(fields, 0);
84024 }
84025
84026
84027#ifdef FREECIV_JSON_CONNECTION
84028 field_addr.name = "fields";
84029#endif /* FREECIV_JSON_CONNECTION */
84030 DIO_BV_PUT(&dout, &field_addr, fields);
84031
84032 if (BV_ISSET(fields, 0)) {
84033 log_packet_detailed(" field 'name' has changed");
84034 #ifdef FREECIV_JSON_CONNECTION
84035 field_addr.name = "name";
84036#endif /* FREECIV_JSON_CONNECTION */
84037 DIO_PUT(string, &dout, &field_addr, real_packet->name);
84038 }
84039
84040 *old = *real_packet;
84041#endif /* FREECIV_DELTA_PROTOCOL */
84042#ifndef FREECIV_DELTA_PROTOCOL
84043#ifdef FREECIV_JSON_CONNECTION
84044 field_addr.name = "name";
84045#endif /* FREECIV_JSON_CONNECTION */
84046 DIO_PUT(string, &dout, &field_addr, real_packet->name);
84047
84048#endif
84049 SEND_PACKET_END(PACKET_SAVE_SCENARIO);
84050}
84051
84052 int send_packet_save_scenario(struct connection *pc, const struct packet_save_scenario *packet)
84053{
84054 if (!pc->used) {
84055 log_error("WARNING: trying to send data to the closed connection %s",
84056 conn_description(pc));
84057 return -1;
84058 }
84059 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SAVE_SCENARIO].packet != NULL, -1,
84060 "Handler for PACKET_SAVE_SCENARIO not installed");
84061 return pc->phs.handlers->send[PACKET_SAVE_SCENARIO].packet(pc, packet);
84062}
84063
84064 int dsend_packet_save_scenario(struct connection *pc, const char *name)
84065{
84066 struct packet_save_scenario packet, *real_packet = &packet;
84067
84068 sz_strlcpy(real_packet->name, name);
84069
84070 return send_packet_save_scenario(pc, real_packet);
84071}
84072
84073#ifdef FREECIV_DELTA_PROTOCOL
84074#define hash_packet_vote_new_100 hash_const
84075
84076#define cmp_packet_vote_new_100 cmp_const
84077
84078 BV_DEFINE(packet_vote_new_100_fields, 5);
84079#endif /* FREECIV_DELTA_PROTOCOL */
84080
84081 static struct packet_vote_new *receive_packet_vote_new_100(struct connection *pc)
84082{
84083#ifdef FREECIV_DELTA_PROTOCOL
84084 packet_vote_new_100_fields fields;
84085 struct packet_vote_new *old;
84086 struct genhash **hash = pc->phs.received + PACKET_VOTE_NEW;
84087#endif /* FREECIV_DELTA_PROTOCOL */
84088 RECEIVE_PACKET_START(packet_vote_new, real_packet);
84089#ifdef FREECIV_JSON_CONNECTION
84090 struct plocation field_addr;
84091 {
84092 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84093 field_addr = *field_addr_tmp;
84094 FC_FREE(field_addr_tmp);
84095 }
84096#endif /* FREECIV_JSON_CONNECTION */
84097
84098#ifdef FREECIV_DELTA_PROTOCOL
84099#ifdef FREECIV_JSON_CONNECTION
84100 field_addr.name = "fields";
84101#endif /* FREECIV_JSON_CONNECTION */
84102 DIO_BV_GET(&din, &field_addr, fields);
84103
84104#else /* FREECIV_DELTA_PROTOCOL */
84105 #ifdef FREECIV_JSON_CONNECTION
84106 field_addr.name = "vote_no";
84107 #endif /* FREECIV_JSON_CONNECTION */
84108 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
84109 RECEIVE_PACKET_FIELD_ERROR(vote_no);
84110 }
84111 #ifdef FREECIV_JSON_CONNECTION
84112 field_addr.name = "user";
84113 #endif /* FREECIV_JSON_CONNECTION */
84114 if (!DIO_GET(string, &din, &field_addr, real_packet->user, sizeof(real_packet->user))) {
84115 RECEIVE_PACKET_FIELD_ERROR(user);
84116 }
84117 #ifdef FREECIV_JSON_CONNECTION
84118 field_addr.name = "desc";
84119 #endif /* FREECIV_JSON_CONNECTION */
84120 if (!DIO_GET(string, &din, &field_addr, real_packet->desc, sizeof(real_packet->desc))) {
84121 RECEIVE_PACKET_FIELD_ERROR(desc);
84122 }
84123 #ifdef FREECIV_JSON_CONNECTION
84124 field_addr.name = "percent_required";
84125 #endif /* FREECIV_JSON_CONNECTION */
84126 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->percent_required)) {
84127 RECEIVE_PACKET_FIELD_ERROR(percent_required);
84128 }
84129 #ifdef FREECIV_JSON_CONNECTION
84130 field_addr.name = "flags";
84131 #endif /* FREECIV_JSON_CONNECTION */
84132 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->flags)) {
84133 RECEIVE_PACKET_FIELD_ERROR(flags);
84134 }
84135
84136#endif
84137 log_packet_detailed("packet_vote_new_100: got info about ()");
84138
84139#ifdef FREECIV_DELTA_PROTOCOL
84140 if (NULL == *hash) {
84141 *hash = genhash_new_full(hash_packet_vote_new_100, cmp_packet_vote_new_100,
84142 NULL, NULL, NULL, free);
84143 }
84144
84145 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
84146 *real_packet = *old;
84147 } else {
84148 log_packet_detailed(" no old info");
84149 memset(real_packet, 0, sizeof(*real_packet));
84150 }
84151
84152 if (BV_ISSET(fields, 0)) {
84153 log_packet_detailed(" got field 'vote_no'");
84154 #ifdef FREECIV_JSON_CONNECTION
84155 field_addr.name = "vote_no";
84156 #endif /* FREECIV_JSON_CONNECTION */
84157 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
84158 RECEIVE_PACKET_FIELD_ERROR(vote_no);
84159 }
84160 }
84161 if (BV_ISSET(fields, 1)) {
84162 log_packet_detailed(" got field 'user'");
84163 #ifdef FREECIV_JSON_CONNECTION
84164 field_addr.name = "user";
84165 #endif /* FREECIV_JSON_CONNECTION */
84166 if (!DIO_GET(string, &din, &field_addr, real_packet->user, sizeof(real_packet->user))) {
84167 RECEIVE_PACKET_FIELD_ERROR(user);
84168 }
84169 }
84170 if (BV_ISSET(fields, 2)) {
84171 log_packet_detailed(" got field 'desc'");
84172 #ifdef FREECIV_JSON_CONNECTION
84173 field_addr.name = "desc";
84174 #endif /* FREECIV_JSON_CONNECTION */
84175 if (!DIO_GET(string, &din, &field_addr, real_packet->desc, sizeof(real_packet->desc))) {
84176 RECEIVE_PACKET_FIELD_ERROR(desc);
84177 }
84178 }
84179 if (BV_ISSET(fields, 3)) {
84180 log_packet_detailed(" got field 'percent_required'");
84181 #ifdef FREECIV_JSON_CONNECTION
84182 field_addr.name = "percent_required";
84183 #endif /* FREECIV_JSON_CONNECTION */
84184 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->percent_required)) {
84185 RECEIVE_PACKET_FIELD_ERROR(percent_required);
84186 }
84187 }
84188 if (BV_ISSET(fields, 4)) {
84189 log_packet_detailed(" got field 'flags'");
84190 #ifdef FREECIV_JSON_CONNECTION
84191 field_addr.name = "flags";
84192 #endif /* FREECIV_JSON_CONNECTION */
84193 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->flags)) {
84194 RECEIVE_PACKET_FIELD_ERROR(flags);
84195 }
84196 }
84197
84198 if (NULL == old) {
84199 old = fc_malloc(sizeof(*old));
84200 *old = *real_packet;
84201 genhash_insert(*hash, old, old);
84202 } else {
84203 *old = *real_packet;
84204 }
84205
84206#endif /* FREECIV_DELTA_PROTOCOL */
84207 RECEIVE_PACKET_END(real_packet);
84208}
84209
84210 static int send_packet_vote_new_100(struct connection *pc, const struct packet_vote_new *packet)
84211{
84212 const struct packet_vote_new *real_packet = packet;
84213#ifdef FREECIV_DELTA_PROTOCOL
84214 packet_vote_new_100_fields fields;
84215 struct packet_vote_new *old;
84216 bool differ;
84217 struct genhash **hash = pc->phs.sent + PACKET_VOTE_NEW;
84218#endif /* FREECIV_DELTA_PROTOCOL */
84219 SEND_PACKET_START(PACKET_VOTE_NEW);
84220#ifdef FREECIV_JSON_CONNECTION
84221 struct plocation field_addr;
84222 {
84223 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84224 field_addr = *field_addr_tmp;
84225 FC_FREE(field_addr_tmp);
84226 }
84227#endif /* FREECIV_JSON_CONNECTION */
84228
84229 log_packet_detailed("packet_vote_new_100: sending info about ()");
84230
84231#ifdef FREECIV_DELTA_PROTOCOL
84232 if (NULL == *hash) {
84233 *hash = genhash_new_full(hash_packet_vote_new_100, cmp_packet_vote_new_100,
84234 NULL, NULL, NULL, free);
84235 }
84236 BV_CLR_ALL(fields);
84237
84238 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
84239 old = fc_malloc(sizeof(*old));
84240 *old = *real_packet;
84241 genhash_insert(*hash, old, old);
84242 memset(old, 0, sizeof(*old));
84243 }
84244 differ = (old->vote_no != real_packet->vote_no);
84245 if (differ) {
84246 BV_SET(fields, 0);
84247 }
84248
84249 differ = (strcmp(old->user, real_packet->user) != 0);
84250 if (differ) {
84251 BV_SET(fields, 1);
84252 }
84253
84254 differ = (strcmp(old->desc, real_packet->desc) != 0);
84255 if (differ) {
84256 BV_SET(fields, 2);
84257 }
84258
84259 differ = (old->percent_required != real_packet->percent_required);
84260 if (differ) {
84261 BV_SET(fields, 3);
84262 }
84263
84264 differ = (old->flags != real_packet->flags);
84265 if (differ) {
84266 BV_SET(fields, 4);
84267 }
84268
84269
84270#ifdef FREECIV_JSON_CONNECTION
84271 field_addr.name = "fields";
84272#endif /* FREECIV_JSON_CONNECTION */
84273 DIO_BV_PUT(&dout, &field_addr, fields);
84274
84275 if (BV_ISSET(fields, 0)) {
84276 log_packet_detailed(" field 'vote_no' has changed");
84277 #ifdef FREECIV_JSON_CONNECTION
84278 field_addr.name = "vote_no";
84279#endif /* FREECIV_JSON_CONNECTION */
84280 DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
84281 }
84282 if (BV_ISSET(fields, 1)) {
84283 log_packet_detailed(" field 'user' has changed");
84284 #ifdef FREECIV_JSON_CONNECTION
84285 field_addr.name = "user";
84286#endif /* FREECIV_JSON_CONNECTION */
84287 DIO_PUT(string, &dout, &field_addr, real_packet->user);
84288 }
84289 if (BV_ISSET(fields, 2)) {
84290 log_packet_detailed(" field 'desc' has changed");
84291 #ifdef FREECIV_JSON_CONNECTION
84292 field_addr.name = "desc";
84293#endif /* FREECIV_JSON_CONNECTION */
84294 DIO_PUT(string, &dout, &field_addr, real_packet->desc);
84295 }
84296 if (BV_ISSET(fields, 3)) {
84297 log_packet_detailed(" field 'percent_required' has changed");
84298 #ifdef FREECIV_JSON_CONNECTION
84299 field_addr.name = "percent_required";
84300#endif /* FREECIV_JSON_CONNECTION */
84301 DIO_PUT(uint8, &dout, &field_addr, real_packet->percent_required);
84302 }
84303 if (BV_ISSET(fields, 4)) {
84304 log_packet_detailed(" field 'flags' has changed");
84305 #ifdef FREECIV_JSON_CONNECTION
84306 field_addr.name = "flags";
84307#endif /* FREECIV_JSON_CONNECTION */
84308 DIO_PUT(uint32, &dout, &field_addr, real_packet->flags);
84309 }
84310
84311 *old = *real_packet;
84312#endif /* FREECIV_DELTA_PROTOCOL */
84313#ifndef FREECIV_DELTA_PROTOCOL
84314#ifdef FREECIV_JSON_CONNECTION
84315 field_addr.name = "vote_no";
84316#endif /* FREECIV_JSON_CONNECTION */
84317 DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
84318#ifdef FREECIV_JSON_CONNECTION
84319 field_addr.name = "user";
84320#endif /* FREECIV_JSON_CONNECTION */
84321 DIO_PUT(string, &dout, &field_addr, real_packet->user);
84322#ifdef FREECIV_JSON_CONNECTION
84323 field_addr.name = "desc";
84324#endif /* FREECIV_JSON_CONNECTION */
84325 DIO_PUT(string, &dout, &field_addr, real_packet->desc);
84326#ifdef FREECIV_JSON_CONNECTION
84327 field_addr.name = "percent_required";
84328#endif /* FREECIV_JSON_CONNECTION */
84329 DIO_PUT(uint8, &dout, &field_addr, real_packet->percent_required);
84330#ifdef FREECIV_JSON_CONNECTION
84331 field_addr.name = "flags";
84332#endif /* FREECIV_JSON_CONNECTION */
84333 DIO_PUT(uint32, &dout, &field_addr, real_packet->flags);
84334
84335#endif
84336 SEND_PACKET_END(PACKET_VOTE_NEW);
84337}
84338
84339 int send_packet_vote_new(struct connection *pc, const struct packet_vote_new *packet)
84340{
84341 if (!pc->used) {
84342 log_error("WARNING: trying to send data to the closed connection %s",
84343 conn_description(pc));
84344 return -1;
84345 }
84346 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_NEW].packet != NULL, -1,
84347 "Handler for PACKET_VOTE_NEW not installed");
84348 return pc->phs.handlers->send[PACKET_VOTE_NEW].packet(pc, packet);
84349}
84350
84351#ifdef FREECIV_DELTA_PROTOCOL
84352static genhash_val_t hash_packet_vote_update_100(const void *vkey)
84353{
84354 const struct packet_vote_update *key = (const struct packet_vote_update *) vkey;
84355
84356 return key->vote_no;
84357}
84358
84359static bool cmp_packet_vote_update_100(const void *vkey1, const void *vkey2)
84360{
84361 const struct packet_vote_update *key1 = (const struct packet_vote_update *) vkey1;
84362 const struct packet_vote_update *key2 = (const struct packet_vote_update *) vkey2;
84363
84364 return key1->vote_no == key2->vote_no;
84365}
84366 BV_DEFINE(packet_vote_update_100_fields, 4);
84367#endif /* FREECIV_DELTA_PROTOCOL */
84368
84369 static struct packet_vote_update *receive_packet_vote_update_100(struct connection *pc)
84370{
84371#ifdef FREECIV_DELTA_PROTOCOL
84372 packet_vote_update_100_fields fields;
84373 struct packet_vote_update *old;
84374 struct genhash **hash = pc->phs.received + PACKET_VOTE_UPDATE;
84375#endif /* FREECIV_DELTA_PROTOCOL */
84376 RECEIVE_PACKET_START(packet_vote_update, real_packet);
84377#ifdef FREECIV_JSON_CONNECTION
84378 struct plocation field_addr;
84379 {
84380 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84381 field_addr = *field_addr_tmp;
84382 FC_FREE(field_addr_tmp);
84383 }
84384#endif /* FREECIV_JSON_CONNECTION */
84385
84386#ifdef FREECIV_DELTA_PROTOCOL
84387#ifdef FREECIV_JSON_CONNECTION
84388 field_addr.name = "fields";
84389#endif /* FREECIV_JSON_CONNECTION */
84390 DIO_BV_GET(&din, &field_addr, fields);
84391 #ifdef FREECIV_JSON_CONNECTION
84392 field_addr.name = "vote_no";
84393 #endif /* FREECIV_JSON_CONNECTION */
84394 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
84395 RECEIVE_PACKET_FIELD_ERROR(vote_no);
84396 }
84397
84398#else /* FREECIV_DELTA_PROTOCOL */
84399 #ifdef FREECIV_JSON_CONNECTION
84400 field_addr.name = "vote_no";
84401 #endif /* FREECIV_JSON_CONNECTION */
84402 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
84403 RECEIVE_PACKET_FIELD_ERROR(vote_no);
84404 }
84405 #ifdef FREECIV_JSON_CONNECTION
84406 field_addr.name = "yes";
84407 #endif /* FREECIV_JSON_CONNECTION */
84408 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->yes)) {
84409 RECEIVE_PACKET_FIELD_ERROR(yes);
84410 }
84411 #ifdef FREECIV_JSON_CONNECTION
84412 field_addr.name = "no";
84413 #endif /* FREECIV_JSON_CONNECTION */
84414 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->no)) {
84415 RECEIVE_PACKET_FIELD_ERROR(no);
84416 }
84417 #ifdef FREECIV_JSON_CONNECTION
84418 field_addr.name = "abstain";
84419 #endif /* FREECIV_JSON_CONNECTION */
84420 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->abstain)) {
84421 RECEIVE_PACKET_FIELD_ERROR(abstain);
84422 }
84423 #ifdef FREECIV_JSON_CONNECTION
84424 field_addr.name = "num_voters";
84425 #endif /* FREECIV_JSON_CONNECTION */
84426 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num_voters)) {
84427 RECEIVE_PACKET_FIELD_ERROR(num_voters);
84428 }
84429
84430#endif
84431 log_packet_detailed("packet_vote_update_100: got info about (%d)",
84432 real_packet->vote_no);
84433
84434#ifdef FREECIV_DELTA_PROTOCOL
84435 if (NULL == *hash) {
84436 *hash = genhash_new_full(hash_packet_vote_update_100, cmp_packet_vote_update_100,
84437 NULL, NULL, NULL, free);
84438 }
84439
84440 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
84441 *real_packet = *old;
84442 } else {
84443 int vote_no = real_packet->vote_no;
84444
84445 log_packet_detailed(" no old info");
84446 memset(real_packet, 0, sizeof(*real_packet));
84447
84448 real_packet->vote_no = vote_no;
84449 }
84450
84451 if (BV_ISSET(fields, 0)) {
84452 log_packet_detailed(" got field 'yes'");
84453 #ifdef FREECIV_JSON_CONNECTION
84454 field_addr.name = "yes";
84455 #endif /* FREECIV_JSON_CONNECTION */
84456 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->yes)) {
84457 RECEIVE_PACKET_FIELD_ERROR(yes);
84458 }
84459 }
84460 if (BV_ISSET(fields, 1)) {
84461 log_packet_detailed(" got field 'no'");
84462 #ifdef FREECIV_JSON_CONNECTION
84463 field_addr.name = "no";
84464 #endif /* FREECIV_JSON_CONNECTION */
84465 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->no)) {
84466 RECEIVE_PACKET_FIELD_ERROR(no);
84467 }
84468 }
84469 if (BV_ISSET(fields, 2)) {
84470 log_packet_detailed(" got field 'abstain'");
84471 #ifdef FREECIV_JSON_CONNECTION
84472 field_addr.name = "abstain";
84473 #endif /* FREECIV_JSON_CONNECTION */
84474 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->abstain)) {
84475 RECEIVE_PACKET_FIELD_ERROR(abstain);
84476 }
84477 }
84478 if (BV_ISSET(fields, 3)) {
84479 log_packet_detailed(" got field 'num_voters'");
84480 #ifdef FREECIV_JSON_CONNECTION
84481 field_addr.name = "num_voters";
84482 #endif /* FREECIV_JSON_CONNECTION */
84483 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num_voters)) {
84484 RECEIVE_PACKET_FIELD_ERROR(num_voters);
84485 }
84486 }
84487
84488 if (NULL == old) {
84489 old = fc_malloc(sizeof(*old));
84490 *old = *real_packet;
84491 genhash_insert(*hash, old, old);
84492 } else {
84493 *old = *real_packet;
84494 }
84495
84496#endif /* FREECIV_DELTA_PROTOCOL */
84497 RECEIVE_PACKET_END(real_packet);
84498}
84499
84500 static int send_packet_vote_update_100(struct connection *pc, const struct packet_vote_update *packet)
84501{
84502 const struct packet_vote_update *real_packet = packet;
84503#ifdef FREECIV_DELTA_PROTOCOL
84504 packet_vote_update_100_fields fields;
84505 struct packet_vote_update *old;
84506 bool differ;
84507 struct genhash **hash = pc->phs.sent + PACKET_VOTE_UPDATE;
84508 int different = 0;
84509#endif /* FREECIV_DELTA_PROTOCOL */
84510 SEND_PACKET_START(PACKET_VOTE_UPDATE);
84511#ifdef FREECIV_JSON_CONNECTION
84512 struct plocation field_addr;
84513 {
84514 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84515 field_addr = *field_addr_tmp;
84516 FC_FREE(field_addr_tmp);
84517 }
84518#endif /* FREECIV_JSON_CONNECTION */
84519
84520 log_packet_detailed("packet_vote_update_100: sending info about (%d)",
84521 real_packet->vote_no);
84522
84523#ifdef FREECIV_DELTA_PROTOCOL
84524 if (NULL == *hash) {
84525 *hash = genhash_new_full(hash_packet_vote_update_100, cmp_packet_vote_update_100,
84526 NULL, NULL, NULL, free);
84527 }
84528 BV_CLR_ALL(fields);
84529
84530 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
84531 old = fc_malloc(sizeof(*old));
84532 *old = *real_packet;
84533 genhash_insert(*hash, old, old);
84534 memset(old, 0, sizeof(*old));
84535 different = 1; /* Force to send. */
84536 }
84537 differ = (old->yes != real_packet->yes);
84538 if (differ) {
84539 different++;
84540 BV_SET(fields, 0);
84541 }
84542
84543 differ = (old->no != real_packet->no);
84544 if (differ) {
84545 different++;
84546 BV_SET(fields, 1);
84547 }
84548
84549 differ = (old->abstain != real_packet->abstain);
84550 if (differ) {
84551 different++;
84552 BV_SET(fields, 2);
84553 }
84554
84555 differ = (old->num_voters != real_packet->num_voters);
84556 if (differ) {
84557 different++;
84558 BV_SET(fields, 3);
84559 }
84560
84561
84562 if (different == 0) {
84563 log_packet_detailed(" no change -> discard");
84564 return 0;
84565 }
84566
84567#ifdef FREECIV_JSON_CONNECTION
84568 field_addr.name = "fields";
84569#endif /* FREECIV_JSON_CONNECTION */
84570 DIO_BV_PUT(&dout, &field_addr, fields);
84571#ifdef FREECIV_JSON_CONNECTION
84572 field_addr.name = "vote_no";
84573#endif /* FREECIV_JSON_CONNECTION */
84574 DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
84575
84576 if (BV_ISSET(fields, 0)) {
84577 log_packet_detailed(" field 'yes' has changed");
84578 #ifdef FREECIV_JSON_CONNECTION
84579 field_addr.name = "yes";
84580#endif /* FREECIV_JSON_CONNECTION */
84581 DIO_PUT(uint8, &dout, &field_addr, real_packet->yes);
84582 }
84583 if (BV_ISSET(fields, 1)) {
84584 log_packet_detailed(" field 'no' has changed");
84585 #ifdef FREECIV_JSON_CONNECTION
84586 field_addr.name = "no";
84587#endif /* FREECIV_JSON_CONNECTION */
84588 DIO_PUT(uint8, &dout, &field_addr, real_packet->no);
84589 }
84590 if (BV_ISSET(fields, 2)) {
84591 log_packet_detailed(" field 'abstain' has changed");
84592 #ifdef FREECIV_JSON_CONNECTION
84593 field_addr.name = "abstain";
84594#endif /* FREECIV_JSON_CONNECTION */
84595 DIO_PUT(uint8, &dout, &field_addr, real_packet->abstain);
84596 }
84597 if (BV_ISSET(fields, 3)) {
84598 log_packet_detailed(" field 'num_voters' has changed");
84599 #ifdef FREECIV_JSON_CONNECTION
84600 field_addr.name = "num_voters";
84601#endif /* FREECIV_JSON_CONNECTION */
84602 DIO_PUT(uint8, &dout, &field_addr, real_packet->num_voters);
84603 }
84604
84605 *old = *real_packet;
84606#endif /* FREECIV_DELTA_PROTOCOL */
84607#ifndef FREECIV_DELTA_PROTOCOL
84608#ifdef FREECIV_JSON_CONNECTION
84609 field_addr.name = "vote_no";
84610#endif /* FREECIV_JSON_CONNECTION */
84611 DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
84612#ifdef FREECIV_JSON_CONNECTION
84613 field_addr.name = "yes";
84614#endif /* FREECIV_JSON_CONNECTION */
84615 DIO_PUT(uint8, &dout, &field_addr, real_packet->yes);
84616#ifdef FREECIV_JSON_CONNECTION
84617 field_addr.name = "no";
84618#endif /* FREECIV_JSON_CONNECTION */
84619 DIO_PUT(uint8, &dout, &field_addr, real_packet->no);
84620#ifdef FREECIV_JSON_CONNECTION
84621 field_addr.name = "abstain";
84622#endif /* FREECIV_JSON_CONNECTION */
84623 DIO_PUT(uint8, &dout, &field_addr, real_packet->abstain);
84624#ifdef FREECIV_JSON_CONNECTION
84625 field_addr.name = "num_voters";
84626#endif /* FREECIV_JSON_CONNECTION */
84627 DIO_PUT(uint8, &dout, &field_addr, real_packet->num_voters);
84628
84629#endif
84630 SEND_PACKET_END(PACKET_VOTE_UPDATE);
84631}
84632
84633 int send_packet_vote_update(struct connection *pc, const struct packet_vote_update *packet)
84634{
84635 if (!pc->used) {
84636 log_error("WARNING: trying to send data to the closed connection %s",
84637 conn_description(pc));
84638 return -1;
84639 }
84640 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_UPDATE].packet != NULL, -1,
84641 "Handler for PACKET_VOTE_UPDATE not installed");
84642 return pc->phs.handlers->send[PACKET_VOTE_UPDATE].packet(pc, packet);
84643}
84644
84645#ifdef FREECIV_DELTA_PROTOCOL
84646#define hash_packet_vote_remove_100 hash_const
84647
84648#define cmp_packet_vote_remove_100 cmp_const
84649
84650 BV_DEFINE(packet_vote_remove_100_fields, 1);
84651#endif /* FREECIV_DELTA_PROTOCOL */
84652
84653 static struct packet_vote_remove *receive_packet_vote_remove_100(struct connection *pc)
84654{
84655#ifdef FREECIV_DELTA_PROTOCOL
84656 packet_vote_remove_100_fields fields;
84657 struct packet_vote_remove *old;
84658 struct genhash **hash = pc->phs.received + PACKET_VOTE_REMOVE;
84659#endif /* FREECIV_DELTA_PROTOCOL */
84660 RECEIVE_PACKET_START(packet_vote_remove, real_packet);
84661#ifdef FREECIV_JSON_CONNECTION
84662 struct plocation field_addr;
84663 {
84664 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84665 field_addr = *field_addr_tmp;
84666 FC_FREE(field_addr_tmp);
84667 }
84668#endif /* FREECIV_JSON_CONNECTION */
84669
84670#ifdef FREECIV_DELTA_PROTOCOL
84671#ifdef FREECIV_JSON_CONNECTION
84672 field_addr.name = "fields";
84673#endif /* FREECIV_JSON_CONNECTION */
84674 DIO_BV_GET(&din, &field_addr, fields);
84675
84676#else /* FREECIV_DELTA_PROTOCOL */
84677 #ifdef FREECIV_JSON_CONNECTION
84678 field_addr.name = "vote_no";
84679 #endif /* FREECIV_JSON_CONNECTION */
84680 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
84681 RECEIVE_PACKET_FIELD_ERROR(vote_no);
84682 }
84683
84684#endif
84685 log_packet_detailed("packet_vote_remove_100: got info about ()");
84686
84687#ifdef FREECIV_DELTA_PROTOCOL
84688 if (NULL == *hash) {
84689 *hash = genhash_new_full(hash_packet_vote_remove_100, cmp_packet_vote_remove_100,
84690 NULL, NULL, NULL, free);
84691 }
84692
84693 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
84694 *real_packet = *old;
84695 } else {
84696 log_packet_detailed(" no old info");
84697 memset(real_packet, 0, sizeof(*real_packet));
84698 }
84699
84700 if (BV_ISSET(fields, 0)) {
84701 log_packet_detailed(" got field 'vote_no'");
84702 #ifdef FREECIV_JSON_CONNECTION
84703 field_addr.name = "vote_no";
84704 #endif /* FREECIV_JSON_CONNECTION */
84705 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
84706 RECEIVE_PACKET_FIELD_ERROR(vote_no);
84707 }
84708 }
84709
84710 if (NULL == old) {
84711 old = fc_malloc(sizeof(*old));
84712 *old = *real_packet;
84713 genhash_insert(*hash, old, old);
84714 } else {
84715 *old = *real_packet;
84716 }
84717
84718#endif /* FREECIV_DELTA_PROTOCOL */
84719 RECEIVE_PACKET_END(real_packet);
84720}
84721
84722 static int send_packet_vote_remove_100(struct connection *pc, const struct packet_vote_remove *packet)
84723{
84724 const struct packet_vote_remove *real_packet = packet;
84725#ifdef FREECIV_DELTA_PROTOCOL
84726 packet_vote_remove_100_fields fields;
84727 struct packet_vote_remove *old;
84728 bool differ;
84729 struct genhash **hash = pc->phs.sent + PACKET_VOTE_REMOVE;
84730#endif /* FREECIV_DELTA_PROTOCOL */
84731 SEND_PACKET_START(PACKET_VOTE_REMOVE);
84732#ifdef FREECIV_JSON_CONNECTION
84733 struct plocation field_addr;
84734 {
84735 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84736 field_addr = *field_addr_tmp;
84737 FC_FREE(field_addr_tmp);
84738 }
84739#endif /* FREECIV_JSON_CONNECTION */
84740
84741 log_packet_detailed("packet_vote_remove_100: sending info about ()");
84742
84743#ifdef FREECIV_DELTA_PROTOCOL
84744 if (NULL == *hash) {
84745 *hash = genhash_new_full(hash_packet_vote_remove_100, cmp_packet_vote_remove_100,
84746 NULL, NULL, NULL, free);
84747 }
84748 BV_CLR_ALL(fields);
84749
84750 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
84751 old = fc_malloc(sizeof(*old));
84752 *old = *real_packet;
84753 genhash_insert(*hash, old, old);
84754 memset(old, 0, sizeof(*old));
84755 }
84756 differ = (old->vote_no != real_packet->vote_no);
84757 if (differ) {
84758 BV_SET(fields, 0);
84759 }
84760
84761
84762#ifdef FREECIV_JSON_CONNECTION
84763 field_addr.name = "fields";
84764#endif /* FREECIV_JSON_CONNECTION */
84765 DIO_BV_PUT(&dout, &field_addr, fields);
84766
84767 if (BV_ISSET(fields, 0)) {
84768 log_packet_detailed(" field 'vote_no' has changed");
84769 #ifdef FREECIV_JSON_CONNECTION
84770 field_addr.name = "vote_no";
84771#endif /* FREECIV_JSON_CONNECTION */
84772 DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
84773 }
84774
84775 *old = *real_packet;
84776#endif /* FREECIV_DELTA_PROTOCOL */
84777#ifndef FREECIV_DELTA_PROTOCOL
84778#ifdef FREECIV_JSON_CONNECTION
84779 field_addr.name = "vote_no";
84780#endif /* FREECIV_JSON_CONNECTION */
84781 DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
84782
84783#endif
84784 SEND_PACKET_END(PACKET_VOTE_REMOVE);
84785}
84786
84787 int send_packet_vote_remove(struct connection *pc, const struct packet_vote_remove *packet)
84788{
84789 if (!pc->used) {
84790 log_error("WARNING: trying to send data to the closed connection %s",
84791 conn_description(pc));
84792 return -1;
84793 }
84794 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_REMOVE].packet != NULL, -1,
84795 "Handler for PACKET_VOTE_REMOVE not installed");
84796 return pc->phs.handlers->send[PACKET_VOTE_REMOVE].packet(pc, packet);
84797}
84798
84799#ifdef FREECIV_DELTA_PROTOCOL
84800#define hash_packet_vote_resolve_100 hash_const
84801
84802#define cmp_packet_vote_resolve_100 cmp_const
84803
84804 BV_DEFINE(packet_vote_resolve_100_fields, 2);
84805#endif /* FREECIV_DELTA_PROTOCOL */
84806
84807 static struct packet_vote_resolve *receive_packet_vote_resolve_100(struct connection *pc)
84808{
84809#ifdef FREECIV_DELTA_PROTOCOL
84810 packet_vote_resolve_100_fields fields;
84811 struct packet_vote_resolve *old;
84812 struct genhash **hash = pc->phs.received + PACKET_VOTE_RESOLVE;
84813#endif /* FREECIV_DELTA_PROTOCOL */
84814 RECEIVE_PACKET_START(packet_vote_resolve, real_packet);
84815#ifdef FREECIV_JSON_CONNECTION
84816 struct plocation field_addr;
84817 {
84818 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84819 field_addr = *field_addr_tmp;
84820 FC_FREE(field_addr_tmp);
84821 }
84822#endif /* FREECIV_JSON_CONNECTION */
84823
84824#ifdef FREECIV_DELTA_PROTOCOL
84825#ifdef FREECIV_JSON_CONNECTION
84826 field_addr.name = "fields";
84827#endif /* FREECIV_JSON_CONNECTION */
84828 DIO_BV_GET(&din, &field_addr, fields);
84829
84830#else /* FREECIV_DELTA_PROTOCOL */
84831 #ifdef FREECIV_JSON_CONNECTION
84832 field_addr.name = "vote_no";
84833 #endif /* FREECIV_JSON_CONNECTION */
84834 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
84835 RECEIVE_PACKET_FIELD_ERROR(vote_no);
84836 }
84837 #ifdef FREECIV_JSON_CONNECTION
84838 field_addr.name = "passed";
84839 #endif /* FREECIV_JSON_CONNECTION */
84840 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->passed)) {
84841 RECEIVE_PACKET_FIELD_ERROR(passed);
84842 }
84843
84844#endif
84845 log_packet_detailed("packet_vote_resolve_100: got info about ()");
84846
84847#ifdef FREECIV_DELTA_PROTOCOL
84848 if (NULL == *hash) {
84849 *hash = genhash_new_full(hash_packet_vote_resolve_100, cmp_packet_vote_resolve_100,
84850 NULL, NULL, NULL, free);
84851 }
84852
84853 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
84854 *real_packet = *old;
84855 } else {
84856 log_packet_detailed(" no old info");
84857 memset(real_packet, 0, sizeof(*real_packet));
84858 }
84859
84860 if (BV_ISSET(fields, 0)) {
84861 log_packet_detailed(" got field 'vote_no'");
84862 #ifdef FREECIV_JSON_CONNECTION
84863 field_addr.name = "vote_no";
84864 #endif /* FREECIV_JSON_CONNECTION */
84865 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
84866 RECEIVE_PACKET_FIELD_ERROR(vote_no);
84867 }
84868 }
84869 real_packet->passed = BV_ISSET(fields, 1);
84870
84871 if (NULL == old) {
84872 old = fc_malloc(sizeof(*old));
84873 *old = *real_packet;
84874 genhash_insert(*hash, old, old);
84875 } else {
84876 *old = *real_packet;
84877 }
84878
84879#endif /* FREECIV_DELTA_PROTOCOL */
84880 RECEIVE_PACKET_END(real_packet);
84881}
84882
84883 static int send_packet_vote_resolve_100(struct connection *pc, const struct packet_vote_resolve *packet)
84884{
84885 const struct packet_vote_resolve *real_packet = packet;
84886#ifdef FREECIV_DELTA_PROTOCOL
84887 packet_vote_resolve_100_fields fields;
84888 struct packet_vote_resolve *old;
84889 bool differ;
84890 struct genhash **hash = pc->phs.sent + PACKET_VOTE_RESOLVE;
84891#endif /* FREECIV_DELTA_PROTOCOL */
84892 SEND_PACKET_START(PACKET_VOTE_RESOLVE);
84893#ifdef FREECIV_JSON_CONNECTION
84894 struct plocation field_addr;
84895 {
84896 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84897 field_addr = *field_addr_tmp;
84898 FC_FREE(field_addr_tmp);
84899 }
84900#endif /* FREECIV_JSON_CONNECTION */
84901
84902 log_packet_detailed("packet_vote_resolve_100: sending info about ()");
84903
84904#ifdef FREECIV_DELTA_PROTOCOL
84905 if (NULL == *hash) {
84906 *hash = genhash_new_full(hash_packet_vote_resolve_100, cmp_packet_vote_resolve_100,
84907 NULL, NULL, NULL, free);
84908 }
84909 BV_CLR_ALL(fields);
84910
84911 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
84912 old = fc_malloc(sizeof(*old));
84913 *old = *real_packet;
84914 genhash_insert(*hash, old, old);
84915 memset(old, 0, sizeof(*old));
84916 }
84917 differ = (old->vote_no != real_packet->vote_no);
84918 if (differ) {
84919 BV_SET(fields, 0);
84920 }
84921
84922 if (packet->passed) {
84923 BV_SET(fields, 1);
84924 }
84925
84926
84927#ifdef FREECIV_JSON_CONNECTION
84928 field_addr.name = "fields";
84929#endif /* FREECIV_JSON_CONNECTION */
84930 DIO_BV_PUT(&dout, &field_addr, fields);
84931
84932 if (BV_ISSET(fields, 0)) {
84933 log_packet_detailed(" field 'vote_no' has changed");
84934 #ifdef FREECIV_JSON_CONNECTION
84935 field_addr.name = "vote_no";
84936#endif /* FREECIV_JSON_CONNECTION */
84937 DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
84938 }
84939 /* field 1 is folded into the header */
84940
84941 *old = *real_packet;
84942#endif /* FREECIV_DELTA_PROTOCOL */
84943#ifndef FREECIV_DELTA_PROTOCOL
84944#ifdef FREECIV_JSON_CONNECTION
84945 field_addr.name = "vote_no";
84946#endif /* FREECIV_JSON_CONNECTION */
84947 DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
84948#ifdef FREECIV_JSON_CONNECTION
84949 field_addr.name = "passed";
84950#endif /* FREECIV_JSON_CONNECTION */
84951 DIO_PUT(bool8, &dout, &field_addr, real_packet->passed);
84952
84953#endif
84954 SEND_PACKET_END(PACKET_VOTE_RESOLVE);
84955}
84956
84957 int send_packet_vote_resolve(struct connection *pc, const struct packet_vote_resolve *packet)
84958{
84959 if (!pc->used) {
84960 log_error("WARNING: trying to send data to the closed connection %s",
84961 conn_description(pc));
84962 return -1;
84963 }
84964 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_RESOLVE].packet != NULL, -1,
84965 "Handler for PACKET_VOTE_RESOLVE not installed");
84966 return pc->phs.handlers->send[PACKET_VOTE_RESOLVE].packet(pc, packet);
84967}
84968
84969 static struct packet_vote_submit *receive_packet_vote_submit_100(struct connection *pc)
84970{
84971 RECEIVE_PACKET_START(packet_vote_submit, real_packet);
84972#ifdef FREECIV_JSON_CONNECTION
84973 struct plocation field_addr;
84974 {
84975 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84976 field_addr = *field_addr_tmp;
84977 FC_FREE(field_addr_tmp);
84978 }
84979#endif /* FREECIV_JSON_CONNECTION */
84980#if 1 /* To match endif */
84981 #ifdef FREECIV_JSON_CONNECTION
84982 field_addr.name = "vote_no";
84983 #endif /* FREECIV_JSON_CONNECTION */
84984 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
84985 RECEIVE_PACKET_FIELD_ERROR(vote_no);
84986 }
84987 #ifdef FREECIV_JSON_CONNECTION
84988 field_addr.name = "value";
84989 #endif /* FREECIV_JSON_CONNECTION */
84990 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->value)) {
84991 RECEIVE_PACKET_FIELD_ERROR(value);
84992 }
84993
84994#endif
84995 log_packet_detailed("packet_vote_submit_100: got info about ()");
84996 RECEIVE_PACKET_END(real_packet);
84997}
84998
84999 static int send_packet_vote_submit_100(struct connection *pc, const struct packet_vote_submit *packet)
85000{
85001 const struct packet_vote_submit *real_packet = packet;
85002 SEND_PACKET_START(PACKET_VOTE_SUBMIT);
85003#ifdef FREECIV_JSON_CONNECTION
85004 struct plocation field_addr;
85005 {
85006 struct plocation *field_addr_tmp = plocation_field_new(NULL);
85007 field_addr = *field_addr_tmp;
85008 FC_FREE(field_addr_tmp);
85009 }
85010#endif /* FREECIV_JSON_CONNECTION */
85011
85012 log_packet_detailed("packet_vote_submit_100: sending info about ()");
85013#if 1 /* To match endif */
85014#ifdef FREECIV_JSON_CONNECTION
85015 field_addr.name = "vote_no";
85016#endif /* FREECIV_JSON_CONNECTION */
85017 DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
85018#ifdef FREECIV_JSON_CONNECTION
85019 field_addr.name = "value";
85020#endif /* FREECIV_JSON_CONNECTION */
85021 DIO_PUT(sint8, &dout, &field_addr, real_packet->value);
85022
85023#endif
85024 SEND_PACKET_END(PACKET_VOTE_SUBMIT);
85025}
85026
85027 int send_packet_vote_submit(struct connection *pc, const struct packet_vote_submit *packet)
85028{
85029 if (!pc->used) {
85030 log_error("WARNING: trying to send data to the closed connection %s",
85031 conn_description(pc));
85032 return -1;
85033 }
85034 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_SUBMIT].packet != NULL, -1,
85035 "Handler for PACKET_VOTE_SUBMIT not installed");
85036 return pc->phs.handlers->send[PACKET_VOTE_SUBMIT].packet(pc, packet);
85037}
85038
85039#ifdef FREECIV_DELTA_PROTOCOL
85040#define hash_packet_edit_mode_100 hash_const
85041
85042#define cmp_packet_edit_mode_100 cmp_const
85043
85044 BV_DEFINE(packet_edit_mode_100_fields, 1);
85045#endif /* FREECIV_DELTA_PROTOCOL */
85046
85047 static struct packet_edit_mode *receive_packet_edit_mode_100(struct connection *pc)
85048{
85049#ifdef FREECIV_DELTA_PROTOCOL
85050 packet_edit_mode_100_fields fields;
85051 struct packet_edit_mode *old;
85052 struct genhash **hash = pc->phs.received + PACKET_EDIT_MODE;
85053#endif /* FREECIV_DELTA_PROTOCOL */
85054 RECEIVE_PACKET_START(packet_edit_mode, real_packet);
85055#ifdef FREECIV_JSON_CONNECTION
85056 struct plocation field_addr;
85057 {
85058 struct plocation *field_addr_tmp = plocation_field_new(NULL);
85059 field_addr = *field_addr_tmp;
85060 FC_FREE(field_addr_tmp);
85061 }
85062#endif /* FREECIV_JSON_CONNECTION */
85063
85064#ifdef FREECIV_DELTA_PROTOCOL
85065#ifdef FREECIV_JSON_CONNECTION
85066 field_addr.name = "fields";
85067#endif /* FREECIV_JSON_CONNECTION */
85068 DIO_BV_GET(&din, &field_addr, fields);
85069
85070#else /* FREECIV_DELTA_PROTOCOL */
85071 #ifdef FREECIV_JSON_CONNECTION
85072 field_addr.name = "state";
85073 #endif /* FREECIV_JSON_CONNECTION */
85074 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->state)) {
85075 RECEIVE_PACKET_FIELD_ERROR(state);
85076 }
85077
85078#endif
85079 log_packet_detailed("packet_edit_mode_100: got info about ()");
85080
85081#ifdef FREECIV_DELTA_PROTOCOL
85082 if (NULL == *hash) {
85083 *hash = genhash_new_full(hash_packet_edit_mode_100, cmp_packet_edit_mode_100,
85084 NULL, NULL, NULL, free);
85085 }
85086
85087 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
85088 *real_packet = *old;
85089 } else {
85090 log_packet_detailed(" no old info");
85091 memset(real_packet, 0, sizeof(*real_packet));
85092 }
85093
85094 real_packet->state = BV_ISSET(fields, 0);
85095
85096 if (NULL == old) {
85097 old = fc_malloc(sizeof(*old));
85098 *old = *real_packet;
85099 genhash_insert(*hash, old, old);
85100 } else {
85101 *old = *real_packet;
85102 }
85103
85104#endif /* FREECIV_DELTA_PROTOCOL */
85105 RECEIVE_PACKET_END(real_packet);
85106}
85107
85108 static int send_packet_edit_mode_100(struct connection *pc, const struct packet_edit_mode *packet)
85109{
85110 const struct packet_edit_mode *real_packet = packet;
85111#ifdef FREECIV_DELTA_PROTOCOL
85112 packet_edit_mode_100_fields fields;
85113 struct packet_edit_mode *old;
85114 struct genhash **hash = pc->phs.sent + PACKET_EDIT_MODE;
85115#endif /* FREECIV_DELTA_PROTOCOL */
85116 SEND_PACKET_START(PACKET_EDIT_MODE);
85117#ifdef FREECIV_JSON_CONNECTION
85118 struct plocation field_addr;
85119 {
85120 struct plocation *field_addr_tmp = plocation_field_new(NULL);
85121 field_addr = *field_addr_tmp;
85122 FC_FREE(field_addr_tmp);
85123 }
85124#endif /* FREECIV_JSON_CONNECTION */
85125
85126 log_packet_detailed("packet_edit_mode_100: sending info about ()");
85127
85128#ifdef FREECIV_DELTA_PROTOCOL
85129 if (NULL == *hash) {
85130 *hash = genhash_new_full(hash_packet_edit_mode_100, cmp_packet_edit_mode_100,
85131 NULL, NULL, NULL, free);
85132 }
85133 BV_CLR_ALL(fields);
85134
85135 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
85136 old = fc_malloc(sizeof(*old));
85137 *old = *real_packet;
85138 genhash_insert(*hash, old, old);
85139 memset(old, 0, sizeof(*old));
85140 }
85141 if (packet->state) {
85142 BV_SET(fields, 0);
85143 }
85144
85145
85146#ifdef FREECIV_JSON_CONNECTION
85147 field_addr.name = "fields";
85148#endif /* FREECIV_JSON_CONNECTION */
85149 DIO_BV_PUT(&dout, &field_addr, fields);
85150
85151 /* field 0 is folded into the header */
85152
85153 *old = *real_packet;
85154#endif /* FREECIV_DELTA_PROTOCOL */
85155#ifndef FREECIV_DELTA_PROTOCOL
85156#ifdef FREECIV_JSON_CONNECTION
85157 field_addr.name = "state";
85158#endif /* FREECIV_JSON_CONNECTION */
85159 DIO_PUT(bool8, &dout, &field_addr, real_packet->state);
85160
85161#endif
85162 SEND_PACKET_END(PACKET_EDIT_MODE);
85163}
85164
85165 int send_packet_edit_mode(struct connection *pc, const struct packet_edit_mode *packet)
85166{
85167 if (!pc->used) {
85168 log_error("WARNING: trying to send data to the closed connection %s",
85169 conn_description(pc));
85170 return -1;
85171 }
85172 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_MODE].packet != NULL, -1,
85173 "Handler for PACKET_EDIT_MODE not installed");
85174 return pc->phs.handlers->send[PACKET_EDIT_MODE].packet(pc, packet);
85175}
85176
85177 int dsend_packet_edit_mode(struct connection *pc, bool state)
85178{
85179 struct packet_edit_mode packet, *real_packet = &packet;
85180
85181 real_packet->state = state;
85182
85183 return send_packet_edit_mode(pc, real_packet);
85184}
85185
85186 static struct packet_edit_recalculate_borders *receive_packet_edit_recalculate_borders_100(struct connection *pc)
85187{
85188 RECEIVE_PACKET_START(packet_edit_recalculate_borders, real_packet);
85189#if 1 /* To match endif */
85190 real_packet->__dummy = 0xff;
85191#endif
85192 log_packet_detailed("packet_edit_recalculate_borders_100: got info about ()");
85193 RECEIVE_PACKET_END(real_packet);
85194}
85195
85196 static int send_packet_edit_recalculate_borders_100(struct connection *pc)
85197{
85198 SEND_PACKET_START(PACKET_EDIT_RECALCULATE_BORDERS);
85199
85200 log_packet_detailed("packet_edit_recalculate_borders_100: sending info about ()");
85201 SEND_PACKET_END(PACKET_EDIT_RECALCULATE_BORDERS);
85202}
85203
85204 int send_packet_edit_recalculate_borders(struct connection *pc)
85205{
85206 if (!pc->used) {
85207 log_error("WARNING: trying to send data to the closed connection %s",
85208 conn_description(pc));
85209 return -1;
85210 }
85211 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_RECALCULATE_BORDERS].no_packet != NULL, -1,
85212 "Handler for PACKET_EDIT_RECALCULATE_BORDERS not installed");
85213 return pc->phs.handlers->send[PACKET_EDIT_RECALCULATE_BORDERS].no_packet(pc);
85214}
85215
85216 static struct packet_edit_check_tiles *receive_packet_edit_check_tiles_100(struct connection *pc)
85217{
85218 RECEIVE_PACKET_START(packet_edit_check_tiles, real_packet);
85219#if 1 /* To match endif */
85220 real_packet->__dummy = 0xff;
85221#endif
85222 log_packet_detailed("packet_edit_check_tiles_100: got info about ()");
85223 RECEIVE_PACKET_END(real_packet);
85224}
85225
85226 static int send_packet_edit_check_tiles_100(struct connection *pc)
85227{
85228 SEND_PACKET_START(PACKET_EDIT_CHECK_TILES);
85229
85230 log_packet_detailed("packet_edit_check_tiles_100: sending info about ()");
85231 SEND_PACKET_END(PACKET_EDIT_CHECK_TILES);
85232}
85233
85234 int send_packet_edit_check_tiles(struct connection *pc)
85235{
85236 if (!pc->used) {
85237 log_error("WARNING: trying to send data to the closed connection %s",
85238 conn_description(pc));
85239 return -1;
85240 }
85241 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_CHECK_TILES].no_packet != NULL, -1,
85242 "Handler for PACKET_EDIT_CHECK_TILES not installed");
85243 return pc->phs.handlers->send[PACKET_EDIT_CHECK_TILES].no_packet(pc);
85244}
85245
85246#ifdef FREECIV_DELTA_PROTOCOL
85247#define hash_packet_edit_toggle_fogofwar_100 hash_const
85248
85249#define cmp_packet_edit_toggle_fogofwar_100 cmp_const
85250
85251 BV_DEFINE(packet_edit_toggle_fogofwar_100_fields, 1);
85252#endif /* FREECIV_DELTA_PROTOCOL */
85253
85254 static struct packet_edit_toggle_fogofwar *receive_packet_edit_toggle_fogofwar_100(struct connection *pc)
85255{
85256#ifdef FREECIV_DELTA_PROTOCOL
85257 packet_edit_toggle_fogofwar_100_fields fields;
85258 struct packet_edit_toggle_fogofwar *old;
85259 struct genhash **hash = pc->phs.received + PACKET_EDIT_TOGGLE_FOGOFWAR;
85260#endif /* FREECIV_DELTA_PROTOCOL */
85261 RECEIVE_PACKET_START(packet_edit_toggle_fogofwar, real_packet);
85262#ifdef FREECIV_JSON_CONNECTION
85263 struct plocation field_addr;
85264 {
85265 struct plocation *field_addr_tmp = plocation_field_new(NULL);
85266 field_addr = *field_addr_tmp;
85267 FC_FREE(field_addr_tmp);
85268 }
85269#endif /* FREECIV_JSON_CONNECTION */
85270
85271#ifdef FREECIV_DELTA_PROTOCOL
85272#ifdef FREECIV_JSON_CONNECTION
85273 field_addr.name = "fields";
85274#endif /* FREECIV_JSON_CONNECTION */
85275 DIO_BV_GET(&din, &field_addr, fields);
85276
85277#else /* FREECIV_DELTA_PROTOCOL */
85278 #ifdef FREECIV_JSON_CONNECTION
85279 field_addr.name = "player";
85280 #endif /* FREECIV_JSON_CONNECTION */
85281 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player)) {
85282 RECEIVE_PACKET_FIELD_ERROR(player);
85283 }
85284
85285#endif
85286 log_packet_detailed("packet_edit_toggle_fogofwar_100: got info about ()");
85287
85288#ifdef FREECIV_DELTA_PROTOCOL
85289 if (NULL == *hash) {
85290 *hash = genhash_new_full(hash_packet_edit_toggle_fogofwar_100, cmp_packet_edit_toggle_fogofwar_100,
85291 NULL, NULL, NULL, free);
85292 }
85293
85294 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
85295 *real_packet = *old;
85296 } else {
85297 log_packet_detailed(" no old info");
85298 memset(real_packet, 0, sizeof(*real_packet));
85299 }
85300
85301 if (BV_ISSET(fields, 0)) {
85302 log_packet_detailed(" got field 'player'");
85303 #ifdef FREECIV_JSON_CONNECTION
85304 field_addr.name = "player";
85305 #endif /* FREECIV_JSON_CONNECTION */
85306 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player)) {
85307 RECEIVE_PACKET_FIELD_ERROR(player);
85308 }
85309 }
85310
85311 if (NULL == old) {
85312 old = fc_malloc(sizeof(*old));
85313 *old = *real_packet;
85314 genhash_insert(*hash, old, old);
85315 } else {
85316 *old = *real_packet;
85317 }
85318
85319#endif /* FREECIV_DELTA_PROTOCOL */
85320 RECEIVE_PACKET_END(real_packet);
85321}
85322
85323 static int send_packet_edit_toggle_fogofwar_100(struct connection *pc, const struct packet_edit_toggle_fogofwar *packet)
85324{
85325 const struct packet_edit_toggle_fogofwar *real_packet = packet;
85326#ifdef FREECIV_DELTA_PROTOCOL
85327 packet_edit_toggle_fogofwar_100_fields fields;
85328 struct packet_edit_toggle_fogofwar *old;
85329 bool differ;
85330 struct genhash **hash = pc->phs.sent + PACKET_EDIT_TOGGLE_FOGOFWAR;
85331#endif /* FREECIV_DELTA_PROTOCOL */
85332 SEND_PACKET_START(PACKET_EDIT_TOGGLE_FOGOFWAR);
85333#ifdef FREECIV_JSON_CONNECTION
85334 struct plocation field_addr;
85335 {
85336 struct plocation *field_addr_tmp = plocation_field_new(NULL);
85337 field_addr = *field_addr_tmp;
85338 FC_FREE(field_addr_tmp);
85339 }
85340#endif /* FREECIV_JSON_CONNECTION */
85341
85342 log_packet_detailed("packet_edit_toggle_fogofwar_100: sending info about ()");
85343
85344#ifdef FREECIV_DELTA_PROTOCOL
85345 if (NULL == *hash) {
85346 *hash = genhash_new_full(hash_packet_edit_toggle_fogofwar_100, cmp_packet_edit_toggle_fogofwar_100,
85347 NULL, NULL, NULL, free);
85348 }
85349 BV_CLR_ALL(fields);
85350
85351 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
85352 old = fc_malloc(sizeof(*old));
85353 *old = *real_packet;
85354 genhash_insert(*hash, old, old);
85355 memset(old, 0, sizeof(*old));
85356 }
85357 differ = (old->player != real_packet->player);
85358 if (differ) {
85359 BV_SET(fields, 0);
85360 }
85361
85362
85363#ifdef FREECIV_JSON_CONNECTION
85364 field_addr.name = "fields";
85365#endif /* FREECIV_JSON_CONNECTION */
85366 DIO_BV_PUT(&dout, &field_addr, fields);
85367
85368 if (BV_ISSET(fields, 0)) {
85369 log_packet_detailed(" field 'player' has changed");
85370 #ifdef FREECIV_JSON_CONNECTION
85371 field_addr.name = "player";
85372#endif /* FREECIV_JSON_CONNECTION */
85373 DIO_PUT(uint16, &dout, &field_addr, real_packet->player);
85374 }
85375
85376 *old = *real_packet;
85377#endif /* FREECIV_DELTA_PROTOCOL */
85378#ifndef FREECIV_DELTA_PROTOCOL
85379#ifdef FREECIV_JSON_CONNECTION
85380 field_addr.name = "player";
85381#endif /* FREECIV_JSON_CONNECTION */
85382 DIO_PUT(uint16, &dout, &field_addr, real_packet->player);
85383
85384#endif
85385 SEND_PACKET_END(PACKET_EDIT_TOGGLE_FOGOFWAR);
85386}
85387
85388 int send_packet_edit_toggle_fogofwar(struct connection *pc, const struct packet_edit_toggle_fogofwar *packet)
85389{
85390 if (!pc->used) {
85391 log_error("WARNING: trying to send data to the closed connection %s",
85392 conn_description(pc));
85393 return -1;
85394 }
85395 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_TOGGLE_FOGOFWAR].packet != NULL, -1,
85396 "Handler for PACKET_EDIT_TOGGLE_FOGOFWAR not installed");
85397 return pc->phs.handlers->send[PACKET_EDIT_TOGGLE_FOGOFWAR].packet(pc, packet);
85398}
85399
85400 int dsend_packet_edit_toggle_fogofwar(struct connection *pc, int player)
85401{
85402 struct packet_edit_toggle_fogofwar packet, *real_packet = &packet;
85403
85404 real_packet->player = player;
85405
85406 return send_packet_edit_toggle_fogofwar(pc, real_packet);
85407}
85408
85409#ifdef FREECIV_DELTA_PROTOCOL
85410static genhash_val_t hash_packet_edit_tile_terrain_100(const void *vkey)
85411{
85412 const struct packet_edit_tile_terrain *key = (const struct packet_edit_tile_terrain *) vkey;
85413
85414 return key->tile;
85415}
85416
85417static bool cmp_packet_edit_tile_terrain_100(const void *vkey1, const void *vkey2)
85418{
85419 const struct packet_edit_tile_terrain *key1 = (const struct packet_edit_tile_terrain *) vkey1;
85420 const struct packet_edit_tile_terrain *key2 = (const struct packet_edit_tile_terrain *) vkey2;
85421
85422 return key1->tile == key2->tile;
85423}
85424 BV_DEFINE(packet_edit_tile_terrain_100_fields, 2);
85425#endif /* FREECIV_DELTA_PROTOCOL */
85426
85427 static struct packet_edit_tile_terrain *receive_packet_edit_tile_terrain_100(struct connection *pc)
85428{
85429#ifdef FREECIV_DELTA_PROTOCOL
85430 packet_edit_tile_terrain_100_fields fields;
85431 struct packet_edit_tile_terrain *old;
85432 struct genhash **hash = pc->phs.received + PACKET_EDIT_TILE_TERRAIN;
85433#endif /* FREECIV_DELTA_PROTOCOL */
85434 RECEIVE_PACKET_START(packet_edit_tile_terrain, real_packet);
85435#ifdef FREECIV_JSON_CONNECTION
85436 struct plocation field_addr;
85437 {
85438 struct plocation *field_addr_tmp = plocation_field_new(NULL);
85439 field_addr = *field_addr_tmp;
85440 FC_FREE(field_addr_tmp);
85441 }
85442#endif /* FREECIV_JSON_CONNECTION */
85443
85444#ifdef FREECIV_DELTA_PROTOCOL
85445#ifdef FREECIV_JSON_CONNECTION
85446 field_addr.name = "fields";
85447#endif /* FREECIV_JSON_CONNECTION */
85448 DIO_BV_GET(&din, &field_addr, fields);
85449 #ifdef FREECIV_JSON_CONNECTION
85450 field_addr.name = "tile";
85451 #endif /* FREECIV_JSON_CONNECTION */
85452 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
85453 RECEIVE_PACKET_FIELD_ERROR(tile);
85454 }
85455
85456#else /* FREECIV_DELTA_PROTOCOL */
85457 #ifdef FREECIV_JSON_CONNECTION
85458 field_addr.name = "tile";
85459 #endif /* FREECIV_JSON_CONNECTION */
85460 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
85461 RECEIVE_PACKET_FIELD_ERROR(tile);
85462 }
85463 #ifdef FREECIV_JSON_CONNECTION
85464 field_addr.name = "terrain";
85465 #endif /* FREECIV_JSON_CONNECTION */
85466 {
85467 int readin;
85468
85469 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
85470 RECEIVE_PACKET_FIELD_ERROR(terrain);
85471 }
85472 real_packet->terrain = readin;
85473 }
85474 #ifdef FREECIV_JSON_CONNECTION
85475 field_addr.name = "size";
85476 #endif /* FREECIV_JSON_CONNECTION */
85477 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
85478 RECEIVE_PACKET_FIELD_ERROR(size);
85479 }
85480
85481#endif
85482 log_packet_detailed("packet_edit_tile_terrain_100: got info about (%d)",
85483 real_packet->tile);
85484
85485#ifdef FREECIV_DELTA_PROTOCOL
85486 if (NULL == *hash) {
85487 *hash = genhash_new_full(hash_packet_edit_tile_terrain_100, cmp_packet_edit_tile_terrain_100,
85488 NULL, NULL, NULL, free);
85489 }
85490
85491 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
85492 *real_packet = *old;
85493 } else {
85494 int tile = real_packet->tile;
85495
85496 log_packet_detailed(" no old info");
85497 memset(real_packet, 0, sizeof(*real_packet));
85498
85499 real_packet->tile = tile;
85500 }
85501
85502 if (BV_ISSET(fields, 0)) {
85503 log_packet_detailed(" got field 'terrain'");
85504 #ifdef FREECIV_JSON_CONNECTION
85505 field_addr.name = "terrain";
85506 #endif /* FREECIV_JSON_CONNECTION */
85507 {
85508 int readin;
85509
85510 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
85511 RECEIVE_PACKET_FIELD_ERROR(terrain);
85512 }
85513 real_packet->terrain = readin;
85514 }
85515 }
85516 if (BV_ISSET(fields, 1)) {
85517 log_packet_detailed(" got field 'size'");
85518 #ifdef FREECIV_JSON_CONNECTION
85519 field_addr.name = "size";
85520 #endif /* FREECIV_JSON_CONNECTION */
85521 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
85522 RECEIVE_PACKET_FIELD_ERROR(size);
85523 }
85524 }
85525
85526 if (NULL == old) {
85527 old = fc_malloc(sizeof(*old));
85528 *old = *real_packet;
85529 genhash_insert(*hash, old, old);
85530 } else {
85531 *old = *real_packet;
85532 }
85533
85534#endif /* FREECIV_DELTA_PROTOCOL */
85535 RECEIVE_PACKET_END(real_packet);
85536}
85537
85538 static int send_packet_edit_tile_terrain_100(struct connection *pc, const struct packet_edit_tile_terrain *packet)
85539{
85540 const struct packet_edit_tile_terrain *real_packet = packet;
85541#ifdef FREECIV_DELTA_PROTOCOL
85542 packet_edit_tile_terrain_100_fields fields;
85543 struct packet_edit_tile_terrain *old;
85544 bool differ;
85545 struct genhash **hash = pc->phs.sent + PACKET_EDIT_TILE_TERRAIN;
85546#endif /* FREECIV_DELTA_PROTOCOL */
85547 SEND_PACKET_START(PACKET_EDIT_TILE_TERRAIN);
85548#ifdef FREECIV_JSON_CONNECTION
85549 struct plocation field_addr;
85550 {
85551 struct plocation *field_addr_tmp = plocation_field_new(NULL);
85552 field_addr = *field_addr_tmp;
85553 FC_FREE(field_addr_tmp);
85554 }
85555#endif /* FREECIV_JSON_CONNECTION */
85556
85557 log_packet_detailed("packet_edit_tile_terrain_100: sending info about (%d)",
85558 real_packet->tile);
85559
85560#ifdef FREECIV_DELTA_PROTOCOL
85561 if (NULL == *hash) {
85562 *hash = genhash_new_full(hash_packet_edit_tile_terrain_100, cmp_packet_edit_tile_terrain_100,
85563 NULL, NULL, NULL, free);
85564 }
85565 BV_CLR_ALL(fields);
85566
85567 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
85568 old = fc_malloc(sizeof(*old));
85569 *old = *real_packet;
85570 genhash_insert(*hash, old, old);
85571 memset(old, 0, sizeof(*old));
85572 }
85573 differ = (old->terrain != real_packet->terrain);
85574 if (differ) {
85575 BV_SET(fields, 0);
85576 }
85577
85578 differ = (old->size != real_packet->size);
85579 if (differ) {
85580 BV_SET(fields, 1);
85581 }
85582
85583
85584#ifdef FREECIV_JSON_CONNECTION
85585 field_addr.name = "fields";
85586#endif /* FREECIV_JSON_CONNECTION */
85587 DIO_BV_PUT(&dout, &field_addr, fields);
85588#ifdef FREECIV_JSON_CONNECTION
85589 field_addr.name = "tile";
85590#endif /* FREECIV_JSON_CONNECTION */
85591 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
85592
85593 if (BV_ISSET(fields, 0)) {
85594 log_packet_detailed(" field 'terrain' has changed");
85595 #ifdef FREECIV_JSON_CONNECTION
85596 field_addr.name = "terrain";
85597#endif /* FREECIV_JSON_CONNECTION */
85598 DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
85599 }
85600 if (BV_ISSET(fields, 1)) {
85601 log_packet_detailed(" field 'size' has changed");
85602 #ifdef FREECIV_JSON_CONNECTION
85603 field_addr.name = "size";
85604#endif /* FREECIV_JSON_CONNECTION */
85605 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
85606 }
85607
85608 *old = *real_packet;
85609#endif /* FREECIV_DELTA_PROTOCOL */
85610#ifndef FREECIV_DELTA_PROTOCOL
85611#ifdef FREECIV_JSON_CONNECTION
85612 field_addr.name = "tile";
85613#endif /* FREECIV_JSON_CONNECTION */
85614 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
85615#ifdef FREECIV_JSON_CONNECTION
85616 field_addr.name = "terrain";
85617#endif /* FREECIV_JSON_CONNECTION */
85618 DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
85619#ifdef FREECIV_JSON_CONNECTION
85620 field_addr.name = "size";
85621#endif /* FREECIV_JSON_CONNECTION */
85622 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
85623
85624#endif
85625 SEND_PACKET_END(PACKET_EDIT_TILE_TERRAIN);
85626}
85627
85628 int send_packet_edit_tile_terrain(struct connection *pc, const struct packet_edit_tile_terrain *packet)
85629{
85630 if (!pc->used) {
85631 log_error("WARNING: trying to send data to the closed connection %s",
85632 conn_description(pc));
85633 return -1;
85634 }
85635 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_TILE_TERRAIN].packet != NULL, -1,
85636 "Handler for PACKET_EDIT_TILE_TERRAIN not installed");
85637 return pc->phs.handlers->send[PACKET_EDIT_TILE_TERRAIN].packet(pc, packet);
85638}
85639
85640 int dsend_packet_edit_tile_terrain(struct connection *pc, int tile, Terrain_type_id terrain, int size)
85641{
85642 struct packet_edit_tile_terrain packet, *real_packet = &packet;
85643
85644 real_packet->tile = tile;
85645 real_packet->terrain = terrain;
85646 real_packet->size = size;
85647
85648 return send_packet_edit_tile_terrain(pc, real_packet);
85649}
85650
85651#ifdef FREECIV_DELTA_PROTOCOL
85652static genhash_val_t hash_packet_edit_tile_extra_100(const void *vkey)
85653{
85654 const struct packet_edit_tile_extra *key = (const struct packet_edit_tile_extra *) vkey;
85655
85656 return key->tile;
85657}
85658
85659static bool cmp_packet_edit_tile_extra_100(const void *vkey1, const void *vkey2)
85660{
85661 const struct packet_edit_tile_extra *key1 = (const struct packet_edit_tile_extra *) vkey1;
85662 const struct packet_edit_tile_extra *key2 = (const struct packet_edit_tile_extra *) vkey2;
85663
85664 return key1->tile == key2->tile;
85665}
85666 BV_DEFINE(packet_edit_tile_extra_100_fields, 4);
85667#endif /* FREECIV_DELTA_PROTOCOL */
85668
85669 static struct packet_edit_tile_extra *receive_packet_edit_tile_extra_100(struct connection *pc)
85670{
85671#ifdef FREECIV_DELTA_PROTOCOL
85672 packet_edit_tile_extra_100_fields fields;
85673 struct packet_edit_tile_extra *old;
85674 struct genhash **hash = pc->phs.received + PACKET_EDIT_TILE_EXTRA;
85675#endif /* FREECIV_DELTA_PROTOCOL */
85676 RECEIVE_PACKET_START(packet_edit_tile_extra, real_packet);
85677#ifdef FREECIV_JSON_CONNECTION
85678 struct plocation field_addr;
85679 {
85680 struct plocation *field_addr_tmp = plocation_field_new(NULL);
85681 field_addr = *field_addr_tmp;
85682 FC_FREE(field_addr_tmp);
85683 }
85684#endif /* FREECIV_JSON_CONNECTION */
85685
85686#ifdef FREECIV_DELTA_PROTOCOL
85687#ifdef FREECIV_JSON_CONNECTION
85688 field_addr.name = "fields";
85689#endif /* FREECIV_JSON_CONNECTION */
85690 DIO_BV_GET(&din, &field_addr, fields);
85691 #ifdef FREECIV_JSON_CONNECTION
85692 field_addr.name = "tile";
85693 #endif /* FREECIV_JSON_CONNECTION */
85694 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
85695 RECEIVE_PACKET_FIELD_ERROR(tile);
85696 }
85697
85698#else /* FREECIV_DELTA_PROTOCOL */
85699 #ifdef FREECIV_JSON_CONNECTION
85700 field_addr.name = "tile";
85701 #endif /* FREECIV_JSON_CONNECTION */
85702 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
85703 RECEIVE_PACKET_FIELD_ERROR(tile);
85704 }
85705 #ifdef FREECIV_JSON_CONNECTION
85706 field_addr.name = "extra_type_id";
85707 #endif /* FREECIV_JSON_CONNECTION */
85708 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->extra_type_id)) {
85709 RECEIVE_PACKET_FIELD_ERROR(extra_type_id);
85710 }
85711 #ifdef FREECIV_JSON_CONNECTION
85712 field_addr.name = "removal";
85713 #endif /* FREECIV_JSON_CONNECTION */
85714 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->removal)) {
85715 RECEIVE_PACKET_FIELD_ERROR(removal);
85716 }
85717 #ifdef FREECIV_JSON_CONNECTION
85718 field_addr.name = "eowner";
85719 #endif /* FREECIV_JSON_CONNECTION */
85720 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->eowner)) {
85721 RECEIVE_PACKET_FIELD_ERROR(eowner);
85722 }
85723 #ifdef FREECIV_JSON_CONNECTION
85724 field_addr.name = "size";
85725 #endif /* FREECIV_JSON_CONNECTION */
85726 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
85727 RECEIVE_PACKET_FIELD_ERROR(size);
85728 }
85729
85730#endif
85731 log_packet_detailed("packet_edit_tile_extra_100: got info about (%d)",
85732 real_packet->tile);
85733
85734#ifdef FREECIV_DELTA_PROTOCOL
85735 if (NULL == *hash) {
85736 *hash = genhash_new_full(hash_packet_edit_tile_extra_100, cmp_packet_edit_tile_extra_100,
85737 NULL, NULL, NULL, free);
85738 }
85739
85740 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
85741 *real_packet = *old;
85742 } else {
85743 int tile = real_packet->tile;
85744
85745 log_packet_detailed(" no old info");
85746 memset(real_packet, 0, sizeof(*real_packet));
85747
85748 real_packet->tile = tile;
85749 }
85750
85751 if (BV_ISSET(fields, 0)) {
85752 log_packet_detailed(" got field 'extra_type_id'");
85753 #ifdef FREECIV_JSON_CONNECTION
85754 field_addr.name = "extra_type_id";
85755 #endif /* FREECIV_JSON_CONNECTION */
85756 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->extra_type_id)) {
85757 RECEIVE_PACKET_FIELD_ERROR(extra_type_id);
85758 }
85759 }
85760 real_packet->removal = BV_ISSET(fields, 1);
85761 if (BV_ISSET(fields, 2)) {
85762 log_packet_detailed(" got field 'eowner'");
85763 #ifdef FREECIV_JSON_CONNECTION
85764 field_addr.name = "eowner";
85765 #endif /* FREECIV_JSON_CONNECTION */
85766 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->eowner)) {
85767 RECEIVE_PACKET_FIELD_ERROR(eowner);
85768 }
85769 }
85770 if (BV_ISSET(fields, 3)) {
85771 log_packet_detailed(" got field 'size'");
85772 #ifdef FREECIV_JSON_CONNECTION
85773 field_addr.name = "size";
85774 #endif /* FREECIV_JSON_CONNECTION */
85775 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
85776 RECEIVE_PACKET_FIELD_ERROR(size);
85777 }
85778 }
85779
85780 if (NULL == old) {
85781 old = fc_malloc(sizeof(*old));
85782 *old = *real_packet;
85783 genhash_insert(*hash, old, old);
85784 } else {
85785 *old = *real_packet;
85786 }
85787
85788#endif /* FREECIV_DELTA_PROTOCOL */
85789 RECEIVE_PACKET_END(real_packet);
85790}
85791
85792 static int send_packet_edit_tile_extra_100(struct connection *pc, const struct packet_edit_tile_extra *packet)
85793{
85794 const struct packet_edit_tile_extra *real_packet = packet;
85795#ifdef FREECIV_DELTA_PROTOCOL
85796 packet_edit_tile_extra_100_fields fields;
85797 struct packet_edit_tile_extra *old;
85798 bool differ;
85799 struct genhash **hash = pc->phs.sent + PACKET_EDIT_TILE_EXTRA;
85800#endif /* FREECIV_DELTA_PROTOCOL */
85801 SEND_PACKET_START(PACKET_EDIT_TILE_EXTRA);
85802#ifdef FREECIV_JSON_CONNECTION
85803 struct plocation field_addr;
85804 {
85805 struct plocation *field_addr_tmp = plocation_field_new(NULL);
85806 field_addr = *field_addr_tmp;
85807 FC_FREE(field_addr_tmp);
85808 }
85809#endif /* FREECIV_JSON_CONNECTION */
85810
85811 log_packet_detailed("packet_edit_tile_extra_100: sending info about (%d)",
85812 real_packet->tile);
85813
85814#ifdef FREECIV_DELTA_PROTOCOL
85815 if (NULL == *hash) {
85816 *hash = genhash_new_full(hash_packet_edit_tile_extra_100, cmp_packet_edit_tile_extra_100,
85817 NULL, NULL, NULL, free);
85818 }
85819 BV_CLR_ALL(fields);
85820
85821 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
85822 old = fc_malloc(sizeof(*old));
85823 *old = *real_packet;
85824 genhash_insert(*hash, old, old);
85825 memset(old, 0, sizeof(*old));
85826 }
85827 differ = (old->extra_type_id != real_packet->extra_type_id);
85828 if (differ) {
85829 BV_SET(fields, 0);
85830 }
85831
85832 if (packet->removal) {
85833 BV_SET(fields, 1);
85834 }
85835
85836 differ = (old->eowner != real_packet->eowner);
85837 if (differ) {
85838 BV_SET(fields, 2);
85839 }
85840
85841 differ = (old->size != real_packet->size);
85842 if (differ) {
85843 BV_SET(fields, 3);
85844 }
85845
85846
85847#ifdef FREECIV_JSON_CONNECTION
85848 field_addr.name = "fields";
85849#endif /* FREECIV_JSON_CONNECTION */
85850 DIO_BV_PUT(&dout, &field_addr, fields);
85851#ifdef FREECIV_JSON_CONNECTION
85852 field_addr.name = "tile";
85853#endif /* FREECIV_JSON_CONNECTION */
85854 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
85855
85856 if (BV_ISSET(fields, 0)) {
85857 log_packet_detailed(" field 'extra_type_id' has changed");
85858 #ifdef FREECIV_JSON_CONNECTION
85859 field_addr.name = "extra_type_id";
85860#endif /* FREECIV_JSON_CONNECTION */
85861 DIO_PUT(sint8, &dout, &field_addr, real_packet->extra_type_id);
85862 }
85863 /* field 1 is folded into the header */
85864 if (BV_ISSET(fields, 2)) {
85865 log_packet_detailed(" field 'eowner' has changed");
85866 #ifdef FREECIV_JSON_CONNECTION
85867 field_addr.name = "eowner";
85868#endif /* FREECIV_JSON_CONNECTION */
85869 DIO_PUT(uint16, &dout, &field_addr, real_packet->eowner);
85870 }
85871 if (BV_ISSET(fields, 3)) {
85872 log_packet_detailed(" field 'size' has changed");
85873 #ifdef FREECIV_JSON_CONNECTION
85874 field_addr.name = "size";
85875#endif /* FREECIV_JSON_CONNECTION */
85876 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
85877 }
85878
85879 *old = *real_packet;
85880#endif /* FREECIV_DELTA_PROTOCOL */
85881#ifndef FREECIV_DELTA_PROTOCOL
85882#ifdef FREECIV_JSON_CONNECTION
85883 field_addr.name = "tile";
85884#endif /* FREECIV_JSON_CONNECTION */
85885 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
85886#ifdef FREECIV_JSON_CONNECTION
85887 field_addr.name = "extra_type_id";
85888#endif /* FREECIV_JSON_CONNECTION */
85889 DIO_PUT(sint8, &dout, &field_addr, real_packet->extra_type_id);
85890#ifdef FREECIV_JSON_CONNECTION
85891 field_addr.name = "removal";
85892#endif /* FREECIV_JSON_CONNECTION */
85893 DIO_PUT(bool8, &dout, &field_addr, real_packet->removal);
85894#ifdef FREECIV_JSON_CONNECTION
85895 field_addr.name = "eowner";
85896#endif /* FREECIV_JSON_CONNECTION */
85897 DIO_PUT(uint16, &dout, &field_addr, real_packet->eowner);
85898#ifdef FREECIV_JSON_CONNECTION
85899 field_addr.name = "size";
85900#endif /* FREECIV_JSON_CONNECTION */
85901 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
85902
85903#endif
85904 SEND_PACKET_END(PACKET_EDIT_TILE_EXTRA);
85905}
85906
85907 int send_packet_edit_tile_extra(struct connection *pc, const struct packet_edit_tile_extra *packet)
85908{
85909 if (!pc->used) {
85910 log_error("WARNING: trying to send data to the closed connection %s",
85911 conn_description(pc));
85912 return -1;
85913 }
85914 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_TILE_EXTRA].packet != NULL, -1,
85915 "Handler for PACKET_EDIT_TILE_EXTRA not installed");
85916 return pc->phs.handlers->send[PACKET_EDIT_TILE_EXTRA].packet(pc, packet);
85917}
85918
85919 int dsend_packet_edit_tile_extra(struct connection *pc, int tile, int extra_type_id, bool removal, int eowner, int size)
85920{
85921 struct packet_edit_tile_extra packet, *real_packet = &packet;
85922
85923 real_packet->tile = tile;
85924 real_packet->extra_type_id = extra_type_id;
85925 real_packet->removal = removal;
85926 real_packet->eowner = eowner;
85927 real_packet->size = size;
85928
85929 return send_packet_edit_tile_extra(pc, real_packet);
85930}
85931
85932 static struct packet_edit_startpos *receive_packet_edit_startpos_100(struct connection *pc)
85933{
85934 RECEIVE_PACKET_START(packet_edit_startpos, real_packet);
85935#ifdef FREECIV_JSON_CONNECTION
85936 struct plocation field_addr;
85937 {
85938 struct plocation *field_addr_tmp = plocation_field_new(NULL);
85939 field_addr = *field_addr_tmp;
85940 FC_FREE(field_addr_tmp);
85941 }
85942#endif /* FREECIV_JSON_CONNECTION */
85943#if 1 /* To match endif */
85944 #ifdef FREECIV_JSON_CONNECTION
85945 field_addr.name = "id";
85946 #endif /* FREECIV_JSON_CONNECTION */
85947 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->id)) {
85948 RECEIVE_PACKET_FIELD_ERROR(id);
85949 }
85950 #ifdef FREECIV_JSON_CONNECTION
85951 field_addr.name = "removal";
85952 #endif /* FREECIV_JSON_CONNECTION */
85953 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->removal)) {
85954 RECEIVE_PACKET_FIELD_ERROR(removal);
85955 }
85956 #ifdef FREECIV_JSON_CONNECTION
85957 field_addr.name = "tag";
85958 #endif /* FREECIV_JSON_CONNECTION */
85959 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
85960 RECEIVE_PACKET_FIELD_ERROR(tag);
85961 }
85962
85963#endif
85964 log_packet_detailed("packet_edit_startpos_100: got info about ()");
85965 RECEIVE_PACKET_END(real_packet);
85966}
85967
85968 static int send_packet_edit_startpos_100(struct connection *pc, const struct packet_edit_startpos *packet)
85969{
85970 const struct packet_edit_startpos *real_packet = packet;
85971 SEND_PACKET_START(PACKET_EDIT_STARTPOS);
85972#ifdef FREECIV_JSON_CONNECTION
85973 struct plocation field_addr;
85974 {
85975 struct plocation *field_addr_tmp = plocation_field_new(NULL);
85976 field_addr = *field_addr_tmp;
85977 FC_FREE(field_addr_tmp);
85978 }
85979#endif /* FREECIV_JSON_CONNECTION */
85980
85981 log_packet_detailed("packet_edit_startpos_100: sending info about ()");
85982#if 1 /* To match endif */
85983#ifdef FREECIV_JSON_CONNECTION
85984 field_addr.name = "id";
85985#endif /* FREECIV_JSON_CONNECTION */
85986 DIO_PUT(sint32, &dout, &field_addr, real_packet->id);
85987#ifdef FREECIV_JSON_CONNECTION
85988 field_addr.name = "removal";
85989#endif /* FREECIV_JSON_CONNECTION */
85990 DIO_PUT(bool8, &dout, &field_addr, real_packet->removal);
85991#ifdef FREECIV_JSON_CONNECTION
85992 field_addr.name = "tag";
85993#endif /* FREECIV_JSON_CONNECTION */
85994 DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
85995
85996#endif
85997 SEND_PACKET_END(PACKET_EDIT_STARTPOS);
85998}
85999
86000 int send_packet_edit_startpos(struct connection *pc, const struct packet_edit_startpos *packet)
86001{
86002 if (!pc->used) {
86003 log_error("WARNING: trying to send data to the closed connection %s",
86004 conn_description(pc));
86005 return -1;
86006 }
86007 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_STARTPOS].packet != NULL, -1,
86008 "Handler for PACKET_EDIT_STARTPOS not installed");
86009 return pc->phs.handlers->send[PACKET_EDIT_STARTPOS].packet(pc, packet);
86010}
86011
86012 int dsend_packet_edit_startpos(struct connection *pc, int id, bool removal, int tag)
86013{
86014 struct packet_edit_startpos packet, *real_packet = &packet;
86015
86016 real_packet->id = id;
86017 real_packet->removal = removal;
86018 real_packet->tag = tag;
86019
86020 return send_packet_edit_startpos(pc, real_packet);
86021}
86022
86023 static struct packet_edit_startpos_full *receive_packet_edit_startpos_full_100(struct connection *pc)
86024{
86025 RECEIVE_PACKET_START(packet_edit_startpos_full, real_packet);
86026#ifdef FREECIV_JSON_CONNECTION
86027 struct plocation field_addr;
86028 {
86029 struct plocation *field_addr_tmp = plocation_field_new(NULL);
86030 field_addr = *field_addr_tmp;
86031 FC_FREE(field_addr_tmp);
86032 }
86033#endif /* FREECIV_JSON_CONNECTION */
86034#if 1 /* To match endif */
86035 #ifdef FREECIV_JSON_CONNECTION
86036 field_addr.name = "id";
86037 #endif /* FREECIV_JSON_CONNECTION */
86038 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->id)) {
86039 RECEIVE_PACKET_FIELD_ERROR(id);
86040 }
86041 #ifdef FREECIV_JSON_CONNECTION
86042 field_addr.name = "exclude";
86043 #endif /* FREECIV_JSON_CONNECTION */
86044 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->exclude)) {
86045 RECEIVE_PACKET_FIELD_ERROR(exclude);
86046 }
86047 #ifdef FREECIV_JSON_CONNECTION
86048 field_addr.name = "nations";
86049 #endif /* FREECIV_JSON_CONNECTION */
86050 if (!DIO_BV_GET(&din, &field_addr, real_packet->nations)) {
86051 RECEIVE_PACKET_FIELD_ERROR(nations);
86052 }
86053
86054#endif
86055 log_packet_detailed("packet_edit_startpos_full_100: got info about ()");
86056 RECEIVE_PACKET_END(real_packet);
86057}
86058
86059 static int send_packet_edit_startpos_full_100(struct connection *pc, const struct packet_edit_startpos_full *packet)
86060{
86061 const struct packet_edit_startpos_full *real_packet = packet;
86062 SEND_PACKET_START(PACKET_EDIT_STARTPOS_FULL);
86063#ifdef FREECIV_JSON_CONNECTION
86064 struct plocation field_addr;
86065 {
86066 struct plocation *field_addr_tmp = plocation_field_new(NULL);
86067 field_addr = *field_addr_tmp;
86068 FC_FREE(field_addr_tmp);
86069 }
86070#endif /* FREECIV_JSON_CONNECTION */
86071
86072 log_packet_detailed("packet_edit_startpos_full_100: sending info about ()");
86073#if 1 /* To match endif */
86074#ifdef FREECIV_JSON_CONNECTION
86075 field_addr.name = "id";
86076#endif /* FREECIV_JSON_CONNECTION */
86077 DIO_PUT(sint32, &dout, &field_addr, real_packet->id);
86078#ifdef FREECIV_JSON_CONNECTION
86079 field_addr.name = "exclude";
86080#endif /* FREECIV_JSON_CONNECTION */
86081 DIO_PUT(bool8, &dout, &field_addr, real_packet->exclude);
86082#ifdef FREECIV_JSON_CONNECTION
86083 field_addr.name = "nations";
86084#endif /* FREECIV_JSON_CONNECTION */
86085 DIO_BV_PUT(&dout, &field_addr, packet->nations);
86086
86087#endif
86088 SEND_PACKET_END(PACKET_EDIT_STARTPOS_FULL);
86089}
86090
86091 int send_packet_edit_startpos_full(struct connection *pc, const struct packet_edit_startpos_full *packet)
86092{
86093 if (!pc->used) {
86094 log_error("WARNING: trying to send data to the closed connection %s",
86095 conn_description(pc));
86096 return -1;
86097 }
86098 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_STARTPOS_FULL].packet != NULL, -1,
86099 "Handler for PACKET_EDIT_STARTPOS_FULL not installed");
86100 return pc->phs.handlers->send[PACKET_EDIT_STARTPOS_FULL].packet(pc, packet);
86101}
86102
86103#ifdef FREECIV_DELTA_PROTOCOL
86104static genhash_val_t hash_packet_edit_tile_100(const void *vkey)
86105{
86106 const struct packet_edit_tile *key = (const struct packet_edit_tile *) vkey;
86107
86108 return key->tile;
86109}
86110
86111static bool cmp_packet_edit_tile_100(const void *vkey1, const void *vkey2)
86112{
86113 const struct packet_edit_tile *key1 = (const struct packet_edit_tile *) vkey1;
86114 const struct packet_edit_tile *key2 = (const struct packet_edit_tile *) vkey2;
86115
86116 return key1->tile == key2->tile;
86117}
86118 BV_DEFINE(packet_edit_tile_100_fields, 6);
86119#endif /* FREECIV_DELTA_PROTOCOL */
86120
86121 static struct packet_edit_tile *receive_packet_edit_tile_100(struct connection *pc)
86122{
86123#ifdef FREECIV_DELTA_PROTOCOL
86124 packet_edit_tile_100_fields fields;
86125 struct packet_edit_tile *old;
86126 struct genhash **hash = pc->phs.received + PACKET_EDIT_TILE;
86127#endif /* FREECIV_DELTA_PROTOCOL */
86128 RECEIVE_PACKET_START(packet_edit_tile, real_packet);
86129#ifdef FREECIV_JSON_CONNECTION
86130 struct plocation field_addr;
86131 {
86132 struct plocation *field_addr_tmp = plocation_field_new(NULL);
86133 field_addr = *field_addr_tmp;
86134 FC_FREE(field_addr_tmp);
86135 }
86136#endif /* FREECIV_JSON_CONNECTION */
86137
86138#ifdef FREECIV_DELTA_PROTOCOL
86139#ifdef FREECIV_JSON_CONNECTION
86140 field_addr.name = "fields";
86141#endif /* FREECIV_JSON_CONNECTION */
86142 DIO_BV_GET(&din, &field_addr, fields);
86143 #ifdef FREECIV_JSON_CONNECTION
86144 field_addr.name = "tile";
86145 #endif /* FREECIV_JSON_CONNECTION */
86146 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
86147 RECEIVE_PACKET_FIELD_ERROR(tile);
86148 }
86149
86150#else /* FREECIV_DELTA_PROTOCOL */
86151 #ifdef FREECIV_JSON_CONNECTION
86152 field_addr.name = "tile";
86153 #endif /* FREECIV_JSON_CONNECTION */
86154 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
86155 RECEIVE_PACKET_FIELD_ERROR(tile);
86156 }
86157 #ifdef FREECIV_JSON_CONNECTION
86158 field_addr.name = "extras";
86159 #endif /* FREECIV_JSON_CONNECTION */
86160 if (!DIO_BV_GET(&din, &field_addr, real_packet->extras)) {
86161 RECEIVE_PACKET_FIELD_ERROR(extras);
86162 }
86163 #ifdef FREECIV_JSON_CONNECTION
86164 field_addr.name = "resource";
86165 #endif /* FREECIV_JSON_CONNECTION */
86166 {
86167 int readin;
86168
86169 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
86170 RECEIVE_PACKET_FIELD_ERROR(resource);
86171 }
86172 real_packet->resource = readin;
86173 }
86174 #ifdef FREECIV_JSON_CONNECTION
86175 field_addr.name = "terrain";
86176 #endif /* FREECIV_JSON_CONNECTION */
86177 {
86178 int readin;
86179
86180 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
86181 RECEIVE_PACKET_FIELD_ERROR(terrain);
86182 }
86183 real_packet->terrain = readin;
86184 }
86185 #ifdef FREECIV_JSON_CONNECTION
86186 field_addr.name = "startpos_nation";
86187 #endif /* FREECIV_JSON_CONNECTION */
86188 {
86189 int readin;
86190
86191 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
86192 RECEIVE_PACKET_FIELD_ERROR(startpos_nation);
86193 }
86194 real_packet->startpos_nation = readin;
86195 }
86196 #ifdef FREECIV_JSON_CONNECTION
86197 field_addr.name = "eowner";
86198 #endif /* FREECIV_JSON_CONNECTION */
86199 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->eowner)) {
86200 RECEIVE_PACKET_FIELD_ERROR(eowner);
86201 }
86202 #ifdef FREECIV_JSON_CONNECTION
86203 field_addr.name = "label";
86204 #endif /* FREECIV_JSON_CONNECTION */
86205 if (!DIO_GET(string, &din, &field_addr, real_packet->label, sizeof(real_packet->label))) {
86206 RECEIVE_PACKET_FIELD_ERROR(label);
86207 }
86208
86209#endif
86210 log_packet_detailed("packet_edit_tile_100: got info about (%d)",
86211 real_packet->tile);
86212
86213#ifdef FREECIV_DELTA_PROTOCOL
86214 if (NULL == *hash) {
86215 *hash = genhash_new_full(hash_packet_edit_tile_100, cmp_packet_edit_tile_100,
86216 NULL, NULL, NULL, free);
86217 }
86218
86219 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
86220 *real_packet = *old;
86221 } else {
86222 int tile = real_packet->tile;
86223
86224 log_packet_detailed(" no old info");
86225 memset(real_packet, 0, sizeof(*real_packet));
86226
86227 real_packet->tile = tile;
86228 }
86229
86230 if (BV_ISSET(fields, 0)) {
86231 log_packet_detailed(" got field 'extras'");
86232 #ifdef FREECIV_JSON_CONNECTION
86233 field_addr.name = "extras";
86234 #endif /* FREECIV_JSON_CONNECTION */
86235 if (!DIO_BV_GET(&din, &field_addr, real_packet->extras)) {
86236 RECEIVE_PACKET_FIELD_ERROR(extras);
86237 }
86238 }
86239 if (BV_ISSET(fields, 1)) {
86240 log_packet_detailed(" got field 'resource'");
86241 #ifdef FREECIV_JSON_CONNECTION
86242 field_addr.name = "resource";
86243 #endif /* FREECIV_JSON_CONNECTION */
86244 {
86245 int readin;
86246
86247 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
86248 RECEIVE_PACKET_FIELD_ERROR(resource);
86249 }
86250 real_packet->resource = readin;
86251 }
86252 }
86253 if (BV_ISSET(fields, 2)) {
86254 log_packet_detailed(" got field 'terrain'");
86255 #ifdef FREECIV_JSON_CONNECTION
86256 field_addr.name = "terrain";
86257 #endif /* FREECIV_JSON_CONNECTION */
86258 {
86259 int readin;
86260
86261 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
86262 RECEIVE_PACKET_FIELD_ERROR(terrain);
86263 }
86264 real_packet->terrain = readin;
86265 }
86266 }
86267 if (BV_ISSET(fields, 3)) {
86268 log_packet_detailed(" got field 'startpos_nation'");
86269 #ifdef FREECIV_JSON_CONNECTION
86270 field_addr.name = "startpos_nation";
86271 #endif /* FREECIV_JSON_CONNECTION */
86272 {
86273 int readin;
86274
86275 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
86276 RECEIVE_PACKET_FIELD_ERROR(startpos_nation);
86277 }
86278 real_packet->startpos_nation = readin;
86279 }
86280 }
86281 if (BV_ISSET(fields, 4)) {
86282 log_packet_detailed(" got field 'eowner'");
86283 #ifdef FREECIV_JSON_CONNECTION
86284 field_addr.name = "eowner";
86285 #endif /* FREECIV_JSON_CONNECTION */
86286 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->eowner)) {
86287 RECEIVE_PACKET_FIELD_ERROR(eowner);
86288 }
86289 }
86290 if (BV_ISSET(fields, 5)) {
86291 log_packet_detailed(" got field 'label'");
86292 #ifdef FREECIV_JSON_CONNECTION
86293 field_addr.name = "label";
86294 #endif /* FREECIV_JSON_CONNECTION */
86295 if (!DIO_GET(string, &din, &field_addr, real_packet->label, sizeof(real_packet->label))) {
86296 RECEIVE_PACKET_FIELD_ERROR(label);
86297 }
86298 }
86299
86300 if (NULL == old) {
86301 old = fc_malloc(sizeof(*old));
86302 *old = *real_packet;
86303 genhash_insert(*hash, old, old);
86304 } else {
86305 *old = *real_packet;
86306 }
86307
86308#endif /* FREECIV_DELTA_PROTOCOL */
86309 RECEIVE_PACKET_END(real_packet);
86310}
86311
86312 static int send_packet_edit_tile_100(struct connection *pc, const struct packet_edit_tile *packet)
86313{
86314 const struct packet_edit_tile *real_packet = packet;
86315#ifdef FREECIV_DELTA_PROTOCOL
86316 packet_edit_tile_100_fields fields;
86317 struct packet_edit_tile *old;
86318 bool differ;
86319 struct genhash **hash = pc->phs.sent + PACKET_EDIT_TILE;
86320#endif /* FREECIV_DELTA_PROTOCOL */
86321 SEND_PACKET_START(PACKET_EDIT_TILE);
86322#ifdef FREECIV_JSON_CONNECTION
86323 struct plocation field_addr;
86324 {
86325 struct plocation *field_addr_tmp = plocation_field_new(NULL);
86326 field_addr = *field_addr_tmp;
86327 FC_FREE(field_addr_tmp);
86328 }
86329#endif /* FREECIV_JSON_CONNECTION */
86330
86331 log_packet_detailed("packet_edit_tile_100: sending info about (%d)",
86332 real_packet->tile);
86333
86334#ifdef FREECIV_DELTA_PROTOCOL
86335 if (NULL == *hash) {
86336 *hash = genhash_new_full(hash_packet_edit_tile_100, cmp_packet_edit_tile_100,
86337 NULL, NULL, NULL, free);
86338 }
86339 BV_CLR_ALL(fields);
86340
86341 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
86342 old = fc_malloc(sizeof(*old));
86343 *old = *real_packet;
86344 genhash_insert(*hash, old, old);
86345 memset(old, 0, sizeof(*old));
86346 }
86347 differ = !BV_ARE_EQUAL(old->extras, real_packet->extras);
86348 if (differ) {
86349 BV_SET(fields, 0);
86350 }
86351
86352 differ = (old->resource != real_packet->resource);
86353 if (differ) {
86354 BV_SET(fields, 1);
86355 }
86356
86357 differ = (old->terrain != real_packet->terrain);
86358 if (differ) {
86359 BV_SET(fields, 2);
86360 }
86361
86362 differ = (old->startpos_nation != real_packet->startpos_nation);
86363 if (differ) {
86364 BV_SET(fields, 3);
86365 }
86366
86367 differ = (old->eowner != real_packet->eowner);
86368 if (differ) {
86369 BV_SET(fields, 4);
86370 }
86371
86372 differ = (strcmp(old->label, real_packet->label) != 0);
86373 if (differ) {
86374 BV_SET(fields, 5);
86375 }
86376
86377
86378#ifdef FREECIV_JSON_CONNECTION
86379 field_addr.name = "fields";
86380#endif /* FREECIV_JSON_CONNECTION */
86381 DIO_BV_PUT(&dout, &field_addr, fields);
86382#ifdef FREECIV_JSON_CONNECTION
86383 field_addr.name = "tile";
86384#endif /* FREECIV_JSON_CONNECTION */
86385 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
86386
86387 if (BV_ISSET(fields, 0)) {
86388 log_packet_detailed(" field 'extras' has changed");
86389 #ifdef FREECIV_JSON_CONNECTION
86390 field_addr.name = "extras";
86391#endif /* FREECIV_JSON_CONNECTION */
86392 DIO_BV_PUT(&dout, &field_addr, packet->extras);
86393 }
86394 if (BV_ISSET(fields, 1)) {
86395 log_packet_detailed(" field 'resource' has changed");
86396 #ifdef FREECIV_JSON_CONNECTION
86397 field_addr.name = "resource";
86398#endif /* FREECIV_JSON_CONNECTION */
86399 DIO_PUT(uint8, &dout, &field_addr, real_packet->resource);
86400 }
86401 if (BV_ISSET(fields, 2)) {
86402 log_packet_detailed(" field 'terrain' has changed");
86403 #ifdef FREECIV_JSON_CONNECTION
86404 field_addr.name = "terrain";
86405#endif /* FREECIV_JSON_CONNECTION */
86406 DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
86407 }
86408 if (BV_ISSET(fields, 3)) {
86409 log_packet_detailed(" field 'startpos_nation' has changed");
86410 #ifdef FREECIV_JSON_CONNECTION
86411 field_addr.name = "startpos_nation";
86412#endif /* FREECIV_JSON_CONNECTION */
86413 DIO_PUT(sint16, &dout, &field_addr, real_packet->startpos_nation);
86414 }
86415 if (BV_ISSET(fields, 4)) {
86416 log_packet_detailed(" field 'eowner' has changed");
86417 #ifdef FREECIV_JSON_CONNECTION
86418 field_addr.name = "eowner";
86419#endif /* FREECIV_JSON_CONNECTION */
86420 DIO_PUT(uint16, &dout, &field_addr, real_packet->eowner);
86421 }
86422 if (BV_ISSET(fields, 5)) {
86423 log_packet_detailed(" field 'label' has changed");
86424 #ifdef FREECIV_JSON_CONNECTION
86425 field_addr.name = "label";
86426#endif /* FREECIV_JSON_CONNECTION */
86427 DIO_PUT(string, &dout, &field_addr, real_packet->label);
86428 }
86429
86430 *old = *real_packet;
86431#endif /* FREECIV_DELTA_PROTOCOL */
86432#ifndef FREECIV_DELTA_PROTOCOL
86433#ifdef FREECIV_JSON_CONNECTION
86434 field_addr.name = "tile";
86435#endif /* FREECIV_JSON_CONNECTION */
86436 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
86437#ifdef FREECIV_JSON_CONNECTION
86438 field_addr.name = "extras";
86439#endif /* FREECIV_JSON_CONNECTION */
86440 DIO_BV_PUT(&dout, &field_addr, packet->extras);
86441#ifdef FREECIV_JSON_CONNECTION
86442 field_addr.name = "resource";
86443#endif /* FREECIV_JSON_CONNECTION */
86444 DIO_PUT(uint8, &dout, &field_addr, real_packet->resource);
86445#ifdef FREECIV_JSON_CONNECTION
86446 field_addr.name = "terrain";
86447#endif /* FREECIV_JSON_CONNECTION */
86448 DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
86449#ifdef FREECIV_JSON_CONNECTION
86450 field_addr.name = "startpos_nation";
86451#endif /* FREECIV_JSON_CONNECTION */
86452 DIO_PUT(sint16, &dout, &field_addr, real_packet->startpos_nation);
86453#ifdef FREECIV_JSON_CONNECTION
86454 field_addr.name = "eowner";
86455#endif /* FREECIV_JSON_CONNECTION */
86456 DIO_PUT(uint16, &dout, &field_addr, real_packet->eowner);
86457#ifdef FREECIV_JSON_CONNECTION
86458 field_addr.name = "label";
86459#endif /* FREECIV_JSON_CONNECTION */
86460 DIO_PUT(string, &dout, &field_addr, real_packet->label);
86461
86462#endif
86463 SEND_PACKET_END(PACKET_EDIT_TILE);
86464}
86465
86466 int send_packet_edit_tile(struct connection *pc, const struct packet_edit_tile *packet)
86467{
86468 if (!pc->used) {
86469 log_error("WARNING: trying to send data to the closed connection %s",
86470 conn_description(pc));
86471 return -1;
86472 }
86473 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_TILE].packet != NULL, -1,
86474 "Handler for PACKET_EDIT_TILE not installed");
86475 return pc->phs.handlers->send[PACKET_EDIT_TILE].packet(pc, packet);
86476}
86477
86478#ifdef FREECIV_DELTA_PROTOCOL
86479#define hash_packet_edit_unit_create_100 hash_const
86480
86481#define cmp_packet_edit_unit_create_100 cmp_const
86482
86483 BV_DEFINE(packet_edit_unit_create_100_fields, 5);
86484#endif /* FREECIV_DELTA_PROTOCOL */
86485
86486 static struct packet_edit_unit_create *receive_packet_edit_unit_create_100(struct connection *pc)
86487{
86488#ifdef FREECIV_DELTA_PROTOCOL
86489 packet_edit_unit_create_100_fields fields;
86490 struct packet_edit_unit_create *old;
86491 struct genhash **hash = pc->phs.received + PACKET_EDIT_UNIT_CREATE;
86492#endif /* FREECIV_DELTA_PROTOCOL */
86493 RECEIVE_PACKET_START(packet_edit_unit_create, real_packet);
86494#ifdef FREECIV_JSON_CONNECTION
86495 struct plocation field_addr;
86496 {
86497 struct plocation *field_addr_tmp = plocation_field_new(NULL);
86498 field_addr = *field_addr_tmp;
86499 FC_FREE(field_addr_tmp);
86500 }
86501#endif /* FREECIV_JSON_CONNECTION */
86502
86503#ifdef FREECIV_DELTA_PROTOCOL
86504#ifdef FREECIV_JSON_CONNECTION
86505 field_addr.name = "fields";
86506#endif /* FREECIV_JSON_CONNECTION */
86507 DIO_BV_GET(&din, &field_addr, fields);
86508
86509#else /* FREECIV_DELTA_PROTOCOL */
86510 #ifdef FREECIV_JSON_CONNECTION
86511 field_addr.name = "owner";
86512 #endif /* FREECIV_JSON_CONNECTION */
86513 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
86514 RECEIVE_PACKET_FIELD_ERROR(owner);
86515 }
86516 #ifdef FREECIV_JSON_CONNECTION
86517 field_addr.name = "tile";
86518 #endif /* FREECIV_JSON_CONNECTION */
86519 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
86520 RECEIVE_PACKET_FIELD_ERROR(tile);
86521 }
86522 #ifdef FREECIV_JSON_CONNECTION
86523 field_addr.name = "type";
86524 #endif /* FREECIV_JSON_CONNECTION */
86525 {
86526 int readin;
86527
86528 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
86529 RECEIVE_PACKET_FIELD_ERROR(type);
86530 }
86531 real_packet->type = readin;
86532 }
86533 #ifdef FREECIV_JSON_CONNECTION
86534 field_addr.name = "count";
86535 #endif /* FREECIV_JSON_CONNECTION */
86536 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
86537 RECEIVE_PACKET_FIELD_ERROR(count);
86538 }
86539 #ifdef FREECIV_JSON_CONNECTION
86540 field_addr.name = "tag";
86541 #endif /* FREECIV_JSON_CONNECTION */
86542 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
86543 RECEIVE_PACKET_FIELD_ERROR(tag);
86544 }
86545
86546#endif
86547 log_packet_detailed("packet_edit_unit_create_100: got info about ()");
86548
86549#ifdef FREECIV_DELTA_PROTOCOL
86550 if (NULL == *hash) {
86551 *hash = genhash_new_full(hash_packet_edit_unit_create_100, cmp_packet_edit_unit_create_100,
86552 NULL, NULL, NULL, free);
86553 }
86554
86555 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
86556 *real_packet = *old;
86557 } else {
86558 log_packet_detailed(" no old info");
86559 memset(real_packet, 0, sizeof(*real_packet));
86560 }
86561
86562 if (BV_ISSET(fields, 0)) {
86563 log_packet_detailed(" got field 'owner'");
86564 #ifdef FREECIV_JSON_CONNECTION
86565 field_addr.name = "owner";
86566 #endif /* FREECIV_JSON_CONNECTION */
86567 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
86568 RECEIVE_PACKET_FIELD_ERROR(owner);
86569 }
86570 }
86571 if (BV_ISSET(fields, 1)) {
86572 log_packet_detailed(" got field 'tile'");
86573 #ifdef FREECIV_JSON_CONNECTION
86574 field_addr.name = "tile";
86575 #endif /* FREECIV_JSON_CONNECTION */
86576 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
86577 RECEIVE_PACKET_FIELD_ERROR(tile);
86578 }
86579 }
86580 if (BV_ISSET(fields, 2)) {
86581 log_packet_detailed(" got field 'type'");
86582 #ifdef FREECIV_JSON_CONNECTION
86583 field_addr.name = "type";
86584 #endif /* FREECIV_JSON_CONNECTION */
86585 {
86586 int readin;
86587
86588 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
86589 RECEIVE_PACKET_FIELD_ERROR(type);
86590 }
86591 real_packet->type = readin;
86592 }
86593 }
86594 if (BV_ISSET(fields, 3)) {
86595 log_packet_detailed(" got field 'count'");
86596 #ifdef FREECIV_JSON_CONNECTION
86597 field_addr.name = "count";
86598 #endif /* FREECIV_JSON_CONNECTION */
86599 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
86600 RECEIVE_PACKET_FIELD_ERROR(count);
86601 }
86602 }
86603 if (BV_ISSET(fields, 4)) {
86604 log_packet_detailed(" got field 'tag'");
86605 #ifdef FREECIV_JSON_CONNECTION
86606 field_addr.name = "tag";
86607 #endif /* FREECIV_JSON_CONNECTION */
86608 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
86609 RECEIVE_PACKET_FIELD_ERROR(tag);
86610 }
86611 }
86612
86613 if (NULL == old) {
86614 old = fc_malloc(sizeof(*old));
86615 *old = *real_packet;
86616 genhash_insert(*hash, old, old);
86617 } else {
86618 *old = *real_packet;
86619 }
86620
86621#endif /* FREECIV_DELTA_PROTOCOL */
86622 RECEIVE_PACKET_END(real_packet);
86623}
86624
86625 static int send_packet_edit_unit_create_100(struct connection *pc, const struct packet_edit_unit_create *packet)
86626{
86627 const struct packet_edit_unit_create *real_packet = packet;
86628#ifdef FREECIV_DELTA_PROTOCOL
86629 packet_edit_unit_create_100_fields fields;
86630 struct packet_edit_unit_create *old;
86631 bool differ;
86632 struct genhash **hash = pc->phs.sent + PACKET_EDIT_UNIT_CREATE;
86633#endif /* FREECIV_DELTA_PROTOCOL */
86634 SEND_PACKET_START(PACKET_EDIT_UNIT_CREATE);
86635#ifdef FREECIV_JSON_CONNECTION
86636 struct plocation field_addr;
86637 {
86638 struct plocation *field_addr_tmp = plocation_field_new(NULL);
86639 field_addr = *field_addr_tmp;
86640 FC_FREE(field_addr_tmp);
86641 }
86642#endif /* FREECIV_JSON_CONNECTION */
86643
86644 log_packet_detailed("packet_edit_unit_create_100: sending info about ()");
86645
86646#ifdef FREECIV_DELTA_PROTOCOL
86647 if (NULL == *hash) {
86648 *hash = genhash_new_full(hash_packet_edit_unit_create_100, cmp_packet_edit_unit_create_100,
86649 NULL, NULL, NULL, free);
86650 }
86651 BV_CLR_ALL(fields);
86652
86653 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
86654 old = fc_malloc(sizeof(*old));
86655 *old = *real_packet;
86656 genhash_insert(*hash, old, old);
86657 memset(old, 0, sizeof(*old));
86658 }
86659 differ = (old->owner != real_packet->owner);
86660 if (differ) {
86661 BV_SET(fields, 0);
86662 }
86663
86664 differ = (old->tile != real_packet->tile);
86665 if (differ) {
86666 BV_SET(fields, 1);
86667 }
86668
86669 differ = (old->type != real_packet->type);
86670 if (differ) {
86671 BV_SET(fields, 2);
86672 }
86673
86674 differ = (old->count != real_packet->count);
86675 if (differ) {
86676 BV_SET(fields, 3);
86677 }
86678
86679 differ = (old->tag != real_packet->tag);
86680 if (differ) {
86681 BV_SET(fields, 4);
86682 }
86683
86684
86685#ifdef FREECIV_JSON_CONNECTION
86686 field_addr.name = "fields";
86687#endif /* FREECIV_JSON_CONNECTION */
86688 DIO_BV_PUT(&dout, &field_addr, fields);
86689
86690 if (BV_ISSET(fields, 0)) {
86691 log_packet_detailed(" field 'owner' has changed");
86692 #ifdef FREECIV_JSON_CONNECTION
86693 field_addr.name = "owner";
86694#endif /* FREECIV_JSON_CONNECTION */
86695 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
86696 }
86697 if (BV_ISSET(fields, 1)) {
86698 log_packet_detailed(" field 'tile' has changed");
86699 #ifdef FREECIV_JSON_CONNECTION
86700 field_addr.name = "tile";
86701#endif /* FREECIV_JSON_CONNECTION */
86702 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
86703 }
86704 if (BV_ISSET(fields, 2)) {
86705 log_packet_detailed(" field 'type' has changed");
86706 #ifdef FREECIV_JSON_CONNECTION
86707 field_addr.name = "type";
86708#endif /* FREECIV_JSON_CONNECTION */
86709 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
86710 }
86711 if (BV_ISSET(fields, 3)) {
86712 log_packet_detailed(" field 'count' has changed");
86713 #ifdef FREECIV_JSON_CONNECTION
86714 field_addr.name = "count";
86715#endif /* FREECIV_JSON_CONNECTION */
86716 DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
86717 }
86718 if (BV_ISSET(fields, 4)) {
86719 log_packet_detailed(" field 'tag' has changed");
86720 #ifdef FREECIV_JSON_CONNECTION
86721 field_addr.name = "tag";
86722#endif /* FREECIV_JSON_CONNECTION */
86723 DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
86724 }
86725
86726 *old = *real_packet;
86727#endif /* FREECIV_DELTA_PROTOCOL */
86728#ifndef FREECIV_DELTA_PROTOCOL
86729#ifdef FREECIV_JSON_CONNECTION
86730 field_addr.name = "owner";
86731#endif /* FREECIV_JSON_CONNECTION */
86732 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
86733#ifdef FREECIV_JSON_CONNECTION
86734 field_addr.name = "tile";
86735#endif /* FREECIV_JSON_CONNECTION */
86736 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
86737#ifdef FREECIV_JSON_CONNECTION
86738 field_addr.name = "type";
86739#endif /* FREECIV_JSON_CONNECTION */
86740 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
86741#ifdef FREECIV_JSON_CONNECTION
86742 field_addr.name = "count";
86743#endif /* FREECIV_JSON_CONNECTION */
86744 DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
86745#ifdef FREECIV_JSON_CONNECTION
86746 field_addr.name = "tag";
86747#endif /* FREECIV_JSON_CONNECTION */
86748 DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
86749
86750#endif
86751 SEND_PACKET_END(PACKET_EDIT_UNIT_CREATE);
86752}
86753
86754 int send_packet_edit_unit_create(struct connection *pc, const struct packet_edit_unit_create *packet)
86755{
86756 if (!pc->used) {
86757 log_error("WARNING: trying to send data to the closed connection %s",
86758 conn_description(pc));
86759 return -1;
86760 }
86761 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_UNIT_CREATE].packet != NULL, -1,
86762 "Handler for PACKET_EDIT_UNIT_CREATE not installed");
86763 return pc->phs.handlers->send[PACKET_EDIT_UNIT_CREATE].packet(pc, packet);
86764}
86765
86766 int dsend_packet_edit_unit_create(struct connection *pc, int owner, int tile, Unit_type_id type, int count, int tag)
86767{
86768 struct packet_edit_unit_create packet, *real_packet = &packet;
86769
86770 real_packet->owner = owner;
86771 real_packet->tile = tile;
86772 real_packet->type = type;
86773 real_packet->count = count;
86774 real_packet->tag = tag;
86775
86776 return send_packet_edit_unit_create(pc, real_packet);
86777}
86778
86779#ifdef FREECIV_DELTA_PROTOCOL
86780#define hash_packet_edit_unit_remove_100 hash_const
86781
86782#define cmp_packet_edit_unit_remove_100 cmp_const
86783
86784 BV_DEFINE(packet_edit_unit_remove_100_fields, 4);
86785#endif /* FREECIV_DELTA_PROTOCOL */
86786
86787 static struct packet_edit_unit_remove *receive_packet_edit_unit_remove_100(struct connection *pc)
86788{
86789#ifdef FREECIV_DELTA_PROTOCOL
86790 packet_edit_unit_remove_100_fields fields;
86791 struct packet_edit_unit_remove *old;
86792 struct genhash **hash = pc->phs.received + PACKET_EDIT_UNIT_REMOVE;
86793#endif /* FREECIV_DELTA_PROTOCOL */
86794 RECEIVE_PACKET_START(packet_edit_unit_remove, real_packet);
86795#ifdef FREECIV_JSON_CONNECTION
86796 struct plocation field_addr;
86797 {
86798 struct plocation *field_addr_tmp = plocation_field_new(NULL);
86799 field_addr = *field_addr_tmp;
86800 FC_FREE(field_addr_tmp);
86801 }
86802#endif /* FREECIV_JSON_CONNECTION */
86803
86804#ifdef FREECIV_DELTA_PROTOCOL
86805#ifdef FREECIV_JSON_CONNECTION
86806 field_addr.name = "fields";
86807#endif /* FREECIV_JSON_CONNECTION */
86808 DIO_BV_GET(&din, &field_addr, fields);
86809
86810#else /* FREECIV_DELTA_PROTOCOL */
86811 #ifdef FREECIV_JSON_CONNECTION
86812 field_addr.name = "owner";
86813 #endif /* FREECIV_JSON_CONNECTION */
86814 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
86815 RECEIVE_PACKET_FIELD_ERROR(owner);
86816 }
86817 #ifdef FREECIV_JSON_CONNECTION
86818 field_addr.name = "tile";
86819 #endif /* FREECIV_JSON_CONNECTION */
86820 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
86821 RECEIVE_PACKET_FIELD_ERROR(tile);
86822 }
86823 #ifdef FREECIV_JSON_CONNECTION
86824 field_addr.name = "type";
86825 #endif /* FREECIV_JSON_CONNECTION */
86826 {
86827 int readin;
86828
86829 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
86830 RECEIVE_PACKET_FIELD_ERROR(type);
86831 }
86832 real_packet->type = readin;
86833 }
86834 #ifdef FREECIV_JSON_CONNECTION
86835 field_addr.name = "count";
86836 #endif /* FREECIV_JSON_CONNECTION */
86837 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
86838 RECEIVE_PACKET_FIELD_ERROR(count);
86839 }
86840
86841#endif
86842 log_packet_detailed("packet_edit_unit_remove_100: got info about ()");
86843
86844#ifdef FREECIV_DELTA_PROTOCOL
86845 if (NULL == *hash) {
86846 *hash = genhash_new_full(hash_packet_edit_unit_remove_100, cmp_packet_edit_unit_remove_100,
86847 NULL, NULL, NULL, free);
86848 }
86849
86850 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
86851 *real_packet = *old;
86852 } else {
86853 log_packet_detailed(" no old info");
86854 memset(real_packet, 0, sizeof(*real_packet));
86855 }
86856
86857 if (BV_ISSET(fields, 0)) {
86858 log_packet_detailed(" got field 'owner'");
86859 #ifdef FREECIV_JSON_CONNECTION
86860 field_addr.name = "owner";
86861 #endif /* FREECIV_JSON_CONNECTION */
86862 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
86863 RECEIVE_PACKET_FIELD_ERROR(owner);
86864 }
86865 }
86866 if (BV_ISSET(fields, 1)) {
86867 log_packet_detailed(" got field 'tile'");
86868 #ifdef FREECIV_JSON_CONNECTION
86869 field_addr.name = "tile";
86870 #endif /* FREECIV_JSON_CONNECTION */
86871 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
86872 RECEIVE_PACKET_FIELD_ERROR(tile);
86873 }
86874 }
86875 if (BV_ISSET(fields, 2)) {
86876 log_packet_detailed(" got field 'type'");
86877 #ifdef FREECIV_JSON_CONNECTION
86878 field_addr.name = "type";
86879 #endif /* FREECIV_JSON_CONNECTION */
86880 {
86881 int readin;
86882
86883 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
86884 RECEIVE_PACKET_FIELD_ERROR(type);
86885 }
86886 real_packet->type = readin;
86887 }
86888 }
86889 if (BV_ISSET(fields, 3)) {
86890 log_packet_detailed(" got field 'count'");
86891 #ifdef FREECIV_JSON_CONNECTION
86892 field_addr.name = "count";
86893 #endif /* FREECIV_JSON_CONNECTION */
86894 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
86895 RECEIVE_PACKET_FIELD_ERROR(count);
86896 }
86897 }
86898
86899 if (NULL == old) {
86900 old = fc_malloc(sizeof(*old));
86901 *old = *real_packet;
86902 genhash_insert(*hash, old, old);
86903 } else {
86904 *old = *real_packet;
86905 }
86906
86907#endif /* FREECIV_DELTA_PROTOCOL */
86908 RECEIVE_PACKET_END(real_packet);
86909}
86910
86911 static int send_packet_edit_unit_remove_100(struct connection *pc, const struct packet_edit_unit_remove *packet)
86912{
86913 const struct packet_edit_unit_remove *real_packet = packet;
86914#ifdef FREECIV_DELTA_PROTOCOL
86915 packet_edit_unit_remove_100_fields fields;
86916 struct packet_edit_unit_remove *old;
86917 bool differ;
86918 struct genhash **hash = pc->phs.sent + PACKET_EDIT_UNIT_REMOVE;
86919#endif /* FREECIV_DELTA_PROTOCOL */
86920 SEND_PACKET_START(PACKET_EDIT_UNIT_REMOVE);
86921#ifdef FREECIV_JSON_CONNECTION
86922 struct plocation field_addr;
86923 {
86924 struct plocation *field_addr_tmp = plocation_field_new(NULL);
86925 field_addr = *field_addr_tmp;
86926 FC_FREE(field_addr_tmp);
86927 }
86928#endif /* FREECIV_JSON_CONNECTION */
86929
86930 log_packet_detailed("packet_edit_unit_remove_100: sending info about ()");
86931
86932#ifdef FREECIV_DELTA_PROTOCOL
86933 if (NULL == *hash) {
86934 *hash = genhash_new_full(hash_packet_edit_unit_remove_100, cmp_packet_edit_unit_remove_100,
86935 NULL, NULL, NULL, free);
86936 }
86937 BV_CLR_ALL(fields);
86938
86939 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
86940 old = fc_malloc(sizeof(*old));
86941 *old = *real_packet;
86942 genhash_insert(*hash, old, old);
86943 memset(old, 0, sizeof(*old));
86944 }
86945 differ = (old->owner != real_packet->owner);
86946 if (differ) {
86947 BV_SET(fields, 0);
86948 }
86949
86950 differ = (old->tile != real_packet->tile);
86951 if (differ) {
86952 BV_SET(fields, 1);
86953 }
86954
86955 differ = (old->type != real_packet->type);
86956 if (differ) {
86957 BV_SET(fields, 2);
86958 }
86959
86960 differ = (old->count != real_packet->count);
86961 if (differ) {
86962 BV_SET(fields, 3);
86963 }
86964
86965
86966#ifdef FREECIV_JSON_CONNECTION
86967 field_addr.name = "fields";
86968#endif /* FREECIV_JSON_CONNECTION */
86969 DIO_BV_PUT(&dout, &field_addr, fields);
86970
86971 if (BV_ISSET(fields, 0)) {
86972 log_packet_detailed(" field 'owner' has changed");
86973 #ifdef FREECIV_JSON_CONNECTION
86974 field_addr.name = "owner";
86975#endif /* FREECIV_JSON_CONNECTION */
86976 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
86977 }
86978 if (BV_ISSET(fields, 1)) {
86979 log_packet_detailed(" field 'tile' has changed");
86980 #ifdef FREECIV_JSON_CONNECTION
86981 field_addr.name = "tile";
86982#endif /* FREECIV_JSON_CONNECTION */
86983 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
86984 }
86985 if (BV_ISSET(fields, 2)) {
86986 log_packet_detailed(" field 'type' has changed");
86987 #ifdef FREECIV_JSON_CONNECTION
86988 field_addr.name = "type";
86989#endif /* FREECIV_JSON_CONNECTION */
86990 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
86991 }
86992 if (BV_ISSET(fields, 3)) {
86993 log_packet_detailed(" field 'count' has changed");
86994 #ifdef FREECIV_JSON_CONNECTION
86995 field_addr.name = "count";
86996#endif /* FREECIV_JSON_CONNECTION */
86997 DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
86998 }
86999
87000 *old = *real_packet;
87001#endif /* FREECIV_DELTA_PROTOCOL */
87002#ifndef FREECIV_DELTA_PROTOCOL
87003#ifdef FREECIV_JSON_CONNECTION
87004 field_addr.name = "owner";
87005#endif /* FREECIV_JSON_CONNECTION */
87006 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
87007#ifdef FREECIV_JSON_CONNECTION
87008 field_addr.name = "tile";
87009#endif /* FREECIV_JSON_CONNECTION */
87010 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
87011#ifdef FREECIV_JSON_CONNECTION
87012 field_addr.name = "type";
87013#endif /* FREECIV_JSON_CONNECTION */
87014 DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
87015#ifdef FREECIV_JSON_CONNECTION
87016 field_addr.name = "count";
87017#endif /* FREECIV_JSON_CONNECTION */
87018 DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
87019
87020#endif
87021 SEND_PACKET_END(PACKET_EDIT_UNIT_REMOVE);
87022}
87023
87024 int send_packet_edit_unit_remove(struct connection *pc, const struct packet_edit_unit_remove *packet)
87025{
87026 if (!pc->used) {
87027 log_error("WARNING: trying to send data to the closed connection %s",
87028 conn_description(pc));
87029 return -1;
87030 }
87031 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_UNIT_REMOVE].packet != NULL, -1,
87032 "Handler for PACKET_EDIT_UNIT_REMOVE not installed");
87033 return pc->phs.handlers->send[PACKET_EDIT_UNIT_REMOVE].packet(pc, packet);
87034}
87035
87036 int dsend_packet_edit_unit_remove(struct connection *pc, int owner, int tile, Unit_type_id type, int count)
87037{
87038 struct packet_edit_unit_remove packet, *real_packet = &packet;
87039
87040 real_packet->owner = owner;
87041 real_packet->tile = tile;
87042 real_packet->type = type;
87043 real_packet->count = count;
87044
87045 return send_packet_edit_unit_remove(pc, real_packet);
87046}
87047
87048#ifdef FREECIV_DELTA_PROTOCOL
87049#define hash_packet_edit_unit_remove_by_id_100 hash_const
87050
87051#define cmp_packet_edit_unit_remove_by_id_100 cmp_const
87052
87053 BV_DEFINE(packet_edit_unit_remove_by_id_100_fields, 1);
87054#endif /* FREECIV_DELTA_PROTOCOL */
87055
87056 static struct packet_edit_unit_remove_by_id *receive_packet_edit_unit_remove_by_id_100(struct connection *pc)
87057{
87058#ifdef FREECIV_DELTA_PROTOCOL
87059 packet_edit_unit_remove_by_id_100_fields fields;
87060 struct packet_edit_unit_remove_by_id *old;
87061 struct genhash **hash = pc->phs.received + PACKET_EDIT_UNIT_REMOVE_BY_ID;
87062#endif /* FREECIV_DELTA_PROTOCOL */
87063 RECEIVE_PACKET_START(packet_edit_unit_remove_by_id, real_packet);
87064#ifdef FREECIV_JSON_CONNECTION
87065 struct plocation field_addr;
87066 {
87067 struct plocation *field_addr_tmp = plocation_field_new(NULL);
87068 field_addr = *field_addr_tmp;
87069 FC_FREE(field_addr_tmp);
87070 }
87071#endif /* FREECIV_JSON_CONNECTION */
87072
87073#ifdef FREECIV_DELTA_PROTOCOL
87074#ifdef FREECIV_JSON_CONNECTION
87075 field_addr.name = "fields";
87076#endif /* FREECIV_JSON_CONNECTION */
87077 DIO_BV_GET(&din, &field_addr, fields);
87078
87079#else /* FREECIV_DELTA_PROTOCOL */
87080 #ifdef FREECIV_JSON_CONNECTION
87081 field_addr.name = "id32";
87082 #endif /* FREECIV_JSON_CONNECTION */
87083 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
87084 RECEIVE_PACKET_FIELD_ERROR(id32);
87085 }
87086
87087#endif
87088 log_packet_detailed("packet_edit_unit_remove_by_id_100: got info about ()");
87089
87090#ifdef FREECIV_DELTA_PROTOCOL
87091 if (NULL == *hash) {
87092 *hash = genhash_new_full(hash_packet_edit_unit_remove_by_id_100, cmp_packet_edit_unit_remove_by_id_100,
87093 NULL, NULL, NULL, free);
87094 }
87095
87096 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
87097 *real_packet = *old;
87098 } else {
87099 log_packet_detailed(" no old info");
87100 memset(real_packet, 0, sizeof(*real_packet));
87101 }
87102
87103 if (BV_ISSET(fields, 0)) {
87104 log_packet_detailed(" got field 'id32'");
87105 #ifdef FREECIV_JSON_CONNECTION
87106 field_addr.name = "id32";
87107 #endif /* FREECIV_JSON_CONNECTION */
87108 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
87109 RECEIVE_PACKET_FIELD_ERROR(id32);
87110 }
87111 }
87112
87113 if (NULL == old) {
87114 old = fc_malloc(sizeof(*old));
87115 *old = *real_packet;
87116 genhash_insert(*hash, old, old);
87117 } else {
87118 *old = *real_packet;
87119 }
87120
87121#endif /* FREECIV_DELTA_PROTOCOL */
87122 RECEIVE_PACKET_END(real_packet);
87123}
87124
87125 static int send_packet_edit_unit_remove_by_id_100(struct connection *pc, const struct packet_edit_unit_remove_by_id *packet)
87126{
87127 const struct packet_edit_unit_remove_by_id *real_packet = packet;
87128#ifdef FREECIV_DELTA_PROTOCOL
87129 packet_edit_unit_remove_by_id_100_fields fields;
87130 struct packet_edit_unit_remove_by_id *old;
87131 bool differ;
87132 struct genhash **hash = pc->phs.sent + PACKET_EDIT_UNIT_REMOVE_BY_ID;
87133#endif /* FREECIV_DELTA_PROTOCOL */
87134 SEND_PACKET_START(PACKET_EDIT_UNIT_REMOVE_BY_ID);
87135#ifdef FREECIV_JSON_CONNECTION
87136 struct plocation field_addr;
87137 {
87138 struct plocation *field_addr_tmp = plocation_field_new(NULL);
87139 field_addr = *field_addr_tmp;
87140 FC_FREE(field_addr_tmp);
87141 }
87142#endif /* FREECIV_JSON_CONNECTION */
87143
87144 log_packet_detailed("packet_edit_unit_remove_by_id_100: sending info about ()");
87145
87146#ifdef FREECIV_DELTA_PROTOCOL
87147 if (NULL == *hash) {
87148 *hash = genhash_new_full(hash_packet_edit_unit_remove_by_id_100, cmp_packet_edit_unit_remove_by_id_100,
87149 NULL, NULL, NULL, free);
87150 }
87151 BV_CLR_ALL(fields);
87152
87153 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
87154 old = fc_malloc(sizeof(*old));
87155 *old = *real_packet;
87156 genhash_insert(*hash, old, old);
87157 memset(old, 0, sizeof(*old));
87158 }
87159 differ = (old->id32 != real_packet->id32);
87160 if (differ) {
87161 BV_SET(fields, 0);
87162 }
87163
87164
87165#ifdef FREECIV_JSON_CONNECTION
87166 field_addr.name = "fields";
87167#endif /* FREECIV_JSON_CONNECTION */
87168 DIO_BV_PUT(&dout, &field_addr, fields);
87169
87170 if (BV_ISSET(fields, 0)) {
87171 log_packet_detailed(" field 'id32' has changed");
87172 #ifdef FREECIV_JSON_CONNECTION
87173 field_addr.name = "id32";
87174#endif /* FREECIV_JSON_CONNECTION */
87175 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
87176 }
87177
87178 *old = *real_packet;
87179#endif /* FREECIV_DELTA_PROTOCOL */
87180#ifndef FREECIV_DELTA_PROTOCOL
87181#ifdef FREECIV_JSON_CONNECTION
87182 field_addr.name = "id32";
87183#endif /* FREECIV_JSON_CONNECTION */
87184 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
87185
87186#endif
87187 SEND_PACKET_END(PACKET_EDIT_UNIT_REMOVE_BY_ID);
87188}
87189
87190#ifdef FREECIV_DELTA_PROTOCOL
87191#define hash_packet_edit_unit_remove_by_id_101 hash_const
87192
87193#define cmp_packet_edit_unit_remove_by_id_101 cmp_const
87194
87195 BV_DEFINE(packet_edit_unit_remove_by_id_101_fields, 1);
87196#endif /* FREECIV_DELTA_PROTOCOL */
87197
87198 static struct packet_edit_unit_remove_by_id *receive_packet_edit_unit_remove_by_id_101(struct connection *pc)
87199{
87200#ifdef FREECIV_DELTA_PROTOCOL
87201 packet_edit_unit_remove_by_id_101_fields fields;
87202 struct packet_edit_unit_remove_by_id *old;
87203 struct genhash **hash = pc->phs.received + PACKET_EDIT_UNIT_REMOVE_BY_ID;
87204#endif /* FREECIV_DELTA_PROTOCOL */
87205 RECEIVE_PACKET_START(packet_edit_unit_remove_by_id, real_packet);
87206#ifdef FREECIV_JSON_CONNECTION
87207 struct plocation field_addr;
87208 {
87209 struct plocation *field_addr_tmp = plocation_field_new(NULL);
87210 field_addr = *field_addr_tmp;
87211 FC_FREE(field_addr_tmp);
87212 }
87213#endif /* FREECIV_JSON_CONNECTION */
87214
87215#ifdef FREECIV_DELTA_PROTOCOL
87216#ifdef FREECIV_JSON_CONNECTION
87217 field_addr.name = "fields";
87218#endif /* FREECIV_JSON_CONNECTION */
87219 DIO_BV_GET(&din, &field_addr, fields);
87220
87221#else /* FREECIV_DELTA_PROTOCOL */
87222 #ifdef FREECIV_JSON_CONNECTION
87223 field_addr.name = "id16";
87224 #endif /* FREECIV_JSON_CONNECTION */
87225 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
87226 RECEIVE_PACKET_FIELD_ERROR(id16);
87227 }
87228
87229#endif
87230 log_packet_detailed("packet_edit_unit_remove_by_id_101: got info about ()");
87231
87232#ifdef FREECIV_DELTA_PROTOCOL
87233 if (NULL == *hash) {
87234 *hash = genhash_new_full(hash_packet_edit_unit_remove_by_id_101, cmp_packet_edit_unit_remove_by_id_101,
87235 NULL, NULL, NULL, free);
87236 }
87237
87238 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
87239 *real_packet = *old;
87240 } else {
87241 log_packet_detailed(" no old info");
87242 memset(real_packet, 0, sizeof(*real_packet));
87243 }
87244
87245 if (BV_ISSET(fields, 0)) {
87246 log_packet_detailed(" got field 'id16'");
87247 #ifdef FREECIV_JSON_CONNECTION
87248 field_addr.name = "id16";
87249 #endif /* FREECIV_JSON_CONNECTION */
87250 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
87251 RECEIVE_PACKET_FIELD_ERROR(id16);
87252 }
87253 }
87254
87255 if (NULL == old) {
87256 old = fc_malloc(sizeof(*old));
87257 *old = *real_packet;
87258 genhash_insert(*hash, old, old);
87259 } else {
87260 *old = *real_packet;
87261 }
87262
87263#endif /* FREECIV_DELTA_PROTOCOL */
87264 RECEIVE_PACKET_END(real_packet);
87265}
87266
87267 static int send_packet_edit_unit_remove_by_id_101(struct connection *pc, const struct packet_edit_unit_remove_by_id *packet)
87268{
87269 const struct packet_edit_unit_remove_by_id *real_packet = packet;
87270#ifdef FREECIV_DELTA_PROTOCOL
87271 packet_edit_unit_remove_by_id_101_fields fields;
87272 struct packet_edit_unit_remove_by_id *old;
87273 bool differ;
87274 struct genhash **hash = pc->phs.sent + PACKET_EDIT_UNIT_REMOVE_BY_ID;
87275#endif /* FREECIV_DELTA_PROTOCOL */
87276 SEND_PACKET_START(PACKET_EDIT_UNIT_REMOVE_BY_ID);
87277#ifdef FREECIV_JSON_CONNECTION
87278 struct plocation field_addr;
87279 {
87280 struct plocation *field_addr_tmp = plocation_field_new(NULL);
87281 field_addr = *field_addr_tmp;
87282 FC_FREE(field_addr_tmp);
87283 }
87284#endif /* FREECIV_JSON_CONNECTION */
87285
87286 log_packet_detailed("packet_edit_unit_remove_by_id_101: sending info about ()");
87287
87288#ifdef FREECIV_DELTA_PROTOCOL
87289 if (NULL == *hash) {
87290 *hash = genhash_new_full(hash_packet_edit_unit_remove_by_id_101, cmp_packet_edit_unit_remove_by_id_101,
87291 NULL, NULL, NULL, free);
87292 }
87293 BV_CLR_ALL(fields);
87294
87295 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
87296 old = fc_malloc(sizeof(*old));
87297 *old = *real_packet;
87298 genhash_insert(*hash, old, old);
87299 memset(old, 0, sizeof(*old));
87300 }
87301 differ = (old->id16 != real_packet->id16);
87302 if (differ) {
87303 BV_SET(fields, 0);
87304 }
87305
87306
87307#ifdef FREECIV_JSON_CONNECTION
87308 field_addr.name = "fields";
87309#endif /* FREECIV_JSON_CONNECTION */
87310 DIO_BV_PUT(&dout, &field_addr, fields);
87311
87312 if (BV_ISSET(fields, 0)) {
87313 log_packet_detailed(" field 'id16' has changed");
87314 #ifdef FREECIV_JSON_CONNECTION
87315 field_addr.name = "id16";
87316#endif /* FREECIV_JSON_CONNECTION */
87317 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
87318 }
87319
87320 *old = *real_packet;
87321#endif /* FREECIV_DELTA_PROTOCOL */
87322#ifndef FREECIV_DELTA_PROTOCOL
87323#ifdef FREECIV_JSON_CONNECTION
87324 field_addr.name = "id16";
87325#endif /* FREECIV_JSON_CONNECTION */
87326 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
87327
87328#endif
87329 SEND_PACKET_END(PACKET_EDIT_UNIT_REMOVE_BY_ID);
87330}
87331
87332 int send_packet_edit_unit_remove_by_id(struct connection *pc, const struct packet_edit_unit_remove_by_id *packet)
87333{
87334 if (!pc->used) {
87335 log_error("WARNING: trying to send data to the closed connection %s",
87336 conn_description(pc));
87337 return -1;
87338 }
87339 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_UNIT_REMOVE_BY_ID].packet != NULL, -1,
87340 "Handler for PACKET_EDIT_UNIT_REMOVE_BY_ID not installed");
87341 return pc->phs.handlers->send[PACKET_EDIT_UNIT_REMOVE_BY_ID].packet(pc, packet);
87342}
87343
87344 int dsend_packet_edit_unit_remove_by_id(struct connection *pc, int id16, int id32)
87345{
87346 struct packet_edit_unit_remove_by_id packet, *real_packet = &packet;
87347
87348 real_packet->id16 = id16;
87349 real_packet->id32 = id32;
87350
87351 return send_packet_edit_unit_remove_by_id(pc, real_packet);
87352}
87353
87354#ifdef FREECIV_DELTA_PROTOCOL
87355#define hash_packet_edit_unit_100 hash_const
87356
87357#define cmp_packet_edit_unit_100 cmp_const
87358
87359 BV_DEFINE(packet_edit_unit_100_fields, 17);
87360#endif /* FREECIV_DELTA_PROTOCOL */
87361
87362 static struct packet_edit_unit *receive_packet_edit_unit_100(struct connection *pc)
87363{
87364#ifdef FREECIV_DELTA_PROTOCOL
87365 packet_edit_unit_100_fields fields;
87366 struct packet_edit_unit *old;
87367 struct genhash **hash = pc->phs.received + PACKET_EDIT_UNIT;
87368#endif /* FREECIV_DELTA_PROTOCOL */
87369 RECEIVE_PACKET_START(packet_edit_unit, real_packet);
87370#ifdef FREECIV_JSON_CONNECTION
87371 struct plocation field_addr;
87372 {
87373 struct plocation *field_addr_tmp = plocation_field_new(NULL);
87374 field_addr = *field_addr_tmp;
87375 FC_FREE(field_addr_tmp);
87376 }
87377#endif /* FREECIV_JSON_CONNECTION */
87378
87379#ifdef FREECIV_DELTA_PROTOCOL
87380#ifdef FREECIV_JSON_CONNECTION
87381 field_addr.name = "fields";
87382#endif /* FREECIV_JSON_CONNECTION */
87383 DIO_BV_GET(&din, &field_addr, fields);
87384
87385#else /* FREECIV_DELTA_PROTOCOL */
87386 #ifdef FREECIV_JSON_CONNECTION
87387 field_addr.name = "id32";
87388 #endif /* FREECIV_JSON_CONNECTION */
87389 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
87390 RECEIVE_PACKET_FIELD_ERROR(id32);
87391 }
87392 #ifdef FREECIV_JSON_CONNECTION
87393 field_addr.name = "utype";
87394 #endif /* FREECIV_JSON_CONNECTION */
87395 {
87396 int readin;
87397
87398 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
87399 RECEIVE_PACKET_FIELD_ERROR(utype);
87400 }
87401 real_packet->utype = readin;
87402 }
87403 #ifdef FREECIV_JSON_CONNECTION
87404 field_addr.name = "owner";
87405 #endif /* FREECIV_JSON_CONNECTION */
87406 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
87407 RECEIVE_PACKET_FIELD_ERROR(owner);
87408 }
87409 #ifdef FREECIV_JSON_CONNECTION
87410 field_addr.name = "homecity32";
87411 #endif /* FREECIV_JSON_CONNECTION */
87412 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->homecity32)) {
87413 RECEIVE_PACKET_FIELD_ERROR(homecity32);
87414 }
87415 #ifdef FREECIV_JSON_CONNECTION
87416 field_addr.name = "moves_left";
87417 #endif /* FREECIV_JSON_CONNECTION */
87418 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->moves_left)) {
87419 RECEIVE_PACKET_FIELD_ERROR(moves_left);
87420 }
87421 #ifdef FREECIV_JSON_CONNECTION
87422 field_addr.name = "hp";
87423 #endif /* FREECIV_JSON_CONNECTION */
87424 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
87425 RECEIVE_PACKET_FIELD_ERROR(hp);
87426 }
87427 #ifdef FREECIV_JSON_CONNECTION
87428 field_addr.name = "veteran";
87429 #endif /* FREECIV_JSON_CONNECTION */
87430 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
87431 RECEIVE_PACKET_FIELD_ERROR(veteran);
87432 }
87433 #ifdef FREECIV_JSON_CONNECTION
87434 field_addr.name = "fuel";
87435 #endif /* FREECIV_JSON_CONNECTION */
87436 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
87437 RECEIVE_PACKET_FIELD_ERROR(fuel);
87438 }
87439 #ifdef FREECIV_JSON_CONNECTION
87440 field_addr.name = "activity";
87441 #endif /* FREECIV_JSON_CONNECTION */
87442 {
87443 int readin;
87444
87445 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
87446 RECEIVE_PACKET_FIELD_ERROR(activity);
87447 }
87448 real_packet->activity = readin;
87449 }
87450 #ifdef FREECIV_JSON_CONNECTION
87451 field_addr.name = "activity_count";
87452 #endif /* FREECIV_JSON_CONNECTION */
87453 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
87454 RECEIVE_PACKET_FIELD_ERROR(activity_count);
87455 }
87456 #ifdef FREECIV_JSON_CONNECTION
87457 field_addr.name = "activity_base";
87458 #endif /* FREECIV_JSON_CONNECTION */
87459 {
87460 int readin;
87461
87462 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
87463 RECEIVE_PACKET_FIELD_ERROR(activity_base);
87464 }
87465 real_packet->activity_base = readin;
87466 }
87467 #ifdef FREECIV_JSON_CONNECTION
87468 field_addr.name = "debug";
87469 #endif /* FREECIV_JSON_CONNECTION */
87470 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->debug)) {
87471 RECEIVE_PACKET_FIELD_ERROR(debug);
87472 }
87473 #ifdef FREECIV_JSON_CONNECTION
87474 field_addr.name = "moved";
87475 #endif /* FREECIV_JSON_CONNECTION */
87476 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->moved)) {
87477 RECEIVE_PACKET_FIELD_ERROR(moved);
87478 }
87479 #ifdef FREECIV_JSON_CONNECTION
87480 field_addr.name = "paradropped";
87481 #endif /* FREECIV_JSON_CONNECTION */
87482 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->paradropped)) {
87483 RECEIVE_PACKET_FIELD_ERROR(paradropped);
87484 }
87485 #ifdef FREECIV_JSON_CONNECTION
87486 field_addr.name = "done_moving";
87487 #endif /* FREECIV_JSON_CONNECTION */
87488 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->done_moving)) {
87489 RECEIVE_PACKET_FIELD_ERROR(done_moving);
87490 }
87491 #ifdef FREECIV_JSON_CONNECTION
87492 field_addr.name = "transported_by32";
87493 #endif /* FREECIV_JSON_CONNECTION */
87494 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by32)) {
87495 RECEIVE_PACKET_FIELD_ERROR(transported_by32);
87496 }
87497 #ifdef FREECIV_JSON_CONNECTION
87498 field_addr.name = "stay";
87499 #endif /* FREECIV_JSON_CONNECTION */
87500 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->stay)) {
87501 RECEIVE_PACKET_FIELD_ERROR(stay);
87502 }
87503
87504#endif
87505 log_packet_detailed("packet_edit_unit_100: got info about ()");
87506
87507#ifdef FREECIV_DELTA_PROTOCOL
87508 if (NULL == *hash) {
87509 *hash = genhash_new_full(hash_packet_edit_unit_100, cmp_packet_edit_unit_100,
87510 NULL, NULL, NULL, free);
87511 }
87512
87513 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
87514 *real_packet = *old;
87515 } else {
87516 log_packet_detailed(" no old info");
87517 memset(real_packet, 0, sizeof(*real_packet));
87518 }
87519
87520 if (BV_ISSET(fields, 0)) {
87521 log_packet_detailed(" got field 'id32'");
87522 #ifdef FREECIV_JSON_CONNECTION
87523 field_addr.name = "id32";
87524 #endif /* FREECIV_JSON_CONNECTION */
87525 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
87526 RECEIVE_PACKET_FIELD_ERROR(id32);
87527 }
87528 }
87529 if (BV_ISSET(fields, 1)) {
87530 log_packet_detailed(" got field 'utype'");
87531 #ifdef FREECIV_JSON_CONNECTION
87532 field_addr.name = "utype";
87533 #endif /* FREECIV_JSON_CONNECTION */
87534 {
87535 int readin;
87536
87537 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
87538 RECEIVE_PACKET_FIELD_ERROR(utype);
87539 }
87540 real_packet->utype = readin;
87541 }
87542 }
87543 if (BV_ISSET(fields, 2)) {
87544 log_packet_detailed(" got field 'owner'");
87545 #ifdef FREECIV_JSON_CONNECTION
87546 field_addr.name = "owner";
87547 #endif /* FREECIV_JSON_CONNECTION */
87548 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
87549 RECEIVE_PACKET_FIELD_ERROR(owner);
87550 }
87551 }
87552 if (BV_ISSET(fields, 3)) {
87553 log_packet_detailed(" got field 'homecity32'");
87554 #ifdef FREECIV_JSON_CONNECTION
87555 field_addr.name = "homecity32";
87556 #endif /* FREECIV_JSON_CONNECTION */
87557 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->homecity32)) {
87558 RECEIVE_PACKET_FIELD_ERROR(homecity32);
87559 }
87560 }
87561 if (BV_ISSET(fields, 4)) {
87562 log_packet_detailed(" got field 'moves_left'");
87563 #ifdef FREECIV_JSON_CONNECTION
87564 field_addr.name = "moves_left";
87565 #endif /* FREECIV_JSON_CONNECTION */
87566 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->moves_left)) {
87567 RECEIVE_PACKET_FIELD_ERROR(moves_left);
87568 }
87569 }
87570 if (BV_ISSET(fields, 5)) {
87571 log_packet_detailed(" got field 'hp'");
87572 #ifdef FREECIV_JSON_CONNECTION
87573 field_addr.name = "hp";
87574 #endif /* FREECIV_JSON_CONNECTION */
87575 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
87576 RECEIVE_PACKET_FIELD_ERROR(hp);
87577 }
87578 }
87579 if (BV_ISSET(fields, 6)) {
87580 log_packet_detailed(" got field 'veteran'");
87581 #ifdef FREECIV_JSON_CONNECTION
87582 field_addr.name = "veteran";
87583 #endif /* FREECIV_JSON_CONNECTION */
87584 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
87585 RECEIVE_PACKET_FIELD_ERROR(veteran);
87586 }
87587 }
87588 if (BV_ISSET(fields, 7)) {
87589 log_packet_detailed(" got field 'fuel'");
87590 #ifdef FREECIV_JSON_CONNECTION
87591 field_addr.name = "fuel";
87592 #endif /* FREECIV_JSON_CONNECTION */
87593 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
87594 RECEIVE_PACKET_FIELD_ERROR(fuel);
87595 }
87596 }
87597 if (BV_ISSET(fields, 8)) {
87598 log_packet_detailed(" got field 'activity'");
87599 #ifdef FREECIV_JSON_CONNECTION
87600 field_addr.name = "activity";
87601 #endif /* FREECIV_JSON_CONNECTION */
87602 {
87603 int readin;
87604
87605 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
87606 RECEIVE_PACKET_FIELD_ERROR(activity);
87607 }
87608 real_packet->activity = readin;
87609 }
87610 }
87611 if (BV_ISSET(fields, 9)) {
87612 log_packet_detailed(" got field 'activity_count'");
87613 #ifdef FREECIV_JSON_CONNECTION
87614 field_addr.name = "activity_count";
87615 #endif /* FREECIV_JSON_CONNECTION */
87616 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
87617 RECEIVE_PACKET_FIELD_ERROR(activity_count);
87618 }
87619 }
87620 if (BV_ISSET(fields, 10)) {
87621 log_packet_detailed(" got field 'activity_base'");
87622 #ifdef FREECIV_JSON_CONNECTION
87623 field_addr.name = "activity_base";
87624 #endif /* FREECIV_JSON_CONNECTION */
87625 {
87626 int readin;
87627
87628 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
87629 RECEIVE_PACKET_FIELD_ERROR(activity_base);
87630 }
87631 real_packet->activity_base = readin;
87632 }
87633 }
87634 real_packet->debug = BV_ISSET(fields, 11);
87635 real_packet->moved = BV_ISSET(fields, 12);
87636 real_packet->paradropped = BV_ISSET(fields, 13);
87637 real_packet->done_moving = BV_ISSET(fields, 14);
87638 if (BV_ISSET(fields, 15)) {
87639 log_packet_detailed(" got field 'transported_by32'");
87640 #ifdef FREECIV_JSON_CONNECTION
87641 field_addr.name = "transported_by32";
87642 #endif /* FREECIV_JSON_CONNECTION */
87643 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by32)) {
87644 RECEIVE_PACKET_FIELD_ERROR(transported_by32);
87645 }
87646 }
87647 real_packet->stay = BV_ISSET(fields, 16);
87648
87649 if (NULL == old) {
87650 old = fc_malloc(sizeof(*old));
87651 *old = *real_packet;
87652 genhash_insert(*hash, old, old);
87653 } else {
87654 *old = *real_packet;
87655 }
87656
87657#endif /* FREECIV_DELTA_PROTOCOL */
87658 RECEIVE_PACKET_END(real_packet);
87659}
87660
87661 static int send_packet_edit_unit_100(struct connection *pc, const struct packet_edit_unit *packet)
87662{
87663 const struct packet_edit_unit *real_packet = packet;
87664#ifdef FREECIV_DELTA_PROTOCOL
87665 packet_edit_unit_100_fields fields;
87666 struct packet_edit_unit *old;
87667 bool differ;
87668 struct genhash **hash = pc->phs.sent + PACKET_EDIT_UNIT;
87669#endif /* FREECIV_DELTA_PROTOCOL */
87670 SEND_PACKET_START(PACKET_EDIT_UNIT);
87671#ifdef FREECIV_JSON_CONNECTION
87672 struct plocation field_addr;
87673 {
87674 struct plocation *field_addr_tmp = plocation_field_new(NULL);
87675 field_addr = *field_addr_tmp;
87676 FC_FREE(field_addr_tmp);
87677 }
87678#endif /* FREECIV_JSON_CONNECTION */
87679
87680 log_packet_detailed("packet_edit_unit_100: sending info about ()");
87681
87682#ifdef FREECIV_DELTA_PROTOCOL
87683 if (NULL == *hash) {
87684 *hash = genhash_new_full(hash_packet_edit_unit_100, cmp_packet_edit_unit_100,
87685 NULL, NULL, NULL, free);
87686 }
87687 BV_CLR_ALL(fields);
87688
87689 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
87690 old = fc_malloc(sizeof(*old));
87691 *old = *real_packet;
87692 genhash_insert(*hash, old, old);
87693 memset(old, 0, sizeof(*old));
87694 }
87695 differ = (old->id32 != real_packet->id32);
87696 if (differ) {
87697 BV_SET(fields, 0);
87698 }
87699
87700 differ = (old->utype != real_packet->utype);
87701 if (differ) {
87702 BV_SET(fields, 1);
87703 }
87704
87705 differ = (old->owner != real_packet->owner);
87706 if (differ) {
87707 BV_SET(fields, 2);
87708 }
87709
87710 differ = (old->homecity32 != real_packet->homecity32);
87711 if (differ) {
87712 BV_SET(fields, 3);
87713 }
87714
87715 differ = (old->moves_left != real_packet->moves_left);
87716 if (differ) {
87717 BV_SET(fields, 4);
87718 }
87719
87720 differ = (old->hp != real_packet->hp);
87721 if (differ) {
87722 BV_SET(fields, 5);
87723 }
87724
87725 differ = (old->veteran != real_packet->veteran);
87726 if (differ) {
87727 BV_SET(fields, 6);
87728 }
87729
87730 differ = (old->fuel != real_packet->fuel);
87731 if (differ) {
87732 BV_SET(fields, 7);
87733 }
87734
87735 differ = (old->activity != real_packet->activity);
87736 if (differ) {
87737 BV_SET(fields, 8);
87738 }
87739
87740 differ = (old->activity_count != real_packet->activity_count);
87741 if (differ) {
87742 BV_SET(fields, 9);
87743 }
87744
87745 differ = (old->activity_base != real_packet->activity_base);
87746 if (differ) {
87747 BV_SET(fields, 10);
87748 }
87749
87750 if (packet->debug) {
87751 BV_SET(fields, 11);
87752 }
87753
87754 if (packet->moved) {
87755 BV_SET(fields, 12);
87756 }
87757
87758 if (packet->paradropped) {
87759 BV_SET(fields, 13);
87760 }
87761
87762 if (packet->done_moving) {
87763 BV_SET(fields, 14);
87764 }
87765
87766 differ = (old->transported_by32 != real_packet->transported_by32);
87767 if (differ) {
87768 BV_SET(fields, 15);
87769 }
87770
87771 if (packet->stay) {
87772 BV_SET(fields, 16);
87773 }
87774
87775
87776#ifdef FREECIV_JSON_CONNECTION
87777 field_addr.name = "fields";
87778#endif /* FREECIV_JSON_CONNECTION */
87779 DIO_BV_PUT(&dout, &field_addr, fields);
87780
87781 if (BV_ISSET(fields, 0)) {
87782 log_packet_detailed(" field 'id32' has changed");
87783 #ifdef FREECIV_JSON_CONNECTION
87784 field_addr.name = "id32";
87785#endif /* FREECIV_JSON_CONNECTION */
87786 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
87787 }
87788 if (BV_ISSET(fields, 1)) {
87789 log_packet_detailed(" field 'utype' has changed");
87790 #ifdef FREECIV_JSON_CONNECTION
87791 field_addr.name = "utype";
87792#endif /* FREECIV_JSON_CONNECTION */
87793 DIO_PUT(uint8, &dout, &field_addr, real_packet->utype);
87794 }
87795 if (BV_ISSET(fields, 2)) {
87796 log_packet_detailed(" field 'owner' has changed");
87797 #ifdef FREECIV_JSON_CONNECTION
87798 field_addr.name = "owner";
87799#endif /* FREECIV_JSON_CONNECTION */
87800 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
87801 }
87802 if (BV_ISSET(fields, 3)) {
87803 log_packet_detailed(" field 'homecity32' has changed");
87804 #ifdef FREECIV_JSON_CONNECTION
87805 field_addr.name = "homecity32";
87806#endif /* FREECIV_JSON_CONNECTION */
87807 DIO_PUT(uint32, &dout, &field_addr, real_packet->homecity32);
87808 }
87809 if (BV_ISSET(fields, 4)) {
87810 log_packet_detailed(" field 'moves_left' has changed");
87811 #ifdef FREECIV_JSON_CONNECTION
87812 field_addr.name = "moves_left";
87813#endif /* FREECIV_JSON_CONNECTION */
87814 DIO_PUT(uint32, &dout, &field_addr, real_packet->moves_left);
87815 }
87816 if (BV_ISSET(fields, 5)) {
87817 log_packet_detailed(" field 'hp' has changed");
87818 #ifdef FREECIV_JSON_CONNECTION
87819 field_addr.name = "hp";
87820#endif /* FREECIV_JSON_CONNECTION */
87821 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
87822 }
87823 if (BV_ISSET(fields, 6)) {
87824 log_packet_detailed(" field 'veteran' has changed");
87825 #ifdef FREECIV_JSON_CONNECTION
87826 field_addr.name = "veteran";
87827#endif /* FREECIV_JSON_CONNECTION */
87828 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
87829 }
87830 if (BV_ISSET(fields, 7)) {
87831 log_packet_detailed(" field 'fuel' has changed");
87832 #ifdef FREECIV_JSON_CONNECTION
87833 field_addr.name = "fuel";
87834#endif /* FREECIV_JSON_CONNECTION */
87835 DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
87836 }
87837 if (BV_ISSET(fields, 8)) {
87838 log_packet_detailed(" field 'activity' has changed");
87839 #ifdef FREECIV_JSON_CONNECTION
87840 field_addr.name = "activity";
87841#endif /* FREECIV_JSON_CONNECTION */
87842 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
87843 }
87844 if (BV_ISSET(fields, 9)) {
87845 log_packet_detailed(" field 'activity_count' has changed");
87846 #ifdef FREECIV_JSON_CONNECTION
87847 field_addr.name = "activity_count";
87848#endif /* FREECIV_JSON_CONNECTION */
87849 DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
87850 }
87851 if (BV_ISSET(fields, 10)) {
87852 log_packet_detailed(" field 'activity_base' has changed");
87853 #ifdef FREECIV_JSON_CONNECTION
87854 field_addr.name = "activity_base";
87855#endif /* FREECIV_JSON_CONNECTION */
87856 DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_base);
87857 }
87858 /* field 11 is folded into the header */
87859 /* field 12 is folded into the header */
87860 /* field 13 is folded into the header */
87861 /* field 14 is folded into the header */
87862 if (BV_ISSET(fields, 15)) {
87863 log_packet_detailed(" field 'transported_by32' has changed");
87864 #ifdef FREECIV_JSON_CONNECTION
87865 field_addr.name = "transported_by32";
87866#endif /* FREECIV_JSON_CONNECTION */
87867 DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by32);
87868 }
87869 /* field 16 is folded into the header */
87870
87871 *old = *real_packet;
87872#endif /* FREECIV_DELTA_PROTOCOL */
87873#ifndef FREECIV_DELTA_PROTOCOL
87874#ifdef FREECIV_JSON_CONNECTION
87875 field_addr.name = "id32";
87876#endif /* FREECIV_JSON_CONNECTION */
87877 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
87878#ifdef FREECIV_JSON_CONNECTION
87879 field_addr.name = "utype";
87880#endif /* FREECIV_JSON_CONNECTION */
87881 DIO_PUT(uint8, &dout, &field_addr, real_packet->utype);
87882#ifdef FREECIV_JSON_CONNECTION
87883 field_addr.name = "owner";
87884#endif /* FREECIV_JSON_CONNECTION */
87885 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
87886#ifdef FREECIV_JSON_CONNECTION
87887 field_addr.name = "homecity32";
87888#endif /* FREECIV_JSON_CONNECTION */
87889 DIO_PUT(uint32, &dout, &field_addr, real_packet->homecity32);
87890#ifdef FREECIV_JSON_CONNECTION
87891 field_addr.name = "moves_left";
87892#endif /* FREECIV_JSON_CONNECTION */
87893 DIO_PUT(uint32, &dout, &field_addr, real_packet->moves_left);
87894#ifdef FREECIV_JSON_CONNECTION
87895 field_addr.name = "hp";
87896#endif /* FREECIV_JSON_CONNECTION */
87897 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
87898#ifdef FREECIV_JSON_CONNECTION
87899 field_addr.name = "veteran";
87900#endif /* FREECIV_JSON_CONNECTION */
87901 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
87902#ifdef FREECIV_JSON_CONNECTION
87903 field_addr.name = "fuel";
87904#endif /* FREECIV_JSON_CONNECTION */
87905 DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
87906#ifdef FREECIV_JSON_CONNECTION
87907 field_addr.name = "activity";
87908#endif /* FREECIV_JSON_CONNECTION */
87909 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
87910#ifdef FREECIV_JSON_CONNECTION
87911 field_addr.name = "activity_count";
87912#endif /* FREECIV_JSON_CONNECTION */
87913 DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
87914#ifdef FREECIV_JSON_CONNECTION
87915 field_addr.name = "activity_base";
87916#endif /* FREECIV_JSON_CONNECTION */
87917 DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_base);
87918#ifdef FREECIV_JSON_CONNECTION
87919 field_addr.name = "debug";
87920#endif /* FREECIV_JSON_CONNECTION */
87921 DIO_PUT(bool8, &dout, &field_addr, real_packet->debug);
87922#ifdef FREECIV_JSON_CONNECTION
87923 field_addr.name = "moved";
87924#endif /* FREECIV_JSON_CONNECTION */
87925 DIO_PUT(bool8, &dout, &field_addr, real_packet->moved);
87926#ifdef FREECIV_JSON_CONNECTION
87927 field_addr.name = "paradropped";
87928#endif /* FREECIV_JSON_CONNECTION */
87929 DIO_PUT(bool8, &dout, &field_addr, real_packet->paradropped);
87930#ifdef FREECIV_JSON_CONNECTION
87931 field_addr.name = "done_moving";
87932#endif /* FREECIV_JSON_CONNECTION */
87933 DIO_PUT(bool8, &dout, &field_addr, real_packet->done_moving);
87934#ifdef FREECIV_JSON_CONNECTION
87935 field_addr.name = "transported_by32";
87936#endif /* FREECIV_JSON_CONNECTION */
87937 DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by32);
87938#ifdef FREECIV_JSON_CONNECTION
87939 field_addr.name = "stay";
87940#endif /* FREECIV_JSON_CONNECTION */
87941 DIO_PUT(bool8, &dout, &field_addr, real_packet->stay);
87942
87943#endif
87944 SEND_PACKET_END(PACKET_EDIT_UNIT);
87945}
87946
87947#ifdef FREECIV_DELTA_PROTOCOL
87948static genhash_val_t hash_packet_edit_unit_101(const void *vkey)
87949{
87950 const struct packet_edit_unit *key = (const struct packet_edit_unit *) vkey;
87951
87952 return key->id16;
87953}
87954
87955static bool cmp_packet_edit_unit_101(const void *vkey1, const void *vkey2)
87956{
87957 const struct packet_edit_unit *key1 = (const struct packet_edit_unit *) vkey1;
87958 const struct packet_edit_unit *key2 = (const struct packet_edit_unit *) vkey2;
87959
87960 return key1->id16 == key2->id16;
87961}
87962 BV_DEFINE(packet_edit_unit_101_fields, 16);
87963#endif /* FREECIV_DELTA_PROTOCOL */
87964
87965 static struct packet_edit_unit *receive_packet_edit_unit_101(struct connection *pc)
87966{
87967#ifdef FREECIV_DELTA_PROTOCOL
87968 packet_edit_unit_101_fields fields;
87969 struct packet_edit_unit *old;
87970 struct genhash **hash = pc->phs.received + PACKET_EDIT_UNIT;
87971#endif /* FREECIV_DELTA_PROTOCOL */
87972 RECEIVE_PACKET_START(packet_edit_unit, real_packet);
87973#ifdef FREECIV_JSON_CONNECTION
87974 struct plocation field_addr;
87975 {
87976 struct plocation *field_addr_tmp = plocation_field_new(NULL);
87977 field_addr = *field_addr_tmp;
87978 FC_FREE(field_addr_tmp);
87979 }
87980#endif /* FREECIV_JSON_CONNECTION */
87981
87982#ifdef FREECIV_DELTA_PROTOCOL
87983#ifdef FREECIV_JSON_CONNECTION
87984 field_addr.name = "fields";
87985#endif /* FREECIV_JSON_CONNECTION */
87986 DIO_BV_GET(&din, &field_addr, fields);
87987 #ifdef FREECIV_JSON_CONNECTION
87988 field_addr.name = "id16";
87989 #endif /* FREECIV_JSON_CONNECTION */
87990 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
87991 RECEIVE_PACKET_FIELD_ERROR(id16);
87992 }
87993
87994#else /* FREECIV_DELTA_PROTOCOL */
87995 #ifdef FREECIV_JSON_CONNECTION
87996 field_addr.name = "id16";
87997 #endif /* FREECIV_JSON_CONNECTION */
87998 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
87999 RECEIVE_PACKET_FIELD_ERROR(id16);
88000 }
88001 #ifdef FREECIV_JSON_CONNECTION
88002 field_addr.name = "utype";
88003 #endif /* FREECIV_JSON_CONNECTION */
88004 {
88005 int readin;
88006
88007 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
88008 RECEIVE_PACKET_FIELD_ERROR(utype);
88009 }
88010 real_packet->utype = readin;
88011 }
88012 #ifdef FREECIV_JSON_CONNECTION
88013 field_addr.name = "owner";
88014 #endif /* FREECIV_JSON_CONNECTION */
88015 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
88016 RECEIVE_PACKET_FIELD_ERROR(owner);
88017 }
88018 #ifdef FREECIV_JSON_CONNECTION
88019 field_addr.name = "homecity16";
88020 #endif /* FREECIV_JSON_CONNECTION */
88021 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->homecity16)) {
88022 RECEIVE_PACKET_FIELD_ERROR(homecity16);
88023 }
88024 #ifdef FREECIV_JSON_CONNECTION
88025 field_addr.name = "moves_left";
88026 #endif /* FREECIV_JSON_CONNECTION */
88027 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->moves_left)) {
88028 RECEIVE_PACKET_FIELD_ERROR(moves_left);
88029 }
88030 #ifdef FREECIV_JSON_CONNECTION
88031 field_addr.name = "hp";
88032 #endif /* FREECIV_JSON_CONNECTION */
88033 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
88034 RECEIVE_PACKET_FIELD_ERROR(hp);
88035 }
88036 #ifdef FREECIV_JSON_CONNECTION
88037 field_addr.name = "veteran";
88038 #endif /* FREECIV_JSON_CONNECTION */
88039 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
88040 RECEIVE_PACKET_FIELD_ERROR(veteran);
88041 }
88042 #ifdef FREECIV_JSON_CONNECTION
88043 field_addr.name = "fuel";
88044 #endif /* FREECIV_JSON_CONNECTION */
88045 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
88046 RECEIVE_PACKET_FIELD_ERROR(fuel);
88047 }
88048 #ifdef FREECIV_JSON_CONNECTION
88049 field_addr.name = "activity";
88050 #endif /* FREECIV_JSON_CONNECTION */
88051 {
88052 int readin;
88053
88054 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
88055 RECEIVE_PACKET_FIELD_ERROR(activity);
88056 }
88057 real_packet->activity = readin;
88058 }
88059 #ifdef FREECIV_JSON_CONNECTION
88060 field_addr.name = "activity_count";
88061 #endif /* FREECIV_JSON_CONNECTION */
88062 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
88063 RECEIVE_PACKET_FIELD_ERROR(activity_count);
88064 }
88065 #ifdef FREECIV_JSON_CONNECTION
88066 field_addr.name = "activity_base";
88067 #endif /* FREECIV_JSON_CONNECTION */
88068 {
88069 int readin;
88070
88071 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
88072 RECEIVE_PACKET_FIELD_ERROR(activity_base);
88073 }
88074 real_packet->activity_base = readin;
88075 }
88076 #ifdef FREECIV_JSON_CONNECTION
88077 field_addr.name = "debug";
88078 #endif /* FREECIV_JSON_CONNECTION */
88079 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->debug)) {
88080 RECEIVE_PACKET_FIELD_ERROR(debug);
88081 }
88082 #ifdef FREECIV_JSON_CONNECTION
88083 field_addr.name = "moved";
88084 #endif /* FREECIV_JSON_CONNECTION */
88085 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->moved)) {
88086 RECEIVE_PACKET_FIELD_ERROR(moved);
88087 }
88088 #ifdef FREECIV_JSON_CONNECTION
88089 field_addr.name = "paradropped";
88090 #endif /* FREECIV_JSON_CONNECTION */
88091 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->paradropped)) {
88092 RECEIVE_PACKET_FIELD_ERROR(paradropped);
88093 }
88094 #ifdef FREECIV_JSON_CONNECTION
88095 field_addr.name = "done_moving";
88096 #endif /* FREECIV_JSON_CONNECTION */
88097 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->done_moving)) {
88098 RECEIVE_PACKET_FIELD_ERROR(done_moving);
88099 }
88100 #ifdef FREECIV_JSON_CONNECTION
88101 field_addr.name = "transported_by16";
88102 #endif /* FREECIV_JSON_CONNECTION */
88103 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->transported_by16)) {
88104 RECEIVE_PACKET_FIELD_ERROR(transported_by16);
88105 }
88106 #ifdef FREECIV_JSON_CONNECTION
88107 field_addr.name = "stay";
88108 #endif /* FREECIV_JSON_CONNECTION */
88109 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->stay)) {
88110 RECEIVE_PACKET_FIELD_ERROR(stay);
88111 }
88112
88113#endif
88114 log_packet_detailed("packet_edit_unit_101: got info about (%d)",
88115 real_packet->id16);
88116
88117#ifdef FREECIV_DELTA_PROTOCOL
88118 if (NULL == *hash) {
88119 *hash = genhash_new_full(hash_packet_edit_unit_101, cmp_packet_edit_unit_101,
88120 NULL, NULL, NULL, free);
88121 }
88122
88123 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
88124 *real_packet = *old;
88125 } else {
88126 int id16 = real_packet->id16;
88127
88128 log_packet_detailed(" no old info");
88129 memset(real_packet, 0, sizeof(*real_packet));
88130
88131 real_packet->id16 = id16;
88132 }
88133
88134 if (BV_ISSET(fields, 0)) {
88135 log_packet_detailed(" got field 'utype'");
88136 #ifdef FREECIV_JSON_CONNECTION
88137 field_addr.name = "utype";
88138 #endif /* FREECIV_JSON_CONNECTION */
88139 {
88140 int readin;
88141
88142 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
88143 RECEIVE_PACKET_FIELD_ERROR(utype);
88144 }
88145 real_packet->utype = readin;
88146 }
88147 }
88148 if (BV_ISSET(fields, 1)) {
88149 log_packet_detailed(" got field 'owner'");
88150 #ifdef FREECIV_JSON_CONNECTION
88151 field_addr.name = "owner";
88152 #endif /* FREECIV_JSON_CONNECTION */
88153 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
88154 RECEIVE_PACKET_FIELD_ERROR(owner);
88155 }
88156 }
88157 if (BV_ISSET(fields, 2)) {
88158 log_packet_detailed(" got field 'homecity16'");
88159 #ifdef FREECIV_JSON_CONNECTION
88160 field_addr.name = "homecity16";
88161 #endif /* FREECIV_JSON_CONNECTION */
88162 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->homecity16)) {
88163 RECEIVE_PACKET_FIELD_ERROR(homecity16);
88164 }
88165 }
88166 if (BV_ISSET(fields, 3)) {
88167 log_packet_detailed(" got field 'moves_left'");
88168 #ifdef FREECIV_JSON_CONNECTION
88169 field_addr.name = "moves_left";
88170 #endif /* FREECIV_JSON_CONNECTION */
88171 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->moves_left)) {
88172 RECEIVE_PACKET_FIELD_ERROR(moves_left);
88173 }
88174 }
88175 if (BV_ISSET(fields, 4)) {
88176 log_packet_detailed(" got field 'hp'");
88177 #ifdef FREECIV_JSON_CONNECTION
88178 field_addr.name = "hp";
88179 #endif /* FREECIV_JSON_CONNECTION */
88180 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
88181 RECEIVE_PACKET_FIELD_ERROR(hp);
88182 }
88183 }
88184 if (BV_ISSET(fields, 5)) {
88185 log_packet_detailed(" got field 'veteran'");
88186 #ifdef FREECIV_JSON_CONNECTION
88187 field_addr.name = "veteran";
88188 #endif /* FREECIV_JSON_CONNECTION */
88189 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
88190 RECEIVE_PACKET_FIELD_ERROR(veteran);
88191 }
88192 }
88193 if (BV_ISSET(fields, 6)) {
88194 log_packet_detailed(" got field 'fuel'");
88195 #ifdef FREECIV_JSON_CONNECTION
88196 field_addr.name = "fuel";
88197 #endif /* FREECIV_JSON_CONNECTION */
88198 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
88199 RECEIVE_PACKET_FIELD_ERROR(fuel);
88200 }
88201 }
88202 if (BV_ISSET(fields, 7)) {
88203 log_packet_detailed(" got field 'activity'");
88204 #ifdef FREECIV_JSON_CONNECTION
88205 field_addr.name = "activity";
88206 #endif /* FREECIV_JSON_CONNECTION */
88207 {
88208 int readin;
88209
88210 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
88211 RECEIVE_PACKET_FIELD_ERROR(activity);
88212 }
88213 real_packet->activity = readin;
88214 }
88215 }
88216 if (BV_ISSET(fields, 8)) {
88217 log_packet_detailed(" got field 'activity_count'");
88218 #ifdef FREECIV_JSON_CONNECTION
88219 field_addr.name = "activity_count";
88220 #endif /* FREECIV_JSON_CONNECTION */
88221 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
88222 RECEIVE_PACKET_FIELD_ERROR(activity_count);
88223 }
88224 }
88225 if (BV_ISSET(fields, 9)) {
88226 log_packet_detailed(" got field 'activity_base'");
88227 #ifdef FREECIV_JSON_CONNECTION
88228 field_addr.name = "activity_base";
88229 #endif /* FREECIV_JSON_CONNECTION */
88230 {
88231 int readin;
88232
88233 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
88234 RECEIVE_PACKET_FIELD_ERROR(activity_base);
88235 }
88236 real_packet->activity_base = readin;
88237 }
88238 }
88239 real_packet->debug = BV_ISSET(fields, 10);
88240 real_packet->moved = BV_ISSET(fields, 11);
88241 real_packet->paradropped = BV_ISSET(fields, 12);
88242 real_packet->done_moving = BV_ISSET(fields, 13);
88243 if (BV_ISSET(fields, 14)) {
88244 log_packet_detailed(" got field 'transported_by16'");
88245 #ifdef FREECIV_JSON_CONNECTION
88246 field_addr.name = "transported_by16";
88247 #endif /* FREECIV_JSON_CONNECTION */
88248 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->transported_by16)) {
88249 RECEIVE_PACKET_FIELD_ERROR(transported_by16);
88250 }
88251 }
88252 real_packet->stay = BV_ISSET(fields, 15);
88253
88254 if (NULL == old) {
88255 old = fc_malloc(sizeof(*old));
88256 *old = *real_packet;
88257 genhash_insert(*hash, old, old);
88258 } else {
88259 *old = *real_packet;
88260 }
88261
88262#endif /* FREECIV_DELTA_PROTOCOL */
88263 RECEIVE_PACKET_END(real_packet);
88264}
88265
88266 static int send_packet_edit_unit_101(struct connection *pc, const struct packet_edit_unit *packet)
88267{
88268 const struct packet_edit_unit *real_packet = packet;
88269#ifdef FREECIV_DELTA_PROTOCOL
88270 packet_edit_unit_101_fields fields;
88271 struct packet_edit_unit *old;
88272 bool differ;
88273 struct genhash **hash = pc->phs.sent + PACKET_EDIT_UNIT;
88274#endif /* FREECIV_DELTA_PROTOCOL */
88275 SEND_PACKET_START(PACKET_EDIT_UNIT);
88276#ifdef FREECIV_JSON_CONNECTION
88277 struct plocation field_addr;
88278 {
88279 struct plocation *field_addr_tmp = plocation_field_new(NULL);
88280 field_addr = *field_addr_tmp;
88281 FC_FREE(field_addr_tmp);
88282 }
88283#endif /* FREECIV_JSON_CONNECTION */
88284
88285 log_packet_detailed("packet_edit_unit_101: sending info about (%d)",
88286 real_packet->id16);
88287
88288#ifdef FREECIV_DELTA_PROTOCOL
88289 if (NULL == *hash) {
88290 *hash = genhash_new_full(hash_packet_edit_unit_101, cmp_packet_edit_unit_101,
88291 NULL, NULL, NULL, free);
88292 }
88293 BV_CLR_ALL(fields);
88294
88295 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
88296 old = fc_malloc(sizeof(*old));
88297 *old = *real_packet;
88298 genhash_insert(*hash, old, old);
88299 memset(old, 0, sizeof(*old));
88300 }
88301 differ = (old->utype != real_packet->utype);
88302 if (differ) {
88303 BV_SET(fields, 0);
88304 }
88305
88306 differ = (old->owner != real_packet->owner);
88307 if (differ) {
88308 BV_SET(fields, 1);
88309 }
88310
88311 differ = (old->homecity16 != real_packet->homecity16);
88312 if (differ) {
88313 BV_SET(fields, 2);
88314 }
88315
88316 differ = (old->moves_left != real_packet->moves_left);
88317 if (differ) {
88318 BV_SET(fields, 3);
88319 }
88320
88321 differ = (old->hp != real_packet->hp);
88322 if (differ) {
88323 BV_SET(fields, 4);
88324 }
88325
88326 differ = (old->veteran != real_packet->veteran);
88327 if (differ) {
88328 BV_SET(fields, 5);
88329 }
88330
88331 differ = (old->fuel != real_packet->fuel);
88332 if (differ) {
88333 BV_SET(fields, 6);
88334 }
88335
88336 differ = (old->activity != real_packet->activity);
88337 if (differ) {
88338 BV_SET(fields, 7);
88339 }
88340
88341 differ = (old->activity_count != real_packet->activity_count);
88342 if (differ) {
88343 BV_SET(fields, 8);
88344 }
88345
88346 differ = (old->activity_base != real_packet->activity_base);
88347 if (differ) {
88348 BV_SET(fields, 9);
88349 }
88350
88351 if (packet->debug) {
88352 BV_SET(fields, 10);
88353 }
88354
88355 if (packet->moved) {
88356 BV_SET(fields, 11);
88357 }
88358
88359 if (packet->paradropped) {
88360 BV_SET(fields, 12);
88361 }
88362
88363 if (packet->done_moving) {
88364 BV_SET(fields, 13);
88365 }
88366
88367 differ = (old->transported_by16 != real_packet->transported_by16);
88368 if (differ) {
88369 BV_SET(fields, 14);
88370 }
88371
88372 if (packet->stay) {
88373 BV_SET(fields, 15);
88374 }
88375
88376
88377#ifdef FREECIV_JSON_CONNECTION
88378 field_addr.name = "fields";
88379#endif /* FREECIV_JSON_CONNECTION */
88380 DIO_BV_PUT(&dout, &field_addr, fields);
88381#ifdef FREECIV_JSON_CONNECTION
88382 field_addr.name = "id16";
88383#endif /* FREECIV_JSON_CONNECTION */
88384 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
88385
88386 if (BV_ISSET(fields, 0)) {
88387 log_packet_detailed(" field 'utype' has changed");
88388 #ifdef FREECIV_JSON_CONNECTION
88389 field_addr.name = "utype";
88390#endif /* FREECIV_JSON_CONNECTION */
88391 DIO_PUT(uint8, &dout, &field_addr, real_packet->utype);
88392 }
88393 if (BV_ISSET(fields, 1)) {
88394 log_packet_detailed(" field 'owner' has changed");
88395 #ifdef FREECIV_JSON_CONNECTION
88396 field_addr.name = "owner";
88397#endif /* FREECIV_JSON_CONNECTION */
88398 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
88399 }
88400 if (BV_ISSET(fields, 2)) {
88401 log_packet_detailed(" field 'homecity16' has changed");
88402 #ifdef FREECIV_JSON_CONNECTION
88403 field_addr.name = "homecity16";
88404#endif /* FREECIV_JSON_CONNECTION */
88405 DIO_PUT(uint16, &dout, &field_addr, real_packet->homecity16);
88406 }
88407 if (BV_ISSET(fields, 3)) {
88408 log_packet_detailed(" field 'moves_left' has changed");
88409 #ifdef FREECIV_JSON_CONNECTION
88410 field_addr.name = "moves_left";
88411#endif /* FREECIV_JSON_CONNECTION */
88412 DIO_PUT(uint32, &dout, &field_addr, real_packet->moves_left);
88413 }
88414 if (BV_ISSET(fields, 4)) {
88415 log_packet_detailed(" field 'hp' has changed");
88416 #ifdef FREECIV_JSON_CONNECTION
88417 field_addr.name = "hp";
88418#endif /* FREECIV_JSON_CONNECTION */
88419 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
88420 }
88421 if (BV_ISSET(fields, 5)) {
88422 log_packet_detailed(" field 'veteran' has changed");
88423 #ifdef FREECIV_JSON_CONNECTION
88424 field_addr.name = "veteran";
88425#endif /* FREECIV_JSON_CONNECTION */
88426 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
88427 }
88428 if (BV_ISSET(fields, 6)) {
88429 log_packet_detailed(" field 'fuel' has changed");
88430 #ifdef FREECIV_JSON_CONNECTION
88431 field_addr.name = "fuel";
88432#endif /* FREECIV_JSON_CONNECTION */
88433 DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
88434 }
88435 if (BV_ISSET(fields, 7)) {
88436 log_packet_detailed(" field 'activity' has changed");
88437 #ifdef FREECIV_JSON_CONNECTION
88438 field_addr.name = "activity";
88439#endif /* FREECIV_JSON_CONNECTION */
88440 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
88441 }
88442 if (BV_ISSET(fields, 8)) {
88443 log_packet_detailed(" field 'activity_count' has changed");
88444 #ifdef FREECIV_JSON_CONNECTION
88445 field_addr.name = "activity_count";
88446#endif /* FREECIV_JSON_CONNECTION */
88447 DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
88448 }
88449 if (BV_ISSET(fields, 9)) {
88450 log_packet_detailed(" field 'activity_base' has changed");
88451 #ifdef FREECIV_JSON_CONNECTION
88452 field_addr.name = "activity_base";
88453#endif /* FREECIV_JSON_CONNECTION */
88454 DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_base);
88455 }
88456 /* field 10 is folded into the header */
88457 /* field 11 is folded into the header */
88458 /* field 12 is folded into the header */
88459 /* field 13 is folded into the header */
88460 if (BV_ISSET(fields, 14)) {
88461 log_packet_detailed(" field 'transported_by16' has changed");
88462 #ifdef FREECIV_JSON_CONNECTION
88463 field_addr.name = "transported_by16";
88464#endif /* FREECIV_JSON_CONNECTION */
88465 DIO_PUT(uint16, &dout, &field_addr, real_packet->transported_by16);
88466 }
88467 /* field 15 is folded into the header */
88468
88469 *old = *real_packet;
88470#endif /* FREECIV_DELTA_PROTOCOL */
88471#ifndef FREECIV_DELTA_PROTOCOL
88472#ifdef FREECIV_JSON_CONNECTION
88473 field_addr.name = "id16";
88474#endif /* FREECIV_JSON_CONNECTION */
88475 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
88476#ifdef FREECIV_JSON_CONNECTION
88477 field_addr.name = "utype";
88478#endif /* FREECIV_JSON_CONNECTION */
88479 DIO_PUT(uint8, &dout, &field_addr, real_packet->utype);
88480#ifdef FREECIV_JSON_CONNECTION
88481 field_addr.name = "owner";
88482#endif /* FREECIV_JSON_CONNECTION */
88483 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
88484#ifdef FREECIV_JSON_CONNECTION
88485 field_addr.name = "homecity16";
88486#endif /* FREECIV_JSON_CONNECTION */
88487 DIO_PUT(uint16, &dout, &field_addr, real_packet->homecity16);
88488#ifdef FREECIV_JSON_CONNECTION
88489 field_addr.name = "moves_left";
88490#endif /* FREECIV_JSON_CONNECTION */
88491 DIO_PUT(uint32, &dout, &field_addr, real_packet->moves_left);
88492#ifdef FREECIV_JSON_CONNECTION
88493 field_addr.name = "hp";
88494#endif /* FREECIV_JSON_CONNECTION */
88495 DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
88496#ifdef FREECIV_JSON_CONNECTION
88497 field_addr.name = "veteran";
88498#endif /* FREECIV_JSON_CONNECTION */
88499 DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
88500#ifdef FREECIV_JSON_CONNECTION
88501 field_addr.name = "fuel";
88502#endif /* FREECIV_JSON_CONNECTION */
88503 DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
88504#ifdef FREECIV_JSON_CONNECTION
88505 field_addr.name = "activity";
88506#endif /* FREECIV_JSON_CONNECTION */
88507 DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
88508#ifdef FREECIV_JSON_CONNECTION
88509 field_addr.name = "activity_count";
88510#endif /* FREECIV_JSON_CONNECTION */
88511 DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
88512#ifdef FREECIV_JSON_CONNECTION
88513 field_addr.name = "activity_base";
88514#endif /* FREECIV_JSON_CONNECTION */
88515 DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_base);
88516#ifdef FREECIV_JSON_CONNECTION
88517 field_addr.name = "debug";
88518#endif /* FREECIV_JSON_CONNECTION */
88519 DIO_PUT(bool8, &dout, &field_addr, real_packet->debug);
88520#ifdef FREECIV_JSON_CONNECTION
88521 field_addr.name = "moved";
88522#endif /* FREECIV_JSON_CONNECTION */
88523 DIO_PUT(bool8, &dout, &field_addr, real_packet->moved);
88524#ifdef FREECIV_JSON_CONNECTION
88525 field_addr.name = "paradropped";
88526#endif /* FREECIV_JSON_CONNECTION */
88527 DIO_PUT(bool8, &dout, &field_addr, real_packet->paradropped);
88528#ifdef FREECIV_JSON_CONNECTION
88529 field_addr.name = "done_moving";
88530#endif /* FREECIV_JSON_CONNECTION */
88531 DIO_PUT(bool8, &dout, &field_addr, real_packet->done_moving);
88532#ifdef FREECIV_JSON_CONNECTION
88533 field_addr.name = "transported_by16";
88534#endif /* FREECIV_JSON_CONNECTION */
88535 DIO_PUT(uint16, &dout, &field_addr, real_packet->transported_by16);
88536#ifdef FREECIV_JSON_CONNECTION
88537 field_addr.name = "stay";
88538#endif /* FREECIV_JSON_CONNECTION */
88539 DIO_PUT(bool8, &dout, &field_addr, real_packet->stay);
88540
88541#endif
88542 SEND_PACKET_END(PACKET_EDIT_UNIT);
88543}
88544
88545 int send_packet_edit_unit(struct connection *pc, const struct packet_edit_unit *packet)
88546{
88547 if (!pc->used) {
88548 log_error("WARNING: trying to send data to the closed connection %s",
88549 conn_description(pc));
88550 return -1;
88551 }
88552 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_UNIT].packet != NULL, -1,
88553 "Handler for PACKET_EDIT_UNIT not installed");
88554 return pc->phs.handlers->send[PACKET_EDIT_UNIT].packet(pc, packet);
88555}
88556
88557#ifdef FREECIV_DELTA_PROTOCOL
88558#define hash_packet_edit_city_create_100 hash_const
88559
88560#define cmp_packet_edit_city_create_100 cmp_const
88561
88562 BV_DEFINE(packet_edit_city_create_100_fields, 4);
88563#endif /* FREECIV_DELTA_PROTOCOL */
88564
88565 static struct packet_edit_city_create *receive_packet_edit_city_create_100(struct connection *pc)
88566{
88567#ifdef FREECIV_DELTA_PROTOCOL
88568 packet_edit_city_create_100_fields fields;
88569 struct packet_edit_city_create *old;
88570 struct genhash **hash = pc->phs.received + PACKET_EDIT_CITY_CREATE;
88571#endif /* FREECIV_DELTA_PROTOCOL */
88572 RECEIVE_PACKET_START(packet_edit_city_create, real_packet);
88573#ifdef FREECIV_JSON_CONNECTION
88574 struct plocation field_addr;
88575 {
88576 struct plocation *field_addr_tmp = plocation_field_new(NULL);
88577 field_addr = *field_addr_tmp;
88578 FC_FREE(field_addr_tmp);
88579 }
88580#endif /* FREECIV_JSON_CONNECTION */
88581
88582#ifdef FREECIV_DELTA_PROTOCOL
88583#ifdef FREECIV_JSON_CONNECTION
88584 field_addr.name = "fields";
88585#endif /* FREECIV_JSON_CONNECTION */
88586 DIO_BV_GET(&din, &field_addr, fields);
88587
88588#else /* FREECIV_DELTA_PROTOCOL */
88589 #ifdef FREECIV_JSON_CONNECTION
88590 field_addr.name = "owner";
88591 #endif /* FREECIV_JSON_CONNECTION */
88592 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
88593 RECEIVE_PACKET_FIELD_ERROR(owner);
88594 }
88595 #ifdef FREECIV_JSON_CONNECTION
88596 field_addr.name = "tile";
88597 #endif /* FREECIV_JSON_CONNECTION */
88598 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
88599 RECEIVE_PACKET_FIELD_ERROR(tile);
88600 }
88601 #ifdef FREECIV_JSON_CONNECTION
88602 field_addr.name = "size";
88603 #endif /* FREECIV_JSON_CONNECTION */
88604 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
88605 RECEIVE_PACKET_FIELD_ERROR(size);
88606 }
88607 #ifdef FREECIV_JSON_CONNECTION
88608 field_addr.name = "tag";
88609 #endif /* FREECIV_JSON_CONNECTION */
88610 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
88611 RECEIVE_PACKET_FIELD_ERROR(tag);
88612 }
88613
88614#endif
88615 log_packet_detailed("packet_edit_city_create_100: got info about ()");
88616
88617#ifdef FREECIV_DELTA_PROTOCOL
88618 if (NULL == *hash) {
88619 *hash = genhash_new_full(hash_packet_edit_city_create_100, cmp_packet_edit_city_create_100,
88620 NULL, NULL, NULL, free);
88621 }
88622
88623 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
88624 *real_packet = *old;
88625 } else {
88626 log_packet_detailed(" no old info");
88627 memset(real_packet, 0, sizeof(*real_packet));
88628 }
88629
88630 if (BV_ISSET(fields, 0)) {
88631 log_packet_detailed(" got field 'owner'");
88632 #ifdef FREECIV_JSON_CONNECTION
88633 field_addr.name = "owner";
88634 #endif /* FREECIV_JSON_CONNECTION */
88635 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
88636 RECEIVE_PACKET_FIELD_ERROR(owner);
88637 }
88638 }
88639 if (BV_ISSET(fields, 1)) {
88640 log_packet_detailed(" got field 'tile'");
88641 #ifdef FREECIV_JSON_CONNECTION
88642 field_addr.name = "tile";
88643 #endif /* FREECIV_JSON_CONNECTION */
88644 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
88645 RECEIVE_PACKET_FIELD_ERROR(tile);
88646 }
88647 }
88648 if (BV_ISSET(fields, 2)) {
88649 log_packet_detailed(" got field 'size'");
88650 #ifdef FREECIV_JSON_CONNECTION
88651 field_addr.name = "size";
88652 #endif /* FREECIV_JSON_CONNECTION */
88653 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
88654 RECEIVE_PACKET_FIELD_ERROR(size);
88655 }
88656 }
88657 if (BV_ISSET(fields, 3)) {
88658 log_packet_detailed(" got field 'tag'");
88659 #ifdef FREECIV_JSON_CONNECTION
88660 field_addr.name = "tag";
88661 #endif /* FREECIV_JSON_CONNECTION */
88662 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
88663 RECEIVE_PACKET_FIELD_ERROR(tag);
88664 }
88665 }
88666
88667 if (NULL == old) {
88668 old = fc_malloc(sizeof(*old));
88669 *old = *real_packet;
88670 genhash_insert(*hash, old, old);
88671 } else {
88672 *old = *real_packet;
88673 }
88674
88675#endif /* FREECIV_DELTA_PROTOCOL */
88676 RECEIVE_PACKET_END(real_packet);
88677}
88678
88679 static int send_packet_edit_city_create_100(struct connection *pc, const struct packet_edit_city_create *packet)
88680{
88681 const struct packet_edit_city_create *real_packet = packet;
88682#ifdef FREECIV_DELTA_PROTOCOL
88683 packet_edit_city_create_100_fields fields;
88684 struct packet_edit_city_create *old;
88685 bool differ;
88686 struct genhash **hash = pc->phs.sent + PACKET_EDIT_CITY_CREATE;
88687#endif /* FREECIV_DELTA_PROTOCOL */
88688 SEND_PACKET_START(PACKET_EDIT_CITY_CREATE);
88689#ifdef FREECIV_JSON_CONNECTION
88690 struct plocation field_addr;
88691 {
88692 struct plocation *field_addr_tmp = plocation_field_new(NULL);
88693 field_addr = *field_addr_tmp;
88694 FC_FREE(field_addr_tmp);
88695 }
88696#endif /* FREECIV_JSON_CONNECTION */
88697
88698 log_packet_detailed("packet_edit_city_create_100: sending info about ()");
88699
88700#ifdef FREECIV_DELTA_PROTOCOL
88701 if (NULL == *hash) {
88702 *hash = genhash_new_full(hash_packet_edit_city_create_100, cmp_packet_edit_city_create_100,
88703 NULL, NULL, NULL, free);
88704 }
88705 BV_CLR_ALL(fields);
88706
88707 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
88708 old = fc_malloc(sizeof(*old));
88709 *old = *real_packet;
88710 genhash_insert(*hash, old, old);
88711 memset(old, 0, sizeof(*old));
88712 }
88713 differ = (old->owner != real_packet->owner);
88714 if (differ) {
88715 BV_SET(fields, 0);
88716 }
88717
88718 differ = (old->tile != real_packet->tile);
88719 if (differ) {
88720 BV_SET(fields, 1);
88721 }
88722
88723 differ = (old->size != real_packet->size);
88724 if (differ) {
88725 BV_SET(fields, 2);
88726 }
88727
88728 differ = (old->tag != real_packet->tag);
88729 if (differ) {
88730 BV_SET(fields, 3);
88731 }
88732
88733
88734#ifdef FREECIV_JSON_CONNECTION
88735 field_addr.name = "fields";
88736#endif /* FREECIV_JSON_CONNECTION */
88737 DIO_BV_PUT(&dout, &field_addr, fields);
88738
88739 if (BV_ISSET(fields, 0)) {
88740 log_packet_detailed(" field 'owner' has changed");
88741 #ifdef FREECIV_JSON_CONNECTION
88742 field_addr.name = "owner";
88743#endif /* FREECIV_JSON_CONNECTION */
88744 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
88745 }
88746 if (BV_ISSET(fields, 1)) {
88747 log_packet_detailed(" field 'tile' has changed");
88748 #ifdef FREECIV_JSON_CONNECTION
88749 field_addr.name = "tile";
88750#endif /* FREECIV_JSON_CONNECTION */
88751 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
88752 }
88753 if (BV_ISSET(fields, 2)) {
88754 log_packet_detailed(" field 'size' has changed");
88755 #ifdef FREECIV_JSON_CONNECTION
88756 field_addr.name = "size";
88757#endif /* FREECIV_JSON_CONNECTION */
88758 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
88759 }
88760 if (BV_ISSET(fields, 3)) {
88761 log_packet_detailed(" field 'tag' has changed");
88762 #ifdef FREECIV_JSON_CONNECTION
88763 field_addr.name = "tag";
88764#endif /* FREECIV_JSON_CONNECTION */
88765 DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
88766 }
88767
88768 *old = *real_packet;
88769#endif /* FREECIV_DELTA_PROTOCOL */
88770#ifndef FREECIV_DELTA_PROTOCOL
88771#ifdef FREECIV_JSON_CONNECTION
88772 field_addr.name = "owner";
88773#endif /* FREECIV_JSON_CONNECTION */
88774 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
88775#ifdef FREECIV_JSON_CONNECTION
88776 field_addr.name = "tile";
88777#endif /* FREECIV_JSON_CONNECTION */
88778 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
88779#ifdef FREECIV_JSON_CONNECTION
88780 field_addr.name = "size";
88781#endif /* FREECIV_JSON_CONNECTION */
88782 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
88783#ifdef FREECIV_JSON_CONNECTION
88784 field_addr.name = "tag";
88785#endif /* FREECIV_JSON_CONNECTION */
88786 DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
88787
88788#endif
88789 SEND_PACKET_END(PACKET_EDIT_CITY_CREATE);
88790}
88791
88792 int send_packet_edit_city_create(struct connection *pc, const struct packet_edit_city_create *packet)
88793{
88794 if (!pc->used) {
88795 log_error("WARNING: trying to send data to the closed connection %s",
88796 conn_description(pc));
88797 return -1;
88798 }
88799 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_CITY_CREATE].packet != NULL, -1,
88800 "Handler for PACKET_EDIT_CITY_CREATE not installed");
88801 return pc->phs.handlers->send[PACKET_EDIT_CITY_CREATE].packet(pc, packet);
88802}
88803
88804 int dsend_packet_edit_city_create(struct connection *pc, int owner, int tile, int size, int tag)
88805{
88806 struct packet_edit_city_create packet, *real_packet = &packet;
88807
88808 real_packet->owner = owner;
88809 real_packet->tile = tile;
88810 real_packet->size = size;
88811 real_packet->tag = tag;
88812
88813 return send_packet_edit_city_create(pc, real_packet);
88814}
88815
88816#ifdef FREECIV_DELTA_PROTOCOL
88817#define hash_packet_edit_city_remove_100 hash_const
88818
88819#define cmp_packet_edit_city_remove_100 cmp_const
88820
88821 BV_DEFINE(packet_edit_city_remove_100_fields, 1);
88822#endif /* FREECIV_DELTA_PROTOCOL */
88823
88824 static struct packet_edit_city_remove *receive_packet_edit_city_remove_100(struct connection *pc)
88825{
88826#ifdef FREECIV_DELTA_PROTOCOL
88827 packet_edit_city_remove_100_fields fields;
88828 struct packet_edit_city_remove *old;
88829 struct genhash **hash = pc->phs.received + PACKET_EDIT_CITY_REMOVE;
88830#endif /* FREECIV_DELTA_PROTOCOL */
88831 RECEIVE_PACKET_START(packet_edit_city_remove, real_packet);
88832#ifdef FREECIV_JSON_CONNECTION
88833 struct plocation field_addr;
88834 {
88835 struct plocation *field_addr_tmp = plocation_field_new(NULL);
88836 field_addr = *field_addr_tmp;
88837 FC_FREE(field_addr_tmp);
88838 }
88839#endif /* FREECIV_JSON_CONNECTION */
88840
88841#ifdef FREECIV_DELTA_PROTOCOL
88842#ifdef FREECIV_JSON_CONNECTION
88843 field_addr.name = "fields";
88844#endif /* FREECIV_JSON_CONNECTION */
88845 DIO_BV_GET(&din, &field_addr, fields);
88846
88847#else /* FREECIV_DELTA_PROTOCOL */
88848 #ifdef FREECIV_JSON_CONNECTION
88849 field_addr.name = "id32";
88850 #endif /* FREECIV_JSON_CONNECTION */
88851 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
88852 RECEIVE_PACKET_FIELD_ERROR(id32);
88853 }
88854
88855#endif
88856 log_packet_detailed("packet_edit_city_remove_100: got info about ()");
88857
88858#ifdef FREECIV_DELTA_PROTOCOL
88859 if (NULL == *hash) {
88860 *hash = genhash_new_full(hash_packet_edit_city_remove_100, cmp_packet_edit_city_remove_100,
88861 NULL, NULL, NULL, free);
88862 }
88863
88864 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
88865 *real_packet = *old;
88866 } else {
88867 log_packet_detailed(" no old info");
88868 memset(real_packet, 0, sizeof(*real_packet));
88869 }
88870
88871 if (BV_ISSET(fields, 0)) {
88872 log_packet_detailed(" got field 'id32'");
88873 #ifdef FREECIV_JSON_CONNECTION
88874 field_addr.name = "id32";
88875 #endif /* FREECIV_JSON_CONNECTION */
88876 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
88877 RECEIVE_PACKET_FIELD_ERROR(id32);
88878 }
88879 }
88880
88881 if (NULL == old) {
88882 old = fc_malloc(sizeof(*old));
88883 *old = *real_packet;
88884 genhash_insert(*hash, old, old);
88885 } else {
88886 *old = *real_packet;
88887 }
88888
88889#endif /* FREECIV_DELTA_PROTOCOL */
88890 RECEIVE_PACKET_END(real_packet);
88891}
88892
88893 static int send_packet_edit_city_remove_100(struct connection *pc, const struct packet_edit_city_remove *packet)
88894{
88895 const struct packet_edit_city_remove *real_packet = packet;
88896#ifdef FREECIV_DELTA_PROTOCOL
88897 packet_edit_city_remove_100_fields fields;
88898 struct packet_edit_city_remove *old;
88899 bool differ;
88900 struct genhash **hash = pc->phs.sent + PACKET_EDIT_CITY_REMOVE;
88901#endif /* FREECIV_DELTA_PROTOCOL */
88902 SEND_PACKET_START(PACKET_EDIT_CITY_REMOVE);
88903#ifdef FREECIV_JSON_CONNECTION
88904 struct plocation field_addr;
88905 {
88906 struct plocation *field_addr_tmp = plocation_field_new(NULL);
88907 field_addr = *field_addr_tmp;
88908 FC_FREE(field_addr_tmp);
88909 }
88910#endif /* FREECIV_JSON_CONNECTION */
88911
88912 log_packet_detailed("packet_edit_city_remove_100: sending info about ()");
88913
88914#ifdef FREECIV_DELTA_PROTOCOL
88915 if (NULL == *hash) {
88916 *hash = genhash_new_full(hash_packet_edit_city_remove_100, cmp_packet_edit_city_remove_100,
88917 NULL, NULL, NULL, free);
88918 }
88919 BV_CLR_ALL(fields);
88920
88921 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
88922 old = fc_malloc(sizeof(*old));
88923 *old = *real_packet;
88924 genhash_insert(*hash, old, old);
88925 memset(old, 0, sizeof(*old));
88926 }
88927 differ = (old->id32 != real_packet->id32);
88928 if (differ) {
88929 BV_SET(fields, 0);
88930 }
88931
88932
88933#ifdef FREECIV_JSON_CONNECTION
88934 field_addr.name = "fields";
88935#endif /* FREECIV_JSON_CONNECTION */
88936 DIO_BV_PUT(&dout, &field_addr, fields);
88937
88938 if (BV_ISSET(fields, 0)) {
88939 log_packet_detailed(" field 'id32' has changed");
88940 #ifdef FREECIV_JSON_CONNECTION
88941 field_addr.name = "id32";
88942#endif /* FREECIV_JSON_CONNECTION */
88943 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
88944 }
88945
88946 *old = *real_packet;
88947#endif /* FREECIV_DELTA_PROTOCOL */
88948#ifndef FREECIV_DELTA_PROTOCOL
88949#ifdef FREECIV_JSON_CONNECTION
88950 field_addr.name = "id32";
88951#endif /* FREECIV_JSON_CONNECTION */
88952 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
88953
88954#endif
88955 SEND_PACKET_END(PACKET_EDIT_CITY_REMOVE);
88956}
88957
88958#ifdef FREECIV_DELTA_PROTOCOL
88959#define hash_packet_edit_city_remove_101 hash_const
88960
88961#define cmp_packet_edit_city_remove_101 cmp_const
88962
88963 BV_DEFINE(packet_edit_city_remove_101_fields, 1);
88964#endif /* FREECIV_DELTA_PROTOCOL */
88965
88966 static struct packet_edit_city_remove *receive_packet_edit_city_remove_101(struct connection *pc)
88967{
88968#ifdef FREECIV_DELTA_PROTOCOL
88969 packet_edit_city_remove_101_fields fields;
88970 struct packet_edit_city_remove *old;
88971 struct genhash **hash = pc->phs.received + PACKET_EDIT_CITY_REMOVE;
88972#endif /* FREECIV_DELTA_PROTOCOL */
88973 RECEIVE_PACKET_START(packet_edit_city_remove, real_packet);
88974#ifdef FREECIV_JSON_CONNECTION
88975 struct plocation field_addr;
88976 {
88977 struct plocation *field_addr_tmp = plocation_field_new(NULL);
88978 field_addr = *field_addr_tmp;
88979 FC_FREE(field_addr_tmp);
88980 }
88981#endif /* FREECIV_JSON_CONNECTION */
88982
88983#ifdef FREECIV_DELTA_PROTOCOL
88984#ifdef FREECIV_JSON_CONNECTION
88985 field_addr.name = "fields";
88986#endif /* FREECIV_JSON_CONNECTION */
88987 DIO_BV_GET(&din, &field_addr, fields);
88988
88989#else /* FREECIV_DELTA_PROTOCOL */
88990 #ifdef FREECIV_JSON_CONNECTION
88991 field_addr.name = "id16";
88992 #endif /* FREECIV_JSON_CONNECTION */
88993 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
88994 RECEIVE_PACKET_FIELD_ERROR(id16);
88995 }
88996
88997#endif
88998 log_packet_detailed("packet_edit_city_remove_101: got info about ()");
88999
89000#ifdef FREECIV_DELTA_PROTOCOL
89001 if (NULL == *hash) {
89002 *hash = genhash_new_full(hash_packet_edit_city_remove_101, cmp_packet_edit_city_remove_101,
89003 NULL, NULL, NULL, free);
89004 }
89005
89006 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
89007 *real_packet = *old;
89008 } else {
89009 log_packet_detailed(" no old info");
89010 memset(real_packet, 0, sizeof(*real_packet));
89011 }
89012
89013 if (BV_ISSET(fields, 0)) {
89014 log_packet_detailed(" got field 'id16'");
89015 #ifdef FREECIV_JSON_CONNECTION
89016 field_addr.name = "id16";
89017 #endif /* FREECIV_JSON_CONNECTION */
89018 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
89019 RECEIVE_PACKET_FIELD_ERROR(id16);
89020 }
89021 }
89022
89023 if (NULL == old) {
89024 old = fc_malloc(sizeof(*old));
89025 *old = *real_packet;
89026 genhash_insert(*hash, old, old);
89027 } else {
89028 *old = *real_packet;
89029 }
89030
89031#endif /* FREECIV_DELTA_PROTOCOL */
89032 RECEIVE_PACKET_END(real_packet);
89033}
89034
89035 static int send_packet_edit_city_remove_101(struct connection *pc, const struct packet_edit_city_remove *packet)
89036{
89037 const struct packet_edit_city_remove *real_packet = packet;
89038#ifdef FREECIV_DELTA_PROTOCOL
89039 packet_edit_city_remove_101_fields fields;
89040 struct packet_edit_city_remove *old;
89041 bool differ;
89042 struct genhash **hash = pc->phs.sent + PACKET_EDIT_CITY_REMOVE;
89043#endif /* FREECIV_DELTA_PROTOCOL */
89044 SEND_PACKET_START(PACKET_EDIT_CITY_REMOVE);
89045#ifdef FREECIV_JSON_CONNECTION
89046 struct plocation field_addr;
89047 {
89048 struct plocation *field_addr_tmp = plocation_field_new(NULL);
89049 field_addr = *field_addr_tmp;
89050 FC_FREE(field_addr_tmp);
89051 }
89052#endif /* FREECIV_JSON_CONNECTION */
89053
89054 log_packet_detailed("packet_edit_city_remove_101: sending info about ()");
89055
89056#ifdef FREECIV_DELTA_PROTOCOL
89057 if (NULL == *hash) {
89058 *hash = genhash_new_full(hash_packet_edit_city_remove_101, cmp_packet_edit_city_remove_101,
89059 NULL, NULL, NULL, free);
89060 }
89061 BV_CLR_ALL(fields);
89062
89063 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
89064 old = fc_malloc(sizeof(*old));
89065 *old = *real_packet;
89066 genhash_insert(*hash, old, old);
89067 memset(old, 0, sizeof(*old));
89068 }
89069 differ = (old->id16 != real_packet->id16);
89070 if (differ) {
89071 BV_SET(fields, 0);
89072 }
89073
89074
89075#ifdef FREECIV_JSON_CONNECTION
89076 field_addr.name = "fields";
89077#endif /* FREECIV_JSON_CONNECTION */
89078 DIO_BV_PUT(&dout, &field_addr, fields);
89079
89080 if (BV_ISSET(fields, 0)) {
89081 log_packet_detailed(" field 'id16' has changed");
89082 #ifdef FREECIV_JSON_CONNECTION
89083 field_addr.name = "id16";
89084#endif /* FREECIV_JSON_CONNECTION */
89085 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
89086 }
89087
89088 *old = *real_packet;
89089#endif /* FREECIV_DELTA_PROTOCOL */
89090#ifndef FREECIV_DELTA_PROTOCOL
89091#ifdef FREECIV_JSON_CONNECTION
89092 field_addr.name = "id16";
89093#endif /* FREECIV_JSON_CONNECTION */
89094 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
89095
89096#endif
89097 SEND_PACKET_END(PACKET_EDIT_CITY_REMOVE);
89098}
89099
89100 int send_packet_edit_city_remove(struct connection *pc, const struct packet_edit_city_remove *packet)
89101{
89102 if (!pc->used) {
89103 log_error("WARNING: trying to send data to the closed connection %s",
89104 conn_description(pc));
89105 return -1;
89106 }
89107 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_CITY_REMOVE].packet != NULL, -1,
89108 "Handler for PACKET_EDIT_CITY_REMOVE not installed");
89109 return pc->phs.handlers->send[PACKET_EDIT_CITY_REMOVE].packet(pc, packet);
89110}
89111
89112 int dsend_packet_edit_city_remove(struct connection *pc, int id16, int id32)
89113{
89114 struct packet_edit_city_remove packet, *real_packet = &packet;
89115
89116 real_packet->id16 = id16;
89117 real_packet->id32 = id32;
89118
89119 return send_packet_edit_city_remove(pc, real_packet);
89120}
89121
89122#ifdef FREECIV_DELTA_PROTOCOL
89123#define hash_packet_edit_city_100 hash_const
89124
89125#define cmp_packet_edit_city_100 cmp_const
89126
89127 BV_DEFINE(packet_edit_city_100_fields, 28);
89128#endif /* FREECIV_DELTA_PROTOCOL */
89129
89130 static struct packet_edit_city *receive_packet_edit_city_100(struct connection *pc)
89131{
89132#ifdef FREECIV_DELTA_PROTOCOL
89133 packet_edit_city_100_fields fields;
89134 struct packet_edit_city *old;
89135 struct genhash **hash = pc->phs.received + PACKET_EDIT_CITY;
89136#endif /* FREECIV_DELTA_PROTOCOL */
89137 RECEIVE_PACKET_START(packet_edit_city, real_packet);
89138#ifdef FREECIV_JSON_CONNECTION
89139 struct plocation field_addr;
89140 {
89141 struct plocation *field_addr_tmp = plocation_field_new(NULL);
89142 field_addr = *field_addr_tmp;
89143 FC_FREE(field_addr_tmp);
89144 }
89145#endif /* FREECIV_JSON_CONNECTION */
89146
89147#ifdef FREECIV_DELTA_PROTOCOL
89148#ifdef FREECIV_JSON_CONNECTION
89149 field_addr.name = "fields";
89150#endif /* FREECIV_JSON_CONNECTION */
89151 DIO_BV_GET(&din, &field_addr, fields);
89152
89153#else /* FREECIV_DELTA_PROTOCOL */
89154 #ifdef FREECIV_JSON_CONNECTION
89155 field_addr.name = "id32";
89156 #endif /* FREECIV_JSON_CONNECTION */
89157 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
89158 RECEIVE_PACKET_FIELD_ERROR(id32);
89159 }
89160 #ifdef FREECIV_JSON_CONNECTION
89161 field_addr.name = "name";
89162 #endif /* FREECIV_JSON_CONNECTION */
89163 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
89164 RECEIVE_PACKET_FIELD_ERROR(name);
89165 }
89166 #ifdef FREECIV_JSON_CONNECTION
89167 field_addr.name = "owner";
89168 #endif /* FREECIV_JSON_CONNECTION */
89169 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
89170 RECEIVE_PACKET_FIELD_ERROR(owner);
89171 }
89172 #ifdef FREECIV_JSON_CONNECTION
89173 field_addr.name = "original";
89174 #endif /* FREECIV_JSON_CONNECTION */
89175 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->original)) {
89176 RECEIVE_PACKET_FIELD_ERROR(original);
89177 }
89178 #ifdef FREECIV_JSON_CONNECTION
89179 field_addr.name = "size";
89180 #endif /* FREECIV_JSON_CONNECTION */
89181 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
89182 RECEIVE_PACKET_FIELD_ERROR(size);
89183 }
89184 #ifdef FREECIV_JSON_CONNECTION
89185 field_addr.name = "history";
89186 #endif /* FREECIV_JSON_CONNECTION */
89187 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
89188 RECEIVE_PACKET_FIELD_ERROR(history);
89189 }
89190 #ifdef FREECIV_JSON_CONNECTION
89191 field_addr.name = "ppl_happy";
89192 #endif /* FREECIV_JSON_CONNECTION */
89193
89194 {
89195 int i;
89196
89197 #ifdef FREECIV_JSON_CONNECTION
89198 /* Enter array. */
89199 field_addr.sub_location = plocation_elem_new(0);
89200 #endif /* FREECIV_JSON_CONNECTION */
89201
89202 for (i = 0; i < 5; i++) {
89203 #ifdef FREECIV_JSON_CONNECTION
89204 field_addr.sub_location->number = i;
89205 #endif /* FREECIV_JSON_CONNECTION */
89206 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
89207 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
89208 }
89209 }
89210
89211 #ifdef FREECIV_JSON_CONNECTION
89212 /* Exit array. */
89213 free(field_addr.sub_location);
89214 field_addr.sub_location = NULL;
89215 #endif /* FREECIV_JSON_CONNECTION */
89216 }
89217 #ifdef FREECIV_JSON_CONNECTION
89218 field_addr.name = "ppl_content";
89219 #endif /* FREECIV_JSON_CONNECTION */
89220
89221 {
89222 int i;
89223
89224 #ifdef FREECIV_JSON_CONNECTION
89225 /* Enter array. */
89226 field_addr.sub_location = plocation_elem_new(0);
89227 #endif /* FREECIV_JSON_CONNECTION */
89228
89229 for (i = 0; i < 5; i++) {
89230 #ifdef FREECIV_JSON_CONNECTION
89231 field_addr.sub_location->number = i;
89232 #endif /* FREECIV_JSON_CONNECTION */
89233 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
89234 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
89235 }
89236 }
89237
89238 #ifdef FREECIV_JSON_CONNECTION
89239 /* Exit array. */
89240 free(field_addr.sub_location);
89241 field_addr.sub_location = NULL;
89242 #endif /* FREECIV_JSON_CONNECTION */
89243 }
89244 #ifdef FREECIV_JSON_CONNECTION
89245 field_addr.name = "ppl_unhappy";
89246 #endif /* FREECIV_JSON_CONNECTION */
89247
89248 {
89249 int i;
89250
89251 #ifdef FREECIV_JSON_CONNECTION
89252 /* Enter array. */
89253 field_addr.sub_location = plocation_elem_new(0);
89254 #endif /* FREECIV_JSON_CONNECTION */
89255
89256 for (i = 0; i < 5; i++) {
89257 #ifdef FREECIV_JSON_CONNECTION
89258 field_addr.sub_location->number = i;
89259 #endif /* FREECIV_JSON_CONNECTION */
89260 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
89261 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
89262 }
89263 }
89264
89265 #ifdef FREECIV_JSON_CONNECTION
89266 /* Exit array. */
89267 free(field_addr.sub_location);
89268 field_addr.sub_location = NULL;
89269 #endif /* FREECIV_JSON_CONNECTION */
89270 }
89271 #ifdef FREECIV_JSON_CONNECTION
89272 field_addr.name = "ppl_angry";
89273 #endif /* FREECIV_JSON_CONNECTION */
89274
89275 {
89276 int i;
89277
89278 #ifdef FREECIV_JSON_CONNECTION
89279 /* Enter array. */
89280 field_addr.sub_location = plocation_elem_new(0);
89281 #endif /* FREECIV_JSON_CONNECTION */
89282
89283 for (i = 0; i < 5; i++) {
89284 #ifdef FREECIV_JSON_CONNECTION
89285 field_addr.sub_location->number = i;
89286 #endif /* FREECIV_JSON_CONNECTION */
89287 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
89288 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
89289 }
89290 }
89291
89292 #ifdef FREECIV_JSON_CONNECTION
89293 /* Exit array. */
89294 free(field_addr.sub_location);
89295 field_addr.sub_location = NULL;
89296 #endif /* FREECIV_JSON_CONNECTION */
89297 }
89298 #ifdef FREECIV_JSON_CONNECTION
89299 field_addr.name = "specialists_size";
89300 #endif /* FREECIV_JSON_CONNECTION */
89301 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
89302 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
89303 }
89304 #ifdef FREECIV_JSON_CONNECTION
89305 field_addr.name = "specialists";
89306 #endif /* FREECIV_JSON_CONNECTION */
89307
89308 {
89309 int i;
89310
89311 #ifdef FREECIV_JSON_CONNECTION
89312 /* Enter array. */
89313 field_addr.sub_location = plocation_elem_new(0);
89314 #endif /* FREECIV_JSON_CONNECTION */
89315
89316 if (real_packet->specialists_size > SP_MAX) {
89317 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
89318 }
89319 for (i = 0; i < real_packet->specialists_size; i++) {
89320 #ifdef FREECIV_JSON_CONNECTION
89321 field_addr.sub_location->number = i;
89322 #endif /* FREECIV_JSON_CONNECTION */
89323 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
89324 RECEIVE_PACKET_FIELD_ERROR(specialists);
89325 }
89326 }
89327
89328 #ifdef FREECIV_JSON_CONNECTION
89329 /* Exit array. */
89330 free(field_addr.sub_location);
89331 field_addr.sub_location = NULL;
89332 #endif /* FREECIV_JSON_CONNECTION */
89333 }
89334 #ifdef FREECIV_JSON_CONNECTION
89335 field_addr.name = "food_stock";
89336 #endif /* FREECIV_JSON_CONNECTION */
89337 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->food_stock)) {
89338 RECEIVE_PACKET_FIELD_ERROR(food_stock);
89339 }
89340 #ifdef FREECIV_JSON_CONNECTION
89341 field_addr.name = "shield_stock";
89342 #endif /* FREECIV_JSON_CONNECTION */
89343 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
89344 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
89345 }
89346 #ifdef FREECIV_JSON_CONNECTION
89347 field_addr.name = "airlift";
89348 #endif /* FREECIV_JSON_CONNECTION */
89349 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->airlift)) {
89350 RECEIVE_PACKET_FIELD_ERROR(airlift);
89351 }
89352 #ifdef FREECIV_JSON_CONNECTION
89353 field_addr.name = "debug";
89354 #endif /* FREECIV_JSON_CONNECTION */
89355 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->debug)) {
89356 RECEIVE_PACKET_FIELD_ERROR(debug);
89357 }
89358 #ifdef FREECIV_JSON_CONNECTION
89359 field_addr.name = "did_buy";
89360 #endif /* FREECIV_JSON_CONNECTION */
89361 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_buy)) {
89362 RECEIVE_PACKET_FIELD_ERROR(did_buy);
89363 }
89364 #ifdef FREECIV_JSON_CONNECTION
89365 field_addr.name = "did_sell";
89366 #endif /* FREECIV_JSON_CONNECTION */
89367 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_sell)) {
89368 RECEIVE_PACKET_FIELD_ERROR(did_sell);
89369 }
89370 #ifdef FREECIV_JSON_CONNECTION
89371 field_addr.name = "was_happy";
89372 #endif /* FREECIV_JSON_CONNECTION */
89373 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->was_happy)) {
89374 RECEIVE_PACKET_FIELD_ERROR(was_happy);
89375 }
89376 #ifdef FREECIV_JSON_CONNECTION
89377 field_addr.name = "anarchy";
89378 #endif /* FREECIV_JSON_CONNECTION */
89379 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->anarchy)) {
89380 RECEIVE_PACKET_FIELD_ERROR(anarchy);
89381 }
89382 #ifdef FREECIV_JSON_CONNECTION
89383 field_addr.name = "rapture";
89384 #endif /* FREECIV_JSON_CONNECTION */
89385 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rapture)) {
89386 RECEIVE_PACKET_FIELD_ERROR(rapture);
89387 }
89388 #ifdef FREECIV_JSON_CONNECTION
89389 field_addr.name = "steal";
89390 #endif /* FREECIV_JSON_CONNECTION */
89391 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->steal)) {
89392 RECEIVE_PACKET_FIELD_ERROR(steal);
89393 }
89394 #ifdef FREECIV_JSON_CONNECTION
89395 field_addr.name = "turn_founded";
89396 #endif /* FREECIV_JSON_CONNECTION */
89397 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
89398 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
89399 }
89400 #ifdef FREECIV_JSON_CONNECTION
89401 field_addr.name = "turn_last_built";
89402 #endif /* FREECIV_JSON_CONNECTION */
89403 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
89404 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
89405 }
89406 #ifdef FREECIV_JSON_CONNECTION
89407 field_addr.name = "built";
89408 #endif /* FREECIV_JSON_CONNECTION */
89409
89410 {
89411 int i;
89412
89413 for (i = 0; i < B_LAST; i++) {
89414 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->built[i])) {
89415 RECEIVE_PACKET_FIELD_ERROR(built);
89416 }
89417 }
89418 }
89419 #ifdef FREECIV_JSON_CONNECTION
89420 field_addr.name = "production_kind";
89421 #endif /* FREECIV_JSON_CONNECTION */
89422 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
89423 RECEIVE_PACKET_FIELD_ERROR(production_kind);
89424 }
89425 #ifdef FREECIV_JSON_CONNECTION
89426 field_addr.name = "production_value";
89427 #endif /* FREECIV_JSON_CONNECTION */
89428 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
89429 RECEIVE_PACKET_FIELD_ERROR(production_value);
89430 }
89431 #ifdef FREECIV_JSON_CONNECTION
89432 field_addr.name = "city_options";
89433 #endif /* FREECIV_JSON_CONNECTION */
89434 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
89435 RECEIVE_PACKET_FIELD_ERROR(city_options);
89436 }
89437
89438#endif
89439 log_packet_detailed("packet_edit_city_100: got info about ()");
89440
89441#ifdef FREECIV_DELTA_PROTOCOL
89442 if (NULL == *hash) {
89443 *hash = genhash_new_full(hash_packet_edit_city_100, cmp_packet_edit_city_100,
89444 NULL, NULL, NULL, free);
89445 }
89446
89447 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
89448 *real_packet = *old;
89449 } else {
89450 log_packet_detailed(" no old info");
89451 memset(real_packet, 0, sizeof(*real_packet));
89452 }
89453
89454 if (BV_ISSET(fields, 0)) {
89455 log_packet_detailed(" got field 'id32'");
89456 #ifdef FREECIV_JSON_CONNECTION
89457 field_addr.name = "id32";
89458 #endif /* FREECIV_JSON_CONNECTION */
89459 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
89460 RECEIVE_PACKET_FIELD_ERROR(id32);
89461 }
89462 }
89463 if (BV_ISSET(fields, 1)) {
89464 log_packet_detailed(" got field 'name'");
89465 #ifdef FREECIV_JSON_CONNECTION
89466 field_addr.name = "name";
89467 #endif /* FREECIV_JSON_CONNECTION */
89468 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
89469 RECEIVE_PACKET_FIELD_ERROR(name);
89470 }
89471 }
89472 if (BV_ISSET(fields, 2)) {
89473 log_packet_detailed(" got field 'owner'");
89474 #ifdef FREECIV_JSON_CONNECTION
89475 field_addr.name = "owner";
89476 #endif /* FREECIV_JSON_CONNECTION */
89477 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
89478 RECEIVE_PACKET_FIELD_ERROR(owner);
89479 }
89480 }
89481 if (BV_ISSET(fields, 3)) {
89482 log_packet_detailed(" got field 'original'");
89483 #ifdef FREECIV_JSON_CONNECTION
89484 field_addr.name = "original";
89485 #endif /* FREECIV_JSON_CONNECTION */
89486 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->original)) {
89487 RECEIVE_PACKET_FIELD_ERROR(original);
89488 }
89489 }
89490 if (BV_ISSET(fields, 4)) {
89491 log_packet_detailed(" got field 'size'");
89492 #ifdef FREECIV_JSON_CONNECTION
89493 field_addr.name = "size";
89494 #endif /* FREECIV_JSON_CONNECTION */
89495 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
89496 RECEIVE_PACKET_FIELD_ERROR(size);
89497 }
89498 }
89499 if (BV_ISSET(fields, 5)) {
89500 log_packet_detailed(" got field 'history'");
89501 #ifdef FREECIV_JSON_CONNECTION
89502 field_addr.name = "history";
89503 #endif /* FREECIV_JSON_CONNECTION */
89504 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
89505 RECEIVE_PACKET_FIELD_ERROR(history);
89506 }
89507 }
89508 if (BV_ISSET(fields, 6)) {
89509 log_packet_detailed(" got field 'ppl_happy'");
89510 #ifdef FREECIV_JSON_CONNECTION
89511 field_addr.name = "ppl_happy";
89512 #endif /* FREECIV_JSON_CONNECTION */
89513
89514 {
89515 int i;
89516
89517 #ifdef FREECIV_JSON_CONNECTION
89518 /* Enter array. */
89519 field_addr.sub_location = plocation_elem_new(0);
89520 #endif /* FREECIV_JSON_CONNECTION */
89521
89522 for (i = 0; i < 5; i++) {
89523 #ifdef FREECIV_JSON_CONNECTION
89524 field_addr.sub_location->number = i;
89525 #endif /* FREECIV_JSON_CONNECTION */
89526 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
89527 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
89528 }
89529 }
89530
89531 #ifdef FREECIV_JSON_CONNECTION
89532 /* Exit array. */
89533 free(field_addr.sub_location);
89534 field_addr.sub_location = NULL;
89535 #endif /* FREECIV_JSON_CONNECTION */
89536 }
89537 }
89538 if (BV_ISSET(fields, 7)) {
89539 log_packet_detailed(" got field 'ppl_content'");
89540 #ifdef FREECIV_JSON_CONNECTION
89541 field_addr.name = "ppl_content";
89542 #endif /* FREECIV_JSON_CONNECTION */
89543
89544 {
89545 int i;
89546
89547 #ifdef FREECIV_JSON_CONNECTION
89548 /* Enter array. */
89549 field_addr.sub_location = plocation_elem_new(0);
89550 #endif /* FREECIV_JSON_CONNECTION */
89551
89552 for (i = 0; i < 5; i++) {
89553 #ifdef FREECIV_JSON_CONNECTION
89554 field_addr.sub_location->number = i;
89555 #endif /* FREECIV_JSON_CONNECTION */
89556 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
89557 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
89558 }
89559 }
89560
89561 #ifdef FREECIV_JSON_CONNECTION
89562 /* Exit array. */
89563 free(field_addr.sub_location);
89564 field_addr.sub_location = NULL;
89565 #endif /* FREECIV_JSON_CONNECTION */
89566 }
89567 }
89568 if (BV_ISSET(fields, 8)) {
89569 log_packet_detailed(" got field 'ppl_unhappy'");
89570 #ifdef FREECIV_JSON_CONNECTION
89571 field_addr.name = "ppl_unhappy";
89572 #endif /* FREECIV_JSON_CONNECTION */
89573
89574 {
89575 int i;
89576
89577 #ifdef FREECIV_JSON_CONNECTION
89578 /* Enter array. */
89579 field_addr.sub_location = plocation_elem_new(0);
89580 #endif /* FREECIV_JSON_CONNECTION */
89581
89582 for (i = 0; i < 5; i++) {
89583 #ifdef FREECIV_JSON_CONNECTION
89584 field_addr.sub_location->number = i;
89585 #endif /* FREECIV_JSON_CONNECTION */
89586 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
89587 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
89588 }
89589 }
89590
89591 #ifdef FREECIV_JSON_CONNECTION
89592 /* Exit array. */
89593 free(field_addr.sub_location);
89594 field_addr.sub_location = NULL;
89595 #endif /* FREECIV_JSON_CONNECTION */
89596 }
89597 }
89598 if (BV_ISSET(fields, 9)) {
89599 log_packet_detailed(" got field 'ppl_angry'");
89600 #ifdef FREECIV_JSON_CONNECTION
89601 field_addr.name = "ppl_angry";
89602 #endif /* FREECIV_JSON_CONNECTION */
89603
89604 {
89605 int i;
89606
89607 #ifdef FREECIV_JSON_CONNECTION
89608 /* Enter array. */
89609 field_addr.sub_location = plocation_elem_new(0);
89610 #endif /* FREECIV_JSON_CONNECTION */
89611
89612 for (i = 0; i < 5; i++) {
89613 #ifdef FREECIV_JSON_CONNECTION
89614 field_addr.sub_location->number = i;
89615 #endif /* FREECIV_JSON_CONNECTION */
89616 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
89617 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
89618 }
89619 }
89620
89621 #ifdef FREECIV_JSON_CONNECTION
89622 /* Exit array. */
89623 free(field_addr.sub_location);
89624 field_addr.sub_location = NULL;
89625 #endif /* FREECIV_JSON_CONNECTION */
89626 }
89627 }
89628 if (BV_ISSET(fields, 10)) {
89629 log_packet_detailed(" got field 'specialists_size'");
89630 #ifdef FREECIV_JSON_CONNECTION
89631 field_addr.name = "specialists_size";
89632 #endif /* FREECIV_JSON_CONNECTION */
89633 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
89634 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
89635 }
89636 }
89637 if (BV_ISSET(fields, 11)) {
89638 log_packet_detailed(" got field 'specialists'");
89639 #ifdef FREECIV_JSON_CONNECTION
89640 field_addr.name = "specialists";
89641 #endif /* FREECIV_JSON_CONNECTION */
89642
89643 {
89644 int i;
89645
89646 #ifdef FREECIV_JSON_CONNECTION
89647 /* Enter array. */
89648 field_addr.sub_location = plocation_elem_new(0);
89649 #endif /* FREECIV_JSON_CONNECTION */
89650
89651 if (real_packet->specialists_size > SP_MAX) {
89652 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
89653 }
89654 for (i = 0; i < real_packet->specialists_size; i++) {
89655 #ifdef FREECIV_JSON_CONNECTION
89656 field_addr.sub_location->number = i;
89657 #endif /* FREECIV_JSON_CONNECTION */
89658 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
89659 RECEIVE_PACKET_FIELD_ERROR(specialists);
89660 }
89661 }
89662
89663 #ifdef FREECIV_JSON_CONNECTION
89664 /* Exit array. */
89665 free(field_addr.sub_location);
89666 field_addr.sub_location = NULL;
89667 #endif /* FREECIV_JSON_CONNECTION */
89668 }
89669 }
89670 if (BV_ISSET(fields, 12)) {
89671 log_packet_detailed(" got field 'food_stock'");
89672 #ifdef FREECIV_JSON_CONNECTION
89673 field_addr.name = "food_stock";
89674 #endif /* FREECIV_JSON_CONNECTION */
89675 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->food_stock)) {
89676 RECEIVE_PACKET_FIELD_ERROR(food_stock);
89677 }
89678 }
89679 if (BV_ISSET(fields, 13)) {
89680 log_packet_detailed(" got field 'shield_stock'");
89681 #ifdef FREECIV_JSON_CONNECTION
89682 field_addr.name = "shield_stock";
89683 #endif /* FREECIV_JSON_CONNECTION */
89684 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
89685 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
89686 }
89687 }
89688 real_packet->airlift = BV_ISSET(fields, 14);
89689 real_packet->debug = BV_ISSET(fields, 15);
89690 real_packet->did_buy = BV_ISSET(fields, 16);
89691 real_packet->did_sell = BV_ISSET(fields, 17);
89692 real_packet->was_happy = BV_ISSET(fields, 18);
89693 if (BV_ISSET(fields, 19)) {
89694 log_packet_detailed(" got field 'anarchy'");
89695 #ifdef FREECIV_JSON_CONNECTION
89696 field_addr.name = "anarchy";
89697 #endif /* FREECIV_JSON_CONNECTION */
89698 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->anarchy)) {
89699 RECEIVE_PACKET_FIELD_ERROR(anarchy);
89700 }
89701 }
89702 if (BV_ISSET(fields, 20)) {
89703 log_packet_detailed(" got field 'rapture'");
89704 #ifdef FREECIV_JSON_CONNECTION
89705 field_addr.name = "rapture";
89706 #endif /* FREECIV_JSON_CONNECTION */
89707 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rapture)) {
89708 RECEIVE_PACKET_FIELD_ERROR(rapture);
89709 }
89710 }
89711 if (BV_ISSET(fields, 21)) {
89712 log_packet_detailed(" got field 'steal'");
89713 #ifdef FREECIV_JSON_CONNECTION
89714 field_addr.name = "steal";
89715 #endif /* FREECIV_JSON_CONNECTION */
89716 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->steal)) {
89717 RECEIVE_PACKET_FIELD_ERROR(steal);
89718 }
89719 }
89720 if (BV_ISSET(fields, 22)) {
89721 log_packet_detailed(" got field 'turn_founded'");
89722 #ifdef FREECIV_JSON_CONNECTION
89723 field_addr.name = "turn_founded";
89724 #endif /* FREECIV_JSON_CONNECTION */
89725 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
89726 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
89727 }
89728 }
89729 if (BV_ISSET(fields, 23)) {
89730 log_packet_detailed(" got field 'turn_last_built'");
89731 #ifdef FREECIV_JSON_CONNECTION
89732 field_addr.name = "turn_last_built";
89733 #endif /* FREECIV_JSON_CONNECTION */
89734 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
89735 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
89736 }
89737 }
89738 if (BV_ISSET(fields, 24)) {
89739 log_packet_detailed(" got field 'built'");
89740 #ifdef FREECIV_JSON_CONNECTION
89741 field_addr.name = "built";
89742 #endif /* FREECIV_JSON_CONNECTION */
89743
89744 {
89745 #ifdef FREECIV_JSON_CONNECTION
89746 int count;
89747
89748 /* Enter array. */
89749 field_addr.sub_location = plocation_elem_new(0);
89750
89751 for (count = 0;; count++) {
89752 int i;
89753
89754 field_addr.sub_location->number = count;
89755
89756 /* Enter diff array element (start at the index address). */
89757 field_addr.sub_location->sub_location = plocation_elem_new(0);
89758 #else /* FREECIV_JSON_CONNECTION */
89759 while (TRUE) {
89760 int i;
89761 #endif /* FREECIV_JSON_CONNECTION */
89762
89763 if (!DIO_GET(uint8, &din, &field_addr, &i)) {
89764 RECEIVE_PACKET_FIELD_ERROR(built);
89765 }
89766 if (i == 255) {
89767 #ifdef FREECIV_JSON_CONNECTION
89768 /* Exit diff array element. */
89769 free(field_addr.sub_location->sub_location);
89770 field_addr.sub_location->sub_location = NULL;
89771
89772 /* Exit diff array. */
89773 free(field_addr.sub_location);
89774 field_addr.sub_location = NULL;
89775 #endif /* FREECIV_JSON_CONNECTION */
89776
89777 break;
89778 }
89779 if (i > B_LAST) {
89780 RECEIVE_PACKET_FIELD_ERROR(built,
89781 ": unexpected value %d "
89782 "(> B_LAST) in array diff",
89783 i);
89784 } else {
89785 #ifdef FREECIV_JSON_CONNECTION
89786 /* Content address. */
89787 field_addr.sub_location->sub_location->number = 1;
89788 #endif /* FREECIV_JSON_CONNECTION */
89789 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->built[i])) {
89790 RECEIVE_PACKET_FIELD_ERROR(built);
89791 }
89792 }
89793
89794 #ifdef FREECIV_JSON_CONNECTION
89795 /* Exit diff array element. */
89796 free(field_addr.sub_location->sub_location);
89797 field_addr.sub_location->sub_location = NULL;
89798 #endif /* FREECIV_JSON_CONNECTION */
89799 }
89800
89801 #ifdef FREECIV_JSON_CONNECTION
89802 /* Exit array. */
89803 free(field_addr.sub_location);
89804 field_addr.sub_location = NULL;
89805 #endif /* FREECIV_JSON_CONNECTION */
89806 }
89807 }
89808 if (BV_ISSET(fields, 25)) {
89809 log_packet_detailed(" got field 'production_kind'");
89810 #ifdef FREECIV_JSON_CONNECTION
89811 field_addr.name = "production_kind";
89812 #endif /* FREECIV_JSON_CONNECTION */
89813 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
89814 RECEIVE_PACKET_FIELD_ERROR(production_kind);
89815 }
89816 }
89817 if (BV_ISSET(fields, 26)) {
89818 log_packet_detailed(" got field 'production_value'");
89819 #ifdef FREECIV_JSON_CONNECTION
89820 field_addr.name = "production_value";
89821 #endif /* FREECIV_JSON_CONNECTION */
89822 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
89823 RECEIVE_PACKET_FIELD_ERROR(production_value);
89824 }
89825 }
89826 if (BV_ISSET(fields, 27)) {
89827 log_packet_detailed(" got field 'city_options'");
89828 #ifdef FREECIV_JSON_CONNECTION
89829 field_addr.name = "city_options";
89830 #endif /* FREECIV_JSON_CONNECTION */
89831 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
89832 RECEIVE_PACKET_FIELD_ERROR(city_options);
89833 }
89834 }
89835
89836 if (NULL == old) {
89837 old = fc_malloc(sizeof(*old));
89838 *old = *real_packet;
89839 genhash_insert(*hash, old, old);
89840 } else {
89841 *old = *real_packet;
89842 }
89843
89844#endif /* FREECIV_DELTA_PROTOCOL */
89845 RECEIVE_PACKET_END(real_packet);
89846}
89847
89848 static int send_packet_edit_city_100(struct connection *pc, const struct packet_edit_city *packet)
89849{
89850 const struct packet_edit_city *real_packet = packet;
89851#ifdef FREECIV_DELTA_PROTOCOL
89852 packet_edit_city_100_fields fields;
89853 struct packet_edit_city *old;
89854 bool differ;
89855 struct genhash **hash = pc->phs.sent + PACKET_EDIT_CITY;
89856#endif /* FREECIV_DELTA_PROTOCOL */
89857 SEND_PACKET_START(PACKET_EDIT_CITY);
89858#ifdef FREECIV_JSON_CONNECTION
89859 struct plocation field_addr;
89860 {
89861 struct plocation *field_addr_tmp = plocation_field_new(NULL);
89862 field_addr = *field_addr_tmp;
89863 FC_FREE(field_addr_tmp);
89864 }
89865#endif /* FREECIV_JSON_CONNECTION */
89866
89867 log_packet_detailed("packet_edit_city_100: sending info about ()");
89868
89869#ifdef FREECIV_DELTA_PROTOCOL
89870 if (NULL == *hash) {
89871 *hash = genhash_new_full(hash_packet_edit_city_100, cmp_packet_edit_city_100,
89872 NULL, NULL, NULL, free);
89873 }
89874 BV_CLR_ALL(fields);
89875
89876 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
89877 old = fc_malloc(sizeof(*old));
89878 *old = *real_packet;
89879 genhash_insert(*hash, old, old);
89880 memset(old, 0, sizeof(*old));
89881 }
89882 differ = (old->id32 != real_packet->id32);
89883 if (differ) {
89884 BV_SET(fields, 0);
89885 }
89886
89887 differ = (strcmp(old->name, real_packet->name) != 0);
89888 if (differ) {
89889 BV_SET(fields, 1);
89890 }
89891
89892 differ = (old->owner != real_packet->owner);
89893 if (differ) {
89894 BV_SET(fields, 2);
89895 }
89896
89897 differ = (old->original != real_packet->original);
89898 if (differ) {
89899 BV_SET(fields, 3);
89900 }
89901
89902 differ = (old->size != real_packet->size);
89903 if (differ) {
89904 BV_SET(fields, 4);
89905 }
89906
89907 differ = (old->history != real_packet->history);
89908 if (differ) {
89909 BV_SET(fields, 5);
89910 }
89911
89912
89913 {
89914 differ = FALSE;
89915 {
89916 int i;
89917
89918 for (i = 0; i < 5; i++) {
89919 if (old->ppl_happy[i] != real_packet->ppl_happy[i]) {
89920 differ = TRUE;
89921 break;
89922 }
89923 }
89924 }
89925 }
89926 if (differ) {
89927 BV_SET(fields, 6);
89928 }
89929
89930
89931 {
89932 differ = FALSE;
89933 {
89934 int i;
89935
89936 for (i = 0; i < 5; i++) {
89937 if (old->ppl_content[i] != real_packet->ppl_content[i]) {
89938 differ = TRUE;
89939 break;
89940 }
89941 }
89942 }
89943 }
89944 if (differ) {
89945 BV_SET(fields, 7);
89946 }
89947
89948
89949 {
89950 differ = FALSE;
89951 {
89952 int i;
89953
89954 for (i = 0; i < 5; i++) {
89955 if (old->ppl_unhappy[i] != real_packet->ppl_unhappy[i]) {
89956 differ = TRUE;
89957 break;
89958 }
89959 }
89960 }
89961 }
89962 if (differ) {
89963 BV_SET(fields, 8);
89964 }
89965
89966
89967 {
89968 differ = FALSE;
89969 {
89970 int i;
89971
89972 for (i = 0; i < 5; i++) {
89973 if (old->ppl_angry[i] != real_packet->ppl_angry[i]) {
89974 differ = TRUE;
89975 break;
89976 }
89977 }
89978 }
89979 }
89980 if (differ) {
89981 BV_SET(fields, 9);
89982 }
89983
89984 differ = (old->specialists_size != real_packet->specialists_size);
89985 if (differ) {
89986 BV_SET(fields, 10);
89987 }
89988
89989
89990 {
89991 differ = (old->specialists_size != real_packet->specialists_size);
89992 if (!differ) {
89993 int i;
89994
89995 for (i = 0; i < real_packet->specialists_size; i++) {
89996 if (old->specialists[i] != real_packet->specialists[i]) {
89997 differ = TRUE;
89998 break;
89999 }
90000 }
90001 }
90002 }
90003 if (differ) {
90004 BV_SET(fields, 11);
90005 }
90006
90007 differ = (old->food_stock != real_packet->food_stock);
90008 if (differ) {
90009 BV_SET(fields, 12);
90010 }
90011
90012 differ = (old->shield_stock != real_packet->shield_stock);
90013 if (differ) {
90014 BV_SET(fields, 13);
90015 }
90016
90017 if (packet->airlift) {
90018 BV_SET(fields, 14);
90019 }
90020
90021 if (packet->debug) {
90022 BV_SET(fields, 15);
90023 }
90024
90025 if (packet->did_buy) {
90026 BV_SET(fields, 16);
90027 }
90028
90029 if (packet->did_sell) {
90030 BV_SET(fields, 17);
90031 }
90032
90033 if (packet->was_happy) {
90034 BV_SET(fields, 18);
90035 }
90036
90037 differ = (old->anarchy != real_packet->anarchy);
90038 if (differ) {
90039 BV_SET(fields, 19);
90040 }
90041
90042 differ = (old->rapture != real_packet->rapture);
90043 if (differ) {
90044 BV_SET(fields, 20);
90045 }
90046
90047 differ = (old->steal != real_packet->steal);
90048 if (differ) {
90049 BV_SET(fields, 21);
90050 }
90051
90052 differ = (old->turn_founded != real_packet->turn_founded);
90053 if (differ) {
90054 BV_SET(fields, 22);
90055 }
90056
90057 differ = (old->turn_last_built != real_packet->turn_last_built);
90058 if (differ) {
90059 BV_SET(fields, 23);
90060 }
90061
90062
90063 {
90064 differ = FALSE;
90065 {
90066 int i;
90067
90068 for (i = 0; i < B_LAST; i++) {
90069 if (old->built[i] != real_packet->built[i]) {
90070 differ = TRUE;
90071 break;
90072 }
90073 }
90074 }
90075 }
90076 if (differ) {
90077 BV_SET(fields, 24);
90078 }
90079
90080 differ = (old->production_kind != real_packet->production_kind);
90081 if (differ) {
90082 BV_SET(fields, 25);
90083 }
90084
90085 differ = (old->production_value != real_packet->production_value);
90086 if (differ) {
90087 BV_SET(fields, 26);
90088 }
90089
90090 differ = !BV_ARE_EQUAL(old->city_options, real_packet->city_options);
90091 if (differ) {
90092 BV_SET(fields, 27);
90093 }
90094
90095
90096#ifdef FREECIV_JSON_CONNECTION
90097 field_addr.name = "fields";
90098#endif /* FREECIV_JSON_CONNECTION */
90099 DIO_BV_PUT(&dout, &field_addr, fields);
90100
90101 if (BV_ISSET(fields, 0)) {
90102 log_packet_detailed(" field 'id32' has changed");
90103 #ifdef FREECIV_JSON_CONNECTION
90104 field_addr.name = "id32";
90105#endif /* FREECIV_JSON_CONNECTION */
90106 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
90107 }
90108 if (BV_ISSET(fields, 1)) {
90109 log_packet_detailed(" field 'name' has changed");
90110 #ifdef FREECIV_JSON_CONNECTION
90111 field_addr.name = "name";
90112#endif /* FREECIV_JSON_CONNECTION */
90113 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
90114 }
90115 if (BV_ISSET(fields, 2)) {
90116 log_packet_detailed(" field 'owner' has changed");
90117 #ifdef FREECIV_JSON_CONNECTION
90118 field_addr.name = "owner";
90119#endif /* FREECIV_JSON_CONNECTION */
90120 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
90121 }
90122 if (BV_ISSET(fields, 3)) {
90123 log_packet_detailed(" field 'original' has changed");
90124 #ifdef FREECIV_JSON_CONNECTION
90125 field_addr.name = "original";
90126#endif /* FREECIV_JSON_CONNECTION */
90127 DIO_PUT(uint16, &dout, &field_addr, real_packet->original);
90128 }
90129 if (BV_ISSET(fields, 4)) {
90130 log_packet_detailed(" field 'size' has changed");
90131 #ifdef FREECIV_JSON_CONNECTION
90132 field_addr.name = "size";
90133#endif /* FREECIV_JSON_CONNECTION */
90134 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
90135 }
90136 if (BV_ISSET(fields, 5)) {
90137 log_packet_detailed(" field 'history' has changed");
90138 #ifdef FREECIV_JSON_CONNECTION
90139 field_addr.name = "history";
90140#endif /* FREECIV_JSON_CONNECTION */
90141 DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
90142 }
90143 if (BV_ISSET(fields, 6)) {
90144 log_packet_detailed(" field 'ppl_happy' has changed");
90145 #ifdef FREECIV_JSON_CONNECTION
90146 field_addr.name = "ppl_happy";
90147#endif /* FREECIV_JSON_CONNECTION */
90148
90149 {
90150 int i;
90151
90152#ifdef FREECIV_JSON_CONNECTION
90153 /* Create the array. */
90154 DIO_PUT(farray, &dout, &field_addr, 5);
90155
90156 /* Enter the array. */
90157 field_addr.sub_location = plocation_elem_new(0);
90158#endif /* FREECIV_JSON_CONNECTION */
90159
90160 for (i = 0; i < 5; i++) {
90161#ifdef FREECIV_JSON_CONNECTION
90162 /* Next array element. */
90163 field_addr.sub_location->number = i;
90164#endif /* FREECIV_JSON_CONNECTION */
90165 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
90166 }
90167
90168#ifdef FREECIV_JSON_CONNECTION
90169 /* Exit array. */
90170 free(field_addr.sub_location);
90171 field_addr.sub_location = NULL;
90172#endif /* FREECIV_JSON_CONNECTION */
90173 }
90174 }
90175 if (BV_ISSET(fields, 7)) {
90176 log_packet_detailed(" field 'ppl_content' has changed");
90177 #ifdef FREECIV_JSON_CONNECTION
90178 field_addr.name = "ppl_content";
90179#endif /* FREECIV_JSON_CONNECTION */
90180
90181 {
90182 int i;
90183
90184#ifdef FREECIV_JSON_CONNECTION
90185 /* Create the array. */
90186 DIO_PUT(farray, &dout, &field_addr, 5);
90187
90188 /* Enter the array. */
90189 field_addr.sub_location = plocation_elem_new(0);
90190#endif /* FREECIV_JSON_CONNECTION */
90191
90192 for (i = 0; i < 5; i++) {
90193#ifdef FREECIV_JSON_CONNECTION
90194 /* Next array element. */
90195 field_addr.sub_location->number = i;
90196#endif /* FREECIV_JSON_CONNECTION */
90197 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
90198 }
90199
90200#ifdef FREECIV_JSON_CONNECTION
90201 /* Exit array. */
90202 free(field_addr.sub_location);
90203 field_addr.sub_location = NULL;
90204#endif /* FREECIV_JSON_CONNECTION */
90205 }
90206 }
90207 if (BV_ISSET(fields, 8)) {
90208 log_packet_detailed(" field 'ppl_unhappy' has changed");
90209 #ifdef FREECIV_JSON_CONNECTION
90210 field_addr.name = "ppl_unhappy";
90211#endif /* FREECIV_JSON_CONNECTION */
90212
90213 {
90214 int i;
90215
90216#ifdef FREECIV_JSON_CONNECTION
90217 /* Create the array. */
90218 DIO_PUT(farray, &dout, &field_addr, 5);
90219
90220 /* Enter the array. */
90221 field_addr.sub_location = plocation_elem_new(0);
90222#endif /* FREECIV_JSON_CONNECTION */
90223
90224 for (i = 0; i < 5; i++) {
90225#ifdef FREECIV_JSON_CONNECTION
90226 /* Next array element. */
90227 field_addr.sub_location->number = i;
90228#endif /* FREECIV_JSON_CONNECTION */
90229 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
90230 }
90231
90232#ifdef FREECIV_JSON_CONNECTION
90233 /* Exit array. */
90234 free(field_addr.sub_location);
90235 field_addr.sub_location = NULL;
90236#endif /* FREECIV_JSON_CONNECTION */
90237 }
90238 }
90239 if (BV_ISSET(fields, 9)) {
90240 log_packet_detailed(" field 'ppl_angry' has changed");
90241 #ifdef FREECIV_JSON_CONNECTION
90242 field_addr.name = "ppl_angry";
90243#endif /* FREECIV_JSON_CONNECTION */
90244
90245 {
90246 int i;
90247
90248#ifdef FREECIV_JSON_CONNECTION
90249 /* Create the array. */
90250 DIO_PUT(farray, &dout, &field_addr, 5);
90251
90252 /* Enter the array. */
90253 field_addr.sub_location = plocation_elem_new(0);
90254#endif /* FREECIV_JSON_CONNECTION */
90255
90256 for (i = 0; i < 5; i++) {
90257#ifdef FREECIV_JSON_CONNECTION
90258 /* Next array element. */
90259 field_addr.sub_location->number = i;
90260#endif /* FREECIV_JSON_CONNECTION */
90261 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
90262 }
90263
90264#ifdef FREECIV_JSON_CONNECTION
90265 /* Exit array. */
90266 free(field_addr.sub_location);
90267 field_addr.sub_location = NULL;
90268#endif /* FREECIV_JSON_CONNECTION */
90269 }
90270 }
90271 if (BV_ISSET(fields, 10)) {
90272 log_packet_detailed(" field 'specialists_size' has changed");
90273 #ifdef FREECIV_JSON_CONNECTION
90274 field_addr.name = "specialists_size";
90275#endif /* FREECIV_JSON_CONNECTION */
90276 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
90277 }
90278 if (BV_ISSET(fields, 11)) {
90279 log_packet_detailed(" field 'specialists' has changed");
90280 #ifdef FREECIV_JSON_CONNECTION
90281 field_addr.name = "specialists";
90282#endif /* FREECIV_JSON_CONNECTION */
90283
90284 {
90285 int i;
90286
90287#ifdef FREECIV_JSON_CONNECTION
90288 /* Create the array. */
90289 DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
90290
90291 /* Enter the array. */
90292 field_addr.sub_location = plocation_elem_new(0);
90293#endif /* FREECIV_JSON_CONNECTION */
90294
90295 for (i = 0; i < real_packet->specialists_size; i++) {
90296#ifdef FREECIV_JSON_CONNECTION
90297 /* Next array element. */
90298 field_addr.sub_location->number = i;
90299#endif /* FREECIV_JSON_CONNECTION */
90300 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
90301 }
90302
90303#ifdef FREECIV_JSON_CONNECTION
90304 /* Exit array. */
90305 free(field_addr.sub_location);
90306 field_addr.sub_location = NULL;
90307#endif /* FREECIV_JSON_CONNECTION */
90308 }
90309 }
90310 if (BV_ISSET(fields, 12)) {
90311 log_packet_detailed(" field 'food_stock' has changed");
90312 #ifdef FREECIV_JSON_CONNECTION
90313 field_addr.name = "food_stock";
90314#endif /* FREECIV_JSON_CONNECTION */
90315 DIO_PUT(uint16, &dout, &field_addr, real_packet->food_stock);
90316 }
90317 if (BV_ISSET(fields, 13)) {
90318 log_packet_detailed(" field 'shield_stock' has changed");
90319 #ifdef FREECIV_JSON_CONNECTION
90320 field_addr.name = "shield_stock";
90321#endif /* FREECIV_JSON_CONNECTION */
90322 DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
90323 }
90324 /* field 14 is folded into the header */
90325 /* field 15 is folded into the header */
90326 /* field 16 is folded into the header */
90327 /* field 17 is folded into the header */
90328 /* field 18 is folded into the header */
90329 if (BV_ISSET(fields, 19)) {
90330 log_packet_detailed(" field 'anarchy' has changed");
90331 #ifdef FREECIV_JSON_CONNECTION
90332 field_addr.name = "anarchy";
90333#endif /* FREECIV_JSON_CONNECTION */
90334 DIO_PUT(uint8, &dout, &field_addr, real_packet->anarchy);
90335 }
90336 if (BV_ISSET(fields, 20)) {
90337 log_packet_detailed(" field 'rapture' has changed");
90338 #ifdef FREECIV_JSON_CONNECTION
90339 field_addr.name = "rapture";
90340#endif /* FREECIV_JSON_CONNECTION */
90341 DIO_PUT(uint8, &dout, &field_addr, real_packet->rapture);
90342 }
90343 if (BV_ISSET(fields, 21)) {
90344 log_packet_detailed(" field 'steal' has changed");
90345 #ifdef FREECIV_JSON_CONNECTION
90346 field_addr.name = "steal";
90347#endif /* FREECIV_JSON_CONNECTION */
90348 DIO_PUT(uint8, &dout, &field_addr, real_packet->steal);
90349 }
90350 if (BV_ISSET(fields, 22)) {
90351 log_packet_detailed(" field 'turn_founded' has changed");
90352 #ifdef FREECIV_JSON_CONNECTION
90353 field_addr.name = "turn_founded";
90354#endif /* FREECIV_JSON_CONNECTION */
90355 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
90356 }
90357 if (BV_ISSET(fields, 23)) {
90358 log_packet_detailed(" field 'turn_last_built' has changed");
90359 #ifdef FREECIV_JSON_CONNECTION
90360 field_addr.name = "turn_last_built";
90361#endif /* FREECIV_JSON_CONNECTION */
90362 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
90363 }
90364 if (BV_ISSET(fields, 24)) {
90365 log_packet_detailed(" field 'built' has changed");
90366 #ifdef FREECIV_JSON_CONNECTION
90367 field_addr.name = "built";
90368#endif /* FREECIV_JSON_CONNECTION */
90369
90370 {
90371 int i;
90372
90373#ifdef FREECIV_JSON_CONNECTION
90374 int count = 0;
90375
90376 for (i = 0; i < B_LAST; i++) {
90377 if (old->built[i] != real_packet->built[i]) {
90378 count++;
90379 }
90380 }
90381 /* Create the array. */
90382 DIO_PUT(farray, &dout, &field_addr, count + 1);
90383
90384 /* Enter array. */
90385 field_addr.sub_location = plocation_elem_new(0);
90386
90387 count = 0;
90388#endif /* FREECIV_JSON_CONNECTION */
90389
90390 fc_assert(B_LAST < 255);
90391
90392 for (i = 0; i < B_LAST; i++) {
90393 if (old->built[i] != real_packet->built[i]) {
90394#ifdef FREECIV_JSON_CONNECTION
90395 /* Next diff array element. */
90396 field_addr.sub_location->number = count - 1;
90397
90398 /* Create the diff array element. */
90399 DIO_PUT(farray, &dout, &field_addr, 2);
90400
90401 /* Enter diff array element (start at the index address). */
90402 field_addr.sub_location->sub_location = plocation_elem_new(0);
90403#endif /* FREECIV_JSON_CONNECTION */
90404 DIO_PUT(uint8, &dout, &field_addr, i);
90405
90406#ifdef FREECIV_JSON_CONNECTION
90407 /* Content address. */
90408 field_addr.sub_location->sub_location->number = 1;
90409#endif /* FREECIV_JSON_CONNECTION */
90410 DIO_PUT(sint32, &dout, &field_addr, real_packet->built[i]);
90411
90412#ifdef FREECIV_JSON_CONNECTION
90413 /* Exit diff array element. */
90414 free(field_addr.sub_location->sub_location);
90415 field_addr.sub_location->sub_location = NULL;
90416#endif /* FREECIV_JSON_CONNECTION */
90417 }
90418 }
90419#ifdef FREECIV_JSON_CONNECTION
90420 field_addr.sub_location->number = count - 1;
90421
90422 /* Create the diff array element. */
90423 DIO_PUT(farray, &dout, &field_addr, B_LAST);
90424
90425 /* Enter diff array element. Point to index address. */
90426 field_addr.sub_location->sub_location = plocation_elem_new(0);
90427#endif /* FREECIV_JSON_CONNECTION */
90428 DIO_PUT(uint8, &dout, &field_addr, 255);
90429
90430#ifdef FREECIV_JSON_CONNECTION
90431 /* Exit diff array element. */
90432 free(field_addr.sub_location->sub_location);
90433 field_addr.sub_location->sub_location = NULL;
90434
90435 /* Exit array. */
90436 free(field_addr.sub_location);
90437 field_addr.sub_location = NULL;
90438#endif /* FREECIV_JSON_CONNECTION */
90439 }
90440 }
90441 if (BV_ISSET(fields, 25)) {
90442 log_packet_detailed(" field 'production_kind' has changed");
90443 #ifdef FREECIV_JSON_CONNECTION
90444 field_addr.name = "production_kind";
90445#endif /* FREECIV_JSON_CONNECTION */
90446 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
90447 }
90448 if (BV_ISSET(fields, 26)) {
90449 log_packet_detailed(" field 'production_value' has changed");
90450 #ifdef FREECIV_JSON_CONNECTION
90451 field_addr.name = "production_value";
90452#endif /* FREECIV_JSON_CONNECTION */
90453 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
90454 }
90455 if (BV_ISSET(fields, 27)) {
90456 log_packet_detailed(" field 'city_options' has changed");
90457 #ifdef FREECIV_JSON_CONNECTION
90458 field_addr.name = "city_options";
90459#endif /* FREECIV_JSON_CONNECTION */
90460 DIO_BV_PUT(&dout, &field_addr, packet->city_options);
90461 }
90462
90463 *old = *real_packet;
90464#endif /* FREECIV_DELTA_PROTOCOL */
90465#ifndef FREECIV_DELTA_PROTOCOL
90466#ifdef FREECIV_JSON_CONNECTION
90467 field_addr.name = "id32";
90468#endif /* FREECIV_JSON_CONNECTION */
90469 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
90470#ifdef FREECIV_JSON_CONNECTION
90471 field_addr.name = "name";
90472#endif /* FREECIV_JSON_CONNECTION */
90473 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
90474#ifdef FREECIV_JSON_CONNECTION
90475 field_addr.name = "owner";
90476#endif /* FREECIV_JSON_CONNECTION */
90477 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
90478#ifdef FREECIV_JSON_CONNECTION
90479 field_addr.name = "original";
90480#endif /* FREECIV_JSON_CONNECTION */
90481 DIO_PUT(uint16, &dout, &field_addr, real_packet->original);
90482#ifdef FREECIV_JSON_CONNECTION
90483 field_addr.name = "size";
90484#endif /* FREECIV_JSON_CONNECTION */
90485 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
90486#ifdef FREECIV_JSON_CONNECTION
90487 field_addr.name = "history";
90488#endif /* FREECIV_JSON_CONNECTION */
90489 DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
90490#ifdef FREECIV_JSON_CONNECTION
90491 field_addr.name = "ppl_happy";
90492#endif /* FREECIV_JSON_CONNECTION */
90493
90494 {
90495 int i;
90496
90497#ifdef FREECIV_JSON_CONNECTION
90498 /* Create the array. */
90499 DIO_PUT(farray, &dout, &field_addr, 5);
90500
90501 /* Enter the array. */
90502 field_addr.sub_location = plocation_elem_new(0);
90503#endif /* FREECIV_JSON_CONNECTION */
90504
90505 for (i = 0; i < 5; i++) {
90506#ifdef FREECIV_JSON_CONNECTION
90507 /* Next array element. */
90508 field_addr.sub_location->number = i;
90509#endif /* FREECIV_JSON_CONNECTION */
90510 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
90511 }
90512
90513#ifdef FREECIV_JSON_CONNECTION
90514 /* Exit array. */
90515 free(field_addr.sub_location);
90516 field_addr.sub_location = NULL;
90517#endif /* FREECIV_JSON_CONNECTION */
90518 }
90519#ifdef FREECIV_JSON_CONNECTION
90520 field_addr.name = "ppl_content";
90521#endif /* FREECIV_JSON_CONNECTION */
90522
90523 {
90524 int i;
90525
90526#ifdef FREECIV_JSON_CONNECTION
90527 /* Create the array. */
90528 DIO_PUT(farray, &dout, &field_addr, 5);
90529
90530 /* Enter the array. */
90531 field_addr.sub_location = plocation_elem_new(0);
90532#endif /* FREECIV_JSON_CONNECTION */
90533
90534 for (i = 0; i < 5; i++) {
90535#ifdef FREECIV_JSON_CONNECTION
90536 /* Next array element. */
90537 field_addr.sub_location->number = i;
90538#endif /* FREECIV_JSON_CONNECTION */
90539 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
90540 }
90541
90542#ifdef FREECIV_JSON_CONNECTION
90543 /* Exit array. */
90544 free(field_addr.sub_location);
90545 field_addr.sub_location = NULL;
90546#endif /* FREECIV_JSON_CONNECTION */
90547 }
90548#ifdef FREECIV_JSON_CONNECTION
90549 field_addr.name = "ppl_unhappy";
90550#endif /* FREECIV_JSON_CONNECTION */
90551
90552 {
90553 int i;
90554
90555#ifdef FREECIV_JSON_CONNECTION
90556 /* Create the array. */
90557 DIO_PUT(farray, &dout, &field_addr, 5);
90558
90559 /* Enter the array. */
90560 field_addr.sub_location = plocation_elem_new(0);
90561#endif /* FREECIV_JSON_CONNECTION */
90562
90563 for (i = 0; i < 5; i++) {
90564#ifdef FREECIV_JSON_CONNECTION
90565 /* Next array element. */
90566 field_addr.sub_location->number = i;
90567#endif /* FREECIV_JSON_CONNECTION */
90568 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
90569 }
90570
90571#ifdef FREECIV_JSON_CONNECTION
90572 /* Exit array. */
90573 free(field_addr.sub_location);
90574 field_addr.sub_location = NULL;
90575#endif /* FREECIV_JSON_CONNECTION */
90576 }
90577#ifdef FREECIV_JSON_CONNECTION
90578 field_addr.name = "ppl_angry";
90579#endif /* FREECIV_JSON_CONNECTION */
90580
90581 {
90582 int i;
90583
90584#ifdef FREECIV_JSON_CONNECTION
90585 /* Create the array. */
90586 DIO_PUT(farray, &dout, &field_addr, 5);
90587
90588 /* Enter the array. */
90589 field_addr.sub_location = plocation_elem_new(0);
90590#endif /* FREECIV_JSON_CONNECTION */
90591
90592 for (i = 0; i < 5; i++) {
90593#ifdef FREECIV_JSON_CONNECTION
90594 /* Next array element. */
90595 field_addr.sub_location->number = i;
90596#endif /* FREECIV_JSON_CONNECTION */
90597 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
90598 }
90599
90600#ifdef FREECIV_JSON_CONNECTION
90601 /* Exit array. */
90602 free(field_addr.sub_location);
90603 field_addr.sub_location = NULL;
90604#endif /* FREECIV_JSON_CONNECTION */
90605 }
90606#ifdef FREECIV_JSON_CONNECTION
90607 field_addr.name = "specialists_size";
90608#endif /* FREECIV_JSON_CONNECTION */
90609 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
90610#ifdef FREECIV_JSON_CONNECTION
90611 field_addr.name = "specialists";
90612#endif /* FREECIV_JSON_CONNECTION */
90613
90614 {
90615 int i;
90616
90617#ifdef FREECIV_JSON_CONNECTION
90618 /* Create the array. */
90619 DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
90620
90621 /* Enter the array. */
90622 field_addr.sub_location = plocation_elem_new(0);
90623#endif /* FREECIV_JSON_CONNECTION */
90624
90625 for (i = 0; i < real_packet->specialists_size; i++) {
90626#ifdef FREECIV_JSON_CONNECTION
90627 /* Next array element. */
90628 field_addr.sub_location->number = i;
90629#endif /* FREECIV_JSON_CONNECTION */
90630 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
90631 }
90632
90633#ifdef FREECIV_JSON_CONNECTION
90634 /* Exit array. */
90635 free(field_addr.sub_location);
90636 field_addr.sub_location = NULL;
90637#endif /* FREECIV_JSON_CONNECTION */
90638 }
90639#ifdef FREECIV_JSON_CONNECTION
90640 field_addr.name = "food_stock";
90641#endif /* FREECIV_JSON_CONNECTION */
90642 DIO_PUT(uint16, &dout, &field_addr, real_packet->food_stock);
90643#ifdef FREECIV_JSON_CONNECTION
90644 field_addr.name = "shield_stock";
90645#endif /* FREECIV_JSON_CONNECTION */
90646 DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
90647#ifdef FREECIV_JSON_CONNECTION
90648 field_addr.name = "airlift";
90649#endif /* FREECIV_JSON_CONNECTION */
90650 DIO_PUT(bool8, &dout, &field_addr, real_packet->airlift);
90651#ifdef FREECIV_JSON_CONNECTION
90652 field_addr.name = "debug";
90653#endif /* FREECIV_JSON_CONNECTION */
90654 DIO_PUT(bool8, &dout, &field_addr, real_packet->debug);
90655#ifdef FREECIV_JSON_CONNECTION
90656 field_addr.name = "did_buy";
90657#endif /* FREECIV_JSON_CONNECTION */
90658 DIO_PUT(bool8, &dout, &field_addr, real_packet->did_buy);
90659#ifdef FREECIV_JSON_CONNECTION
90660 field_addr.name = "did_sell";
90661#endif /* FREECIV_JSON_CONNECTION */
90662 DIO_PUT(bool8, &dout, &field_addr, real_packet->did_sell);
90663#ifdef FREECIV_JSON_CONNECTION
90664 field_addr.name = "was_happy";
90665#endif /* FREECIV_JSON_CONNECTION */
90666 DIO_PUT(bool8, &dout, &field_addr, real_packet->was_happy);
90667#ifdef FREECIV_JSON_CONNECTION
90668 field_addr.name = "anarchy";
90669#endif /* FREECIV_JSON_CONNECTION */
90670 DIO_PUT(uint8, &dout, &field_addr, real_packet->anarchy);
90671#ifdef FREECIV_JSON_CONNECTION
90672 field_addr.name = "rapture";
90673#endif /* FREECIV_JSON_CONNECTION */
90674 DIO_PUT(uint8, &dout, &field_addr, real_packet->rapture);
90675#ifdef FREECIV_JSON_CONNECTION
90676 field_addr.name = "steal";
90677#endif /* FREECIV_JSON_CONNECTION */
90678 DIO_PUT(uint8, &dout, &field_addr, real_packet->steal);
90679#ifdef FREECIV_JSON_CONNECTION
90680 field_addr.name = "turn_founded";
90681#endif /* FREECIV_JSON_CONNECTION */
90682 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
90683#ifdef FREECIV_JSON_CONNECTION
90684 field_addr.name = "turn_last_built";
90685#endif /* FREECIV_JSON_CONNECTION */
90686 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
90687#ifdef FREECIV_JSON_CONNECTION
90688 field_addr.name = "built";
90689#endif /* FREECIV_JSON_CONNECTION */
90690
90691 {
90692 int i;
90693
90694#ifdef FREECIV_JSON_CONNECTION
90695 /* Create the array. */
90696 DIO_PUT(farray, &dout, &field_addr, B_LAST);
90697
90698 /* Enter the array. */
90699 field_addr.sub_location = plocation_elem_new(0);
90700#endif /* FREECIV_JSON_CONNECTION */
90701
90702 for (i = 0; i < B_LAST; i++) {
90703#ifdef FREECIV_JSON_CONNECTION
90704 /* Next array element. */
90705 field_addr.sub_location->number = i;
90706#endif /* FREECIV_JSON_CONNECTION */
90707 DIO_PUT(sint32, &dout, &field_addr, real_packet->built[i]);
90708 }
90709
90710#ifdef FREECIV_JSON_CONNECTION
90711 /* Exit array. */
90712 free(field_addr.sub_location);
90713 field_addr.sub_location = NULL;
90714#endif /* FREECIV_JSON_CONNECTION */
90715 }
90716#ifdef FREECIV_JSON_CONNECTION
90717 field_addr.name = "production_kind";
90718#endif /* FREECIV_JSON_CONNECTION */
90719 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
90720#ifdef FREECIV_JSON_CONNECTION
90721 field_addr.name = "production_value";
90722#endif /* FREECIV_JSON_CONNECTION */
90723 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
90724#ifdef FREECIV_JSON_CONNECTION
90725 field_addr.name = "city_options";
90726#endif /* FREECIV_JSON_CONNECTION */
90727 DIO_BV_PUT(&dout, &field_addr, packet->city_options);
90728
90729#endif
90730 SEND_PACKET_END(PACKET_EDIT_CITY);
90731}
90732
90733#ifdef FREECIV_DELTA_PROTOCOL
90734static genhash_val_t hash_packet_edit_city_101(const void *vkey)
90735{
90736 const struct packet_edit_city *key = (const struct packet_edit_city *) vkey;
90737
90738 return key->id16;
90739}
90740
90741static bool cmp_packet_edit_city_101(const void *vkey1, const void *vkey2)
90742{
90743 const struct packet_edit_city *key1 = (const struct packet_edit_city *) vkey1;
90744 const struct packet_edit_city *key2 = (const struct packet_edit_city *) vkey2;
90745
90746 return key1->id16 == key2->id16;
90747}
90748 BV_DEFINE(packet_edit_city_101_fields, 27);
90749#endif /* FREECIV_DELTA_PROTOCOL */
90750
90751 static struct packet_edit_city *receive_packet_edit_city_101(struct connection *pc)
90752{
90753#ifdef FREECIV_DELTA_PROTOCOL
90754 packet_edit_city_101_fields fields;
90755 struct packet_edit_city *old;
90756 struct genhash **hash = pc->phs.received + PACKET_EDIT_CITY;
90757#endif /* FREECIV_DELTA_PROTOCOL */
90758 RECEIVE_PACKET_START(packet_edit_city, real_packet);
90759#ifdef FREECIV_JSON_CONNECTION
90760 struct plocation field_addr;
90761 {
90762 struct plocation *field_addr_tmp = plocation_field_new(NULL);
90763 field_addr = *field_addr_tmp;
90764 FC_FREE(field_addr_tmp);
90765 }
90766#endif /* FREECIV_JSON_CONNECTION */
90767
90768#ifdef FREECIV_DELTA_PROTOCOL
90769#ifdef FREECIV_JSON_CONNECTION
90770 field_addr.name = "fields";
90771#endif /* FREECIV_JSON_CONNECTION */
90772 DIO_BV_GET(&din, &field_addr, fields);
90773 #ifdef FREECIV_JSON_CONNECTION
90774 field_addr.name = "id16";
90775 #endif /* FREECIV_JSON_CONNECTION */
90776 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
90777 RECEIVE_PACKET_FIELD_ERROR(id16);
90778 }
90779
90780#else /* FREECIV_DELTA_PROTOCOL */
90781 #ifdef FREECIV_JSON_CONNECTION
90782 field_addr.name = "id16";
90783 #endif /* FREECIV_JSON_CONNECTION */
90784 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
90785 RECEIVE_PACKET_FIELD_ERROR(id16);
90786 }
90787 #ifdef FREECIV_JSON_CONNECTION
90788 field_addr.name = "name";
90789 #endif /* FREECIV_JSON_CONNECTION */
90790 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
90791 RECEIVE_PACKET_FIELD_ERROR(name);
90792 }
90793 #ifdef FREECIV_JSON_CONNECTION
90794 field_addr.name = "owner";
90795 #endif /* FREECIV_JSON_CONNECTION */
90796 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
90797 RECEIVE_PACKET_FIELD_ERROR(owner);
90798 }
90799 #ifdef FREECIV_JSON_CONNECTION
90800 field_addr.name = "original";
90801 #endif /* FREECIV_JSON_CONNECTION */
90802 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->original)) {
90803 RECEIVE_PACKET_FIELD_ERROR(original);
90804 }
90805 #ifdef FREECIV_JSON_CONNECTION
90806 field_addr.name = "size";
90807 #endif /* FREECIV_JSON_CONNECTION */
90808 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
90809 RECEIVE_PACKET_FIELD_ERROR(size);
90810 }
90811 #ifdef FREECIV_JSON_CONNECTION
90812 field_addr.name = "history";
90813 #endif /* FREECIV_JSON_CONNECTION */
90814 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
90815 RECEIVE_PACKET_FIELD_ERROR(history);
90816 }
90817 #ifdef FREECIV_JSON_CONNECTION
90818 field_addr.name = "ppl_happy";
90819 #endif /* FREECIV_JSON_CONNECTION */
90820
90821 {
90822 int i;
90823
90824 #ifdef FREECIV_JSON_CONNECTION
90825 /* Enter array. */
90826 field_addr.sub_location = plocation_elem_new(0);
90827 #endif /* FREECIV_JSON_CONNECTION */
90828
90829 for (i = 0; i < 5; i++) {
90830 #ifdef FREECIV_JSON_CONNECTION
90831 field_addr.sub_location->number = i;
90832 #endif /* FREECIV_JSON_CONNECTION */
90833 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
90834 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
90835 }
90836 }
90837
90838 #ifdef FREECIV_JSON_CONNECTION
90839 /* Exit array. */
90840 free(field_addr.sub_location);
90841 field_addr.sub_location = NULL;
90842 #endif /* FREECIV_JSON_CONNECTION */
90843 }
90844 #ifdef FREECIV_JSON_CONNECTION
90845 field_addr.name = "ppl_content";
90846 #endif /* FREECIV_JSON_CONNECTION */
90847
90848 {
90849 int i;
90850
90851 #ifdef FREECIV_JSON_CONNECTION
90852 /* Enter array. */
90853 field_addr.sub_location = plocation_elem_new(0);
90854 #endif /* FREECIV_JSON_CONNECTION */
90855
90856 for (i = 0; i < 5; i++) {
90857 #ifdef FREECIV_JSON_CONNECTION
90858 field_addr.sub_location->number = i;
90859 #endif /* FREECIV_JSON_CONNECTION */
90860 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
90861 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
90862 }
90863 }
90864
90865 #ifdef FREECIV_JSON_CONNECTION
90866 /* Exit array. */
90867 free(field_addr.sub_location);
90868 field_addr.sub_location = NULL;
90869 #endif /* FREECIV_JSON_CONNECTION */
90870 }
90871 #ifdef FREECIV_JSON_CONNECTION
90872 field_addr.name = "ppl_unhappy";
90873 #endif /* FREECIV_JSON_CONNECTION */
90874
90875 {
90876 int i;
90877
90878 #ifdef FREECIV_JSON_CONNECTION
90879 /* Enter array. */
90880 field_addr.sub_location = plocation_elem_new(0);
90881 #endif /* FREECIV_JSON_CONNECTION */
90882
90883 for (i = 0; i < 5; i++) {
90884 #ifdef FREECIV_JSON_CONNECTION
90885 field_addr.sub_location->number = i;
90886 #endif /* FREECIV_JSON_CONNECTION */
90887 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
90888 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
90889 }
90890 }
90891
90892 #ifdef FREECIV_JSON_CONNECTION
90893 /* Exit array. */
90894 free(field_addr.sub_location);
90895 field_addr.sub_location = NULL;
90896 #endif /* FREECIV_JSON_CONNECTION */
90897 }
90898 #ifdef FREECIV_JSON_CONNECTION
90899 field_addr.name = "ppl_angry";
90900 #endif /* FREECIV_JSON_CONNECTION */
90901
90902 {
90903 int i;
90904
90905 #ifdef FREECIV_JSON_CONNECTION
90906 /* Enter array. */
90907 field_addr.sub_location = plocation_elem_new(0);
90908 #endif /* FREECIV_JSON_CONNECTION */
90909
90910 for (i = 0; i < 5; i++) {
90911 #ifdef FREECIV_JSON_CONNECTION
90912 field_addr.sub_location->number = i;
90913 #endif /* FREECIV_JSON_CONNECTION */
90914 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
90915 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
90916 }
90917 }
90918
90919 #ifdef FREECIV_JSON_CONNECTION
90920 /* Exit array. */
90921 free(field_addr.sub_location);
90922 field_addr.sub_location = NULL;
90923 #endif /* FREECIV_JSON_CONNECTION */
90924 }
90925 #ifdef FREECIV_JSON_CONNECTION
90926 field_addr.name = "specialists_size";
90927 #endif /* FREECIV_JSON_CONNECTION */
90928 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
90929 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
90930 }
90931 #ifdef FREECIV_JSON_CONNECTION
90932 field_addr.name = "specialists";
90933 #endif /* FREECIV_JSON_CONNECTION */
90934
90935 {
90936 int i;
90937
90938 #ifdef FREECIV_JSON_CONNECTION
90939 /* Enter array. */
90940 field_addr.sub_location = plocation_elem_new(0);
90941 #endif /* FREECIV_JSON_CONNECTION */
90942
90943 if (real_packet->specialists_size > SP_MAX) {
90944 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
90945 }
90946 for (i = 0; i < real_packet->specialists_size; i++) {
90947 #ifdef FREECIV_JSON_CONNECTION
90948 field_addr.sub_location->number = i;
90949 #endif /* FREECIV_JSON_CONNECTION */
90950 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
90951 RECEIVE_PACKET_FIELD_ERROR(specialists);
90952 }
90953 }
90954
90955 #ifdef FREECIV_JSON_CONNECTION
90956 /* Exit array. */
90957 free(field_addr.sub_location);
90958 field_addr.sub_location = NULL;
90959 #endif /* FREECIV_JSON_CONNECTION */
90960 }
90961 #ifdef FREECIV_JSON_CONNECTION
90962 field_addr.name = "food_stock";
90963 #endif /* FREECIV_JSON_CONNECTION */
90964 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->food_stock)) {
90965 RECEIVE_PACKET_FIELD_ERROR(food_stock);
90966 }
90967 #ifdef FREECIV_JSON_CONNECTION
90968 field_addr.name = "shield_stock";
90969 #endif /* FREECIV_JSON_CONNECTION */
90970 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
90971 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
90972 }
90973 #ifdef FREECIV_JSON_CONNECTION
90974 field_addr.name = "airlift";
90975 #endif /* FREECIV_JSON_CONNECTION */
90976 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->airlift)) {
90977 RECEIVE_PACKET_FIELD_ERROR(airlift);
90978 }
90979 #ifdef FREECIV_JSON_CONNECTION
90980 field_addr.name = "debug";
90981 #endif /* FREECIV_JSON_CONNECTION */
90982 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->debug)) {
90983 RECEIVE_PACKET_FIELD_ERROR(debug);
90984 }
90985 #ifdef FREECIV_JSON_CONNECTION
90986 field_addr.name = "did_buy";
90987 #endif /* FREECIV_JSON_CONNECTION */
90988 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_buy)) {
90989 RECEIVE_PACKET_FIELD_ERROR(did_buy);
90990 }
90991 #ifdef FREECIV_JSON_CONNECTION
90992 field_addr.name = "did_sell";
90993 #endif /* FREECIV_JSON_CONNECTION */
90994 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_sell)) {
90995 RECEIVE_PACKET_FIELD_ERROR(did_sell);
90996 }
90997 #ifdef FREECIV_JSON_CONNECTION
90998 field_addr.name = "was_happy";
90999 #endif /* FREECIV_JSON_CONNECTION */
91000 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->was_happy)) {
91001 RECEIVE_PACKET_FIELD_ERROR(was_happy);
91002 }
91003 #ifdef FREECIV_JSON_CONNECTION
91004 field_addr.name = "anarchy";
91005 #endif /* FREECIV_JSON_CONNECTION */
91006 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->anarchy)) {
91007 RECEIVE_PACKET_FIELD_ERROR(anarchy);
91008 }
91009 #ifdef FREECIV_JSON_CONNECTION
91010 field_addr.name = "rapture";
91011 #endif /* FREECIV_JSON_CONNECTION */
91012 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rapture)) {
91013 RECEIVE_PACKET_FIELD_ERROR(rapture);
91014 }
91015 #ifdef FREECIV_JSON_CONNECTION
91016 field_addr.name = "steal";
91017 #endif /* FREECIV_JSON_CONNECTION */
91018 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->steal)) {
91019 RECEIVE_PACKET_FIELD_ERROR(steal);
91020 }
91021 #ifdef FREECIV_JSON_CONNECTION
91022 field_addr.name = "turn_founded";
91023 #endif /* FREECIV_JSON_CONNECTION */
91024 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
91025 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
91026 }
91027 #ifdef FREECIV_JSON_CONNECTION
91028 field_addr.name = "turn_last_built";
91029 #endif /* FREECIV_JSON_CONNECTION */
91030 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
91031 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
91032 }
91033 #ifdef FREECIV_JSON_CONNECTION
91034 field_addr.name = "built";
91035 #endif /* FREECIV_JSON_CONNECTION */
91036
91037 {
91038 int i;
91039
91040 for (i = 0; i < B_LAST; i++) {
91041 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->built[i])) {
91042 RECEIVE_PACKET_FIELD_ERROR(built);
91043 }
91044 }
91045 }
91046 #ifdef FREECIV_JSON_CONNECTION
91047 field_addr.name = "production_kind";
91048 #endif /* FREECIV_JSON_CONNECTION */
91049 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
91050 RECEIVE_PACKET_FIELD_ERROR(production_kind);
91051 }
91052 #ifdef FREECIV_JSON_CONNECTION
91053 field_addr.name = "production_value";
91054 #endif /* FREECIV_JSON_CONNECTION */
91055 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
91056 RECEIVE_PACKET_FIELD_ERROR(production_value);
91057 }
91058 #ifdef FREECIV_JSON_CONNECTION
91059 field_addr.name = "city_options";
91060 #endif /* FREECIV_JSON_CONNECTION */
91061 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
91062 RECEIVE_PACKET_FIELD_ERROR(city_options);
91063 }
91064
91065#endif
91066 log_packet_detailed("packet_edit_city_101: got info about (%d)",
91067 real_packet->id16);
91068
91069#ifdef FREECIV_DELTA_PROTOCOL
91070 if (NULL == *hash) {
91071 *hash = genhash_new_full(hash_packet_edit_city_101, cmp_packet_edit_city_101,
91072 NULL, NULL, NULL, free);
91073 }
91074
91075 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
91076 *real_packet = *old;
91077 } else {
91078 int id16 = real_packet->id16;
91079
91080 log_packet_detailed(" no old info");
91081 memset(real_packet, 0, sizeof(*real_packet));
91082
91083 real_packet->id16 = id16;
91084 }
91085
91086 if (BV_ISSET(fields, 0)) {
91087 log_packet_detailed(" got field 'name'");
91088 #ifdef FREECIV_JSON_CONNECTION
91089 field_addr.name = "name";
91090 #endif /* FREECIV_JSON_CONNECTION */
91091 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
91092 RECEIVE_PACKET_FIELD_ERROR(name);
91093 }
91094 }
91095 if (BV_ISSET(fields, 1)) {
91096 log_packet_detailed(" got field 'owner'");
91097 #ifdef FREECIV_JSON_CONNECTION
91098 field_addr.name = "owner";
91099 #endif /* FREECIV_JSON_CONNECTION */
91100 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
91101 RECEIVE_PACKET_FIELD_ERROR(owner);
91102 }
91103 }
91104 if (BV_ISSET(fields, 2)) {
91105 log_packet_detailed(" got field 'original'");
91106 #ifdef FREECIV_JSON_CONNECTION
91107 field_addr.name = "original";
91108 #endif /* FREECIV_JSON_CONNECTION */
91109 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->original)) {
91110 RECEIVE_PACKET_FIELD_ERROR(original);
91111 }
91112 }
91113 if (BV_ISSET(fields, 3)) {
91114 log_packet_detailed(" got field 'size'");
91115 #ifdef FREECIV_JSON_CONNECTION
91116 field_addr.name = "size";
91117 #endif /* FREECIV_JSON_CONNECTION */
91118 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
91119 RECEIVE_PACKET_FIELD_ERROR(size);
91120 }
91121 }
91122 if (BV_ISSET(fields, 4)) {
91123 log_packet_detailed(" got field 'history'");
91124 #ifdef FREECIV_JSON_CONNECTION
91125 field_addr.name = "history";
91126 #endif /* FREECIV_JSON_CONNECTION */
91127 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
91128 RECEIVE_PACKET_FIELD_ERROR(history);
91129 }
91130 }
91131 if (BV_ISSET(fields, 5)) {
91132 log_packet_detailed(" got field 'ppl_happy'");
91133 #ifdef FREECIV_JSON_CONNECTION
91134 field_addr.name = "ppl_happy";
91135 #endif /* FREECIV_JSON_CONNECTION */
91136
91137 {
91138 int i;
91139
91140 #ifdef FREECIV_JSON_CONNECTION
91141 /* Enter array. */
91142 field_addr.sub_location = plocation_elem_new(0);
91143 #endif /* FREECIV_JSON_CONNECTION */
91144
91145 for (i = 0; i < 5; i++) {
91146 #ifdef FREECIV_JSON_CONNECTION
91147 field_addr.sub_location->number = i;
91148 #endif /* FREECIV_JSON_CONNECTION */
91149 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
91150 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
91151 }
91152 }
91153
91154 #ifdef FREECIV_JSON_CONNECTION
91155 /* Exit array. */
91156 free(field_addr.sub_location);
91157 field_addr.sub_location = NULL;
91158 #endif /* FREECIV_JSON_CONNECTION */
91159 }
91160 }
91161 if (BV_ISSET(fields, 6)) {
91162 log_packet_detailed(" got field 'ppl_content'");
91163 #ifdef FREECIV_JSON_CONNECTION
91164 field_addr.name = "ppl_content";
91165 #endif /* FREECIV_JSON_CONNECTION */
91166
91167 {
91168 int i;
91169
91170 #ifdef FREECIV_JSON_CONNECTION
91171 /* Enter array. */
91172 field_addr.sub_location = plocation_elem_new(0);
91173 #endif /* FREECIV_JSON_CONNECTION */
91174
91175 for (i = 0; i < 5; i++) {
91176 #ifdef FREECIV_JSON_CONNECTION
91177 field_addr.sub_location->number = i;
91178 #endif /* FREECIV_JSON_CONNECTION */
91179 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
91180 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
91181 }
91182 }
91183
91184 #ifdef FREECIV_JSON_CONNECTION
91185 /* Exit array. */
91186 free(field_addr.sub_location);
91187 field_addr.sub_location = NULL;
91188 #endif /* FREECIV_JSON_CONNECTION */
91189 }
91190 }
91191 if (BV_ISSET(fields, 7)) {
91192 log_packet_detailed(" got field 'ppl_unhappy'");
91193 #ifdef FREECIV_JSON_CONNECTION
91194 field_addr.name = "ppl_unhappy";
91195 #endif /* FREECIV_JSON_CONNECTION */
91196
91197 {
91198 int i;
91199
91200 #ifdef FREECIV_JSON_CONNECTION
91201 /* Enter array. */
91202 field_addr.sub_location = plocation_elem_new(0);
91203 #endif /* FREECIV_JSON_CONNECTION */
91204
91205 for (i = 0; i < 5; i++) {
91206 #ifdef FREECIV_JSON_CONNECTION
91207 field_addr.sub_location->number = i;
91208 #endif /* FREECIV_JSON_CONNECTION */
91209 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
91210 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
91211 }
91212 }
91213
91214 #ifdef FREECIV_JSON_CONNECTION
91215 /* Exit array. */
91216 free(field_addr.sub_location);
91217 field_addr.sub_location = NULL;
91218 #endif /* FREECIV_JSON_CONNECTION */
91219 }
91220 }
91221 if (BV_ISSET(fields, 8)) {
91222 log_packet_detailed(" got field 'ppl_angry'");
91223 #ifdef FREECIV_JSON_CONNECTION
91224 field_addr.name = "ppl_angry";
91225 #endif /* FREECIV_JSON_CONNECTION */
91226
91227 {
91228 int i;
91229
91230 #ifdef FREECIV_JSON_CONNECTION
91231 /* Enter array. */
91232 field_addr.sub_location = plocation_elem_new(0);
91233 #endif /* FREECIV_JSON_CONNECTION */
91234
91235 for (i = 0; i < 5; i++) {
91236 #ifdef FREECIV_JSON_CONNECTION
91237 field_addr.sub_location->number = i;
91238 #endif /* FREECIV_JSON_CONNECTION */
91239 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
91240 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
91241 }
91242 }
91243
91244 #ifdef FREECIV_JSON_CONNECTION
91245 /* Exit array. */
91246 free(field_addr.sub_location);
91247 field_addr.sub_location = NULL;
91248 #endif /* FREECIV_JSON_CONNECTION */
91249 }
91250 }
91251 if (BV_ISSET(fields, 9)) {
91252 log_packet_detailed(" got field 'specialists_size'");
91253 #ifdef FREECIV_JSON_CONNECTION
91254 field_addr.name = "specialists_size";
91255 #endif /* FREECIV_JSON_CONNECTION */
91256 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
91257 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
91258 }
91259 }
91260 if (BV_ISSET(fields, 10)) {
91261 log_packet_detailed(" got field 'specialists'");
91262 #ifdef FREECIV_JSON_CONNECTION
91263 field_addr.name = "specialists";
91264 #endif /* FREECIV_JSON_CONNECTION */
91265
91266 {
91267 int i;
91268
91269 #ifdef FREECIV_JSON_CONNECTION
91270 /* Enter array. */
91271 field_addr.sub_location = plocation_elem_new(0);
91272 #endif /* FREECIV_JSON_CONNECTION */
91273
91274 if (real_packet->specialists_size > SP_MAX) {
91275 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
91276 }
91277 for (i = 0; i < real_packet->specialists_size; i++) {
91278 #ifdef FREECIV_JSON_CONNECTION
91279 field_addr.sub_location->number = i;
91280 #endif /* FREECIV_JSON_CONNECTION */
91281 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
91282 RECEIVE_PACKET_FIELD_ERROR(specialists);
91283 }
91284 }
91285
91286 #ifdef FREECIV_JSON_CONNECTION
91287 /* Exit array. */
91288 free(field_addr.sub_location);
91289 field_addr.sub_location = NULL;
91290 #endif /* FREECIV_JSON_CONNECTION */
91291 }
91292 }
91293 if (BV_ISSET(fields, 11)) {
91294 log_packet_detailed(" got field 'food_stock'");
91295 #ifdef FREECIV_JSON_CONNECTION
91296 field_addr.name = "food_stock";
91297 #endif /* FREECIV_JSON_CONNECTION */
91298 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->food_stock)) {
91299 RECEIVE_PACKET_FIELD_ERROR(food_stock);
91300 }
91301 }
91302 if (BV_ISSET(fields, 12)) {
91303 log_packet_detailed(" got field 'shield_stock'");
91304 #ifdef FREECIV_JSON_CONNECTION
91305 field_addr.name = "shield_stock";
91306 #endif /* FREECIV_JSON_CONNECTION */
91307 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
91308 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
91309 }
91310 }
91311 real_packet->airlift = BV_ISSET(fields, 13);
91312 real_packet->debug = BV_ISSET(fields, 14);
91313 real_packet->did_buy = BV_ISSET(fields, 15);
91314 real_packet->did_sell = BV_ISSET(fields, 16);
91315 real_packet->was_happy = BV_ISSET(fields, 17);
91316 if (BV_ISSET(fields, 18)) {
91317 log_packet_detailed(" got field 'anarchy'");
91318 #ifdef FREECIV_JSON_CONNECTION
91319 field_addr.name = "anarchy";
91320 #endif /* FREECIV_JSON_CONNECTION */
91321 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->anarchy)) {
91322 RECEIVE_PACKET_FIELD_ERROR(anarchy);
91323 }
91324 }
91325 if (BV_ISSET(fields, 19)) {
91326 log_packet_detailed(" got field 'rapture'");
91327 #ifdef FREECIV_JSON_CONNECTION
91328 field_addr.name = "rapture";
91329 #endif /* FREECIV_JSON_CONNECTION */
91330 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rapture)) {
91331 RECEIVE_PACKET_FIELD_ERROR(rapture);
91332 }
91333 }
91334 if (BV_ISSET(fields, 20)) {
91335 log_packet_detailed(" got field 'steal'");
91336 #ifdef FREECIV_JSON_CONNECTION
91337 field_addr.name = "steal";
91338 #endif /* FREECIV_JSON_CONNECTION */
91339 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->steal)) {
91340 RECEIVE_PACKET_FIELD_ERROR(steal);
91341 }
91342 }
91343 if (BV_ISSET(fields, 21)) {
91344 log_packet_detailed(" got field 'turn_founded'");
91345 #ifdef FREECIV_JSON_CONNECTION
91346 field_addr.name = "turn_founded";
91347 #endif /* FREECIV_JSON_CONNECTION */
91348 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
91349 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
91350 }
91351 }
91352 if (BV_ISSET(fields, 22)) {
91353 log_packet_detailed(" got field 'turn_last_built'");
91354 #ifdef FREECIV_JSON_CONNECTION
91355 field_addr.name = "turn_last_built";
91356 #endif /* FREECIV_JSON_CONNECTION */
91357 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
91358 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
91359 }
91360 }
91361 if (BV_ISSET(fields, 23)) {
91362 log_packet_detailed(" got field 'built'");
91363 #ifdef FREECIV_JSON_CONNECTION
91364 field_addr.name = "built";
91365 #endif /* FREECIV_JSON_CONNECTION */
91366
91367 {
91368 #ifdef FREECIV_JSON_CONNECTION
91369 int count;
91370
91371 /* Enter array. */
91372 field_addr.sub_location = plocation_elem_new(0);
91373
91374 for (count = 0;; count++) {
91375 int i;
91376
91377 field_addr.sub_location->number = count;
91378
91379 /* Enter diff array element (start at the index address). */
91380 field_addr.sub_location->sub_location = plocation_elem_new(0);
91381 #else /* FREECIV_JSON_CONNECTION */
91382 while (TRUE) {
91383 int i;
91384 #endif /* FREECIV_JSON_CONNECTION */
91385
91386 if (!DIO_GET(uint8, &din, &field_addr, &i)) {
91387 RECEIVE_PACKET_FIELD_ERROR(built);
91388 }
91389 if (i == 255) {
91390 #ifdef FREECIV_JSON_CONNECTION
91391 /* Exit diff array element. */
91392 free(field_addr.sub_location->sub_location);
91393 field_addr.sub_location->sub_location = NULL;
91394
91395 /* Exit diff array. */
91396 free(field_addr.sub_location);
91397 field_addr.sub_location = NULL;
91398 #endif /* FREECIV_JSON_CONNECTION */
91399
91400 break;
91401 }
91402 if (i > B_LAST) {
91403 RECEIVE_PACKET_FIELD_ERROR(built,
91404 ": unexpected value %d "
91405 "(> B_LAST) in array diff",
91406 i);
91407 } else {
91408 #ifdef FREECIV_JSON_CONNECTION
91409 /* Content address. */
91410 field_addr.sub_location->sub_location->number = 1;
91411 #endif /* FREECIV_JSON_CONNECTION */
91412 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->built[i])) {
91413 RECEIVE_PACKET_FIELD_ERROR(built);
91414 }
91415 }
91416
91417 #ifdef FREECIV_JSON_CONNECTION
91418 /* Exit diff array element. */
91419 free(field_addr.sub_location->sub_location);
91420 field_addr.sub_location->sub_location = NULL;
91421 #endif /* FREECIV_JSON_CONNECTION */
91422 }
91423
91424 #ifdef FREECIV_JSON_CONNECTION
91425 /* Exit array. */
91426 free(field_addr.sub_location);
91427 field_addr.sub_location = NULL;
91428 #endif /* FREECIV_JSON_CONNECTION */
91429 }
91430 }
91431 if (BV_ISSET(fields, 24)) {
91432 log_packet_detailed(" got field 'production_kind'");
91433 #ifdef FREECIV_JSON_CONNECTION
91434 field_addr.name = "production_kind";
91435 #endif /* FREECIV_JSON_CONNECTION */
91436 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
91437 RECEIVE_PACKET_FIELD_ERROR(production_kind);
91438 }
91439 }
91440 if (BV_ISSET(fields, 25)) {
91441 log_packet_detailed(" got field 'production_value'");
91442 #ifdef FREECIV_JSON_CONNECTION
91443 field_addr.name = "production_value";
91444 #endif /* FREECIV_JSON_CONNECTION */
91445 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
91446 RECEIVE_PACKET_FIELD_ERROR(production_value);
91447 }
91448 }
91449 if (BV_ISSET(fields, 26)) {
91450 log_packet_detailed(" got field 'city_options'");
91451 #ifdef FREECIV_JSON_CONNECTION
91452 field_addr.name = "city_options";
91453 #endif /* FREECIV_JSON_CONNECTION */
91454 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
91455 RECEIVE_PACKET_FIELD_ERROR(city_options);
91456 }
91457 }
91458
91459 if (NULL == old) {
91460 old = fc_malloc(sizeof(*old));
91461 *old = *real_packet;
91462 genhash_insert(*hash, old, old);
91463 } else {
91464 *old = *real_packet;
91465 }
91466
91467#endif /* FREECIV_DELTA_PROTOCOL */
91468 RECEIVE_PACKET_END(real_packet);
91469}
91470
91471 static int send_packet_edit_city_101(struct connection *pc, const struct packet_edit_city *packet)
91472{
91473 const struct packet_edit_city *real_packet = packet;
91474#ifdef FREECIV_DELTA_PROTOCOL
91475 packet_edit_city_101_fields fields;
91476 struct packet_edit_city *old;
91477 bool differ;
91478 struct genhash **hash = pc->phs.sent + PACKET_EDIT_CITY;
91479#endif /* FREECIV_DELTA_PROTOCOL */
91480 SEND_PACKET_START(PACKET_EDIT_CITY);
91481#ifdef FREECIV_JSON_CONNECTION
91482 struct plocation field_addr;
91483 {
91484 struct plocation *field_addr_tmp = plocation_field_new(NULL);
91485 field_addr = *field_addr_tmp;
91486 FC_FREE(field_addr_tmp);
91487 }
91488#endif /* FREECIV_JSON_CONNECTION */
91489
91490 log_packet_detailed("packet_edit_city_101: sending info about (%d)",
91491 real_packet->id16);
91492
91493#ifdef FREECIV_DELTA_PROTOCOL
91494 if (NULL == *hash) {
91495 *hash = genhash_new_full(hash_packet_edit_city_101, cmp_packet_edit_city_101,
91496 NULL, NULL, NULL, free);
91497 }
91498 BV_CLR_ALL(fields);
91499
91500 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
91501 old = fc_malloc(sizeof(*old));
91502 *old = *real_packet;
91503 genhash_insert(*hash, old, old);
91504 memset(old, 0, sizeof(*old));
91505 }
91506 differ = (strcmp(old->name, real_packet->name) != 0);
91507 if (differ) {
91508 BV_SET(fields, 0);
91509 }
91510
91511 differ = (old->owner != real_packet->owner);
91512 if (differ) {
91513 BV_SET(fields, 1);
91514 }
91515
91516 differ = (old->original != real_packet->original);
91517 if (differ) {
91518 BV_SET(fields, 2);
91519 }
91520
91521 differ = (old->size != real_packet->size);
91522 if (differ) {
91523 BV_SET(fields, 3);
91524 }
91525
91526 differ = (old->history != real_packet->history);
91527 if (differ) {
91528 BV_SET(fields, 4);
91529 }
91530
91531
91532 {
91533 differ = FALSE;
91534 {
91535 int i;
91536
91537 for (i = 0; i < 5; i++) {
91538 if (old->ppl_happy[i] != real_packet->ppl_happy[i]) {
91539 differ = TRUE;
91540 break;
91541 }
91542 }
91543 }
91544 }
91545 if (differ) {
91546 BV_SET(fields, 5);
91547 }
91548
91549
91550 {
91551 differ = FALSE;
91552 {
91553 int i;
91554
91555 for (i = 0; i < 5; i++) {
91556 if (old->ppl_content[i] != real_packet->ppl_content[i]) {
91557 differ = TRUE;
91558 break;
91559 }
91560 }
91561 }
91562 }
91563 if (differ) {
91564 BV_SET(fields, 6);
91565 }
91566
91567
91568 {
91569 differ = FALSE;
91570 {
91571 int i;
91572
91573 for (i = 0; i < 5; i++) {
91574 if (old->ppl_unhappy[i] != real_packet->ppl_unhappy[i]) {
91575 differ = TRUE;
91576 break;
91577 }
91578 }
91579 }
91580 }
91581 if (differ) {
91582 BV_SET(fields, 7);
91583 }
91584
91585
91586 {
91587 differ = FALSE;
91588 {
91589 int i;
91590
91591 for (i = 0; i < 5; i++) {
91592 if (old->ppl_angry[i] != real_packet->ppl_angry[i]) {
91593 differ = TRUE;
91594 break;
91595 }
91596 }
91597 }
91598 }
91599 if (differ) {
91600 BV_SET(fields, 8);
91601 }
91602
91603 differ = (old->specialists_size != real_packet->specialists_size);
91604 if (differ) {
91605 BV_SET(fields, 9);
91606 }
91607
91608
91609 {
91610 differ = (old->specialists_size != real_packet->specialists_size);
91611 if (!differ) {
91612 int i;
91613
91614 for (i = 0; i < real_packet->specialists_size; i++) {
91615 if (old->specialists[i] != real_packet->specialists[i]) {
91616 differ = TRUE;
91617 break;
91618 }
91619 }
91620 }
91621 }
91622 if (differ) {
91623 BV_SET(fields, 10);
91624 }
91625
91626 differ = (old->food_stock != real_packet->food_stock);
91627 if (differ) {
91628 BV_SET(fields, 11);
91629 }
91630
91631 differ = (old->shield_stock != real_packet->shield_stock);
91632 if (differ) {
91633 BV_SET(fields, 12);
91634 }
91635
91636 if (packet->airlift) {
91637 BV_SET(fields, 13);
91638 }
91639
91640 if (packet->debug) {
91641 BV_SET(fields, 14);
91642 }
91643
91644 if (packet->did_buy) {
91645 BV_SET(fields, 15);
91646 }
91647
91648 if (packet->did_sell) {
91649 BV_SET(fields, 16);
91650 }
91651
91652 if (packet->was_happy) {
91653 BV_SET(fields, 17);
91654 }
91655
91656 differ = (old->anarchy != real_packet->anarchy);
91657 if (differ) {
91658 BV_SET(fields, 18);
91659 }
91660
91661 differ = (old->rapture != real_packet->rapture);
91662 if (differ) {
91663 BV_SET(fields, 19);
91664 }
91665
91666 differ = (old->steal != real_packet->steal);
91667 if (differ) {
91668 BV_SET(fields, 20);
91669 }
91670
91671 differ = (old->turn_founded != real_packet->turn_founded);
91672 if (differ) {
91673 BV_SET(fields, 21);
91674 }
91675
91676 differ = (old->turn_last_built != real_packet->turn_last_built);
91677 if (differ) {
91678 BV_SET(fields, 22);
91679 }
91680
91681
91682 {
91683 differ = FALSE;
91684 {
91685 int i;
91686
91687 for (i = 0; i < B_LAST; i++) {
91688 if (old->built[i] != real_packet->built[i]) {
91689 differ = TRUE;
91690 break;
91691 }
91692 }
91693 }
91694 }
91695 if (differ) {
91696 BV_SET(fields, 23);
91697 }
91698
91699 differ = (old->production_kind != real_packet->production_kind);
91700 if (differ) {
91701 BV_SET(fields, 24);
91702 }
91703
91704 differ = (old->production_value != real_packet->production_value);
91705 if (differ) {
91706 BV_SET(fields, 25);
91707 }
91708
91709 differ = !BV_ARE_EQUAL(old->city_options, real_packet->city_options);
91710 if (differ) {
91711 BV_SET(fields, 26);
91712 }
91713
91714
91715#ifdef FREECIV_JSON_CONNECTION
91716 field_addr.name = "fields";
91717#endif /* FREECIV_JSON_CONNECTION */
91718 DIO_BV_PUT(&dout, &field_addr, fields);
91719#ifdef FREECIV_JSON_CONNECTION
91720 field_addr.name = "id16";
91721#endif /* FREECIV_JSON_CONNECTION */
91722 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
91723
91724 if (BV_ISSET(fields, 0)) {
91725 log_packet_detailed(" field 'name' has changed");
91726 #ifdef FREECIV_JSON_CONNECTION
91727 field_addr.name = "name";
91728#endif /* FREECIV_JSON_CONNECTION */
91729 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
91730 }
91731 if (BV_ISSET(fields, 1)) {
91732 log_packet_detailed(" field 'owner' has changed");
91733 #ifdef FREECIV_JSON_CONNECTION
91734 field_addr.name = "owner";
91735#endif /* FREECIV_JSON_CONNECTION */
91736 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
91737 }
91738 if (BV_ISSET(fields, 2)) {
91739 log_packet_detailed(" field 'original' has changed");
91740 #ifdef FREECIV_JSON_CONNECTION
91741 field_addr.name = "original";
91742#endif /* FREECIV_JSON_CONNECTION */
91743 DIO_PUT(uint16, &dout, &field_addr, real_packet->original);
91744 }
91745 if (BV_ISSET(fields, 3)) {
91746 log_packet_detailed(" field 'size' has changed");
91747 #ifdef FREECIV_JSON_CONNECTION
91748 field_addr.name = "size";
91749#endif /* FREECIV_JSON_CONNECTION */
91750 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
91751 }
91752 if (BV_ISSET(fields, 4)) {
91753 log_packet_detailed(" field 'history' has changed");
91754 #ifdef FREECIV_JSON_CONNECTION
91755 field_addr.name = "history";
91756#endif /* FREECIV_JSON_CONNECTION */
91757 DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
91758 }
91759 if (BV_ISSET(fields, 5)) {
91760 log_packet_detailed(" field 'ppl_happy' has changed");
91761 #ifdef FREECIV_JSON_CONNECTION
91762 field_addr.name = "ppl_happy";
91763#endif /* FREECIV_JSON_CONNECTION */
91764
91765 {
91766 int i;
91767
91768#ifdef FREECIV_JSON_CONNECTION
91769 /* Create the array. */
91770 DIO_PUT(farray, &dout, &field_addr, 5);
91771
91772 /* Enter the array. */
91773 field_addr.sub_location = plocation_elem_new(0);
91774#endif /* FREECIV_JSON_CONNECTION */
91775
91776 for (i = 0; i < 5; i++) {
91777#ifdef FREECIV_JSON_CONNECTION
91778 /* Next array element. */
91779 field_addr.sub_location->number = i;
91780#endif /* FREECIV_JSON_CONNECTION */
91781 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
91782 }
91783
91784#ifdef FREECIV_JSON_CONNECTION
91785 /* Exit array. */
91786 free(field_addr.sub_location);
91787 field_addr.sub_location = NULL;
91788#endif /* FREECIV_JSON_CONNECTION */
91789 }
91790 }
91791 if (BV_ISSET(fields, 6)) {
91792 log_packet_detailed(" field 'ppl_content' has changed");
91793 #ifdef FREECIV_JSON_CONNECTION
91794 field_addr.name = "ppl_content";
91795#endif /* FREECIV_JSON_CONNECTION */
91796
91797 {
91798 int i;
91799
91800#ifdef FREECIV_JSON_CONNECTION
91801 /* Create the array. */
91802 DIO_PUT(farray, &dout, &field_addr, 5);
91803
91804 /* Enter the array. */
91805 field_addr.sub_location = plocation_elem_new(0);
91806#endif /* FREECIV_JSON_CONNECTION */
91807
91808 for (i = 0; i < 5; i++) {
91809#ifdef FREECIV_JSON_CONNECTION
91810 /* Next array element. */
91811 field_addr.sub_location->number = i;
91812#endif /* FREECIV_JSON_CONNECTION */
91813 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
91814 }
91815
91816#ifdef FREECIV_JSON_CONNECTION
91817 /* Exit array. */
91818 free(field_addr.sub_location);
91819 field_addr.sub_location = NULL;
91820#endif /* FREECIV_JSON_CONNECTION */
91821 }
91822 }
91823 if (BV_ISSET(fields, 7)) {
91824 log_packet_detailed(" field 'ppl_unhappy' has changed");
91825 #ifdef FREECIV_JSON_CONNECTION
91826 field_addr.name = "ppl_unhappy";
91827#endif /* FREECIV_JSON_CONNECTION */
91828
91829 {
91830 int i;
91831
91832#ifdef FREECIV_JSON_CONNECTION
91833 /* Create the array. */
91834 DIO_PUT(farray, &dout, &field_addr, 5);
91835
91836 /* Enter the array. */
91837 field_addr.sub_location = plocation_elem_new(0);
91838#endif /* FREECIV_JSON_CONNECTION */
91839
91840 for (i = 0; i < 5; i++) {
91841#ifdef FREECIV_JSON_CONNECTION
91842 /* Next array element. */
91843 field_addr.sub_location->number = i;
91844#endif /* FREECIV_JSON_CONNECTION */
91845 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
91846 }
91847
91848#ifdef FREECIV_JSON_CONNECTION
91849 /* Exit array. */
91850 free(field_addr.sub_location);
91851 field_addr.sub_location = NULL;
91852#endif /* FREECIV_JSON_CONNECTION */
91853 }
91854 }
91855 if (BV_ISSET(fields, 8)) {
91856 log_packet_detailed(" field 'ppl_angry' has changed");
91857 #ifdef FREECIV_JSON_CONNECTION
91858 field_addr.name = "ppl_angry";
91859#endif /* FREECIV_JSON_CONNECTION */
91860
91861 {
91862 int i;
91863
91864#ifdef FREECIV_JSON_CONNECTION
91865 /* Create the array. */
91866 DIO_PUT(farray, &dout, &field_addr, 5);
91867
91868 /* Enter the array. */
91869 field_addr.sub_location = plocation_elem_new(0);
91870#endif /* FREECIV_JSON_CONNECTION */
91871
91872 for (i = 0; i < 5; i++) {
91873#ifdef FREECIV_JSON_CONNECTION
91874 /* Next array element. */
91875 field_addr.sub_location->number = i;
91876#endif /* FREECIV_JSON_CONNECTION */
91877 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
91878 }
91879
91880#ifdef FREECIV_JSON_CONNECTION
91881 /* Exit array. */
91882 free(field_addr.sub_location);
91883 field_addr.sub_location = NULL;
91884#endif /* FREECIV_JSON_CONNECTION */
91885 }
91886 }
91887 if (BV_ISSET(fields, 9)) {
91888 log_packet_detailed(" field 'specialists_size' has changed");
91889 #ifdef FREECIV_JSON_CONNECTION
91890 field_addr.name = "specialists_size";
91891#endif /* FREECIV_JSON_CONNECTION */
91892 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
91893 }
91894 if (BV_ISSET(fields, 10)) {
91895 log_packet_detailed(" field 'specialists' has changed");
91896 #ifdef FREECIV_JSON_CONNECTION
91897 field_addr.name = "specialists";
91898#endif /* FREECIV_JSON_CONNECTION */
91899
91900 {
91901 int i;
91902
91903#ifdef FREECIV_JSON_CONNECTION
91904 /* Create the array. */
91905 DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
91906
91907 /* Enter the array. */
91908 field_addr.sub_location = plocation_elem_new(0);
91909#endif /* FREECIV_JSON_CONNECTION */
91910
91911 for (i = 0; i < real_packet->specialists_size; i++) {
91912#ifdef FREECIV_JSON_CONNECTION
91913 /* Next array element. */
91914 field_addr.sub_location->number = i;
91915#endif /* FREECIV_JSON_CONNECTION */
91916 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
91917 }
91918
91919#ifdef FREECIV_JSON_CONNECTION
91920 /* Exit array. */
91921 free(field_addr.sub_location);
91922 field_addr.sub_location = NULL;
91923#endif /* FREECIV_JSON_CONNECTION */
91924 }
91925 }
91926 if (BV_ISSET(fields, 11)) {
91927 log_packet_detailed(" field 'food_stock' has changed");
91928 #ifdef FREECIV_JSON_CONNECTION
91929 field_addr.name = "food_stock";
91930#endif /* FREECIV_JSON_CONNECTION */
91931 DIO_PUT(uint16, &dout, &field_addr, real_packet->food_stock);
91932 }
91933 if (BV_ISSET(fields, 12)) {
91934 log_packet_detailed(" field 'shield_stock' has changed");
91935 #ifdef FREECIV_JSON_CONNECTION
91936 field_addr.name = "shield_stock";
91937#endif /* FREECIV_JSON_CONNECTION */
91938 DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
91939 }
91940 /* field 13 is folded into the header */
91941 /* field 14 is folded into the header */
91942 /* field 15 is folded into the header */
91943 /* field 16 is folded into the header */
91944 /* field 17 is folded into the header */
91945 if (BV_ISSET(fields, 18)) {
91946 log_packet_detailed(" field 'anarchy' has changed");
91947 #ifdef FREECIV_JSON_CONNECTION
91948 field_addr.name = "anarchy";
91949#endif /* FREECIV_JSON_CONNECTION */
91950 DIO_PUT(uint8, &dout, &field_addr, real_packet->anarchy);
91951 }
91952 if (BV_ISSET(fields, 19)) {
91953 log_packet_detailed(" field 'rapture' has changed");
91954 #ifdef FREECIV_JSON_CONNECTION
91955 field_addr.name = "rapture";
91956#endif /* FREECIV_JSON_CONNECTION */
91957 DIO_PUT(uint8, &dout, &field_addr, real_packet->rapture);
91958 }
91959 if (BV_ISSET(fields, 20)) {
91960 log_packet_detailed(" field 'steal' has changed");
91961 #ifdef FREECIV_JSON_CONNECTION
91962 field_addr.name = "steal";
91963#endif /* FREECIV_JSON_CONNECTION */
91964 DIO_PUT(uint8, &dout, &field_addr, real_packet->steal);
91965 }
91966 if (BV_ISSET(fields, 21)) {
91967 log_packet_detailed(" field 'turn_founded' has changed");
91968 #ifdef FREECIV_JSON_CONNECTION
91969 field_addr.name = "turn_founded";
91970#endif /* FREECIV_JSON_CONNECTION */
91971 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
91972 }
91973 if (BV_ISSET(fields, 22)) {
91974 log_packet_detailed(" field 'turn_last_built' has changed");
91975 #ifdef FREECIV_JSON_CONNECTION
91976 field_addr.name = "turn_last_built";
91977#endif /* FREECIV_JSON_CONNECTION */
91978 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
91979 }
91980 if (BV_ISSET(fields, 23)) {
91981 log_packet_detailed(" field 'built' has changed");
91982 #ifdef FREECIV_JSON_CONNECTION
91983 field_addr.name = "built";
91984#endif /* FREECIV_JSON_CONNECTION */
91985
91986 {
91987 int i;
91988
91989#ifdef FREECIV_JSON_CONNECTION
91990 int count = 0;
91991
91992 for (i = 0; i < B_LAST; i++) {
91993 if (old->built[i] != real_packet->built[i]) {
91994 count++;
91995 }
91996 }
91997 /* Create the array. */
91998 DIO_PUT(farray, &dout, &field_addr, count + 1);
91999
92000 /* Enter array. */
92001 field_addr.sub_location = plocation_elem_new(0);
92002
92003 count = 0;
92004#endif /* FREECIV_JSON_CONNECTION */
92005
92006 fc_assert(B_LAST < 255);
92007
92008 for (i = 0; i < B_LAST; i++) {
92009 if (old->built[i] != real_packet->built[i]) {
92010#ifdef FREECIV_JSON_CONNECTION
92011 /* Next diff array element. */
92012 field_addr.sub_location->number = count - 1;
92013
92014 /* Create the diff array element. */
92015 DIO_PUT(farray, &dout, &field_addr, 2);
92016
92017 /* Enter diff array element (start at the index address). */
92018 field_addr.sub_location->sub_location = plocation_elem_new(0);
92019#endif /* FREECIV_JSON_CONNECTION */
92020 DIO_PUT(uint8, &dout, &field_addr, i);
92021
92022#ifdef FREECIV_JSON_CONNECTION
92023 /* Content address. */
92024 field_addr.sub_location->sub_location->number = 1;
92025#endif /* FREECIV_JSON_CONNECTION */
92026 DIO_PUT(sint32, &dout, &field_addr, real_packet->built[i]);
92027
92028#ifdef FREECIV_JSON_CONNECTION
92029 /* Exit diff array element. */
92030 free(field_addr.sub_location->sub_location);
92031 field_addr.sub_location->sub_location = NULL;
92032#endif /* FREECIV_JSON_CONNECTION */
92033 }
92034 }
92035#ifdef FREECIV_JSON_CONNECTION
92036 field_addr.sub_location->number = count - 1;
92037
92038 /* Create the diff array element. */
92039 DIO_PUT(farray, &dout, &field_addr, B_LAST);
92040
92041 /* Enter diff array element. Point to index address. */
92042 field_addr.sub_location->sub_location = plocation_elem_new(0);
92043#endif /* FREECIV_JSON_CONNECTION */
92044 DIO_PUT(uint8, &dout, &field_addr, 255);
92045
92046#ifdef FREECIV_JSON_CONNECTION
92047 /* Exit diff array element. */
92048 free(field_addr.sub_location->sub_location);
92049 field_addr.sub_location->sub_location = NULL;
92050
92051 /* Exit array. */
92052 free(field_addr.sub_location);
92053 field_addr.sub_location = NULL;
92054#endif /* FREECIV_JSON_CONNECTION */
92055 }
92056 }
92057 if (BV_ISSET(fields, 24)) {
92058 log_packet_detailed(" field 'production_kind' has changed");
92059 #ifdef FREECIV_JSON_CONNECTION
92060 field_addr.name = "production_kind";
92061#endif /* FREECIV_JSON_CONNECTION */
92062 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
92063 }
92064 if (BV_ISSET(fields, 25)) {
92065 log_packet_detailed(" field 'production_value' has changed");
92066 #ifdef FREECIV_JSON_CONNECTION
92067 field_addr.name = "production_value";
92068#endif /* FREECIV_JSON_CONNECTION */
92069 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
92070 }
92071 if (BV_ISSET(fields, 26)) {
92072 log_packet_detailed(" field 'city_options' has changed");
92073 #ifdef FREECIV_JSON_CONNECTION
92074 field_addr.name = "city_options";
92075#endif /* FREECIV_JSON_CONNECTION */
92076 DIO_BV_PUT(&dout, &field_addr, packet->city_options);
92077 }
92078
92079 *old = *real_packet;
92080#endif /* FREECIV_DELTA_PROTOCOL */
92081#ifndef FREECIV_DELTA_PROTOCOL
92082#ifdef FREECIV_JSON_CONNECTION
92083 field_addr.name = "id16";
92084#endif /* FREECIV_JSON_CONNECTION */
92085 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
92086#ifdef FREECIV_JSON_CONNECTION
92087 field_addr.name = "name";
92088#endif /* FREECIV_JSON_CONNECTION */
92089 DIO_PUT(estring, &dout, &field_addr, real_packet->name);
92090#ifdef FREECIV_JSON_CONNECTION
92091 field_addr.name = "owner";
92092#endif /* FREECIV_JSON_CONNECTION */
92093 DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
92094#ifdef FREECIV_JSON_CONNECTION
92095 field_addr.name = "original";
92096#endif /* FREECIV_JSON_CONNECTION */
92097 DIO_PUT(uint16, &dout, &field_addr, real_packet->original);
92098#ifdef FREECIV_JSON_CONNECTION
92099 field_addr.name = "size";
92100#endif /* FREECIV_JSON_CONNECTION */
92101 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
92102#ifdef FREECIV_JSON_CONNECTION
92103 field_addr.name = "history";
92104#endif /* FREECIV_JSON_CONNECTION */
92105 DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
92106#ifdef FREECIV_JSON_CONNECTION
92107 field_addr.name = "ppl_happy";
92108#endif /* FREECIV_JSON_CONNECTION */
92109
92110 {
92111 int i;
92112
92113#ifdef FREECIV_JSON_CONNECTION
92114 /* Create the array. */
92115 DIO_PUT(farray, &dout, &field_addr, 5);
92116
92117 /* Enter the array. */
92118 field_addr.sub_location = plocation_elem_new(0);
92119#endif /* FREECIV_JSON_CONNECTION */
92120
92121 for (i = 0; i < 5; i++) {
92122#ifdef FREECIV_JSON_CONNECTION
92123 /* Next array element. */
92124 field_addr.sub_location->number = i;
92125#endif /* FREECIV_JSON_CONNECTION */
92126 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
92127 }
92128
92129#ifdef FREECIV_JSON_CONNECTION
92130 /* Exit array. */
92131 free(field_addr.sub_location);
92132 field_addr.sub_location = NULL;
92133#endif /* FREECIV_JSON_CONNECTION */
92134 }
92135#ifdef FREECIV_JSON_CONNECTION
92136 field_addr.name = "ppl_content";
92137#endif /* FREECIV_JSON_CONNECTION */
92138
92139 {
92140 int i;
92141
92142#ifdef FREECIV_JSON_CONNECTION
92143 /* Create the array. */
92144 DIO_PUT(farray, &dout, &field_addr, 5);
92145
92146 /* Enter the array. */
92147 field_addr.sub_location = plocation_elem_new(0);
92148#endif /* FREECIV_JSON_CONNECTION */
92149
92150 for (i = 0; i < 5; i++) {
92151#ifdef FREECIV_JSON_CONNECTION
92152 /* Next array element. */
92153 field_addr.sub_location->number = i;
92154#endif /* FREECIV_JSON_CONNECTION */
92155 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
92156 }
92157
92158#ifdef FREECIV_JSON_CONNECTION
92159 /* Exit array. */
92160 free(field_addr.sub_location);
92161 field_addr.sub_location = NULL;
92162#endif /* FREECIV_JSON_CONNECTION */
92163 }
92164#ifdef FREECIV_JSON_CONNECTION
92165 field_addr.name = "ppl_unhappy";
92166#endif /* FREECIV_JSON_CONNECTION */
92167
92168 {
92169 int i;
92170
92171#ifdef FREECIV_JSON_CONNECTION
92172 /* Create the array. */
92173 DIO_PUT(farray, &dout, &field_addr, 5);
92174
92175 /* Enter the array. */
92176 field_addr.sub_location = plocation_elem_new(0);
92177#endif /* FREECIV_JSON_CONNECTION */
92178
92179 for (i = 0; i < 5; i++) {
92180#ifdef FREECIV_JSON_CONNECTION
92181 /* Next array element. */
92182 field_addr.sub_location->number = i;
92183#endif /* FREECIV_JSON_CONNECTION */
92184 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
92185 }
92186
92187#ifdef FREECIV_JSON_CONNECTION
92188 /* Exit array. */
92189 free(field_addr.sub_location);
92190 field_addr.sub_location = NULL;
92191#endif /* FREECIV_JSON_CONNECTION */
92192 }
92193#ifdef FREECIV_JSON_CONNECTION
92194 field_addr.name = "ppl_angry";
92195#endif /* FREECIV_JSON_CONNECTION */
92196
92197 {
92198 int i;
92199
92200#ifdef FREECIV_JSON_CONNECTION
92201 /* Create the array. */
92202 DIO_PUT(farray, &dout, &field_addr, 5);
92203
92204 /* Enter the array. */
92205 field_addr.sub_location = plocation_elem_new(0);
92206#endif /* FREECIV_JSON_CONNECTION */
92207
92208 for (i = 0; i < 5; i++) {
92209#ifdef FREECIV_JSON_CONNECTION
92210 /* Next array element. */
92211 field_addr.sub_location->number = i;
92212#endif /* FREECIV_JSON_CONNECTION */
92213 DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
92214 }
92215
92216#ifdef FREECIV_JSON_CONNECTION
92217 /* Exit array. */
92218 free(field_addr.sub_location);
92219 field_addr.sub_location = NULL;
92220#endif /* FREECIV_JSON_CONNECTION */
92221 }
92222#ifdef FREECIV_JSON_CONNECTION
92223 field_addr.name = "specialists_size";
92224#endif /* FREECIV_JSON_CONNECTION */
92225 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
92226#ifdef FREECIV_JSON_CONNECTION
92227 field_addr.name = "specialists";
92228#endif /* FREECIV_JSON_CONNECTION */
92229
92230 {
92231 int i;
92232
92233#ifdef FREECIV_JSON_CONNECTION
92234 /* Create the array. */
92235 DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
92236
92237 /* Enter the array. */
92238 field_addr.sub_location = plocation_elem_new(0);
92239#endif /* FREECIV_JSON_CONNECTION */
92240
92241 for (i = 0; i < real_packet->specialists_size; i++) {
92242#ifdef FREECIV_JSON_CONNECTION
92243 /* Next array element. */
92244 field_addr.sub_location->number = i;
92245#endif /* FREECIV_JSON_CONNECTION */
92246 DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
92247 }
92248
92249#ifdef FREECIV_JSON_CONNECTION
92250 /* Exit array. */
92251 free(field_addr.sub_location);
92252 field_addr.sub_location = NULL;
92253#endif /* FREECIV_JSON_CONNECTION */
92254 }
92255#ifdef FREECIV_JSON_CONNECTION
92256 field_addr.name = "food_stock";
92257#endif /* FREECIV_JSON_CONNECTION */
92258 DIO_PUT(uint16, &dout, &field_addr, real_packet->food_stock);
92259#ifdef FREECIV_JSON_CONNECTION
92260 field_addr.name = "shield_stock";
92261#endif /* FREECIV_JSON_CONNECTION */
92262 DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
92263#ifdef FREECIV_JSON_CONNECTION
92264 field_addr.name = "airlift";
92265#endif /* FREECIV_JSON_CONNECTION */
92266 DIO_PUT(bool8, &dout, &field_addr, real_packet->airlift);
92267#ifdef FREECIV_JSON_CONNECTION
92268 field_addr.name = "debug";
92269#endif /* FREECIV_JSON_CONNECTION */
92270 DIO_PUT(bool8, &dout, &field_addr, real_packet->debug);
92271#ifdef FREECIV_JSON_CONNECTION
92272 field_addr.name = "did_buy";
92273#endif /* FREECIV_JSON_CONNECTION */
92274 DIO_PUT(bool8, &dout, &field_addr, real_packet->did_buy);
92275#ifdef FREECIV_JSON_CONNECTION
92276 field_addr.name = "did_sell";
92277#endif /* FREECIV_JSON_CONNECTION */
92278 DIO_PUT(bool8, &dout, &field_addr, real_packet->did_sell);
92279#ifdef FREECIV_JSON_CONNECTION
92280 field_addr.name = "was_happy";
92281#endif /* FREECIV_JSON_CONNECTION */
92282 DIO_PUT(bool8, &dout, &field_addr, real_packet->was_happy);
92283#ifdef FREECIV_JSON_CONNECTION
92284 field_addr.name = "anarchy";
92285#endif /* FREECIV_JSON_CONNECTION */
92286 DIO_PUT(uint8, &dout, &field_addr, real_packet->anarchy);
92287#ifdef FREECIV_JSON_CONNECTION
92288 field_addr.name = "rapture";
92289#endif /* FREECIV_JSON_CONNECTION */
92290 DIO_PUT(uint8, &dout, &field_addr, real_packet->rapture);
92291#ifdef FREECIV_JSON_CONNECTION
92292 field_addr.name = "steal";
92293#endif /* FREECIV_JSON_CONNECTION */
92294 DIO_PUT(uint8, &dout, &field_addr, real_packet->steal);
92295#ifdef FREECIV_JSON_CONNECTION
92296 field_addr.name = "turn_founded";
92297#endif /* FREECIV_JSON_CONNECTION */
92298 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
92299#ifdef FREECIV_JSON_CONNECTION
92300 field_addr.name = "turn_last_built";
92301#endif /* FREECIV_JSON_CONNECTION */
92302 DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
92303#ifdef FREECIV_JSON_CONNECTION
92304 field_addr.name = "built";
92305#endif /* FREECIV_JSON_CONNECTION */
92306
92307 {
92308 int i;
92309
92310#ifdef FREECIV_JSON_CONNECTION
92311 /* Create the array. */
92312 DIO_PUT(farray, &dout, &field_addr, B_LAST);
92313
92314 /* Enter the array. */
92315 field_addr.sub_location = plocation_elem_new(0);
92316#endif /* FREECIV_JSON_CONNECTION */
92317
92318 for (i = 0; i < B_LAST; i++) {
92319#ifdef FREECIV_JSON_CONNECTION
92320 /* Next array element. */
92321 field_addr.sub_location->number = i;
92322#endif /* FREECIV_JSON_CONNECTION */
92323 DIO_PUT(sint32, &dout, &field_addr, real_packet->built[i]);
92324 }
92325
92326#ifdef FREECIV_JSON_CONNECTION
92327 /* Exit array. */
92328 free(field_addr.sub_location);
92329 field_addr.sub_location = NULL;
92330#endif /* FREECIV_JSON_CONNECTION */
92331 }
92332#ifdef FREECIV_JSON_CONNECTION
92333 field_addr.name = "production_kind";
92334#endif /* FREECIV_JSON_CONNECTION */
92335 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
92336#ifdef FREECIV_JSON_CONNECTION
92337 field_addr.name = "production_value";
92338#endif /* FREECIV_JSON_CONNECTION */
92339 DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
92340#ifdef FREECIV_JSON_CONNECTION
92341 field_addr.name = "city_options";
92342#endif /* FREECIV_JSON_CONNECTION */
92343 DIO_BV_PUT(&dout, &field_addr, packet->city_options);
92344
92345#endif
92346 SEND_PACKET_END(PACKET_EDIT_CITY);
92347}
92348
92349 int send_packet_edit_city(struct connection *pc, const struct packet_edit_city *packet)
92350{
92351 if (!pc->used) {
92352 log_error("WARNING: trying to send data to the closed connection %s",
92353 conn_description(pc));
92354 return -1;
92355 }
92356 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_CITY].packet != NULL, -1,
92357 "Handler for PACKET_EDIT_CITY not installed");
92358 return pc->phs.handlers->send[PACKET_EDIT_CITY].packet(pc, packet);
92359}
92360
92361#ifdef FREECIV_DELTA_PROTOCOL
92362#define hash_packet_edit_player_create_100 hash_const
92363
92364#define cmp_packet_edit_player_create_100 cmp_const
92365
92366 BV_DEFINE(packet_edit_player_create_100_fields, 1);
92367#endif /* FREECIV_DELTA_PROTOCOL */
92368
92369 static struct packet_edit_player_create *receive_packet_edit_player_create_100(struct connection *pc)
92370{
92371#ifdef FREECIV_DELTA_PROTOCOL
92372 packet_edit_player_create_100_fields fields;
92373 struct packet_edit_player_create *old;
92374 struct genhash **hash = pc->phs.received + PACKET_EDIT_PLAYER_CREATE;
92375#endif /* FREECIV_DELTA_PROTOCOL */
92376 RECEIVE_PACKET_START(packet_edit_player_create, real_packet);
92377#ifdef FREECIV_JSON_CONNECTION
92378 struct plocation field_addr;
92379 {
92380 struct plocation *field_addr_tmp = plocation_field_new(NULL);
92381 field_addr = *field_addr_tmp;
92382 FC_FREE(field_addr_tmp);
92383 }
92384#endif /* FREECIV_JSON_CONNECTION */
92385
92386#ifdef FREECIV_DELTA_PROTOCOL
92387#ifdef FREECIV_JSON_CONNECTION
92388 field_addr.name = "fields";
92389#endif /* FREECIV_JSON_CONNECTION */
92390 DIO_BV_GET(&din, &field_addr, fields);
92391
92392#else /* FREECIV_DELTA_PROTOCOL */
92393 #ifdef FREECIV_JSON_CONNECTION
92394 field_addr.name = "tag";
92395 #endif /* FREECIV_JSON_CONNECTION */
92396 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
92397 RECEIVE_PACKET_FIELD_ERROR(tag);
92398 }
92399
92400#endif
92401 log_packet_detailed("packet_edit_player_create_100: got info about ()");
92402
92403#ifdef FREECIV_DELTA_PROTOCOL
92404 if (NULL == *hash) {
92405 *hash = genhash_new_full(hash_packet_edit_player_create_100, cmp_packet_edit_player_create_100,
92406 NULL, NULL, NULL, free);
92407 }
92408
92409 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
92410 *real_packet = *old;
92411 } else {
92412 log_packet_detailed(" no old info");
92413 memset(real_packet, 0, sizeof(*real_packet));
92414 }
92415
92416 if (BV_ISSET(fields, 0)) {
92417 log_packet_detailed(" got field 'tag'");
92418 #ifdef FREECIV_JSON_CONNECTION
92419 field_addr.name = "tag";
92420 #endif /* FREECIV_JSON_CONNECTION */
92421 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
92422 RECEIVE_PACKET_FIELD_ERROR(tag);
92423 }
92424 }
92425
92426 if (NULL == old) {
92427 old = fc_malloc(sizeof(*old));
92428 *old = *real_packet;
92429 genhash_insert(*hash, old, old);
92430 } else {
92431 *old = *real_packet;
92432 }
92433
92434#endif /* FREECIV_DELTA_PROTOCOL */
92435 RECEIVE_PACKET_END(real_packet);
92436}
92437
92438 static int send_packet_edit_player_create_100(struct connection *pc, const struct packet_edit_player_create *packet)
92439{
92440 const struct packet_edit_player_create *real_packet = packet;
92441#ifdef FREECIV_DELTA_PROTOCOL
92442 packet_edit_player_create_100_fields fields;
92443 struct packet_edit_player_create *old;
92444 bool differ;
92445 struct genhash **hash = pc->phs.sent + PACKET_EDIT_PLAYER_CREATE;
92446#endif /* FREECIV_DELTA_PROTOCOL */
92447 SEND_PACKET_START(PACKET_EDIT_PLAYER_CREATE);
92448#ifdef FREECIV_JSON_CONNECTION
92449 struct plocation field_addr;
92450 {
92451 struct plocation *field_addr_tmp = plocation_field_new(NULL);
92452 field_addr = *field_addr_tmp;
92453 FC_FREE(field_addr_tmp);
92454 }
92455#endif /* FREECIV_JSON_CONNECTION */
92456
92457 log_packet_detailed("packet_edit_player_create_100: sending info about ()");
92458
92459#ifdef FREECIV_DELTA_PROTOCOL
92460 if (NULL == *hash) {
92461 *hash = genhash_new_full(hash_packet_edit_player_create_100, cmp_packet_edit_player_create_100,
92462 NULL, NULL, NULL, free);
92463 }
92464 BV_CLR_ALL(fields);
92465
92466 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
92467 old = fc_malloc(sizeof(*old));
92468 *old = *real_packet;
92469 genhash_insert(*hash, old, old);
92470 memset(old, 0, sizeof(*old));
92471 }
92472 differ = (old->tag != real_packet->tag);
92473 if (differ) {
92474 BV_SET(fields, 0);
92475 }
92476
92477
92478#ifdef FREECIV_JSON_CONNECTION
92479 field_addr.name = "fields";
92480#endif /* FREECIV_JSON_CONNECTION */
92481 DIO_BV_PUT(&dout, &field_addr, fields);
92482
92483 if (BV_ISSET(fields, 0)) {
92484 log_packet_detailed(" field 'tag' has changed");
92485 #ifdef FREECIV_JSON_CONNECTION
92486 field_addr.name = "tag";
92487#endif /* FREECIV_JSON_CONNECTION */
92488 DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
92489 }
92490
92491 *old = *real_packet;
92492#endif /* FREECIV_DELTA_PROTOCOL */
92493#ifndef FREECIV_DELTA_PROTOCOL
92494#ifdef FREECIV_JSON_CONNECTION
92495 field_addr.name = "tag";
92496#endif /* FREECIV_JSON_CONNECTION */
92497 DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
92498
92499#endif
92500 SEND_PACKET_END(PACKET_EDIT_PLAYER_CREATE);
92501}
92502
92503 int send_packet_edit_player_create(struct connection *pc, const struct packet_edit_player_create *packet)
92504{
92505 if (!pc->used) {
92506 log_error("WARNING: trying to send data to the closed connection %s",
92507 conn_description(pc));
92508 return -1;
92509 }
92510 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_PLAYER_CREATE].packet != NULL, -1,
92511 "Handler for PACKET_EDIT_PLAYER_CREATE not installed");
92512 return pc->phs.handlers->send[PACKET_EDIT_PLAYER_CREATE].packet(pc, packet);
92513}
92514
92515 int dsend_packet_edit_player_create(struct connection *pc, int tag)
92516{
92517 struct packet_edit_player_create packet, *real_packet = &packet;
92518
92519 real_packet->tag = tag;
92520
92521 return send_packet_edit_player_create(pc, real_packet);
92522}
92523
92524#ifdef FREECIV_DELTA_PROTOCOL
92525#define hash_packet_edit_player_remove_100 hash_const
92526
92527#define cmp_packet_edit_player_remove_100 cmp_const
92528
92529 BV_DEFINE(packet_edit_player_remove_100_fields, 1);
92530#endif /* FREECIV_DELTA_PROTOCOL */
92531
92532 static struct packet_edit_player_remove *receive_packet_edit_player_remove_100(struct connection *pc)
92533{
92534#ifdef FREECIV_DELTA_PROTOCOL
92535 packet_edit_player_remove_100_fields fields;
92536 struct packet_edit_player_remove *old;
92537 struct genhash **hash = pc->phs.received + PACKET_EDIT_PLAYER_REMOVE;
92538#endif /* FREECIV_DELTA_PROTOCOL */
92539 RECEIVE_PACKET_START(packet_edit_player_remove, real_packet);
92540#ifdef FREECIV_JSON_CONNECTION
92541 struct plocation field_addr;
92542 {
92543 struct plocation *field_addr_tmp = plocation_field_new(NULL);
92544 field_addr = *field_addr_tmp;
92545 FC_FREE(field_addr_tmp);
92546 }
92547#endif /* FREECIV_JSON_CONNECTION */
92548
92549#ifdef FREECIV_DELTA_PROTOCOL
92550#ifdef FREECIV_JSON_CONNECTION
92551 field_addr.name = "fields";
92552#endif /* FREECIV_JSON_CONNECTION */
92553 DIO_BV_GET(&din, &field_addr, fields);
92554
92555#else /* FREECIV_DELTA_PROTOCOL */
92556 #ifdef FREECIV_JSON_CONNECTION
92557 field_addr.name = "id";
92558 #endif /* FREECIV_JSON_CONNECTION */
92559 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
92560 RECEIVE_PACKET_FIELD_ERROR(id);
92561 }
92562
92563#endif
92564 log_packet_detailed("packet_edit_player_remove_100: got info about ()");
92565
92566#ifdef FREECIV_DELTA_PROTOCOL
92567 if (NULL == *hash) {
92568 *hash = genhash_new_full(hash_packet_edit_player_remove_100, cmp_packet_edit_player_remove_100,
92569 NULL, NULL, NULL, free);
92570 }
92571
92572 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
92573 *real_packet = *old;
92574 } else {
92575 log_packet_detailed(" no old info");
92576 memset(real_packet, 0, sizeof(*real_packet));
92577 }
92578
92579 if (BV_ISSET(fields, 0)) {
92580 log_packet_detailed(" got field 'id'");
92581 #ifdef FREECIV_JSON_CONNECTION
92582 field_addr.name = "id";
92583 #endif /* FREECIV_JSON_CONNECTION */
92584 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
92585 RECEIVE_PACKET_FIELD_ERROR(id);
92586 }
92587 }
92588
92589 if (NULL == old) {
92590 old = fc_malloc(sizeof(*old));
92591 *old = *real_packet;
92592 genhash_insert(*hash, old, old);
92593 } else {
92594 *old = *real_packet;
92595 }
92596
92597#endif /* FREECIV_DELTA_PROTOCOL */
92598 RECEIVE_PACKET_END(real_packet);
92599}
92600
92601 static int send_packet_edit_player_remove_100(struct connection *pc, const struct packet_edit_player_remove *packet)
92602{
92603 const struct packet_edit_player_remove *real_packet = packet;
92604#ifdef FREECIV_DELTA_PROTOCOL
92605 packet_edit_player_remove_100_fields fields;
92606 struct packet_edit_player_remove *old;
92607 bool differ;
92608 struct genhash **hash = pc->phs.sent + PACKET_EDIT_PLAYER_REMOVE;
92609#endif /* FREECIV_DELTA_PROTOCOL */
92610 SEND_PACKET_START(PACKET_EDIT_PLAYER_REMOVE);
92611#ifdef FREECIV_JSON_CONNECTION
92612 struct plocation field_addr;
92613 {
92614 struct plocation *field_addr_tmp = plocation_field_new(NULL);
92615 field_addr = *field_addr_tmp;
92616 FC_FREE(field_addr_tmp);
92617 }
92618#endif /* FREECIV_JSON_CONNECTION */
92619
92620 log_packet_detailed("packet_edit_player_remove_100: sending info about ()");
92621
92622#ifdef FREECIV_DELTA_PROTOCOL
92623 if (NULL == *hash) {
92624 *hash = genhash_new_full(hash_packet_edit_player_remove_100, cmp_packet_edit_player_remove_100,
92625 NULL, NULL, NULL, free);
92626 }
92627 BV_CLR_ALL(fields);
92628
92629 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
92630 old = fc_malloc(sizeof(*old));
92631 *old = *real_packet;
92632 genhash_insert(*hash, old, old);
92633 memset(old, 0, sizeof(*old));
92634 }
92635 differ = (old->id != real_packet->id);
92636 if (differ) {
92637 BV_SET(fields, 0);
92638 }
92639
92640
92641#ifdef FREECIV_JSON_CONNECTION
92642 field_addr.name = "fields";
92643#endif /* FREECIV_JSON_CONNECTION */
92644 DIO_BV_PUT(&dout, &field_addr, fields);
92645
92646 if (BV_ISSET(fields, 0)) {
92647 log_packet_detailed(" field 'id' has changed");
92648 #ifdef FREECIV_JSON_CONNECTION
92649 field_addr.name = "id";
92650#endif /* FREECIV_JSON_CONNECTION */
92651 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
92652 }
92653
92654 *old = *real_packet;
92655#endif /* FREECIV_DELTA_PROTOCOL */
92656#ifndef FREECIV_DELTA_PROTOCOL
92657#ifdef FREECIV_JSON_CONNECTION
92658 field_addr.name = "id";
92659#endif /* FREECIV_JSON_CONNECTION */
92660 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
92661
92662#endif
92663 SEND_PACKET_END(PACKET_EDIT_PLAYER_REMOVE);
92664}
92665
92666 int send_packet_edit_player_remove(struct connection *pc, const struct packet_edit_player_remove *packet)
92667{
92668 if (!pc->used) {
92669 log_error("WARNING: trying to send data to the closed connection %s",
92670 conn_description(pc));
92671 return -1;
92672 }
92673 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_PLAYER_REMOVE].packet != NULL, -1,
92674 "Handler for PACKET_EDIT_PLAYER_REMOVE not installed");
92675 return pc->phs.handlers->send[PACKET_EDIT_PLAYER_REMOVE].packet(pc, packet);
92676}
92677
92678 int dsend_packet_edit_player_remove(struct connection *pc, int id)
92679{
92680 struct packet_edit_player_remove packet, *real_packet = &packet;
92681
92682 real_packet->id = id;
92683
92684 return send_packet_edit_player_remove(pc, real_packet);
92685}
92686
92687#ifdef FREECIV_DELTA_PROTOCOL
92688static genhash_val_t hash_packet_edit_player_100(const void *vkey)
92689{
92690 const struct packet_edit_player *key = (const struct packet_edit_player *) vkey;
92691
92692 return key->id;
92693}
92694
92695static bool cmp_packet_edit_player_100(const void *vkey1, const void *vkey2)
92696{
92697 const struct packet_edit_player *key1 = (const struct packet_edit_player *) vkey1;
92698 const struct packet_edit_player *key2 = (const struct packet_edit_player *) vkey2;
92699
92700 return key1->id == key2->id;
92701}
92702 BV_DEFINE(packet_edit_player_100_fields, 24);
92703#endif /* FREECIV_DELTA_PROTOCOL */
92704
92705 static struct packet_edit_player *receive_packet_edit_player_100(struct connection *pc)
92706{
92707#ifdef FREECIV_DELTA_PROTOCOL
92708 packet_edit_player_100_fields fields;
92709 struct packet_edit_player *old;
92710 struct genhash **hash = pc->phs.received + PACKET_EDIT_PLAYER;
92711#endif /* FREECIV_DELTA_PROTOCOL */
92712 RECEIVE_PACKET_START(packet_edit_player, real_packet);
92713#ifdef FREECIV_JSON_CONNECTION
92714 struct plocation field_addr;
92715 {
92716 struct plocation *field_addr_tmp = plocation_field_new(NULL);
92717 field_addr = *field_addr_tmp;
92718 FC_FREE(field_addr_tmp);
92719 }
92720#endif /* FREECIV_JSON_CONNECTION */
92721
92722#ifdef FREECIV_DELTA_PROTOCOL
92723#ifdef FREECIV_JSON_CONNECTION
92724 field_addr.name = "fields";
92725#endif /* FREECIV_JSON_CONNECTION */
92726 DIO_BV_GET(&din, &field_addr, fields);
92727 #ifdef FREECIV_JSON_CONNECTION
92728 field_addr.name = "id";
92729 #endif /* FREECIV_JSON_CONNECTION */
92730 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
92731 RECEIVE_PACKET_FIELD_ERROR(id);
92732 }
92733
92734#else /* FREECIV_DELTA_PROTOCOL */
92735 #ifdef FREECIV_JSON_CONNECTION
92736 field_addr.name = "id";
92737 #endif /* FREECIV_JSON_CONNECTION */
92738 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
92739 RECEIVE_PACKET_FIELD_ERROR(id);
92740 }
92741 #ifdef FREECIV_JSON_CONNECTION
92742 field_addr.name = "name";
92743 #endif /* FREECIV_JSON_CONNECTION */
92744 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
92745 RECEIVE_PACKET_FIELD_ERROR(name);
92746 }
92747 #ifdef FREECIV_JSON_CONNECTION
92748 field_addr.name = "username";
92749 #endif /* FREECIV_JSON_CONNECTION */
92750 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
92751 RECEIVE_PACKET_FIELD_ERROR(username);
92752 }
92753 #ifdef FREECIV_JSON_CONNECTION
92754 field_addr.name = "ranked_username";
92755 #endif /* FREECIV_JSON_CONNECTION */
92756 if (!DIO_GET(string, &din, &field_addr, real_packet->ranked_username, sizeof(real_packet->ranked_username))) {
92757 RECEIVE_PACKET_FIELD_ERROR(ranked_username);
92758 }
92759 #ifdef FREECIV_JSON_CONNECTION
92760 field_addr.name = "user_turns";
92761 #endif /* FREECIV_JSON_CONNECTION */
92762 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->user_turns)) {
92763 RECEIVE_PACKET_FIELD_ERROR(user_turns);
92764 }
92765 #ifdef FREECIV_JSON_CONNECTION
92766 field_addr.name = "is_male";
92767 #endif /* FREECIV_JSON_CONNECTION */
92768 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_male)) {
92769 RECEIVE_PACKET_FIELD_ERROR(is_male);
92770 }
92771 #ifdef FREECIV_JSON_CONNECTION
92772 field_addr.name = "government";
92773 #endif /* FREECIV_JSON_CONNECTION */
92774 {
92775 int readin;
92776
92777 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
92778 RECEIVE_PACKET_FIELD_ERROR(government);
92779 }
92780 real_packet->government = readin;
92781 }
92782 #ifdef FREECIV_JSON_CONNECTION
92783 field_addr.name = "target_government";
92784 #endif /* FREECIV_JSON_CONNECTION */
92785 {
92786 int readin;
92787
92788 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
92789 RECEIVE_PACKET_FIELD_ERROR(target_government);
92790 }
92791 real_packet->target_government = readin;
92792 }
92793 #ifdef FREECIV_JSON_CONNECTION
92794 field_addr.name = "nation";
92795 #endif /* FREECIV_JSON_CONNECTION */
92796 {
92797 int readin;
92798
92799 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
92800 RECEIVE_PACKET_FIELD_ERROR(nation);
92801 }
92802 real_packet->nation = readin;
92803 }
92804 #ifdef FREECIV_JSON_CONNECTION
92805 field_addr.name = "team";
92806 #endif /* FREECIV_JSON_CONNECTION */
92807 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->team)) {
92808 RECEIVE_PACKET_FIELD_ERROR(team);
92809 }
92810 #ifdef FREECIV_JSON_CONNECTION
92811 field_addr.name = "phase_done";
92812 #endif /* FREECIV_JSON_CONNECTION */
92813 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->phase_done)) {
92814 RECEIVE_PACKET_FIELD_ERROR(phase_done);
92815 }
92816 #ifdef FREECIV_JSON_CONNECTION
92817 field_addr.name = "nturns_idle";
92818 #endif /* FREECIV_JSON_CONNECTION */
92819 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nturns_idle)) {
92820 RECEIVE_PACKET_FIELD_ERROR(nturns_idle);
92821 }
92822 #ifdef FREECIV_JSON_CONNECTION
92823 field_addr.name = "is_alive";
92824 #endif /* FREECIV_JSON_CONNECTION */
92825 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_alive)) {
92826 RECEIVE_PACKET_FIELD_ERROR(is_alive);
92827 }
92828 #ifdef FREECIV_JSON_CONNECTION
92829 field_addr.name = "revolution_finishes";
92830 #endif /* FREECIV_JSON_CONNECTION */
92831 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->revolution_finishes)) {
92832 RECEIVE_PACKET_FIELD_ERROR(revolution_finishes);
92833 }
92834 #ifdef FREECIV_JSON_CONNECTION
92835 field_addr.name = "embassy";
92836 #endif /* FREECIV_JSON_CONNECTION */
92837 if (!DIO_BV_GET(&din, &field_addr, real_packet->embassy)) {
92838 RECEIVE_PACKET_FIELD_ERROR(embassy);
92839 }
92840 #ifdef FREECIV_JSON_CONNECTION
92841 field_addr.name = "gold";
92842 #endif /* FREECIV_JSON_CONNECTION */
92843 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
92844 RECEIVE_PACKET_FIELD_ERROR(gold);
92845 }
92846 #ifdef FREECIV_JSON_CONNECTION
92847 field_addr.name = "tax";
92848 #endif /* FREECIV_JSON_CONNECTION */
92849 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
92850 RECEIVE_PACKET_FIELD_ERROR(tax);
92851 }
92852 #ifdef FREECIV_JSON_CONNECTION
92853 field_addr.name = "science";
92854 #endif /* FREECIV_JSON_CONNECTION */
92855 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
92856 RECEIVE_PACKET_FIELD_ERROR(science);
92857 }
92858 #ifdef FREECIV_JSON_CONNECTION
92859 field_addr.name = "luxury";
92860 #endif /* FREECIV_JSON_CONNECTION */
92861 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
92862 RECEIVE_PACKET_FIELD_ERROR(luxury);
92863 }
92864 #ifdef FREECIV_JSON_CONNECTION
92865 field_addr.name = "future_tech";
92866 #endif /* FREECIV_JSON_CONNECTION */
92867 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->future_tech)) {
92868 RECEIVE_PACKET_FIELD_ERROR(future_tech);
92869 }
92870 #ifdef FREECIV_JSON_CONNECTION
92871 field_addr.name = "researching";
92872 #endif /* FREECIV_JSON_CONNECTION */
92873 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->researching)) {
92874 RECEIVE_PACKET_FIELD_ERROR(researching);
92875 }
92876 #ifdef FREECIV_JSON_CONNECTION
92877 field_addr.name = "bulbs_researched";
92878 #endif /* FREECIV_JSON_CONNECTION */
92879 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->bulbs_researched)) {
92880 RECEIVE_PACKET_FIELD_ERROR(bulbs_researched);
92881 }
92882 #ifdef FREECIV_JSON_CONNECTION
92883 field_addr.name = "inventions";
92884 #endif /* FREECIV_JSON_CONNECTION */
92885
92886 {
92887 int i;
92888
92889 for (i = 0; i < A_LAST + 1; i++) {
92890 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->inventions[i])) {
92891 RECEIVE_PACKET_FIELD_ERROR(inventions);
92892 }
92893 }
92894 }
92895 #ifdef FREECIV_JSON_CONNECTION
92896 field_addr.name = "ai";
92897 #endif /* FREECIV_JSON_CONNECTION */
92898 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->ai)) {
92899 RECEIVE_PACKET_FIELD_ERROR(ai);
92900 }
92901 #ifdef FREECIV_JSON_CONNECTION
92902 field_addr.name = "scenario_reserved";
92903 #endif /* FREECIV_JSON_CONNECTION */
92904 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->scenario_reserved)) {
92905 RECEIVE_PACKET_FIELD_ERROR(scenario_reserved);
92906 }
92907
92908#endif
92909 log_packet_detailed("packet_edit_player_100: got info about (%d)",
92910 real_packet->id);
92911
92912#ifdef FREECIV_DELTA_PROTOCOL
92913 if (NULL == *hash) {
92914 *hash = genhash_new_full(hash_packet_edit_player_100, cmp_packet_edit_player_100,
92915 NULL, NULL, NULL, free);
92916 }
92917
92918 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
92919 *real_packet = *old;
92920 } else {
92921 int id = real_packet->id;
92922
92923 log_packet_detailed(" no old info");
92924 memset(real_packet, 0, sizeof(*real_packet));
92925
92926 real_packet->id = id;
92927 }
92928
92929 if (BV_ISSET(fields, 0)) {
92930 log_packet_detailed(" got field 'name'");
92931 #ifdef FREECIV_JSON_CONNECTION
92932 field_addr.name = "name";
92933 #endif /* FREECIV_JSON_CONNECTION */
92934 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
92935 RECEIVE_PACKET_FIELD_ERROR(name);
92936 }
92937 }
92938 if (BV_ISSET(fields, 1)) {
92939 log_packet_detailed(" got field 'username'");
92940 #ifdef FREECIV_JSON_CONNECTION
92941 field_addr.name = "username";
92942 #endif /* FREECIV_JSON_CONNECTION */
92943 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
92944 RECEIVE_PACKET_FIELD_ERROR(username);
92945 }
92946 }
92947 if (BV_ISSET(fields, 2)) {
92948 log_packet_detailed(" got field 'ranked_username'");
92949 #ifdef FREECIV_JSON_CONNECTION
92950 field_addr.name = "ranked_username";
92951 #endif /* FREECIV_JSON_CONNECTION */
92952 if (!DIO_GET(string, &din, &field_addr, real_packet->ranked_username, sizeof(real_packet->ranked_username))) {
92953 RECEIVE_PACKET_FIELD_ERROR(ranked_username);
92954 }
92955 }
92956 if (BV_ISSET(fields, 3)) {
92957 log_packet_detailed(" got field 'user_turns'");
92958 #ifdef FREECIV_JSON_CONNECTION
92959 field_addr.name = "user_turns";
92960 #endif /* FREECIV_JSON_CONNECTION */
92961 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->user_turns)) {
92962 RECEIVE_PACKET_FIELD_ERROR(user_turns);
92963 }
92964 }
92965 real_packet->is_male = BV_ISSET(fields, 4);
92966 if (BV_ISSET(fields, 5)) {
92967 log_packet_detailed(" got field 'government'");
92968 #ifdef FREECIV_JSON_CONNECTION
92969 field_addr.name = "government";
92970 #endif /* FREECIV_JSON_CONNECTION */
92971 {
92972 int readin;
92973
92974 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
92975 RECEIVE_PACKET_FIELD_ERROR(government);
92976 }
92977 real_packet->government = readin;
92978 }
92979 }
92980 if (BV_ISSET(fields, 6)) {
92981 log_packet_detailed(" got field 'target_government'");
92982 #ifdef FREECIV_JSON_CONNECTION
92983 field_addr.name = "target_government";
92984 #endif /* FREECIV_JSON_CONNECTION */
92985 {
92986 int readin;
92987
92988 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
92989 RECEIVE_PACKET_FIELD_ERROR(target_government);
92990 }
92991 real_packet->target_government = readin;
92992 }
92993 }
92994 if (BV_ISSET(fields, 7)) {
92995 log_packet_detailed(" got field 'nation'");
92996 #ifdef FREECIV_JSON_CONNECTION
92997 field_addr.name = "nation";
92998 #endif /* FREECIV_JSON_CONNECTION */
92999 {
93000 int readin;
93001
93002 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
93003 RECEIVE_PACKET_FIELD_ERROR(nation);
93004 }
93005 real_packet->nation = readin;
93006 }
93007 }
93008 if (BV_ISSET(fields, 8)) {
93009 log_packet_detailed(" got field 'team'");
93010 #ifdef FREECIV_JSON_CONNECTION
93011 field_addr.name = "team";
93012 #endif /* FREECIV_JSON_CONNECTION */
93013 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->team)) {
93014 RECEIVE_PACKET_FIELD_ERROR(team);
93015 }
93016 }
93017 real_packet->phase_done = BV_ISSET(fields, 9);
93018 if (BV_ISSET(fields, 10)) {
93019 log_packet_detailed(" got field 'nturns_idle'");
93020 #ifdef FREECIV_JSON_CONNECTION
93021 field_addr.name = "nturns_idle";
93022 #endif /* FREECIV_JSON_CONNECTION */
93023 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nturns_idle)) {
93024 RECEIVE_PACKET_FIELD_ERROR(nturns_idle);
93025 }
93026 }
93027 real_packet->is_alive = BV_ISSET(fields, 11);
93028 if (BV_ISSET(fields, 12)) {
93029 log_packet_detailed(" got field 'revolution_finishes'");
93030 #ifdef FREECIV_JSON_CONNECTION
93031 field_addr.name = "revolution_finishes";
93032 #endif /* FREECIV_JSON_CONNECTION */
93033 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->revolution_finishes)) {
93034 RECEIVE_PACKET_FIELD_ERROR(revolution_finishes);
93035 }
93036 }
93037 if (BV_ISSET(fields, 13)) {
93038 log_packet_detailed(" got field 'embassy'");
93039 #ifdef FREECIV_JSON_CONNECTION
93040 field_addr.name = "embassy";
93041 #endif /* FREECIV_JSON_CONNECTION */
93042 if (!DIO_BV_GET(&din, &field_addr, real_packet->embassy)) {
93043 RECEIVE_PACKET_FIELD_ERROR(embassy);
93044 }
93045 }
93046 if (BV_ISSET(fields, 14)) {
93047 log_packet_detailed(" got field 'gold'");
93048 #ifdef FREECIV_JSON_CONNECTION
93049 field_addr.name = "gold";
93050 #endif /* FREECIV_JSON_CONNECTION */
93051 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
93052 RECEIVE_PACKET_FIELD_ERROR(gold);
93053 }
93054 }
93055 if (BV_ISSET(fields, 15)) {
93056 log_packet_detailed(" got field 'tax'");
93057 #ifdef FREECIV_JSON_CONNECTION
93058 field_addr.name = "tax";
93059 #endif /* FREECIV_JSON_CONNECTION */
93060 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
93061 RECEIVE_PACKET_FIELD_ERROR(tax);
93062 }
93063 }
93064 if (BV_ISSET(fields, 16)) {
93065 log_packet_detailed(" got field 'science'");
93066 #ifdef FREECIV_JSON_CONNECTION
93067 field_addr.name = "science";
93068 #endif /* FREECIV_JSON_CONNECTION */
93069 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
93070 RECEIVE_PACKET_FIELD_ERROR(science);
93071 }
93072 }
93073 if (BV_ISSET(fields, 17)) {
93074 log_packet_detailed(" got field 'luxury'");
93075 #ifdef FREECIV_JSON_CONNECTION
93076 field_addr.name = "luxury";
93077 #endif /* FREECIV_JSON_CONNECTION */
93078 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
93079 RECEIVE_PACKET_FIELD_ERROR(luxury);
93080 }
93081 }
93082 if (BV_ISSET(fields, 18)) {
93083 log_packet_detailed(" got field 'future_tech'");
93084 #ifdef FREECIV_JSON_CONNECTION
93085 field_addr.name = "future_tech";
93086 #endif /* FREECIV_JSON_CONNECTION */
93087 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->future_tech)) {
93088 RECEIVE_PACKET_FIELD_ERROR(future_tech);
93089 }
93090 }
93091 if (BV_ISSET(fields, 19)) {
93092 log_packet_detailed(" got field 'researching'");
93093 #ifdef FREECIV_JSON_CONNECTION
93094 field_addr.name = "researching";
93095 #endif /* FREECIV_JSON_CONNECTION */
93096 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->researching)) {
93097 RECEIVE_PACKET_FIELD_ERROR(researching);
93098 }
93099 }
93100 if (BV_ISSET(fields, 20)) {
93101 log_packet_detailed(" got field 'bulbs_researched'");
93102 #ifdef FREECIV_JSON_CONNECTION
93103 field_addr.name = "bulbs_researched";
93104 #endif /* FREECIV_JSON_CONNECTION */
93105 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->bulbs_researched)) {
93106 RECEIVE_PACKET_FIELD_ERROR(bulbs_researched);
93107 }
93108 }
93109 if (BV_ISSET(fields, 21)) {
93110 log_packet_detailed(" got field 'inventions'");
93111 #ifdef FREECIV_JSON_CONNECTION
93112 field_addr.name = "inventions";
93113 #endif /* FREECIV_JSON_CONNECTION */
93114
93115 {
93116 #ifdef FREECIV_JSON_CONNECTION
93117 int count;
93118
93119 /* Enter array. */
93120 field_addr.sub_location = plocation_elem_new(0);
93121
93122 for (count = 0;; count++) {
93123 int i;
93124
93125 field_addr.sub_location->number = count;
93126
93127 /* Enter diff array element (start at the index address). */
93128 field_addr.sub_location->sub_location = plocation_elem_new(0);
93129 #else /* FREECIV_JSON_CONNECTION */
93130 while (TRUE) {
93131 int i;
93132 #endif /* FREECIV_JSON_CONNECTION */
93133
93134 if (!DIO_GET(uint8, &din, &field_addr, &i)) {
93135 RECEIVE_PACKET_FIELD_ERROR(inventions);
93136 }
93137 if (i == 255) {
93138 #ifdef FREECIV_JSON_CONNECTION
93139 /* Exit diff array element. */
93140 free(field_addr.sub_location->sub_location);
93141 field_addr.sub_location->sub_location = NULL;
93142
93143 /* Exit diff array. */
93144 free(field_addr.sub_location);
93145 field_addr.sub_location = NULL;
93146 #endif /* FREECIV_JSON_CONNECTION */
93147
93148 break;
93149 }
93150 if (i > A_LAST + 1) {
93151 RECEIVE_PACKET_FIELD_ERROR(inventions,
93152 ": unexpected value %d "
93153 "(> A_LAST + 1) in array diff",
93154 i);
93155 } else {
93156 #ifdef FREECIV_JSON_CONNECTION
93157 /* Content address. */
93158 field_addr.sub_location->sub_location->number = 1;
93159 #endif /* FREECIV_JSON_CONNECTION */
93160 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->inventions[i])) {
93161 RECEIVE_PACKET_FIELD_ERROR(inventions);
93162 }
93163 }
93164
93165 #ifdef FREECIV_JSON_CONNECTION
93166 /* Exit diff array element. */
93167 free(field_addr.sub_location->sub_location);
93168 field_addr.sub_location->sub_location = NULL;
93169 #endif /* FREECIV_JSON_CONNECTION */
93170 }
93171
93172 #ifdef FREECIV_JSON_CONNECTION
93173 /* Exit array. */
93174 free(field_addr.sub_location);
93175 field_addr.sub_location = NULL;
93176 #endif /* FREECIV_JSON_CONNECTION */
93177 }
93178 }
93179 real_packet->ai = BV_ISSET(fields, 22);
93180 real_packet->scenario_reserved = BV_ISSET(fields, 23);
93181
93182 if (NULL == old) {
93183 old = fc_malloc(sizeof(*old));
93184 *old = *real_packet;
93185 genhash_insert(*hash, old, old);
93186 } else {
93187 *old = *real_packet;
93188 }
93189
93190#endif /* FREECIV_DELTA_PROTOCOL */
93191 RECEIVE_PACKET_END(real_packet);
93192}
93193
93194 static int send_packet_edit_player_100(struct connection *pc, const struct packet_edit_player *packet)
93195{
93196 const struct packet_edit_player *real_packet = packet;
93197#ifdef FREECIV_DELTA_PROTOCOL
93198 packet_edit_player_100_fields fields;
93199 struct packet_edit_player *old;
93200 bool differ;
93201 struct genhash **hash = pc->phs.sent + PACKET_EDIT_PLAYER;
93202#endif /* FREECIV_DELTA_PROTOCOL */
93203 SEND_PACKET_START(PACKET_EDIT_PLAYER);
93204#ifdef FREECIV_JSON_CONNECTION
93205 struct plocation field_addr;
93206 {
93207 struct plocation *field_addr_tmp = plocation_field_new(NULL);
93208 field_addr = *field_addr_tmp;
93209 FC_FREE(field_addr_tmp);
93210 }
93211#endif /* FREECIV_JSON_CONNECTION */
93212
93213 log_packet_detailed("packet_edit_player_100: sending info about (%d)",
93214 real_packet->id);
93215
93216#ifdef FREECIV_DELTA_PROTOCOL
93217 if (NULL == *hash) {
93218 *hash = genhash_new_full(hash_packet_edit_player_100, cmp_packet_edit_player_100,
93219 NULL, NULL, NULL, free);
93220 }
93221 BV_CLR_ALL(fields);
93222
93223 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
93224 old = fc_malloc(sizeof(*old));
93225 *old = *real_packet;
93226 genhash_insert(*hash, old, old);
93227 memset(old, 0, sizeof(*old));
93228 }
93229 differ = (strcmp(old->name, real_packet->name) != 0);
93230 if (differ) {
93231 BV_SET(fields, 0);
93232 }
93233
93234 differ = (strcmp(old->username, real_packet->username) != 0);
93235 if (differ) {
93236 BV_SET(fields, 1);
93237 }
93238
93239 differ = (strcmp(old->ranked_username, real_packet->ranked_username) != 0);
93240 if (differ) {
93241 BV_SET(fields, 2);
93242 }
93243
93244 differ = (old->user_turns != real_packet->user_turns);
93245 if (differ) {
93246 BV_SET(fields, 3);
93247 }
93248
93249 if (packet->is_male) {
93250 BV_SET(fields, 4);
93251 }
93252
93253 differ = (old->government != real_packet->government);
93254 if (differ) {
93255 BV_SET(fields, 5);
93256 }
93257
93258 differ = (old->target_government != real_packet->target_government);
93259 if (differ) {
93260 BV_SET(fields, 6);
93261 }
93262
93263 differ = (old->nation != real_packet->nation);
93264 if (differ) {
93265 BV_SET(fields, 7);
93266 }
93267
93268 differ = (old->team != real_packet->team);
93269 if (differ) {
93270 BV_SET(fields, 8);
93271 }
93272
93273 if (packet->phase_done) {
93274 BV_SET(fields, 9);
93275 }
93276
93277 differ = (old->nturns_idle != real_packet->nturns_idle);
93278 if (differ) {
93279 BV_SET(fields, 10);
93280 }
93281
93282 if (packet->is_alive) {
93283 BV_SET(fields, 11);
93284 }
93285
93286 differ = (old->revolution_finishes != real_packet->revolution_finishes);
93287 if (differ) {
93288 BV_SET(fields, 12);
93289 }
93290
93291 differ = !BV_ARE_EQUAL(old->embassy, real_packet->embassy);
93292 if (differ) {
93293 BV_SET(fields, 13);
93294 }
93295
93296 differ = (old->gold != real_packet->gold);
93297 if (differ) {
93298 BV_SET(fields, 14);
93299 }
93300
93301 differ = (old->tax != real_packet->tax);
93302 if (differ) {
93303 BV_SET(fields, 15);
93304 }
93305
93306 differ = (old->science != real_packet->science);
93307 if (differ) {
93308 BV_SET(fields, 16);
93309 }
93310
93311 differ = (old->luxury != real_packet->luxury);
93312 if (differ) {
93313 BV_SET(fields, 17);
93314 }
93315
93316 differ = (old->future_tech != real_packet->future_tech);
93317 if (differ) {
93318 BV_SET(fields, 18);
93319 }
93320
93321 differ = (old->researching != real_packet->researching);
93322 if (differ) {
93323 BV_SET(fields, 19);
93324 }
93325
93326 differ = (old->bulbs_researched != real_packet->bulbs_researched);
93327 if (differ) {
93328 BV_SET(fields, 20);
93329 }
93330
93331
93332 {
93333 differ = FALSE;
93334 {
93335 int i;
93336
93337 for (i = 0; i < A_LAST + 1; i++) {
93338 if (old->inventions[i] != real_packet->inventions[i]) {
93339 differ = TRUE;
93340 break;
93341 }
93342 }
93343 }
93344 }
93345 if (differ) {
93346 BV_SET(fields, 21);
93347 }
93348
93349 if (packet->ai) {
93350 BV_SET(fields, 22);
93351 }
93352
93353 if (packet->scenario_reserved) {
93354 BV_SET(fields, 23);
93355 }
93356
93357
93358#ifdef FREECIV_JSON_CONNECTION
93359 field_addr.name = "fields";
93360#endif /* FREECIV_JSON_CONNECTION */
93361 DIO_BV_PUT(&dout, &field_addr, fields);
93362#ifdef FREECIV_JSON_CONNECTION
93363 field_addr.name = "id";
93364#endif /* FREECIV_JSON_CONNECTION */
93365 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
93366
93367 if (BV_ISSET(fields, 0)) {
93368 log_packet_detailed(" field 'name' has changed");
93369 #ifdef FREECIV_JSON_CONNECTION
93370 field_addr.name = "name";
93371#endif /* FREECIV_JSON_CONNECTION */
93372 DIO_PUT(string, &dout, &field_addr, real_packet->name);
93373 }
93374 if (BV_ISSET(fields, 1)) {
93375 log_packet_detailed(" field 'username' has changed");
93376 #ifdef FREECIV_JSON_CONNECTION
93377 field_addr.name = "username";
93378#endif /* FREECIV_JSON_CONNECTION */
93379 DIO_PUT(string, &dout, &field_addr, real_packet->username);
93380 }
93381 if (BV_ISSET(fields, 2)) {
93382 log_packet_detailed(" field 'ranked_username' has changed");
93383 #ifdef FREECIV_JSON_CONNECTION
93384 field_addr.name = "ranked_username";
93385#endif /* FREECIV_JSON_CONNECTION */
93386 DIO_PUT(string, &dout, &field_addr, real_packet->ranked_username);
93387 }
93388 if (BV_ISSET(fields, 3)) {
93389 log_packet_detailed(" field 'user_turns' has changed");
93390 #ifdef FREECIV_JSON_CONNECTION
93391 field_addr.name = "user_turns";
93392#endif /* FREECIV_JSON_CONNECTION */
93393 DIO_PUT(sint16, &dout, &field_addr, real_packet->user_turns);
93394 }
93395 /* field 4 is folded into the header */
93396 if (BV_ISSET(fields, 5)) {
93397 log_packet_detailed(" field 'government' has changed");
93398 #ifdef FREECIV_JSON_CONNECTION
93399 field_addr.name = "government";
93400#endif /* FREECIV_JSON_CONNECTION */
93401 DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
93402 }
93403 if (BV_ISSET(fields, 6)) {
93404 log_packet_detailed(" field 'target_government' has changed");
93405 #ifdef FREECIV_JSON_CONNECTION
93406 field_addr.name = "target_government";
93407#endif /* FREECIV_JSON_CONNECTION */
93408 DIO_PUT(sint8, &dout, &field_addr, real_packet->target_government);
93409 }
93410 if (BV_ISSET(fields, 7)) {
93411 log_packet_detailed(" field 'nation' has changed");
93412 #ifdef FREECIV_JSON_CONNECTION
93413 field_addr.name = "nation";
93414#endif /* FREECIV_JSON_CONNECTION */
93415 DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
93416 }
93417 if (BV_ISSET(fields, 8)) {
93418 log_packet_detailed(" field 'team' has changed");
93419 #ifdef FREECIV_JSON_CONNECTION
93420 field_addr.name = "team";
93421#endif /* FREECIV_JSON_CONNECTION */
93422 DIO_PUT(uint16, &dout, &field_addr, real_packet->team);
93423 }
93424 /* field 9 is folded into the header */
93425 if (BV_ISSET(fields, 10)) {
93426 log_packet_detailed(" field 'nturns_idle' has changed");
93427 #ifdef FREECIV_JSON_CONNECTION
93428 field_addr.name = "nturns_idle";
93429#endif /* FREECIV_JSON_CONNECTION */
93430 DIO_PUT(sint16, &dout, &field_addr, real_packet->nturns_idle);
93431 }
93432 /* field 11 is folded into the header */
93433 if (BV_ISSET(fields, 12)) {
93434 log_packet_detailed(" field 'revolution_finishes' has changed");
93435 #ifdef FREECIV_JSON_CONNECTION
93436 field_addr.name = "revolution_finishes";
93437#endif /* FREECIV_JSON_CONNECTION */
93438 DIO_PUT(sint16, &dout, &field_addr, real_packet->revolution_finishes);
93439 }
93440 if (BV_ISSET(fields, 13)) {
93441 log_packet_detailed(" field 'embassy' has changed");
93442 #ifdef FREECIV_JSON_CONNECTION
93443 field_addr.name = "embassy";
93444#endif /* FREECIV_JSON_CONNECTION */
93445 DIO_BV_PUT(&dout, &field_addr, packet->embassy);
93446 }
93447 if (BV_ISSET(fields, 14)) {
93448 log_packet_detailed(" field 'gold' has changed");
93449 #ifdef FREECIV_JSON_CONNECTION
93450 field_addr.name = "gold";
93451#endif /* FREECIV_JSON_CONNECTION */
93452 DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
93453 }
93454 if (BV_ISSET(fields, 15)) {
93455 log_packet_detailed(" field 'tax' has changed");
93456 #ifdef FREECIV_JSON_CONNECTION
93457 field_addr.name = "tax";
93458#endif /* FREECIV_JSON_CONNECTION */
93459 DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
93460 }
93461 if (BV_ISSET(fields, 16)) {
93462 log_packet_detailed(" field 'science' has changed");
93463 #ifdef FREECIV_JSON_CONNECTION
93464 field_addr.name = "science";
93465#endif /* FREECIV_JSON_CONNECTION */
93466 DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
93467 }
93468 if (BV_ISSET(fields, 17)) {
93469 log_packet_detailed(" field 'luxury' has changed");
93470 #ifdef FREECIV_JSON_CONNECTION
93471 field_addr.name = "luxury";
93472#endif /* FREECIV_JSON_CONNECTION */
93473 DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
93474 }
93475 if (BV_ISSET(fields, 18)) {
93476 log_packet_detailed(" field 'future_tech' has changed");
93477 #ifdef FREECIV_JSON_CONNECTION
93478 field_addr.name = "future_tech";
93479#endif /* FREECIV_JSON_CONNECTION */
93480 DIO_PUT(uint16, &dout, &field_addr, real_packet->future_tech);
93481 }
93482 if (BV_ISSET(fields, 19)) {
93483 log_packet_detailed(" field 'researching' has changed");
93484 #ifdef FREECIV_JSON_CONNECTION
93485 field_addr.name = "researching";
93486#endif /* FREECIV_JSON_CONNECTION */
93487 DIO_PUT(uint8, &dout, &field_addr, real_packet->researching);
93488 }
93489 if (BV_ISSET(fields, 20)) {
93490 log_packet_detailed(" field 'bulbs_researched' has changed");
93491 #ifdef FREECIV_JSON_CONNECTION
93492 field_addr.name = "bulbs_researched";
93493#endif /* FREECIV_JSON_CONNECTION */
93494 DIO_PUT(uint32, &dout, &field_addr, real_packet->bulbs_researched);
93495 }
93496 if (BV_ISSET(fields, 21)) {
93497 log_packet_detailed(" field 'inventions' has changed");
93498 #ifdef FREECIV_JSON_CONNECTION
93499 field_addr.name = "inventions";
93500#endif /* FREECIV_JSON_CONNECTION */
93501
93502 {
93503 int i;
93504
93505#ifdef FREECIV_JSON_CONNECTION
93506 int count = 0;
93507
93508 for (i = 0; i < A_LAST + 1; i++) {
93509 if (old->inventions[i] != real_packet->inventions[i]) {
93510 count++;
93511 }
93512 }
93513 /* Create the array. */
93514 DIO_PUT(farray, &dout, &field_addr, count + 1);
93515
93516 /* Enter array. */
93517 field_addr.sub_location = plocation_elem_new(0);
93518
93519 count = 0;
93520#endif /* FREECIV_JSON_CONNECTION */
93521
93522 fc_assert(A_LAST + 1 < 255);
93523
93524 for (i = 0; i < A_LAST + 1; i++) {
93525 if (old->inventions[i] != real_packet->inventions[i]) {
93526#ifdef FREECIV_JSON_CONNECTION
93527 /* Next diff array element. */
93528 field_addr.sub_location->number = count - 1;
93529
93530 /* Create the diff array element. */
93531 DIO_PUT(farray, &dout, &field_addr, 2);
93532
93533 /* Enter diff array element (start at the index address). */
93534 field_addr.sub_location->sub_location = plocation_elem_new(0);
93535#endif /* FREECIV_JSON_CONNECTION */
93536 DIO_PUT(uint8, &dout, &field_addr, i);
93537
93538#ifdef FREECIV_JSON_CONNECTION
93539 /* Content address. */
93540 field_addr.sub_location->sub_location->number = 1;
93541#endif /* FREECIV_JSON_CONNECTION */
93542 DIO_PUT(bool8, &dout, &field_addr, real_packet->inventions[i]);
93543
93544#ifdef FREECIV_JSON_CONNECTION
93545 /* Exit diff array element. */
93546 free(field_addr.sub_location->sub_location);
93547 field_addr.sub_location->sub_location = NULL;
93548#endif /* FREECIV_JSON_CONNECTION */
93549 }
93550 }
93551#ifdef FREECIV_JSON_CONNECTION
93552 field_addr.sub_location->number = count - 1;
93553
93554 /* Create the diff array element. */
93555 DIO_PUT(farray, &dout, &field_addr, A_LAST + 1);
93556
93557 /* Enter diff array element. Point to index address. */
93558 field_addr.sub_location->sub_location = plocation_elem_new(0);
93559#endif /* FREECIV_JSON_CONNECTION */
93560 DIO_PUT(uint8, &dout, &field_addr, 255);
93561
93562#ifdef FREECIV_JSON_CONNECTION
93563 /* Exit diff array element. */
93564 free(field_addr.sub_location->sub_location);
93565 field_addr.sub_location->sub_location = NULL;
93566
93567 /* Exit array. */
93568 free(field_addr.sub_location);
93569 field_addr.sub_location = NULL;
93570#endif /* FREECIV_JSON_CONNECTION */
93571 }
93572 }
93573 /* field 22 is folded into the header */
93574 /* field 23 is folded into the header */
93575
93576 *old = *real_packet;
93577#endif /* FREECIV_DELTA_PROTOCOL */
93578#ifndef FREECIV_DELTA_PROTOCOL
93579#ifdef FREECIV_JSON_CONNECTION
93580 field_addr.name = "id";
93581#endif /* FREECIV_JSON_CONNECTION */
93582 DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
93583#ifdef FREECIV_JSON_CONNECTION
93584 field_addr.name = "name";
93585#endif /* FREECIV_JSON_CONNECTION */
93586 DIO_PUT(string, &dout, &field_addr, real_packet->name);
93587#ifdef FREECIV_JSON_CONNECTION
93588 field_addr.name = "username";
93589#endif /* FREECIV_JSON_CONNECTION */
93590 DIO_PUT(string, &dout, &field_addr, real_packet->username);
93591#ifdef FREECIV_JSON_CONNECTION
93592 field_addr.name = "ranked_username";
93593#endif /* FREECIV_JSON_CONNECTION */
93594 DIO_PUT(string, &dout, &field_addr, real_packet->ranked_username);
93595#ifdef FREECIV_JSON_CONNECTION
93596 field_addr.name = "user_turns";
93597#endif /* FREECIV_JSON_CONNECTION */
93598 DIO_PUT(sint16, &dout, &field_addr, real_packet->user_turns);
93599#ifdef FREECIV_JSON_CONNECTION
93600 field_addr.name = "is_male";
93601#endif /* FREECIV_JSON_CONNECTION */
93602 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_male);
93603#ifdef FREECIV_JSON_CONNECTION
93604 field_addr.name = "government";
93605#endif /* FREECIV_JSON_CONNECTION */
93606 DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
93607#ifdef FREECIV_JSON_CONNECTION
93608 field_addr.name = "target_government";
93609#endif /* FREECIV_JSON_CONNECTION */
93610 DIO_PUT(sint8, &dout, &field_addr, real_packet->target_government);
93611#ifdef FREECIV_JSON_CONNECTION
93612 field_addr.name = "nation";
93613#endif /* FREECIV_JSON_CONNECTION */
93614 DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
93615#ifdef FREECIV_JSON_CONNECTION
93616 field_addr.name = "team";
93617#endif /* FREECIV_JSON_CONNECTION */
93618 DIO_PUT(uint16, &dout, &field_addr, real_packet->team);
93619#ifdef FREECIV_JSON_CONNECTION
93620 field_addr.name = "phase_done";
93621#endif /* FREECIV_JSON_CONNECTION */
93622 DIO_PUT(bool8, &dout, &field_addr, real_packet->phase_done);
93623#ifdef FREECIV_JSON_CONNECTION
93624 field_addr.name = "nturns_idle";
93625#endif /* FREECIV_JSON_CONNECTION */
93626 DIO_PUT(sint16, &dout, &field_addr, real_packet->nturns_idle);
93627#ifdef FREECIV_JSON_CONNECTION
93628 field_addr.name = "is_alive";
93629#endif /* FREECIV_JSON_CONNECTION */
93630 DIO_PUT(bool8, &dout, &field_addr, real_packet->is_alive);
93631#ifdef FREECIV_JSON_CONNECTION
93632 field_addr.name = "revolution_finishes";
93633#endif /* FREECIV_JSON_CONNECTION */
93634 DIO_PUT(sint16, &dout, &field_addr, real_packet->revolution_finishes);
93635#ifdef FREECIV_JSON_CONNECTION
93636 field_addr.name = "embassy";
93637#endif /* FREECIV_JSON_CONNECTION */
93638 DIO_BV_PUT(&dout, &field_addr, packet->embassy);
93639#ifdef FREECIV_JSON_CONNECTION
93640 field_addr.name = "gold";
93641#endif /* FREECIV_JSON_CONNECTION */
93642 DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
93643#ifdef FREECIV_JSON_CONNECTION
93644 field_addr.name = "tax";
93645#endif /* FREECIV_JSON_CONNECTION */
93646 DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
93647#ifdef FREECIV_JSON_CONNECTION
93648 field_addr.name = "science";
93649#endif /* FREECIV_JSON_CONNECTION */
93650 DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
93651#ifdef FREECIV_JSON_CONNECTION
93652 field_addr.name = "luxury";
93653#endif /* FREECIV_JSON_CONNECTION */
93654 DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
93655#ifdef FREECIV_JSON_CONNECTION
93656 field_addr.name = "future_tech";
93657#endif /* FREECIV_JSON_CONNECTION */
93658 DIO_PUT(uint16, &dout, &field_addr, real_packet->future_tech);
93659#ifdef FREECIV_JSON_CONNECTION
93660 field_addr.name = "researching";
93661#endif /* FREECIV_JSON_CONNECTION */
93662 DIO_PUT(uint8, &dout, &field_addr, real_packet->researching);
93663#ifdef FREECIV_JSON_CONNECTION
93664 field_addr.name = "bulbs_researched";
93665#endif /* FREECIV_JSON_CONNECTION */
93666 DIO_PUT(uint32, &dout, &field_addr, real_packet->bulbs_researched);
93667#ifdef FREECIV_JSON_CONNECTION
93668 field_addr.name = "inventions";
93669#endif /* FREECIV_JSON_CONNECTION */
93670
93671 {
93672 int i;
93673
93674#ifdef FREECIV_JSON_CONNECTION
93675 /* Create the array. */
93676 DIO_PUT(farray, &dout, &field_addr, A_LAST + 1);
93677
93678 /* Enter the array. */
93679 field_addr.sub_location = plocation_elem_new(0);
93680#endif /* FREECIV_JSON_CONNECTION */
93681
93682 for (i = 0; i < A_LAST + 1; i++) {
93683#ifdef FREECIV_JSON_CONNECTION
93684 /* Next array element. */
93685 field_addr.sub_location->number = i;
93686#endif /* FREECIV_JSON_CONNECTION */
93687 DIO_PUT(bool8, &dout, &field_addr, real_packet->inventions[i]);
93688 }
93689
93690#ifdef FREECIV_JSON_CONNECTION
93691 /* Exit array. */
93692 free(field_addr.sub_location);
93693 field_addr.sub_location = NULL;
93694#endif /* FREECIV_JSON_CONNECTION */
93695 }
93696#ifdef FREECIV_JSON_CONNECTION
93697 field_addr.name = "ai";
93698#endif /* FREECIV_JSON_CONNECTION */
93699 DIO_PUT(bool8, &dout, &field_addr, real_packet->ai);
93700#ifdef FREECIV_JSON_CONNECTION
93701 field_addr.name = "scenario_reserved";
93702#endif /* FREECIV_JSON_CONNECTION */
93703 DIO_PUT(bool8, &dout, &field_addr, real_packet->scenario_reserved);
93704
93705#endif
93706 SEND_PACKET_END(PACKET_EDIT_PLAYER);
93707}
93708
93709 int send_packet_edit_player(struct connection *pc, const struct packet_edit_player *packet)
93710{
93711 if (!pc->used) {
93712 log_error("WARNING: trying to send data to the closed connection %s",
93713 conn_description(pc));
93714 return -1;
93715 }
93716 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_PLAYER].packet != NULL, -1,
93717 "Handler for PACKET_EDIT_PLAYER not installed");
93718 return pc->phs.handlers->send[PACKET_EDIT_PLAYER].packet(pc, packet);
93719}
93720
93721 void lsend_packet_edit_player(struct conn_list *dest, const struct packet_edit_player *packet)
93722{
93723 conn_list_iterate(dest, pconn) {
93724 send_packet_edit_player(pconn, packet);
93725 } conn_list_iterate_end;
93726}
93727
93728#ifdef FREECIV_DELTA_PROTOCOL
93729#define hash_packet_edit_player_vision_100 hash_const
93730
93731#define cmp_packet_edit_player_vision_100 cmp_const
93732
93733 BV_DEFINE(packet_edit_player_vision_100_fields, 4);
93734#endif /* FREECIV_DELTA_PROTOCOL */
93735
93736 static struct packet_edit_player_vision *receive_packet_edit_player_vision_100(struct connection *pc)
93737{
93738#ifdef FREECIV_DELTA_PROTOCOL
93739 packet_edit_player_vision_100_fields fields;
93740 struct packet_edit_player_vision *old;
93741 struct genhash **hash = pc->phs.received + PACKET_EDIT_PLAYER_VISION;
93742#endif /* FREECIV_DELTA_PROTOCOL */
93743 RECEIVE_PACKET_START(packet_edit_player_vision, real_packet);
93744#ifdef FREECIV_JSON_CONNECTION
93745 struct plocation field_addr;
93746 {
93747 struct plocation *field_addr_tmp = plocation_field_new(NULL);
93748 field_addr = *field_addr_tmp;
93749 FC_FREE(field_addr_tmp);
93750 }
93751#endif /* FREECIV_JSON_CONNECTION */
93752
93753#ifdef FREECIV_DELTA_PROTOCOL
93754#ifdef FREECIV_JSON_CONNECTION
93755 field_addr.name = "fields";
93756#endif /* FREECIV_JSON_CONNECTION */
93757 DIO_BV_GET(&din, &field_addr, fields);
93758
93759#else /* FREECIV_DELTA_PROTOCOL */
93760 #ifdef FREECIV_JSON_CONNECTION
93761 field_addr.name = "player";
93762 #endif /* FREECIV_JSON_CONNECTION */
93763 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player)) {
93764 RECEIVE_PACKET_FIELD_ERROR(player);
93765 }
93766 #ifdef FREECIV_JSON_CONNECTION
93767 field_addr.name = "tile";
93768 #endif /* FREECIV_JSON_CONNECTION */
93769 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
93770 RECEIVE_PACKET_FIELD_ERROR(tile);
93771 }
93772 #ifdef FREECIV_JSON_CONNECTION
93773 field_addr.name = "known";
93774 #endif /* FREECIV_JSON_CONNECTION */
93775 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->known)) {
93776 RECEIVE_PACKET_FIELD_ERROR(known);
93777 }
93778 #ifdef FREECIV_JSON_CONNECTION
93779 field_addr.name = "size";
93780 #endif /* FREECIV_JSON_CONNECTION */
93781 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
93782 RECEIVE_PACKET_FIELD_ERROR(size);
93783 }
93784
93785#endif
93786 log_packet_detailed("packet_edit_player_vision_100: got info about ()");
93787
93788#ifdef FREECIV_DELTA_PROTOCOL
93789 if (NULL == *hash) {
93790 *hash = genhash_new_full(hash_packet_edit_player_vision_100, cmp_packet_edit_player_vision_100,
93791 NULL, NULL, NULL, free);
93792 }
93793
93794 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
93795 *real_packet = *old;
93796 } else {
93797 log_packet_detailed(" no old info");
93798 memset(real_packet, 0, sizeof(*real_packet));
93799 }
93800
93801 if (BV_ISSET(fields, 0)) {
93802 log_packet_detailed(" got field 'player'");
93803 #ifdef FREECIV_JSON_CONNECTION
93804 field_addr.name = "player";
93805 #endif /* FREECIV_JSON_CONNECTION */
93806 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player)) {
93807 RECEIVE_PACKET_FIELD_ERROR(player);
93808 }
93809 }
93810 if (BV_ISSET(fields, 1)) {
93811 log_packet_detailed(" got field 'tile'");
93812 #ifdef FREECIV_JSON_CONNECTION
93813 field_addr.name = "tile";
93814 #endif /* FREECIV_JSON_CONNECTION */
93815 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
93816 RECEIVE_PACKET_FIELD_ERROR(tile);
93817 }
93818 }
93819 real_packet->known = BV_ISSET(fields, 2);
93820 if (BV_ISSET(fields, 3)) {
93821 log_packet_detailed(" got field 'size'");
93822 #ifdef FREECIV_JSON_CONNECTION
93823 field_addr.name = "size";
93824 #endif /* FREECIV_JSON_CONNECTION */
93825 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
93826 RECEIVE_PACKET_FIELD_ERROR(size);
93827 }
93828 }
93829
93830 if (NULL == old) {
93831 old = fc_malloc(sizeof(*old));
93832 *old = *real_packet;
93833 genhash_insert(*hash, old, old);
93834 } else {
93835 *old = *real_packet;
93836 }
93837
93838#endif /* FREECIV_DELTA_PROTOCOL */
93839 RECEIVE_PACKET_END(real_packet);
93840}
93841
93842 static int send_packet_edit_player_vision_100(struct connection *pc, const struct packet_edit_player_vision *packet)
93843{
93844 const struct packet_edit_player_vision *real_packet = packet;
93845#ifdef FREECIV_DELTA_PROTOCOL
93846 packet_edit_player_vision_100_fields fields;
93847 struct packet_edit_player_vision *old;
93848 bool differ;
93849 struct genhash **hash = pc->phs.sent + PACKET_EDIT_PLAYER_VISION;
93850#endif /* FREECIV_DELTA_PROTOCOL */
93851 SEND_PACKET_START(PACKET_EDIT_PLAYER_VISION);
93852#ifdef FREECIV_JSON_CONNECTION
93853 struct plocation field_addr;
93854 {
93855 struct plocation *field_addr_tmp = plocation_field_new(NULL);
93856 field_addr = *field_addr_tmp;
93857 FC_FREE(field_addr_tmp);
93858 }
93859#endif /* FREECIV_JSON_CONNECTION */
93860
93861 log_packet_detailed("packet_edit_player_vision_100: sending info about ()");
93862
93863#ifdef FREECIV_DELTA_PROTOCOL
93864 if (NULL == *hash) {
93865 *hash = genhash_new_full(hash_packet_edit_player_vision_100, cmp_packet_edit_player_vision_100,
93866 NULL, NULL, NULL, free);
93867 }
93868 BV_CLR_ALL(fields);
93869
93870 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
93871 old = fc_malloc(sizeof(*old));
93872 *old = *real_packet;
93873 genhash_insert(*hash, old, old);
93874 memset(old, 0, sizeof(*old));
93875 }
93876 differ = (old->player != real_packet->player);
93877 if (differ) {
93878 BV_SET(fields, 0);
93879 }
93880
93881 differ = (old->tile != real_packet->tile);
93882 if (differ) {
93883 BV_SET(fields, 1);
93884 }
93885
93886 if (packet->known) {
93887 BV_SET(fields, 2);
93888 }
93889
93890 differ = (old->size != real_packet->size);
93891 if (differ) {
93892 BV_SET(fields, 3);
93893 }
93894
93895
93896#ifdef FREECIV_JSON_CONNECTION
93897 field_addr.name = "fields";
93898#endif /* FREECIV_JSON_CONNECTION */
93899 DIO_BV_PUT(&dout, &field_addr, fields);
93900
93901 if (BV_ISSET(fields, 0)) {
93902 log_packet_detailed(" field 'player' has changed");
93903 #ifdef FREECIV_JSON_CONNECTION
93904 field_addr.name = "player";
93905#endif /* FREECIV_JSON_CONNECTION */
93906 DIO_PUT(uint16, &dout, &field_addr, real_packet->player);
93907 }
93908 if (BV_ISSET(fields, 1)) {
93909 log_packet_detailed(" field 'tile' has changed");
93910 #ifdef FREECIV_JSON_CONNECTION
93911 field_addr.name = "tile";
93912#endif /* FREECIV_JSON_CONNECTION */
93913 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
93914 }
93915 /* field 2 is folded into the header */
93916 if (BV_ISSET(fields, 3)) {
93917 log_packet_detailed(" field 'size' has changed");
93918 #ifdef FREECIV_JSON_CONNECTION
93919 field_addr.name = "size";
93920#endif /* FREECIV_JSON_CONNECTION */
93921 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
93922 }
93923
93924 *old = *real_packet;
93925#endif /* FREECIV_DELTA_PROTOCOL */
93926#ifndef FREECIV_DELTA_PROTOCOL
93927#ifdef FREECIV_JSON_CONNECTION
93928 field_addr.name = "player";
93929#endif /* FREECIV_JSON_CONNECTION */
93930 DIO_PUT(uint16, &dout, &field_addr, real_packet->player);
93931#ifdef FREECIV_JSON_CONNECTION
93932 field_addr.name = "tile";
93933#endif /* FREECIV_JSON_CONNECTION */
93934 DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
93935#ifdef FREECIV_JSON_CONNECTION
93936 field_addr.name = "known";
93937#endif /* FREECIV_JSON_CONNECTION */
93938 DIO_PUT(bool8, &dout, &field_addr, real_packet->known);
93939#ifdef FREECIV_JSON_CONNECTION
93940 field_addr.name = "size";
93941#endif /* FREECIV_JSON_CONNECTION */
93942 DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
93943
93944#endif
93945 SEND_PACKET_END(PACKET_EDIT_PLAYER_VISION);
93946}
93947
93948 int send_packet_edit_player_vision(struct connection *pc, const struct packet_edit_player_vision *packet)
93949{
93950 if (!pc->used) {
93951 log_error("WARNING: trying to send data to the closed connection %s",
93952 conn_description(pc));
93953 return -1;
93954 }
93955 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_PLAYER_VISION].packet != NULL, -1,
93956 "Handler for PACKET_EDIT_PLAYER_VISION not installed");
93957 return pc->phs.handlers->send[PACKET_EDIT_PLAYER_VISION].packet(pc, packet);
93958}
93959
93960 int dsend_packet_edit_player_vision(struct connection *pc, int player, int tile, bool known, int size)
93961{
93962 struct packet_edit_player_vision packet, *real_packet = &packet;
93963
93964 real_packet->player = player;
93965 real_packet->tile = tile;
93966 real_packet->known = known;
93967 real_packet->size = size;
93968
93969 return send_packet_edit_player_vision(pc, real_packet);
93970}
93971
93972#ifdef FREECIV_DELTA_PROTOCOL
93973#define hash_packet_edit_game_100 hash_const
93974
93975#define cmp_packet_edit_game_100 cmp_const
93976
93977 BV_DEFINE(packet_edit_game_100_fields, 9);
93978#endif /* FREECIV_DELTA_PROTOCOL */
93979
93980 static struct packet_edit_game *receive_packet_edit_game_100(struct connection *pc)
93981{
93982#ifdef FREECIV_DELTA_PROTOCOL
93983 packet_edit_game_100_fields fields;
93984 struct packet_edit_game *old;
93985 struct genhash **hash = pc->phs.received + PACKET_EDIT_GAME;
93986#endif /* FREECIV_DELTA_PROTOCOL */
93987 RECEIVE_PACKET_START(packet_edit_game, real_packet);
93988#ifdef FREECIV_JSON_CONNECTION
93989 struct plocation field_addr;
93990 {
93991 struct plocation *field_addr_tmp = plocation_field_new(NULL);
93992 field_addr = *field_addr_tmp;
93993 FC_FREE(field_addr_tmp);
93994 }
93995#endif /* FREECIV_JSON_CONNECTION */
93996
93997#ifdef FREECIV_DELTA_PROTOCOL
93998#ifdef FREECIV_JSON_CONNECTION
93999 field_addr.name = "fields";
94000#endif /* FREECIV_JSON_CONNECTION */
94001 DIO_BV_GET(&din, &field_addr, fields);
94002
94003#else /* FREECIV_DELTA_PROTOCOL */
94004 #ifdef FREECIV_JSON_CONNECTION
94005 field_addr.name = "scenario";
94006 #endif /* FREECIV_JSON_CONNECTION */
94007 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->scenario)) {
94008 RECEIVE_PACKET_FIELD_ERROR(scenario);
94009 }
94010 #ifdef FREECIV_JSON_CONNECTION
94011 field_addr.name = "scenario_name";
94012 #endif /* FREECIV_JSON_CONNECTION */
94013 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_name, sizeof(real_packet->scenario_name))) {
94014 RECEIVE_PACKET_FIELD_ERROR(scenario_name);
94015 }
94016 #ifdef FREECIV_JSON_CONNECTION
94017 field_addr.name = "scenario_authors";
94018 #endif /* FREECIV_JSON_CONNECTION */
94019 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_authors, sizeof(real_packet->scenario_authors))) {
94020 RECEIVE_PACKET_FIELD_ERROR(scenario_authors);
94021 }
94022 #ifdef FREECIV_JSON_CONNECTION
94023 field_addr.name = "scenario_random";
94024 #endif /* FREECIV_JSON_CONNECTION */
94025 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->scenario_random)) {
94026 RECEIVE_PACKET_FIELD_ERROR(scenario_random);
94027 }
94028 #ifdef FREECIV_JSON_CONNECTION
94029 field_addr.name = "scenario_players";
94030 #endif /* FREECIV_JSON_CONNECTION */
94031 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->scenario_players)) {
94032 RECEIVE_PACKET_FIELD_ERROR(scenario_players);
94033 }
94034 #ifdef FREECIV_JSON_CONNECTION
94035 field_addr.name = "startpos_nations";
94036 #endif /* FREECIV_JSON_CONNECTION */
94037 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->startpos_nations)) {
94038 RECEIVE_PACKET_FIELD_ERROR(startpos_nations);
94039 }
94040 #ifdef FREECIV_JSON_CONNECTION
94041 field_addr.name = "prevent_new_cities";
94042 #endif /* FREECIV_JSON_CONNECTION */
94043 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->prevent_new_cities)) {
94044 RECEIVE_PACKET_FIELD_ERROR(prevent_new_cities);
94045 }
94046 #ifdef FREECIV_JSON_CONNECTION
94047 field_addr.name = "lake_flooding";
94048 #endif /* FREECIV_JSON_CONNECTION */
94049 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->lake_flooding)) {
94050 RECEIVE_PACKET_FIELD_ERROR(lake_flooding);
94051 }
94052 #ifdef FREECIV_JSON_CONNECTION
94053 field_addr.name = "ruleset_locked";
94054 #endif /* FREECIV_JSON_CONNECTION */
94055 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->ruleset_locked)) {
94056 RECEIVE_PACKET_FIELD_ERROR(ruleset_locked);
94057 }
94058
94059#endif
94060 log_packet_detailed("packet_edit_game_100: got info about ()");
94061
94062#ifdef FREECIV_DELTA_PROTOCOL
94063 if (NULL == *hash) {
94064 *hash = genhash_new_full(hash_packet_edit_game_100, cmp_packet_edit_game_100,
94065 NULL, NULL, NULL, free);
94066 }
94067
94068 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
94069 *real_packet = *old;
94070 } else {
94071 log_packet_detailed(" no old info");
94072 memset(real_packet, 0, sizeof(*real_packet));
94073 }
94074
94075 real_packet->scenario = BV_ISSET(fields, 0);
94076 if (BV_ISSET(fields, 1)) {
94077 log_packet_detailed(" got field 'scenario_name'");
94078 #ifdef FREECIV_JSON_CONNECTION
94079 field_addr.name = "scenario_name";
94080 #endif /* FREECIV_JSON_CONNECTION */
94081 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_name, sizeof(real_packet->scenario_name))) {
94082 RECEIVE_PACKET_FIELD_ERROR(scenario_name);
94083 }
94084 }
94085 if (BV_ISSET(fields, 2)) {
94086 log_packet_detailed(" got field 'scenario_authors'");
94087 #ifdef FREECIV_JSON_CONNECTION
94088 field_addr.name = "scenario_authors";
94089 #endif /* FREECIV_JSON_CONNECTION */
94090 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_authors, sizeof(real_packet->scenario_authors))) {
94091 RECEIVE_PACKET_FIELD_ERROR(scenario_authors);
94092 }
94093 }
94094 real_packet->scenario_random = BV_ISSET(fields, 3);
94095 real_packet->scenario_players = BV_ISSET(fields, 4);
94096 real_packet->startpos_nations = BV_ISSET(fields, 5);
94097 real_packet->prevent_new_cities = BV_ISSET(fields, 6);
94098 real_packet->lake_flooding = BV_ISSET(fields, 7);
94099 real_packet->ruleset_locked = BV_ISSET(fields, 8);
94100
94101 if (NULL == old) {
94102 old = fc_malloc(sizeof(*old));
94103 *old = *real_packet;
94104 genhash_insert(*hash, old, old);
94105 } else {
94106 *old = *real_packet;
94107 }
94108
94109#endif /* FREECIV_DELTA_PROTOCOL */
94110 RECEIVE_PACKET_END(real_packet);
94111}
94112
94113 static int send_packet_edit_game_100(struct connection *pc, const struct packet_edit_game *packet)
94114{
94115 const struct packet_edit_game *real_packet = packet;
94116#ifdef FREECIV_DELTA_PROTOCOL
94117 packet_edit_game_100_fields fields;
94118 struct packet_edit_game *old;
94119 bool differ;
94120 struct genhash **hash = pc->phs.sent + PACKET_EDIT_GAME;
94121#endif /* FREECIV_DELTA_PROTOCOL */
94122 SEND_PACKET_START(PACKET_EDIT_GAME);
94123#ifdef FREECIV_JSON_CONNECTION
94124 struct plocation field_addr;
94125 {
94126 struct plocation *field_addr_tmp = plocation_field_new(NULL);
94127 field_addr = *field_addr_tmp;
94128 FC_FREE(field_addr_tmp);
94129 }
94130#endif /* FREECIV_JSON_CONNECTION */
94131
94132 log_packet_detailed("packet_edit_game_100: sending info about ()");
94133
94134#ifdef FREECIV_DELTA_PROTOCOL
94135 if (NULL == *hash) {
94136 *hash = genhash_new_full(hash_packet_edit_game_100, cmp_packet_edit_game_100,
94137 NULL, NULL, NULL, free);
94138 }
94139 BV_CLR_ALL(fields);
94140
94141 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
94142 old = fc_malloc(sizeof(*old));
94143 *old = *real_packet;
94144 genhash_insert(*hash, old, old);
94145 memset(old, 0, sizeof(*old));
94146 }
94147 if (packet->scenario) {
94148 BV_SET(fields, 0);
94149 }
94150
94151 differ = (strcmp(old->scenario_name, real_packet->scenario_name) != 0);
94152 if (differ) {
94153 BV_SET(fields, 1);
94154 }
94155
94156 differ = (strcmp(old->scenario_authors, real_packet->scenario_authors) != 0);
94157 if (differ) {
94158 BV_SET(fields, 2);
94159 }
94160
94161 if (packet->scenario_random) {
94162 BV_SET(fields, 3);
94163 }
94164
94165 if (packet->scenario_players) {
94166 BV_SET(fields, 4);
94167 }
94168
94169 if (packet->startpos_nations) {
94170 BV_SET(fields, 5);
94171 }
94172
94173 if (packet->prevent_new_cities) {
94174 BV_SET(fields, 6);
94175 }
94176
94177 if (packet->lake_flooding) {
94178 BV_SET(fields, 7);
94179 }
94180
94181 if (packet->ruleset_locked) {
94182 BV_SET(fields, 8);
94183 }
94184
94185
94186#ifdef FREECIV_JSON_CONNECTION
94187 field_addr.name = "fields";
94188#endif /* FREECIV_JSON_CONNECTION */
94189 DIO_BV_PUT(&dout, &field_addr, fields);
94190
94191 /* field 0 is folded into the header */
94192 if (BV_ISSET(fields, 1)) {
94193 log_packet_detailed(" field 'scenario_name' has changed");
94194 #ifdef FREECIV_JSON_CONNECTION
94195 field_addr.name = "scenario_name";
94196#endif /* FREECIV_JSON_CONNECTION */
94197 DIO_PUT(string, &dout, &field_addr, real_packet->scenario_name);
94198 }
94199 if (BV_ISSET(fields, 2)) {
94200 log_packet_detailed(" field 'scenario_authors' has changed");
94201 #ifdef FREECIV_JSON_CONNECTION
94202 field_addr.name = "scenario_authors";
94203#endif /* FREECIV_JSON_CONNECTION */
94204 DIO_PUT(string, &dout, &field_addr, real_packet->scenario_authors);
94205 }
94206 /* field 3 is folded into the header */
94207 /* field 4 is folded into the header */
94208 /* field 5 is folded into the header */
94209 /* field 6 is folded into the header */
94210 /* field 7 is folded into the header */
94211 /* field 8 is folded into the header */
94212
94213 *old = *real_packet;
94214#endif /* FREECIV_DELTA_PROTOCOL */
94215#ifndef FREECIV_DELTA_PROTOCOL
94216#ifdef FREECIV_JSON_CONNECTION
94217 field_addr.name = "scenario";
94218#endif /* FREECIV_JSON_CONNECTION */
94219 DIO_PUT(bool8, &dout, &field_addr, real_packet->scenario);
94220#ifdef FREECIV_JSON_CONNECTION
94221 field_addr.name = "scenario_name";
94222#endif /* FREECIV_JSON_CONNECTION */
94223 DIO_PUT(string, &dout, &field_addr, real_packet->scenario_name);
94224#ifdef FREECIV_JSON_CONNECTION
94225 field_addr.name = "scenario_authors";
94226#endif /* FREECIV_JSON_CONNECTION */
94227 DIO_PUT(string, &dout, &field_addr, real_packet->scenario_authors);
94228#ifdef FREECIV_JSON_CONNECTION
94229 field_addr.name = "scenario_random";
94230#endif /* FREECIV_JSON_CONNECTION */
94231 DIO_PUT(bool8, &dout, &field_addr, real_packet->scenario_random);
94232#ifdef FREECIV_JSON_CONNECTION
94233 field_addr.name = "scenario_players";
94234#endif /* FREECIV_JSON_CONNECTION */
94235 DIO_PUT(bool8, &dout, &field_addr, real_packet->scenario_players);
94236#ifdef FREECIV_JSON_CONNECTION
94237 field_addr.name = "startpos_nations";
94238#endif /* FREECIV_JSON_CONNECTION */
94239 DIO_PUT(bool8, &dout, &field_addr, real_packet->startpos_nations);
94240#ifdef FREECIV_JSON_CONNECTION
94241 field_addr.name = "prevent_new_cities";
94242#endif /* FREECIV_JSON_CONNECTION */
94243 DIO_PUT(bool8, &dout, &field_addr, real_packet->prevent_new_cities);
94244#ifdef FREECIV_JSON_CONNECTION
94245 field_addr.name = "lake_flooding";
94246#endif /* FREECIV_JSON_CONNECTION */
94247 DIO_PUT(bool8, &dout, &field_addr, real_packet->lake_flooding);
94248#ifdef FREECIV_JSON_CONNECTION
94249 field_addr.name = "ruleset_locked";
94250#endif /* FREECIV_JSON_CONNECTION */
94251 DIO_PUT(bool8, &dout, &field_addr, real_packet->ruleset_locked);
94252
94253#endif
94254 SEND_PACKET_END(PACKET_EDIT_GAME);
94255}
94256
94257 int send_packet_edit_game(struct connection *pc, const struct packet_edit_game *packet)
94258{
94259 if (!pc->used) {
94260 log_error("WARNING: trying to send data to the closed connection %s",
94261 conn_description(pc));
94262 return -1;
94263 }
94264 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_GAME].packet != NULL, -1,
94265 "Handler for PACKET_EDIT_GAME not installed");
94266 return pc->phs.handlers->send[PACKET_EDIT_GAME].packet(pc, packet);
94267}
94268
94269#ifdef FREECIV_DELTA_PROTOCOL
94270#define hash_packet_edit_scenario_desc_100 hash_const
94271
94272#define cmp_packet_edit_scenario_desc_100 cmp_const
94273
94274 BV_DEFINE(packet_edit_scenario_desc_100_fields, 1);
94275#endif /* FREECIV_DELTA_PROTOCOL */
94276
94277 static struct packet_edit_scenario_desc *receive_packet_edit_scenario_desc_100(struct connection *pc)
94278{
94279#ifdef FREECIV_DELTA_PROTOCOL
94280 packet_edit_scenario_desc_100_fields fields;
94281 struct packet_edit_scenario_desc *old;
94282 struct genhash **hash = pc->phs.received + PACKET_EDIT_SCENARIO_DESC;
94283#endif /* FREECIV_DELTA_PROTOCOL */
94284 RECEIVE_PACKET_START(packet_edit_scenario_desc, real_packet);
94285#ifdef FREECIV_JSON_CONNECTION
94286 struct plocation field_addr;
94287 {
94288 struct plocation *field_addr_tmp = plocation_field_new(NULL);
94289 field_addr = *field_addr_tmp;
94290 FC_FREE(field_addr_tmp);
94291 }
94292#endif /* FREECIV_JSON_CONNECTION */
94293
94294#ifdef FREECIV_DELTA_PROTOCOL
94295#ifdef FREECIV_JSON_CONNECTION
94296 field_addr.name = "fields";
94297#endif /* FREECIV_JSON_CONNECTION */
94298 DIO_BV_GET(&din, &field_addr, fields);
94299
94300#else /* FREECIV_DELTA_PROTOCOL */
94301 #ifdef FREECIV_JSON_CONNECTION
94302 field_addr.name = "scenario_desc";
94303 #endif /* FREECIV_JSON_CONNECTION */
94304 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_desc, sizeof(real_packet->scenario_desc))) {
94305 RECEIVE_PACKET_FIELD_ERROR(scenario_desc);
94306 }
94307
94308#endif
94309 log_packet_detailed("packet_edit_scenario_desc_100: got info about ()");
94310
94311#ifdef FREECIV_DELTA_PROTOCOL
94312 if (NULL == *hash) {
94313 *hash = genhash_new_full(hash_packet_edit_scenario_desc_100, cmp_packet_edit_scenario_desc_100,
94314 NULL, NULL, NULL, free);
94315 }
94316
94317 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
94318 *real_packet = *old;
94319 } else {
94320 log_packet_detailed(" no old info");
94321 memset(real_packet, 0, sizeof(*real_packet));
94322 }
94323
94324 if (BV_ISSET(fields, 0)) {
94325 log_packet_detailed(" got field 'scenario_desc'");
94326 #ifdef FREECIV_JSON_CONNECTION
94327 field_addr.name = "scenario_desc";
94328 #endif /* FREECIV_JSON_CONNECTION */
94329 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_desc, sizeof(real_packet->scenario_desc))) {
94330 RECEIVE_PACKET_FIELD_ERROR(scenario_desc);
94331 }
94332 }
94333
94334 if (NULL == old) {
94335 old = fc_malloc(sizeof(*old));
94336 *old = *real_packet;
94337 genhash_insert(*hash, old, old);
94338 } else {
94339 *old = *real_packet;
94340 }
94341
94342#endif /* FREECIV_DELTA_PROTOCOL */
94343 RECEIVE_PACKET_END(real_packet);
94344}
94345
94346 static int send_packet_edit_scenario_desc_100(struct connection *pc, const struct packet_edit_scenario_desc *packet)
94347{
94348 const struct packet_edit_scenario_desc *real_packet = packet;
94349#ifdef FREECIV_DELTA_PROTOCOL
94350 packet_edit_scenario_desc_100_fields fields;
94351 struct packet_edit_scenario_desc *old;
94352 bool differ;
94353 struct genhash **hash = pc->phs.sent + PACKET_EDIT_SCENARIO_DESC;
94354#endif /* FREECIV_DELTA_PROTOCOL */
94355 SEND_PACKET_START(PACKET_EDIT_SCENARIO_DESC);
94356#ifdef FREECIV_JSON_CONNECTION
94357 struct plocation field_addr;
94358 {
94359 struct plocation *field_addr_tmp = plocation_field_new(NULL);
94360 field_addr = *field_addr_tmp;
94361 FC_FREE(field_addr_tmp);
94362 }
94363#endif /* FREECIV_JSON_CONNECTION */
94364
94365 log_packet_detailed("packet_edit_scenario_desc_100: sending info about ()");
94366
94367#ifdef FREECIV_DELTA_PROTOCOL
94368 if (NULL == *hash) {
94369 *hash = genhash_new_full(hash_packet_edit_scenario_desc_100, cmp_packet_edit_scenario_desc_100,
94370 NULL, NULL, NULL, free);
94371 }
94372 BV_CLR_ALL(fields);
94373
94374 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
94375 old = fc_malloc(sizeof(*old));
94376 *old = *real_packet;
94377 genhash_insert(*hash, old, old);
94378 memset(old, 0, sizeof(*old));
94379 }
94380 differ = (strcmp(old->scenario_desc, real_packet->scenario_desc) != 0);
94381 if (differ) {
94382 BV_SET(fields, 0);
94383 }
94384
94385
94386#ifdef FREECIV_JSON_CONNECTION
94387 field_addr.name = "fields";
94388#endif /* FREECIV_JSON_CONNECTION */
94389 DIO_BV_PUT(&dout, &field_addr, fields);
94390
94391 if (BV_ISSET(fields, 0)) {
94392 log_packet_detailed(" field 'scenario_desc' has changed");
94393 #ifdef FREECIV_JSON_CONNECTION
94394 field_addr.name = "scenario_desc";
94395#endif /* FREECIV_JSON_CONNECTION */
94396 DIO_PUT(string, &dout, &field_addr, real_packet->scenario_desc);
94397 }
94398
94399 *old = *real_packet;
94400#endif /* FREECIV_DELTA_PROTOCOL */
94401#ifndef FREECIV_DELTA_PROTOCOL
94402#ifdef FREECIV_JSON_CONNECTION
94403 field_addr.name = "scenario_desc";
94404#endif /* FREECIV_JSON_CONNECTION */
94405 DIO_PUT(string, &dout, &field_addr, real_packet->scenario_desc);
94406
94407#endif
94408 SEND_PACKET_END(PACKET_EDIT_SCENARIO_DESC);
94409}
94410
94411 int send_packet_edit_scenario_desc(struct connection *pc, const struct packet_edit_scenario_desc *packet)
94412{
94413 if (!pc->used) {
94414 log_error("WARNING: trying to send data to the closed connection %s",
94415 conn_description(pc));
94416 return -1;
94417 }
94418 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_SCENARIO_DESC].packet != NULL, -1,
94419 "Handler for PACKET_EDIT_SCENARIO_DESC not installed");
94420 return pc->phs.handlers->send[PACKET_EDIT_SCENARIO_DESC].packet(pc, packet);
94421}
94422
94423#ifdef FREECIV_DELTA_PROTOCOL
94424#define hash_packet_edit_object_created_100 hash_const
94425
94426#define cmp_packet_edit_object_created_100 cmp_const
94427
94428 BV_DEFINE(packet_edit_object_created_100_fields, 2);
94429#endif /* FREECIV_DELTA_PROTOCOL */
94430
94431 static struct packet_edit_object_created *receive_packet_edit_object_created_100(struct connection *pc)
94432{
94433#ifdef FREECIV_DELTA_PROTOCOL
94434 packet_edit_object_created_100_fields fields;
94435 struct packet_edit_object_created *old;
94436 struct genhash **hash = pc->phs.received + PACKET_EDIT_OBJECT_CREATED;
94437#endif /* FREECIV_DELTA_PROTOCOL */
94438 RECEIVE_PACKET_START(packet_edit_object_created, real_packet);
94439#ifdef FREECIV_JSON_CONNECTION
94440 struct plocation field_addr;
94441 {
94442 struct plocation *field_addr_tmp = plocation_field_new(NULL);
94443 field_addr = *field_addr_tmp;
94444 FC_FREE(field_addr_tmp);
94445 }
94446#endif /* FREECIV_JSON_CONNECTION */
94447
94448#ifdef FREECIV_DELTA_PROTOCOL
94449#ifdef FREECIV_JSON_CONNECTION
94450 field_addr.name = "fields";
94451#endif /* FREECIV_JSON_CONNECTION */
94452 DIO_BV_GET(&din, &field_addr, fields);
94453
94454#else /* FREECIV_DELTA_PROTOCOL */
94455 #ifdef FREECIV_JSON_CONNECTION
94456 field_addr.name = "tag";
94457 #endif /* FREECIV_JSON_CONNECTION */
94458 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
94459 RECEIVE_PACKET_FIELD_ERROR(tag);
94460 }
94461 #ifdef FREECIV_JSON_CONNECTION
94462 field_addr.name = "id";
94463 #endif /* FREECIV_JSON_CONNECTION */
94464 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->id)) {
94465 RECEIVE_PACKET_FIELD_ERROR(id);
94466 }
94467
94468#endif
94469 log_packet_detailed("packet_edit_object_created_100: got info about ()");
94470
94471#ifdef FREECIV_DELTA_PROTOCOL
94472 if (NULL == *hash) {
94473 *hash = genhash_new_full(hash_packet_edit_object_created_100, cmp_packet_edit_object_created_100,
94474 NULL, NULL, NULL, free);
94475 }
94476
94477 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
94478 *real_packet = *old;
94479 } else {
94480 log_packet_detailed(" no old info");
94481 memset(real_packet, 0, sizeof(*real_packet));
94482 }
94483
94484 if (BV_ISSET(fields, 0)) {
94485 log_packet_detailed(" got field 'tag'");
94486 #ifdef FREECIV_JSON_CONNECTION
94487 field_addr.name = "tag";
94488 #endif /* FREECIV_JSON_CONNECTION */
94489 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
94490 RECEIVE_PACKET_FIELD_ERROR(tag);
94491 }
94492 }
94493 if (BV_ISSET(fields, 1)) {
94494 log_packet_detailed(" got field 'id'");
94495 #ifdef FREECIV_JSON_CONNECTION
94496 field_addr.name = "id";
94497 #endif /* FREECIV_JSON_CONNECTION */
94498 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->id)) {
94499 RECEIVE_PACKET_FIELD_ERROR(id);
94500 }
94501 }
94502
94503 if (NULL == old) {
94504 old = fc_malloc(sizeof(*old));
94505 *old = *real_packet;
94506 genhash_insert(*hash, old, old);
94507 } else {
94508 *old = *real_packet;
94509 }
94510
94511#endif /* FREECIV_DELTA_PROTOCOL */
94512 RECEIVE_PACKET_END(real_packet);
94513}
94514
94515 static int send_packet_edit_object_created_100(struct connection *pc, const struct packet_edit_object_created *packet)
94516{
94517 const struct packet_edit_object_created *real_packet = packet;
94518#ifdef FREECIV_DELTA_PROTOCOL
94519 packet_edit_object_created_100_fields fields;
94520 struct packet_edit_object_created *old;
94521 bool differ;
94522 struct genhash **hash = pc->phs.sent + PACKET_EDIT_OBJECT_CREATED;
94523#endif /* FREECIV_DELTA_PROTOCOL */
94524 SEND_PACKET_START(PACKET_EDIT_OBJECT_CREATED);
94525#ifdef FREECIV_JSON_CONNECTION
94526 struct plocation field_addr;
94527 {
94528 struct plocation *field_addr_tmp = plocation_field_new(NULL);
94529 field_addr = *field_addr_tmp;
94530 FC_FREE(field_addr_tmp);
94531 }
94532#endif /* FREECIV_JSON_CONNECTION */
94533
94534 log_packet_detailed("packet_edit_object_created_100: sending info about ()");
94535
94536#ifdef FREECIV_DELTA_PROTOCOL
94537 if (NULL == *hash) {
94538 *hash = genhash_new_full(hash_packet_edit_object_created_100, cmp_packet_edit_object_created_100,
94539 NULL, NULL, NULL, free);
94540 }
94541 BV_CLR_ALL(fields);
94542
94543 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
94544 old = fc_malloc(sizeof(*old));
94545 *old = *real_packet;
94546 genhash_insert(*hash, old, old);
94547 memset(old, 0, sizeof(*old));
94548 }
94549 differ = (old->tag != real_packet->tag);
94550 if (differ) {
94551 BV_SET(fields, 0);
94552 }
94553
94554 differ = (old->id != real_packet->id);
94555 if (differ) {
94556 BV_SET(fields, 1);
94557 }
94558
94559
94560#ifdef FREECIV_JSON_CONNECTION
94561 field_addr.name = "fields";
94562#endif /* FREECIV_JSON_CONNECTION */
94563 DIO_BV_PUT(&dout, &field_addr, fields);
94564
94565 if (BV_ISSET(fields, 0)) {
94566 log_packet_detailed(" field 'tag' has changed");
94567 #ifdef FREECIV_JSON_CONNECTION
94568 field_addr.name = "tag";
94569#endif /* FREECIV_JSON_CONNECTION */
94570 DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
94571 }
94572 if (BV_ISSET(fields, 1)) {
94573 log_packet_detailed(" field 'id' has changed");
94574 #ifdef FREECIV_JSON_CONNECTION
94575 field_addr.name = "id";
94576#endif /* FREECIV_JSON_CONNECTION */
94577 DIO_PUT(sint32, &dout, &field_addr, real_packet->id);
94578 }
94579
94580 *old = *real_packet;
94581#endif /* FREECIV_DELTA_PROTOCOL */
94582#ifndef FREECIV_DELTA_PROTOCOL
94583#ifdef FREECIV_JSON_CONNECTION
94584 field_addr.name = "tag";
94585#endif /* FREECIV_JSON_CONNECTION */
94586 DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
94587#ifdef FREECIV_JSON_CONNECTION
94588 field_addr.name = "id";
94589#endif /* FREECIV_JSON_CONNECTION */
94590 DIO_PUT(sint32, &dout, &field_addr, real_packet->id);
94591
94592#endif
94593 SEND_PACKET_END(PACKET_EDIT_OBJECT_CREATED);
94594}
94595
94596 int send_packet_edit_object_created(struct connection *pc, const struct packet_edit_object_created *packet)
94597{
94598 if (!pc->used) {
94599 log_error("WARNING: trying to send data to the closed connection %s",
94600 conn_description(pc));
94601 return -1;
94602 }
94603 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_OBJECT_CREATED].packet != NULL, -1,
94604 "Handler for PACKET_EDIT_OBJECT_CREATED not installed");
94605 return pc->phs.handlers->send[PACKET_EDIT_OBJECT_CREATED].packet(pc, packet);
94606}
94607
94608 int dsend_packet_edit_object_created(struct connection *pc, int tag, int id)
94609{
94610 struct packet_edit_object_created packet, *real_packet = &packet;
94611
94612 real_packet->tag = tag;
94613 real_packet->id = id;
94614
94615 return send_packet_edit_object_created(pc, real_packet);
94616}
94617
94618#ifdef FREECIV_DELTA_PROTOCOL
94619#define hash_packet_play_music_100 hash_const
94620
94621#define cmp_packet_play_music_100 cmp_const
94622
94623 BV_DEFINE(packet_play_music_100_fields, 1);
94624#endif /* FREECIV_DELTA_PROTOCOL */
94625
94626 static struct packet_play_music *receive_packet_play_music_100(struct connection *pc)
94627{
94628#ifdef FREECIV_DELTA_PROTOCOL
94629 packet_play_music_100_fields fields;
94630 struct packet_play_music *old;
94631 struct genhash **hash = pc->phs.received + PACKET_PLAY_MUSIC;
94632#endif /* FREECIV_DELTA_PROTOCOL */
94633 RECEIVE_PACKET_START(packet_play_music, real_packet);
94634#ifdef FREECIV_JSON_CONNECTION
94635 struct plocation field_addr;
94636 {
94637 struct plocation *field_addr_tmp = plocation_field_new(NULL);
94638 field_addr = *field_addr_tmp;
94639 FC_FREE(field_addr_tmp);
94640 }
94641#endif /* FREECIV_JSON_CONNECTION */
94642
94643#ifdef FREECIV_DELTA_PROTOCOL
94644#ifdef FREECIV_JSON_CONNECTION
94645 field_addr.name = "fields";
94646#endif /* FREECIV_JSON_CONNECTION */
94647 DIO_BV_GET(&din, &field_addr, fields);
94648
94649#else /* FREECIV_DELTA_PROTOCOL */
94650 #ifdef FREECIV_JSON_CONNECTION
94651 field_addr.name = "tag";
94652 #endif /* FREECIV_JSON_CONNECTION */
94653 if (!DIO_GET(string, &din, &field_addr, real_packet->tag, sizeof(real_packet->tag))) {
94654 RECEIVE_PACKET_FIELD_ERROR(tag);
94655 }
94656
94657#endif
94658 log_packet_detailed("packet_play_music_100: got info about ()");
94659
94660#ifdef FREECIV_DELTA_PROTOCOL
94661 if (NULL == *hash) {
94662 *hash = genhash_new_full(hash_packet_play_music_100, cmp_packet_play_music_100,
94663 NULL, NULL, NULL, free);
94664 }
94665
94666 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
94667 *real_packet = *old;
94668 } else {
94669 log_packet_detailed(" no old info");
94670 memset(real_packet, 0, sizeof(*real_packet));
94671 }
94672
94673 if (BV_ISSET(fields, 0)) {
94674 log_packet_detailed(" got field 'tag'");
94675 #ifdef FREECIV_JSON_CONNECTION
94676 field_addr.name = "tag";
94677 #endif /* FREECIV_JSON_CONNECTION */
94678 if (!DIO_GET(string, &din, &field_addr, real_packet->tag, sizeof(real_packet->tag))) {
94679 RECEIVE_PACKET_FIELD_ERROR(tag);
94680 }
94681 }
94682
94683 if (NULL == old) {
94684 old = fc_malloc(sizeof(*old));
94685 *old = *real_packet;
94686 genhash_insert(*hash, old, old);
94687 } else {
94688 *old = *real_packet;
94689 }
94690
94691#endif /* FREECIV_DELTA_PROTOCOL */
94692 RECEIVE_PACKET_END(real_packet);
94693}
94694
94695 static int send_packet_play_music_100(struct connection *pc, const struct packet_play_music *packet)
94696{
94697 const struct packet_play_music *real_packet = packet;
94698#ifdef FREECIV_DELTA_PROTOCOL
94699 packet_play_music_100_fields fields;
94700 struct packet_play_music *old;
94701 bool differ;
94702 struct genhash **hash = pc->phs.sent + PACKET_PLAY_MUSIC;
94703#endif /* FREECIV_DELTA_PROTOCOL */
94704 SEND_PACKET_START(PACKET_PLAY_MUSIC);
94705#ifdef FREECIV_JSON_CONNECTION
94706 struct plocation field_addr;
94707 {
94708 struct plocation *field_addr_tmp = plocation_field_new(NULL);
94709 field_addr = *field_addr_tmp;
94710 FC_FREE(field_addr_tmp);
94711 }
94712#endif /* FREECIV_JSON_CONNECTION */
94713
94714 log_packet_detailed("packet_play_music_100: sending info about ()");
94715
94716#ifdef FREECIV_DELTA_PROTOCOL
94717 if (NULL == *hash) {
94718 *hash = genhash_new_full(hash_packet_play_music_100, cmp_packet_play_music_100,
94719 NULL, NULL, NULL, free);
94720 }
94721 BV_CLR_ALL(fields);
94722
94723 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
94724 old = fc_malloc(sizeof(*old));
94725 *old = *real_packet;
94726 genhash_insert(*hash, old, old);
94727 memset(old, 0, sizeof(*old));
94728 }
94729 differ = (strcmp(old->tag, real_packet->tag) != 0);
94730 if (differ) {
94731 BV_SET(fields, 0);
94732 }
94733
94734
94735#ifdef FREECIV_JSON_CONNECTION
94736 field_addr.name = "fields";
94737#endif /* FREECIV_JSON_CONNECTION */
94738 DIO_BV_PUT(&dout, &field_addr, fields);
94739
94740 if (BV_ISSET(fields, 0)) {
94741 log_packet_detailed(" field 'tag' has changed");
94742 #ifdef FREECIV_JSON_CONNECTION
94743 field_addr.name = "tag";
94744#endif /* FREECIV_JSON_CONNECTION */
94745 DIO_PUT(string, &dout, &field_addr, real_packet->tag);
94746 }
94747
94748 *old = *real_packet;
94749#endif /* FREECIV_DELTA_PROTOCOL */
94750#ifndef FREECIV_DELTA_PROTOCOL
94751#ifdef FREECIV_JSON_CONNECTION
94752 field_addr.name = "tag";
94753#endif /* FREECIV_JSON_CONNECTION */
94754 DIO_PUT(string, &dout, &field_addr, real_packet->tag);
94755
94756#endif
94757 SEND_PACKET_END(PACKET_PLAY_MUSIC);
94758}
94759
94760 int send_packet_play_music(struct connection *pc, const struct packet_play_music *packet)
94761{
94762 if (!pc->used) {
94763 log_error("WARNING: trying to send data to the closed connection %s",
94764 conn_description(pc));
94765 return -1;
94766 }
94767 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAY_MUSIC].packet != NULL, -1,
94768 "Handler for PACKET_PLAY_MUSIC not installed");
94769 return pc->phs.handlers->send[PACKET_PLAY_MUSIC].packet(pc, packet);
94770}
94771
94772 void lsend_packet_play_music(struct conn_list *dest, const struct packet_play_music *packet)
94773{
94774 conn_list_iterate(dest, pconn) {
94775 send_packet_play_music(pconn, packet);
94776 } conn_list_iterate_end;
94777}
94778
94779#ifdef FREECIV_DELTA_PROTOCOL
94780#define hash_packet_web_city_info_addition_100 hash_const
94781
94782#define cmp_packet_web_city_info_addition_100 cmp_const
94783
94784 BV_DEFINE(packet_web_city_info_addition_100_fields, 3);
94785#endif /* FREECIV_DELTA_PROTOCOL */
94786
94787 static struct packet_web_city_info_addition *receive_packet_web_city_info_addition_100(struct connection *pc)
94788{
94789#ifdef FREECIV_DELTA_PROTOCOL
94790 packet_web_city_info_addition_100_fields fields;
94791 struct packet_web_city_info_addition *old;
94792 struct genhash **hash = pc->phs.received + PACKET_WEB_CITY_INFO_ADDITION;
94793#endif /* FREECIV_DELTA_PROTOCOL */
94794 RECEIVE_PACKET_START(packet_web_city_info_addition, real_packet);
94795#ifdef FREECIV_JSON_CONNECTION
94796 struct plocation field_addr;
94797 {
94798 struct plocation *field_addr_tmp = plocation_field_new(NULL);
94799 field_addr = *field_addr_tmp;
94800 FC_FREE(field_addr_tmp);
94801 }
94802#endif /* FREECIV_JSON_CONNECTION */
94803
94804#ifdef FREECIV_DELTA_PROTOCOL
94805#ifdef FREECIV_JSON_CONNECTION
94806 field_addr.name = "fields";
94807#endif /* FREECIV_JSON_CONNECTION */
94808 DIO_BV_GET(&din, &field_addr, fields);
94809
94810#else /* FREECIV_DELTA_PROTOCOL */
94811 #ifdef FREECIV_JSON_CONNECTION
94812 field_addr.name = "id32";
94813 #endif /* FREECIV_JSON_CONNECTION */
94814 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
94815 RECEIVE_PACKET_FIELD_ERROR(id32);
94816 }
94817 #ifdef FREECIV_JSON_CONNECTION
94818 field_addr.name = "granary_size";
94819 #endif /* FREECIV_JSON_CONNECTION */
94820 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_size)) {
94821 RECEIVE_PACKET_FIELD_ERROR(granary_size);
94822 }
94823 #ifdef FREECIV_JSON_CONNECTION
94824 field_addr.name = "granary_turns";
94825 #endif /* FREECIV_JSON_CONNECTION */
94826 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->granary_turns)) {
94827 RECEIVE_PACKET_FIELD_ERROR(granary_turns);
94828 }
94829
94830#endif
94831 log_packet_detailed("packet_web_city_info_addition_100: got info about ()");
94832
94833#ifdef FREECIV_DELTA_PROTOCOL
94834 if (NULL == *hash) {
94835 *hash = genhash_new_full(hash_packet_web_city_info_addition_100, cmp_packet_web_city_info_addition_100,
94836 NULL, NULL, NULL, free);
94837 }
94838
94839 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
94840 *real_packet = *old;
94841 } else {
94842 log_packet_detailed(" no old info");
94843 memset(real_packet, 0, sizeof(*real_packet));
94844 }
94845
94846 if (BV_ISSET(fields, 0)) {
94847 log_packet_detailed(" got field 'id32'");
94848 #ifdef FREECIV_JSON_CONNECTION
94849 field_addr.name = "id32";
94850 #endif /* FREECIV_JSON_CONNECTION */
94851 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id32)) {
94852 RECEIVE_PACKET_FIELD_ERROR(id32);
94853 }
94854 }
94855 if (BV_ISSET(fields, 1)) {
94856 log_packet_detailed(" got field 'granary_size'");
94857 #ifdef FREECIV_JSON_CONNECTION
94858 field_addr.name = "granary_size";
94859 #endif /* FREECIV_JSON_CONNECTION */
94860 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_size)) {
94861 RECEIVE_PACKET_FIELD_ERROR(granary_size);
94862 }
94863 }
94864 if (BV_ISSET(fields, 2)) {
94865 log_packet_detailed(" got field 'granary_turns'");
94866 #ifdef FREECIV_JSON_CONNECTION
94867 field_addr.name = "granary_turns";
94868 #endif /* FREECIV_JSON_CONNECTION */
94869 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->granary_turns)) {
94870 RECEIVE_PACKET_FIELD_ERROR(granary_turns);
94871 }
94872 }
94873
94874 if (NULL == old) {
94875 old = fc_malloc(sizeof(*old));
94876 *old = *real_packet;
94877 genhash_insert(*hash, old, old);
94878 } else {
94879 *old = *real_packet;
94880 }
94881
94882 hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
94883 if (NULL != *hash) {
94884 genhash_remove(*hash, real_packet);
94885 }
94886
94887#endif /* FREECIV_DELTA_PROTOCOL */
94888 RECEIVE_PACKET_END(real_packet);
94889}
94890
94891 static int send_packet_web_city_info_addition_100(struct connection *pc, const struct packet_web_city_info_addition *packet, bool force_to_send)
94892{
94893 const struct packet_web_city_info_addition *real_packet = packet;
94894#ifdef FREECIV_DELTA_PROTOCOL
94895 packet_web_city_info_addition_100_fields fields;
94896 struct packet_web_city_info_addition *old;
94897 bool differ;
94898 struct genhash **hash = pc->phs.sent + PACKET_WEB_CITY_INFO_ADDITION;
94899 int different = force_to_send;
94900#endif /* FREECIV_DELTA_PROTOCOL */
94901 SEND_PACKET_START(PACKET_WEB_CITY_INFO_ADDITION);
94902#ifdef FREECIV_JSON_CONNECTION
94903 struct plocation field_addr;
94904 {
94905 struct plocation *field_addr_tmp = plocation_field_new(NULL);
94906 field_addr = *field_addr_tmp;
94907 FC_FREE(field_addr_tmp);
94908 }
94909#endif /* FREECIV_JSON_CONNECTION */
94910
94911 log_packet_detailed("packet_web_city_info_addition_100: sending info about ()");
94912
94913#ifdef FREECIV_DELTA_PROTOCOL
94914 if (NULL == *hash) {
94915 *hash = genhash_new_full(hash_packet_web_city_info_addition_100, cmp_packet_web_city_info_addition_100,
94916 NULL, NULL, NULL, free);
94917 }
94918 BV_CLR_ALL(fields);
94919
94920 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
94921 old = fc_malloc(sizeof(*old));
94922 *old = *real_packet;
94923 genhash_insert(*hash, old, old);
94924 memset(old, 0, sizeof(*old));
94925 different = 1; /* Force to send. */
94926 }
94927 differ = (old->id32 != real_packet->id32);
94928 if (differ) {
94929 different++;
94930 BV_SET(fields, 0);
94931 }
94932
94933 differ = (old->granary_size != real_packet->granary_size);
94934 if (differ) {
94935 different++;
94936 BV_SET(fields, 1);
94937 }
94938
94939 differ = (old->granary_turns != real_packet->granary_turns);
94940 if (differ) {
94941 different++;
94942 BV_SET(fields, 2);
94943 }
94944
94945
94946 if (different == 0) {
94947 log_packet_detailed(" no change -> discard");
94948 return 0;
94949 }
94950
94951#ifdef FREECIV_JSON_CONNECTION
94952 field_addr.name = "fields";
94953#endif /* FREECIV_JSON_CONNECTION */
94954 DIO_BV_PUT(&dout, &field_addr, fields);
94955
94956 if (BV_ISSET(fields, 0)) {
94957 log_packet_detailed(" field 'id32' has changed");
94958 #ifdef FREECIV_JSON_CONNECTION
94959 field_addr.name = "id32";
94960#endif /* FREECIV_JSON_CONNECTION */
94961 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
94962 }
94963 if (BV_ISSET(fields, 1)) {
94964 log_packet_detailed(" field 'granary_size' has changed");
94965 #ifdef FREECIV_JSON_CONNECTION
94966 field_addr.name = "granary_size";
94967#endif /* FREECIV_JSON_CONNECTION */
94968 DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_size);
94969 }
94970 if (BV_ISSET(fields, 2)) {
94971 log_packet_detailed(" field 'granary_turns' has changed");
94972 #ifdef FREECIV_JSON_CONNECTION
94973 field_addr.name = "granary_turns";
94974#endif /* FREECIV_JSON_CONNECTION */
94975 DIO_PUT(sint16, &dout, &field_addr, real_packet->granary_turns);
94976 }
94977
94978 *old = *real_packet;
94979
94980 hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
94981 if (NULL != *hash) {
94982 genhash_remove(*hash, real_packet);
94983 }
94984#endif /* FREECIV_DELTA_PROTOCOL */
94985#ifndef FREECIV_DELTA_PROTOCOL
94986#ifdef FREECIV_JSON_CONNECTION
94987 field_addr.name = "id32";
94988#endif /* FREECIV_JSON_CONNECTION */
94989 DIO_PUT(uint32, &dout, &field_addr, real_packet->id32);
94990#ifdef FREECIV_JSON_CONNECTION
94991 field_addr.name = "granary_size";
94992#endif /* FREECIV_JSON_CONNECTION */
94993 DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_size);
94994#ifdef FREECIV_JSON_CONNECTION
94995 field_addr.name = "granary_turns";
94996#endif /* FREECIV_JSON_CONNECTION */
94997 DIO_PUT(sint16, &dout, &field_addr, real_packet->granary_turns);
94998
94999#endif
95000 SEND_PACKET_END(PACKET_WEB_CITY_INFO_ADDITION);
95001}
95002
95003#ifdef FREECIV_DELTA_PROTOCOL
95004static genhash_val_t hash_packet_web_city_info_addition_101(const void *vkey)
95005{
95006 const struct packet_web_city_info_addition *key = (const struct packet_web_city_info_addition *) vkey;
95007
95008 return key->id16;
95009}
95010
95011static bool cmp_packet_web_city_info_addition_101(const void *vkey1, const void *vkey2)
95012{
95013 const struct packet_web_city_info_addition *key1 = (const struct packet_web_city_info_addition *) vkey1;
95014 const struct packet_web_city_info_addition *key2 = (const struct packet_web_city_info_addition *) vkey2;
95015
95016 return key1->id16 == key2->id16;
95017}
95018 BV_DEFINE(packet_web_city_info_addition_101_fields, 2);
95019#endif /* FREECIV_DELTA_PROTOCOL */
95020
95021 static struct packet_web_city_info_addition *receive_packet_web_city_info_addition_101(struct connection *pc)
95022{
95023#ifdef FREECIV_DELTA_PROTOCOL
95024 packet_web_city_info_addition_101_fields fields;
95025 struct packet_web_city_info_addition *old;
95026 struct genhash **hash = pc->phs.received + PACKET_WEB_CITY_INFO_ADDITION;
95027#endif /* FREECIV_DELTA_PROTOCOL */
95028 RECEIVE_PACKET_START(packet_web_city_info_addition, real_packet);
95029#ifdef FREECIV_JSON_CONNECTION
95030 struct plocation field_addr;
95031 {
95032 struct plocation *field_addr_tmp = plocation_field_new(NULL);
95033 field_addr = *field_addr_tmp;
95034 FC_FREE(field_addr_tmp);
95035 }
95036#endif /* FREECIV_JSON_CONNECTION */
95037
95038#ifdef FREECIV_DELTA_PROTOCOL
95039#ifdef FREECIV_JSON_CONNECTION
95040 field_addr.name = "fields";
95041#endif /* FREECIV_JSON_CONNECTION */
95042 DIO_BV_GET(&din, &field_addr, fields);
95043 #ifdef FREECIV_JSON_CONNECTION
95044 field_addr.name = "id16";
95045 #endif /* FREECIV_JSON_CONNECTION */
95046 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
95047 RECEIVE_PACKET_FIELD_ERROR(id16);
95048 }
95049
95050#else /* FREECIV_DELTA_PROTOCOL */
95051 #ifdef FREECIV_JSON_CONNECTION
95052 field_addr.name = "id16";
95053 #endif /* FREECIV_JSON_CONNECTION */
95054 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id16)) {
95055 RECEIVE_PACKET_FIELD_ERROR(id16);
95056 }
95057 #ifdef FREECIV_JSON_CONNECTION
95058 field_addr.name = "granary_size";
95059 #endif /* FREECIV_JSON_CONNECTION */
95060 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_size)) {
95061 RECEIVE_PACKET_FIELD_ERROR(granary_size);
95062 }
95063 #ifdef FREECIV_JSON_CONNECTION
95064 field_addr.name = "granary_turns";
95065 #endif /* FREECIV_JSON_CONNECTION */
95066 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->granary_turns)) {
95067 RECEIVE_PACKET_FIELD_ERROR(granary_turns);
95068 }
95069
95070#endif
95071 log_packet_detailed("packet_web_city_info_addition_101: got info about (%d)",
95072 real_packet->id16);
95073
95074#ifdef FREECIV_DELTA_PROTOCOL
95075 if (NULL == *hash) {
95076 *hash = genhash_new_full(hash_packet_web_city_info_addition_101, cmp_packet_web_city_info_addition_101,
95077 NULL, NULL, NULL, free);
95078 }
95079
95080 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
95081 *real_packet = *old;
95082 } else {
95083 int id16 = real_packet->id16;
95084
95085 log_packet_detailed(" no old info");
95086 memset(real_packet, 0, sizeof(*real_packet));
95087
95088 real_packet->id16 = id16;
95089 }
95090
95091 if (BV_ISSET(fields, 0)) {
95092 log_packet_detailed(" got field 'granary_size'");
95093 #ifdef FREECIV_JSON_CONNECTION
95094 field_addr.name = "granary_size";
95095 #endif /* FREECIV_JSON_CONNECTION */
95096 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_size)) {
95097 RECEIVE_PACKET_FIELD_ERROR(granary_size);
95098 }
95099 }
95100 if (BV_ISSET(fields, 1)) {
95101 log_packet_detailed(" got field 'granary_turns'");
95102 #ifdef FREECIV_JSON_CONNECTION
95103 field_addr.name = "granary_turns";
95104 #endif /* FREECIV_JSON_CONNECTION */
95105 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->granary_turns)) {
95106 RECEIVE_PACKET_FIELD_ERROR(granary_turns);
95107 }
95108 }
95109
95110 if (NULL == old) {
95111 old = fc_malloc(sizeof(*old));
95112 *old = *real_packet;
95113 genhash_insert(*hash, old, old);
95114 } else {
95115 *old = *real_packet;
95116 }
95117
95118 hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
95119 if (NULL != *hash) {
95120 genhash_remove(*hash, real_packet);
95121 }
95122
95123#endif /* FREECIV_DELTA_PROTOCOL */
95124 RECEIVE_PACKET_END(real_packet);
95125}
95126
95127 static int send_packet_web_city_info_addition_101(struct connection *pc, const struct packet_web_city_info_addition *packet, bool force_to_send)
95128{
95129 const struct packet_web_city_info_addition *real_packet = packet;
95130#ifdef FREECIV_DELTA_PROTOCOL
95131 packet_web_city_info_addition_101_fields fields;
95132 struct packet_web_city_info_addition *old;
95133 bool differ;
95134 struct genhash **hash = pc->phs.sent + PACKET_WEB_CITY_INFO_ADDITION;
95135 int different = force_to_send;
95136#endif /* FREECIV_DELTA_PROTOCOL */
95137 SEND_PACKET_START(PACKET_WEB_CITY_INFO_ADDITION);
95138#ifdef FREECIV_JSON_CONNECTION
95139 struct plocation field_addr;
95140 {
95141 struct plocation *field_addr_tmp = plocation_field_new(NULL);
95142 field_addr = *field_addr_tmp;
95143 FC_FREE(field_addr_tmp);
95144 }
95145#endif /* FREECIV_JSON_CONNECTION */
95146
95147 log_packet_detailed("packet_web_city_info_addition_101: sending info about (%d)",
95148 real_packet->id16);
95149
95150#ifdef FREECIV_DELTA_PROTOCOL
95151 if (NULL == *hash) {
95152 *hash = genhash_new_full(hash_packet_web_city_info_addition_101, cmp_packet_web_city_info_addition_101,
95153 NULL, NULL, NULL, free);
95154 }
95155 BV_CLR_ALL(fields);
95156
95157 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
95158 old = fc_malloc(sizeof(*old));
95159 *old = *real_packet;
95160 genhash_insert(*hash, old, old);
95161 memset(old, 0, sizeof(*old));
95162 different = 1; /* Force to send. */
95163 }
95164 differ = (old->granary_size != real_packet->granary_size);
95165 if (differ) {
95166 different++;
95167 BV_SET(fields, 0);
95168 }
95169
95170 differ = (old->granary_turns != real_packet->granary_turns);
95171 if (differ) {
95172 different++;
95173 BV_SET(fields, 1);
95174 }
95175
95176
95177 if (different == 0) {
95178 log_packet_detailed(" no change -> discard");
95179 return 0;
95180 }
95181
95182#ifdef FREECIV_JSON_CONNECTION
95183 field_addr.name = "fields";
95184#endif /* FREECIV_JSON_CONNECTION */
95185 DIO_BV_PUT(&dout, &field_addr, fields);
95186#ifdef FREECIV_JSON_CONNECTION
95187 field_addr.name = "id16";
95188#endif /* FREECIV_JSON_CONNECTION */
95189 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
95190
95191 if (BV_ISSET(fields, 0)) {
95192 log_packet_detailed(" field 'granary_size' has changed");
95193 #ifdef FREECIV_JSON_CONNECTION
95194 field_addr.name = "granary_size";
95195#endif /* FREECIV_JSON_CONNECTION */
95196 DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_size);
95197 }
95198 if (BV_ISSET(fields, 1)) {
95199 log_packet_detailed(" field 'granary_turns' has changed");
95200 #ifdef FREECIV_JSON_CONNECTION
95201 field_addr.name = "granary_turns";
95202#endif /* FREECIV_JSON_CONNECTION */
95203 DIO_PUT(sint16, &dout, &field_addr, real_packet->granary_turns);
95204 }
95205
95206 *old = *real_packet;
95207
95208 hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
95209 if (NULL != *hash) {
95210 genhash_remove(*hash, real_packet);
95211 }
95212#endif /* FREECIV_DELTA_PROTOCOL */
95213#ifndef FREECIV_DELTA_PROTOCOL
95214#ifdef FREECIV_JSON_CONNECTION
95215 field_addr.name = "id16";
95216#endif /* FREECIV_JSON_CONNECTION */
95217 DIO_PUT(uint16, &dout, &field_addr, real_packet->id16);
95218#ifdef FREECIV_JSON_CONNECTION
95219 field_addr.name = "granary_size";
95220#endif /* FREECIV_JSON_CONNECTION */
95221 DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_size);
95222#ifdef FREECIV_JSON_CONNECTION
95223 field_addr.name = "granary_turns";
95224#endif /* FREECIV_JSON_CONNECTION */
95225 DIO_PUT(sint16, &dout, &field_addr, real_packet->granary_turns);
95226
95227#endif
95228 SEND_PACKET_END(PACKET_WEB_CITY_INFO_ADDITION);
95229}
95230
95231 int send_packet_web_city_info_addition(struct connection *pc, const struct packet_web_city_info_addition *packet, bool force_to_send)
95232{
95233 if (!pc->used) {
95234 log_error("WARNING: trying to send data to the closed connection %s",
95235 conn_description(pc));
95236 return -1;
95237 }
95238 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WEB_CITY_INFO_ADDITION].force_to_send != NULL, -1,
95239 "Handler for PACKET_WEB_CITY_INFO_ADDITION not installed");
95240 return pc->phs.handlers->send[PACKET_WEB_CITY_INFO_ADDITION].force_to_send(pc, packet, force_to_send);
95241}
95242
95243 void lsend_packet_web_city_info_addition(struct conn_list *dest, const struct packet_web_city_info_addition *packet, bool force_to_send)
95244{
95245 conn_list_iterate(dest, pconn) {
95246 send_packet_web_city_info_addition(pconn, packet, force_to_send);
95247 } conn_list_iterate_end;
95248}
95249
95250#ifdef FREECIV_DELTA_PROTOCOL
95251static genhash_val_t hash_packet_web_player_info_addition_100(const void *vkey)
95252{
95253 const struct packet_web_player_info_addition *key = (const struct packet_web_player_info_addition *) vkey;
95254
95255 return key->playerno;
95256}
95257
95258static bool cmp_packet_web_player_info_addition_100(const void *vkey1, const void *vkey2)
95259{
95260 const struct packet_web_player_info_addition *key1 = (const struct packet_web_player_info_addition *) vkey1;
95261 const struct packet_web_player_info_addition *key2 = (const struct packet_web_player_info_addition *) vkey2;
95262
95263 return key1->playerno == key2->playerno;
95264}
95265 BV_DEFINE(packet_web_player_info_addition_100_fields, 1);
95266#endif /* FREECIV_DELTA_PROTOCOL */
95267
95268 static struct packet_web_player_info_addition *receive_packet_web_player_info_addition_100(struct connection *pc)
95269{
95270#ifdef FREECIV_DELTA_PROTOCOL
95271 packet_web_player_info_addition_100_fields fields;
95272 struct packet_web_player_info_addition *old;
95273 struct genhash **hash = pc->phs.received + PACKET_WEB_PLAYER_INFO_ADDITION;
95274#endif /* FREECIV_DELTA_PROTOCOL */
95275 RECEIVE_PACKET_START(packet_web_player_info_addition, real_packet);
95276#ifdef FREECIV_JSON_CONNECTION
95277 struct plocation field_addr;
95278 {
95279 struct plocation *field_addr_tmp = plocation_field_new(NULL);
95280 field_addr = *field_addr_tmp;
95281 FC_FREE(field_addr_tmp);
95282 }
95283#endif /* FREECIV_JSON_CONNECTION */
95284
95285#ifdef FREECIV_DELTA_PROTOCOL
95286#ifdef FREECIV_JSON_CONNECTION
95287 field_addr.name = "fields";
95288#endif /* FREECIV_JSON_CONNECTION */
95289 DIO_BV_GET(&din, &field_addr, fields);
95290 #ifdef FREECIV_JSON_CONNECTION
95291 field_addr.name = "playerno";
95292 #endif /* FREECIV_JSON_CONNECTION */
95293 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->playerno)) {
95294 RECEIVE_PACKET_FIELD_ERROR(playerno);
95295 }
95296
95297#else /* FREECIV_DELTA_PROTOCOL */
95298 #ifdef FREECIV_JSON_CONNECTION
95299 field_addr.name = "playerno";
95300 #endif /* FREECIV_JSON_CONNECTION */
95301 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->playerno)) {
95302 RECEIVE_PACKET_FIELD_ERROR(playerno);
95303 }
95304 #ifdef FREECIV_JSON_CONNECTION
95305 field_addr.name = "expected_income";
95306 #endif /* FREECIV_JSON_CONNECTION */
95307 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->expected_income)) {
95308 RECEIVE_PACKET_FIELD_ERROR(expected_income);
95309 }
95310
95311#endif
95312 log_packet_detailed("packet_web_player_info_addition_100: got info about (%d)",
95313 real_packet->playerno);
95314
95315#ifdef FREECIV_DELTA_PROTOCOL
95316 if (NULL == *hash) {
95317 *hash = genhash_new_full(hash_packet_web_player_info_addition_100, cmp_packet_web_player_info_addition_100,
95318 NULL, NULL, NULL, free);
95319 }
95320
95321 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
95322 *real_packet = *old;
95323 } else {
95324 int playerno = real_packet->playerno;
95325
95326 log_packet_detailed(" no old info");
95327 memset(real_packet, 0, sizeof(*real_packet));
95328
95329 real_packet->playerno = playerno;
95330 }
95331
95332 if (BV_ISSET(fields, 0)) {
95333 log_packet_detailed(" got field 'expected_income'");
95334 #ifdef FREECIV_JSON_CONNECTION
95335 field_addr.name = "expected_income";
95336 #endif /* FREECIV_JSON_CONNECTION */
95337 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->expected_income)) {
95338 RECEIVE_PACKET_FIELD_ERROR(expected_income);
95339 }
95340 }
95341
95342 if (NULL == old) {
95343 old = fc_malloc(sizeof(*old));
95344 *old = *real_packet;
95345 genhash_insert(*hash, old, old);
95346 } else {
95347 *old = *real_packet;
95348 }
95349
95350#endif /* FREECIV_DELTA_PROTOCOL */
95351 RECEIVE_PACKET_END(real_packet);
95352}
95353
95354 static int send_packet_web_player_info_addition_100(struct connection *pc, const struct packet_web_player_info_addition *packet)
95355{
95356 const struct packet_web_player_info_addition *real_packet = packet;
95357#ifdef FREECIV_DELTA_PROTOCOL
95358 packet_web_player_info_addition_100_fields fields;
95359 struct packet_web_player_info_addition *old;
95360 bool differ;
95361 struct genhash **hash = pc->phs.sent + PACKET_WEB_PLAYER_INFO_ADDITION;
95362 int different = 0;
95363#endif /* FREECIV_DELTA_PROTOCOL */
95364 SEND_PACKET_START(PACKET_WEB_PLAYER_INFO_ADDITION);
95365#ifdef FREECIV_JSON_CONNECTION
95366 struct plocation field_addr;
95367 {
95368 struct plocation *field_addr_tmp = plocation_field_new(NULL);
95369 field_addr = *field_addr_tmp;
95370 FC_FREE(field_addr_tmp);
95371 }
95372#endif /* FREECIV_JSON_CONNECTION */
95373
95374 log_packet_detailed("packet_web_player_info_addition_100: sending info about (%d)",
95375 real_packet->playerno);
95376
95377#ifdef FREECIV_DELTA_PROTOCOL
95378 if (NULL == *hash) {
95379 *hash = genhash_new_full(hash_packet_web_player_info_addition_100, cmp_packet_web_player_info_addition_100,
95380 NULL, NULL, NULL, free);
95381 }
95382 BV_CLR_ALL(fields);
95383
95384 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
95385 old = fc_malloc(sizeof(*old));
95386 *old = *real_packet;
95387 genhash_insert(*hash, old, old);
95388 memset(old, 0, sizeof(*old));
95389 different = 1; /* Force to send. */
95390 }
95391 differ = (old->expected_income != real_packet->expected_income);
95392 if (differ) {
95393 different++;
95394 BV_SET(fields, 0);
95395 }
95396
95397
95398 if (different == 0) {
95399 log_packet_detailed(" no change -> discard");
95400 return 0;
95401 }
95402
95403#ifdef FREECIV_JSON_CONNECTION
95404 field_addr.name = "fields";
95405#endif /* FREECIV_JSON_CONNECTION */
95406 DIO_BV_PUT(&dout, &field_addr, fields);
95407#ifdef FREECIV_JSON_CONNECTION
95408 field_addr.name = "playerno";
95409#endif /* FREECIV_JSON_CONNECTION */
95410 DIO_PUT(uint16, &dout, &field_addr, real_packet->playerno);
95411
95412 if (BV_ISSET(fields, 0)) {
95413 log_packet_detailed(" field 'expected_income' has changed");
95414 #ifdef FREECIV_JSON_CONNECTION
95415 field_addr.name = "expected_income";
95416#endif /* FREECIV_JSON_CONNECTION */
95417 DIO_PUT(uint32, &dout, &field_addr, real_packet->expected_income);
95418 }
95419
95420 *old = *real_packet;
95421#endif /* FREECIV_DELTA_PROTOCOL */
95422#ifndef FREECIV_DELTA_PROTOCOL
95423#ifdef FREECIV_JSON_CONNECTION
95424 field_addr.name = "playerno";
95425#endif /* FREECIV_JSON_CONNECTION */
95426 DIO_PUT(uint16, &dout, &field_addr, real_packet->playerno);
95427#ifdef FREECIV_JSON_CONNECTION
95428 field_addr.name = "expected_income";
95429#endif /* FREECIV_JSON_CONNECTION */
95430 DIO_PUT(uint32, &dout, &field_addr, real_packet->expected_income);
95431
95432#endif
95433 SEND_PACKET_END(PACKET_WEB_PLAYER_INFO_ADDITION);
95434}
95435
95436 int send_packet_web_player_info_addition(struct connection *pc, const struct packet_web_player_info_addition *packet)
95437{
95438 if (!pc->used) {
95439 log_error("WARNING: trying to send data to the closed connection %s",
95440 conn_description(pc));
95441 return -1;
95442 }
95443 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WEB_PLAYER_INFO_ADDITION].packet != NULL, -1,
95444 "Handler for PACKET_WEB_PLAYER_INFO_ADDITION not installed");
95445 return pc->phs.handlers->send[PACKET_WEB_PLAYER_INFO_ADDITION].packet(pc, packet);
95446}
95447
95448#ifdef FREECIV_DELTA_PROTOCOL
95449static genhash_val_t hash_packet_web_ruleset_unit_addition_100(const void *vkey)
95450{
95451 const struct packet_web_ruleset_unit_addition *key = (const struct packet_web_ruleset_unit_addition *) vkey;
95452
95453 return key->id;
95454}
95455
95456static bool cmp_packet_web_ruleset_unit_addition_100(const void *vkey1, const void *vkey2)
95457{
95458 const struct packet_web_ruleset_unit_addition *key1 = (const struct packet_web_ruleset_unit_addition *) vkey1;
95459 const struct packet_web_ruleset_unit_addition *key2 = (const struct packet_web_ruleset_unit_addition *) vkey2;
95460
95461 return key1->id == key2->id;
95462}
95463 BV_DEFINE(packet_web_ruleset_unit_addition_100_fields, 1);
95464#endif /* FREECIV_DELTA_PROTOCOL */
95465
95466 static struct packet_web_ruleset_unit_addition *receive_packet_web_ruleset_unit_addition_100(struct connection *pc)
95467{
95468#ifdef FREECIV_DELTA_PROTOCOL
95469 packet_web_ruleset_unit_addition_100_fields fields;
95470 struct packet_web_ruleset_unit_addition *old;
95471 struct genhash **hash = pc->phs.received + PACKET_WEB_RULESET_UNIT_ADDITION;
95472#endif /* FREECIV_DELTA_PROTOCOL */
95473 RECEIVE_PACKET_START(packet_web_ruleset_unit_addition, real_packet);
95474#ifdef FREECIV_JSON_CONNECTION
95475 struct plocation field_addr;
95476 {
95477 struct plocation *field_addr_tmp = plocation_field_new(NULL);
95478 field_addr = *field_addr_tmp;
95479 FC_FREE(field_addr_tmp);
95480 }
95481#endif /* FREECIV_JSON_CONNECTION */
95482
95483#ifdef FREECIV_DELTA_PROTOCOL
95484#ifdef FREECIV_JSON_CONNECTION
95485 field_addr.name = "fields";
95486#endif /* FREECIV_JSON_CONNECTION */
95487 DIO_BV_GET(&din, &field_addr, fields);
95488 #ifdef FREECIV_JSON_CONNECTION
95489 field_addr.name = "id";
95490 #endif /* FREECIV_JSON_CONNECTION */
95491 {
95492 int readin;
95493
95494 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
95495 RECEIVE_PACKET_FIELD_ERROR(id);
95496 }
95497 real_packet->id = readin;
95498 }
95499
95500#else /* FREECIV_DELTA_PROTOCOL */
95501 #ifdef FREECIV_JSON_CONNECTION
95502 field_addr.name = "id";
95503 #endif /* FREECIV_JSON_CONNECTION */
95504 {
95505 int readin;
95506
95507 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
95508 RECEIVE_PACKET_FIELD_ERROR(id);
95509 }
95510 real_packet->id = readin;
95511 }
95512 #ifdef FREECIV_JSON_CONNECTION
95513 field_addr.name = "utype_actions";
95514 #endif /* FREECIV_JSON_CONNECTION */
95515 if (!DIO_BV_GET(&din, &field_addr, real_packet->utype_actions)) {
95516 RECEIVE_PACKET_FIELD_ERROR(utype_actions);
95517 }
95518
95519#endif
95520 log_packet_detailed("packet_web_ruleset_unit_addition_100: got info about (%d)",
95521 real_packet->id);
95522
95523#ifdef FREECIV_DELTA_PROTOCOL
95524 if (NULL == *hash) {
95525 *hash = genhash_new_full(hash_packet_web_ruleset_unit_addition_100, cmp_packet_web_ruleset_unit_addition_100,
95526 NULL, NULL, NULL, free);
95527 }
95528
95529 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
95530 *real_packet = *old;
95531 } else {
95532 Unit_type_id id = real_packet->id;
95533
95534 log_packet_detailed(" no old info");
95535 memset(real_packet, 0, sizeof(*real_packet));
95536
95537 real_packet->id = id;
95538 }
95539
95540 if (BV_ISSET(fields, 0)) {
95541 log_packet_detailed(" got field 'utype_actions'");
95542 #ifdef FREECIV_JSON_CONNECTION
95543 field_addr.name = "utype_actions";
95544 #endif /* FREECIV_JSON_CONNECTION */
95545 if (!DIO_BV_GET(&din, &field_addr, real_packet->utype_actions)) {
95546 RECEIVE_PACKET_FIELD_ERROR(utype_actions);
95547 }
95548 }
95549
95550 if (NULL == old) {
95551 old = fc_malloc(sizeof(*old));
95552 *old = *real_packet;
95553 genhash_insert(*hash, old, old);
95554 } else {
95555 *old = *real_packet;
95556 }
95557
95558#endif /* FREECIV_DELTA_PROTOCOL */
95559 RECEIVE_PACKET_END(real_packet);
95560}
95561
95562 static int send_packet_web_ruleset_unit_addition_100(struct connection *pc, const struct packet_web_ruleset_unit_addition *packet)
95563{
95564 const struct packet_web_ruleset_unit_addition *real_packet = packet;
95565#ifdef FREECIV_DELTA_PROTOCOL
95566 packet_web_ruleset_unit_addition_100_fields fields;
95567 struct packet_web_ruleset_unit_addition *old;
95568 bool differ;
95569 struct genhash **hash = pc->phs.sent + PACKET_WEB_RULESET_UNIT_ADDITION;
95570#endif /* FREECIV_DELTA_PROTOCOL */
95571 SEND_PACKET_START(PACKET_WEB_RULESET_UNIT_ADDITION);
95572#ifdef FREECIV_JSON_CONNECTION
95573 struct plocation field_addr;
95574 {
95575 struct plocation *field_addr_tmp = plocation_field_new(NULL);
95576 field_addr = *field_addr_tmp;
95577 FC_FREE(field_addr_tmp);
95578 }
95579#endif /* FREECIV_JSON_CONNECTION */
95580
95581 log_packet_detailed("packet_web_ruleset_unit_addition_100: sending info about (%d)",
95582 real_packet->id);
95583
95584#ifdef FREECIV_DELTA_PROTOCOL
95585 if (NULL == *hash) {
95586 *hash = genhash_new_full(hash_packet_web_ruleset_unit_addition_100, cmp_packet_web_ruleset_unit_addition_100,
95587 NULL, NULL, NULL, free);
95588 }
95589 BV_CLR_ALL(fields);
95590
95591 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
95592 old = fc_malloc(sizeof(*old));
95593 *old = *real_packet;
95594 genhash_insert(*hash, old, old);
95595 memset(old, 0, sizeof(*old));
95596 }
95597 differ = !BV_ARE_EQUAL(old->utype_actions, real_packet->utype_actions);
95598 if (differ) {
95599 BV_SET(fields, 0);
95600 }
95601
95602
95603#ifdef FREECIV_JSON_CONNECTION
95604 field_addr.name = "fields";
95605#endif /* FREECIV_JSON_CONNECTION */
95606 DIO_BV_PUT(&dout, &field_addr, fields);
95607#ifdef FREECIV_JSON_CONNECTION
95608 field_addr.name = "id";
95609#endif /* FREECIV_JSON_CONNECTION */
95610 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
95611
95612 if (BV_ISSET(fields, 0)) {
95613 log_packet_detailed(" field 'utype_actions' has changed");
95614 #ifdef FREECIV_JSON_CONNECTION
95615 field_addr.name = "utype_actions";
95616#endif /* FREECIV_JSON_CONNECTION */
95617 DIO_BV_PUT(&dout, &field_addr, packet->utype_actions);
95618 }
95619
95620 *old = *real_packet;
95621#endif /* FREECIV_DELTA_PROTOCOL */
95622#ifndef FREECIV_DELTA_PROTOCOL
95623#ifdef FREECIV_JSON_CONNECTION
95624 field_addr.name = "id";
95625#endif /* FREECIV_JSON_CONNECTION */
95626 DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
95627#ifdef FREECIV_JSON_CONNECTION
95628 field_addr.name = "utype_actions";
95629#endif /* FREECIV_JSON_CONNECTION */
95630 DIO_BV_PUT(&dout, &field_addr, packet->utype_actions);
95631
95632#endif
95633 SEND_PACKET_END(PACKET_WEB_RULESET_UNIT_ADDITION);
95634}
95635
95636 int send_packet_web_ruleset_unit_addition(struct connection *pc, const struct packet_web_ruleset_unit_addition *packet)
95637{
95638 if (!pc->used) {
95639 log_error("WARNING: trying to send data to the closed connection %s",
95640 conn_description(pc));
95641 return -1;
95642 }
95643 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WEB_RULESET_UNIT_ADDITION].packet != NULL, -1,
95644 "Handler for PACKET_WEB_RULESET_UNIT_ADDITION not installed");
95645 return pc->phs.handlers->send[PACKET_WEB_RULESET_UNIT_ADDITION].packet(pc, packet);
95646}
95647
95648 void lsend_packet_web_ruleset_unit_addition(struct conn_list *dest, const struct packet_web_ruleset_unit_addition *packet)
95649{
95650 conn_list_iterate(dest, pconn) {
95651 send_packet_web_ruleset_unit_addition(pconn, packet);
95652 } conn_list_iterate_end;
95653}
95654
95655 void packet_handlers_fill_initial(struct packet_handlers *phandlers)
95656{
95657 fc_assert_msg(has_capability("ids32", our_capability),
95658 "Packets have support for unknown 'ids32' capability!");
95659 fc_assert_msg(has_capability("city-original", our_capability),
95660 "Packets have support for unknown 'city-original' capability!");
95661 fc_assert_msg(has_capability("rsdesc32", our_capability),
95662 "Packets have support for unknown 'rsdesc32' capability!");
95663 phandlers->send[PACKET_PLAYER_ATTRIBUTE_CHUNK].packet = (int(*)(struct connection *, const void *)) send_packet_player_attribute_chunk_100;
95664 phandlers->receive[PACKET_PLAYER_ATTRIBUTE_CHUNK] = (void *(*)(struct connection *)) receive_packet_player_attribute_chunk_100;
95665 phandlers->send[PACKET_EDIT_STARTPOS].packet = (int(*)(struct connection *, const void *)) send_packet_edit_startpos_100;
95666 phandlers->receive[PACKET_EDIT_STARTPOS] = (void *(*)(struct connection *)) receive_packet_edit_startpos_100;
95667 phandlers->send[PACKET_EDIT_STARTPOS_FULL].packet = (int(*)(struct connection *, const void *)) send_packet_edit_startpos_full_100;
95668 phandlers->receive[PACKET_EDIT_STARTPOS_FULL] = (void *(*)(struct connection *)) receive_packet_edit_startpos_full_100;
95669 if (is_server()) {
95670 phandlers->send[PACKET_PROCESSING_STARTED].no_packet = (int(*)(struct connection *)) send_packet_processing_started_100;
95671 phandlers->send[PACKET_PROCESSING_FINISHED].no_packet = (int(*)(struct connection *)) send_packet_processing_finished_100;
95672 phandlers->send[PACKET_SERVER_JOIN_REPLY].packet = (int(*)(struct connection *, const void *)) send_packet_server_join_reply_100;
95673 phandlers->send[PACKET_AUTHENTICATION_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_authentication_req_100;
95674 phandlers->send[PACKET_SERVER_SHUTDOWN].no_packet = (int(*)(struct connection *)) send_packet_server_shutdown_100;
95675 phandlers->send[PACKET_ENDGAME_REPORT].packet = (int(*)(struct connection *, const void *)) send_packet_endgame_report_100;
95676 phandlers->send[PACKET_ENDGAME_PLAYER].packet = (int(*)(struct connection *, const void *)) send_packet_endgame_player_100;
95677 phandlers->send[PACKET_GAME_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_game_info_100;
95678 phandlers->send[PACKET_CALENDAR_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_calendar_info_100;
95679 phandlers->send[PACKET_TIMEOUT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_timeout_info_100;
95680 phandlers->send[PACKET_MAP_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_map_info_100;
95681 phandlers->send[PACKET_NUKE_TILE_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_nuke_tile_info_100;
95682 phandlers->send[PACKET_TEAM_NAME_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_team_name_info_100;
95683 phandlers->send[PACKET_ACHIEVEMENT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_achievement_info_100;
95684 phandlers->send[PACKET_CHAT_MSG].packet = (int(*)(struct connection *, const void *)) send_packet_chat_msg_100;
95685 phandlers->send[PACKET_EARLY_CHAT_MSG].packet = (int(*)(struct connection *, const void *)) send_packet_early_chat_msg_100;
95686 phandlers->send[PACKET_CONNECT_MSG].packet = (int(*)(struct connection *, const void *)) send_packet_connect_msg_100;
95687 phandlers->send[PACKET_SERVER_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_server_info_100;
95688 phandlers->send[PACKET_PLAYER_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_player_remove_100;
95689 phandlers->send[PACKET_PLAYER_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_player_info_100;
95690 phandlers->send[PACKET_PLAYER_DIPLSTATE].packet = (int(*)(struct connection *, const void *)) send_packet_player_diplstate_100;
95691 phandlers->send[PACKET_RESEARCH_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_research_info_100;
95692 phandlers->send[PACKET_UNKNOWN_RESEARCH].packet = (int(*)(struct connection *, const void *)) send_packet_unknown_research_100;
95693 phandlers->send[PACKET_DIPLOMACY_INIT_MEETING].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_init_meeting_100;
95694 phandlers->send[PACKET_DIPLOMACY_CANCEL_MEETING].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_cancel_meeting_100;
95695 phandlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_create_clause_100;
95696 phandlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_remove_clause_100;
95697 phandlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_accept_treaty_100;
95698 phandlers->send[PACKET_PAGE_MSG].packet = (int(*)(struct connection *, const void *)) send_packet_page_msg_100;
95699 phandlers->send[PACKET_PAGE_MSG_PART].packet = (int(*)(struct connection *, const void *)) send_packet_page_msg_part_100;
95700 phandlers->send[PACKET_CONN_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_conn_info_100;
95701 phandlers->send[PACKET_CONN_PING_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_conn_ping_info_100;
95702 phandlers->send[PACKET_CONN_PING].no_packet = (int(*)(struct connection *)) send_packet_conn_ping_100;
95703 phandlers->send[PACKET_END_PHASE].no_packet = (int(*)(struct connection *)) send_packet_end_phase_100;
95704 phandlers->send[PACKET_START_PHASE].packet = (int(*)(struct connection *, const void *)) send_packet_start_phase_100;
95705 phandlers->send[PACKET_NEW_YEAR].packet = (int(*)(struct connection *, const void *)) send_packet_new_year_100;
95706 phandlers->send[PACKET_BEGIN_TURN].no_packet = (int(*)(struct connection *)) send_packet_begin_turn_100;
95707 phandlers->send[PACKET_END_TURN].no_packet = (int(*)(struct connection *)) send_packet_end_turn_100;
95708 phandlers->send[PACKET_FREEZE_CLIENT].no_packet = (int(*)(struct connection *)) send_packet_freeze_client_100;
95709 phandlers->send[PACKET_THAW_CLIENT].no_packet = (int(*)(struct connection *)) send_packet_thaw_client_100;
95710 phandlers->send[PACKET_SPACESHIP_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_spaceship_info_100;
95711 phandlers->send[PACKET_RULESET_UNIT].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_100;
95712 phandlers->send[PACKET_RULESET_UNIT_BONUS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_bonus_100;
95713 phandlers->send[PACKET_RULESET_UNIT_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_flag_100;
95714 phandlers->send[PACKET_RULESET_UNIT_CLASS_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_class_flag_100;
95715 phandlers->send[PACKET_RULESET_GAME].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_game_100;
95716 phandlers->send[PACKET_RULESET_SPECIALIST].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_specialist_100;
95717 phandlers->send[PACKET_RULESET_GOVERNMENT_RULER_TITLE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_government_ruler_title_100;
95718 phandlers->send[PACKET_RULESET_TECH].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_tech_100;
95719 phandlers->send[PACKET_RULESET_TECH_CLASS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_tech_class_100;
95720 phandlers->send[PACKET_RULESET_TECH_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_tech_flag_100;
95721 phandlers->send[PACKET_RULESET_GOVERNMENT].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_government_100;
95722 phandlers->send[PACKET_RULESET_TERRAIN_CONTROL].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_terrain_control_100;
95723 phandlers->send[PACKET_RULESETS_READY].no_packet = (int(*)(struct connection *)) send_packet_rulesets_ready_100;
95724 phandlers->send[PACKET_RULESET_NATION_SETS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_nation_sets_100;
95725 phandlers->send[PACKET_RULESET_NATION_GROUPS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_nation_groups_100;
95726 phandlers->send[PACKET_RULESET_NATION].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_nation_100;
95727 phandlers->send[PACKET_NATION_AVAILABILITY].packet = (int(*)(struct connection *, const void *)) send_packet_nation_availability_100;
95728 phandlers->send[PACKET_RULESET_STYLE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_style_100;
95729 phandlers->send[PACKET_RULESET_CITY].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_city_100;
95730 phandlers->send[PACKET_RULESET_BUILDING].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_building_100;
95731 phandlers->send[PACKET_RULESET_TERRAIN].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_terrain_100;
95732 phandlers->send[PACKET_RULESET_TERRAIN_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_terrain_flag_100;
95733 phandlers->send[PACKET_RULESET_UNIT_CLASS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_class_100;
95734 phandlers->send[PACKET_RULESET_EXTRA].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_extra_100;
95735 phandlers->send[PACKET_RULESET_EXTRA_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_extra_flag_100;
95736 phandlers->send[PACKET_RULESET_BASE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_base_100;
95737 phandlers->send[PACKET_RULESET_ROAD].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_road_100;
95738 phandlers->send[PACKET_RULESET_GOODS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_goods_100;
95739 phandlers->send[PACKET_RULESET_DISASTER].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_disaster_100;
95740 phandlers->send[PACKET_RULESET_ACHIEVEMENT].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_achievement_100;
95741 phandlers->send[PACKET_RULESET_TRADE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_trade_100;
95742 phandlers->send[PACKET_RULESET_ACTION].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_action_100;
95743 phandlers->send[PACKET_RULESET_ACTION_ENABLER].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_action_enabler_100;
95744 phandlers->send[PACKET_RULESET_ACTION_AUTO].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_action_auto_100;
95745 phandlers->send[PACKET_RULESET_MUSIC].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_music_100;
95746 phandlers->send[PACKET_RULESET_MULTIPLIER].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_multiplier_100;
95747 phandlers->send[PACKET_RULESET_CLAUSE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_clause_100;
95748 phandlers->send[PACKET_RULESET_SUMMARY].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_summary_100;
95749 phandlers->send[PACKET_RULESET_DESCRIPTION_PART].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_description_part_100;
95750 phandlers->send[PACKET_SINGLE_WANT_HACK_REPLY].packet = (int(*)(struct connection *, const void *)) send_packet_single_want_hack_reply_100;
95751 phandlers->send[PACKET_RULESET_CHOICES].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_choices_100;
95752 phandlers->send[PACKET_GAME_LOAD].packet = (int(*)(struct connection *, const void *)) send_packet_game_load_100;
95753 phandlers->send[PACKET_SERVER_SETTING_CONTROL].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_control_100;
95754 phandlers->send[PACKET_SERVER_SETTING_CONST].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_const_100;
95755 phandlers->send[PACKET_SERVER_SETTING_BOOL].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_bool_100;
95756 phandlers->send[PACKET_SERVER_SETTING_INT].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_int_100;
95757 phandlers->send[PACKET_SERVER_SETTING_STR].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_str_100;
95758 phandlers->send[PACKET_SERVER_SETTING_ENUM].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_enum_100;
95759 phandlers->send[PACKET_SERVER_SETTING_BITWISE].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_bitwise_100;
95760 phandlers->send[PACKET_SET_TOPOLOGY].packet = (int(*)(struct connection *, const void *)) send_packet_set_topology_100;
95761 phandlers->send[PACKET_RULESET_EFFECT].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_effect_100;
95762 phandlers->send[PACKET_RULESET_RESOURCE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_resource_100;
95763 phandlers->send[PACKET_SCENARIO_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_scenario_info_100;
95764 phandlers->send[PACKET_SCENARIO_DESCRIPTION].packet = (int(*)(struct connection *, const void *)) send_packet_scenario_description_100;
95765 phandlers->send[PACKET_VOTE_NEW].packet = (int(*)(struct connection *, const void *)) send_packet_vote_new_100;
95766 phandlers->send[PACKET_VOTE_UPDATE].packet = (int(*)(struct connection *, const void *)) send_packet_vote_update_100;
95767 phandlers->send[PACKET_VOTE_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_vote_remove_100;
95768 phandlers->send[PACKET_VOTE_RESOLVE].packet = (int(*)(struct connection *, const void *)) send_packet_vote_resolve_100;
95769 phandlers->send[PACKET_EDIT_OBJECT_CREATED].packet = (int(*)(struct connection *, const void *)) send_packet_edit_object_created_100;
95770 phandlers->send[PACKET_PLAY_MUSIC].packet = (int(*)(struct connection *, const void *)) send_packet_play_music_100;
95771 phandlers->send[PACKET_WEB_PLAYER_INFO_ADDITION].packet = (int(*)(struct connection *, const void *)) send_packet_web_player_info_addition_100;
95772 phandlers->send[PACKET_WEB_RULESET_UNIT_ADDITION].packet = (int(*)(struct connection *, const void *)) send_packet_web_ruleset_unit_addition_100;
95773 phandlers->receive[PACKET_SERVER_JOIN_REQ] = (void *(*)(struct connection *)) receive_packet_server_join_req_100;
95774 phandlers->receive[PACKET_AUTHENTICATION_REPLY] = (void *(*)(struct connection *)) receive_packet_authentication_reply_100;
95775 phandlers->receive[PACKET_NATION_SELECT_REQ] = (void *(*)(struct connection *)) receive_packet_nation_select_req_100;
95776 phandlers->receive[PACKET_PLAYER_READY] = (void *(*)(struct connection *)) receive_packet_player_ready_100;
95777 phandlers->receive[PACKET_CHAT_MSG_REQ] = (void *(*)(struct connection *)) receive_packet_chat_msg_req_100;
95778 phandlers->receive[PACKET_PLAYER_PHASE_DONE] = (void *(*)(struct connection *)) receive_packet_player_phase_done_100;
95779 phandlers->receive[PACKET_PLAYER_RATES] = (void *(*)(struct connection *)) receive_packet_player_rates_100;
95780 phandlers->receive[PACKET_PLAYER_CHANGE_GOVERNMENT] = (void *(*)(struct connection *)) receive_packet_player_change_government_100;
95781 phandlers->receive[PACKET_PLAYER_PLACE_INFRA] = (void *(*)(struct connection *)) receive_packet_player_place_infra_100;
95782 phandlers->receive[PACKET_PLAYER_ATTRIBUTE_BLOCK] = (void *(*)(struct connection *)) receive_packet_player_attribute_block_100;
95783 phandlers->receive[PACKET_PLAYER_MULTIPLIER] = (void *(*)(struct connection *)) receive_packet_player_multiplier_100;
95784 phandlers->receive[PACKET_PLAYER_RESEARCH] = (void *(*)(struct connection *)) receive_packet_player_research_100;
95785 phandlers->receive[PACKET_PLAYER_TECH_GOAL] = (void *(*)(struct connection *)) receive_packet_player_tech_goal_100;
95786 phandlers->receive[PACKET_UNIT_TYPE_UPGRADE] = (void *(*)(struct connection *)) receive_packet_unit_type_upgrade_100;
95787 phandlers->receive[PACKET_DIPLOMACY_INIT_MEETING_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_init_meeting_req_100;
95788 phandlers->receive[PACKET_DIPLOMACY_CANCEL_MEETING_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_cancel_meeting_req_100;
95789 phandlers->receive[PACKET_DIPLOMACY_CREATE_CLAUSE_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_create_clause_req_100;
95790 phandlers->receive[PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_remove_clause_req_100;
95791 phandlers->receive[PACKET_DIPLOMACY_ACCEPT_TREATY_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_accept_treaty_req_100;
95792 phandlers->receive[PACKET_DIPLOMACY_CANCEL_PACT] = (void *(*)(struct connection *)) receive_packet_diplomacy_cancel_pact_100;
95793 phandlers->receive[PACKET_REPORT_REQ] = (void *(*)(struct connection *)) receive_packet_report_req_100;
95794 phandlers->receive[PACKET_CONN_PONG] = (void *(*)(struct connection *)) receive_packet_conn_pong_100;
95795 phandlers->receive[PACKET_CLIENT_HEARTBEAT] = (void *(*)(struct connection *)) receive_packet_client_heartbeat_100;
95796 phandlers->receive[PACKET_CLIENT_INFO] = (void *(*)(struct connection *)) receive_packet_client_info_100;
95797 phandlers->receive[PACKET_SPACESHIP_LAUNCH] = (void *(*)(struct connection *)) receive_packet_spaceship_launch_100;
95798 phandlers->receive[PACKET_SPACESHIP_PLACE] = (void *(*)(struct connection *)) receive_packet_spaceship_place_100;
95799 phandlers->receive[PACKET_SINGLE_WANT_HACK_REQ] = (void *(*)(struct connection *)) receive_packet_single_want_hack_req_100;
95800 phandlers->receive[PACKET_SAVE_SCENARIO] = (void *(*)(struct connection *)) receive_packet_save_scenario_100;
95801 phandlers->receive[PACKET_VOTE_SUBMIT] = (void *(*)(struct connection *)) receive_packet_vote_submit_100;
95802 phandlers->receive[PACKET_EDIT_MODE] = (void *(*)(struct connection *)) receive_packet_edit_mode_100;
95803 phandlers->receive[PACKET_EDIT_RECALCULATE_BORDERS] = (void *(*)(struct connection *)) receive_packet_edit_recalculate_borders_100;
95804 phandlers->receive[PACKET_EDIT_CHECK_TILES] = (void *(*)(struct connection *)) receive_packet_edit_check_tiles_100;
95805 phandlers->receive[PACKET_EDIT_TOGGLE_FOGOFWAR] = (void *(*)(struct connection *)) receive_packet_edit_toggle_fogofwar_100;
95806 phandlers->receive[PACKET_EDIT_TILE_TERRAIN] = (void *(*)(struct connection *)) receive_packet_edit_tile_terrain_100;
95807 phandlers->receive[PACKET_EDIT_TILE_EXTRA] = (void *(*)(struct connection *)) receive_packet_edit_tile_extra_100;
95808 phandlers->receive[PACKET_EDIT_TILE] = (void *(*)(struct connection *)) receive_packet_edit_tile_100;
95809 phandlers->receive[PACKET_EDIT_UNIT_CREATE] = (void *(*)(struct connection *)) receive_packet_edit_unit_create_100;
95810 phandlers->receive[PACKET_EDIT_UNIT_REMOVE] = (void *(*)(struct connection *)) receive_packet_edit_unit_remove_100;
95811 phandlers->receive[PACKET_EDIT_CITY_CREATE] = (void *(*)(struct connection *)) receive_packet_edit_city_create_100;
95812 phandlers->receive[PACKET_EDIT_PLAYER_CREATE] = (void *(*)(struct connection *)) receive_packet_edit_player_create_100;
95813 phandlers->receive[PACKET_EDIT_PLAYER_REMOVE] = (void *(*)(struct connection *)) receive_packet_edit_player_remove_100;
95814 phandlers->receive[PACKET_EDIT_PLAYER] = (void *(*)(struct connection *)) receive_packet_edit_player_100;
95815 phandlers->receive[PACKET_EDIT_PLAYER_VISION] = (void *(*)(struct connection *)) receive_packet_edit_player_vision_100;
95816 phandlers->receive[PACKET_EDIT_GAME] = (void *(*)(struct connection *)) receive_packet_edit_game_100;
95817 phandlers->receive[PACKET_EDIT_SCENARIO_DESC] = (void *(*)(struct connection *)) receive_packet_edit_scenario_desc_100;
95818 } else {
95819 phandlers->send[PACKET_SERVER_JOIN_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_server_join_req_100;
95820 phandlers->send[PACKET_AUTHENTICATION_REPLY].packet = (int(*)(struct connection *, const void *)) send_packet_authentication_reply_100;
95821 phandlers->send[PACKET_NATION_SELECT_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_nation_select_req_100;
95822 phandlers->send[PACKET_PLAYER_READY].packet = (int(*)(struct connection *, const void *)) send_packet_player_ready_100;
95823 phandlers->send[PACKET_CHAT_MSG_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_chat_msg_req_100;
95824 phandlers->send[PACKET_PLAYER_PHASE_DONE].packet = (int(*)(struct connection *, const void *)) send_packet_player_phase_done_100;
95825 phandlers->send[PACKET_PLAYER_RATES].packet = (int(*)(struct connection *, const void *)) send_packet_player_rates_100;
95826 phandlers->send[PACKET_PLAYER_CHANGE_GOVERNMENT].packet = (int(*)(struct connection *, const void *)) send_packet_player_change_government_100;
95827 phandlers->send[PACKET_PLAYER_PLACE_INFRA].packet = (int(*)(struct connection *, const void *)) send_packet_player_place_infra_100;
95828 phandlers->send[PACKET_PLAYER_ATTRIBUTE_BLOCK].no_packet = (int(*)(struct connection *)) send_packet_player_attribute_block_100;
95829 phandlers->send[PACKET_PLAYER_MULTIPLIER].packet = (int(*)(struct connection *, const void *)) send_packet_player_multiplier_100;
95830 phandlers->send[PACKET_PLAYER_RESEARCH].packet = (int(*)(struct connection *, const void *)) send_packet_player_research_100;
95831 phandlers->send[PACKET_PLAYER_TECH_GOAL].packet = (int(*)(struct connection *, const void *)) send_packet_player_tech_goal_100;
95832 phandlers->send[PACKET_UNIT_TYPE_UPGRADE].packet = (int(*)(struct connection *, const void *)) send_packet_unit_type_upgrade_100;
95833 phandlers->send[PACKET_DIPLOMACY_INIT_MEETING_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_init_meeting_req_100;
95834 phandlers->send[PACKET_DIPLOMACY_CANCEL_MEETING_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_cancel_meeting_req_100;
95835 phandlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_create_clause_req_100;
95836 phandlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_remove_clause_req_100;
95837 phandlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_accept_treaty_req_100;
95838 phandlers->send[PACKET_DIPLOMACY_CANCEL_PACT].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_cancel_pact_100;
95839 phandlers->send[PACKET_REPORT_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_report_req_100;
95840 phandlers->send[PACKET_CONN_PONG].no_packet = (int(*)(struct connection *)) send_packet_conn_pong_100;
95841 phandlers->send[PACKET_CLIENT_HEARTBEAT].no_packet = (int(*)(struct connection *)) send_packet_client_heartbeat_100;
95842 phandlers->send[PACKET_CLIENT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_client_info_100;
95843 phandlers->send[PACKET_SPACESHIP_LAUNCH].no_packet = (int(*)(struct connection *)) send_packet_spaceship_launch_100;
95844 phandlers->send[PACKET_SPACESHIP_PLACE].packet = (int(*)(struct connection *, const void *)) send_packet_spaceship_place_100;
95845 phandlers->send[PACKET_SINGLE_WANT_HACK_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_single_want_hack_req_100;
95846 phandlers->send[PACKET_SAVE_SCENARIO].packet = (int(*)(struct connection *, const void *)) send_packet_save_scenario_100;
95847 phandlers->send[PACKET_VOTE_SUBMIT].packet = (int(*)(struct connection *, const void *)) send_packet_vote_submit_100;
95848 phandlers->send[PACKET_EDIT_MODE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_mode_100;
95849 phandlers->send[PACKET_EDIT_RECALCULATE_BORDERS].no_packet = (int(*)(struct connection *)) send_packet_edit_recalculate_borders_100;
95850 phandlers->send[PACKET_EDIT_CHECK_TILES].no_packet = (int(*)(struct connection *)) send_packet_edit_check_tiles_100;
95851 phandlers->send[PACKET_EDIT_TOGGLE_FOGOFWAR].packet = (int(*)(struct connection *, const void *)) send_packet_edit_toggle_fogofwar_100;
95852 phandlers->send[PACKET_EDIT_TILE_TERRAIN].packet = (int(*)(struct connection *, const void *)) send_packet_edit_tile_terrain_100;
95853 phandlers->send[PACKET_EDIT_TILE_EXTRA].packet = (int(*)(struct connection *, const void *)) send_packet_edit_tile_extra_100;
95854 phandlers->send[PACKET_EDIT_TILE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_tile_100;
95855 phandlers->send[PACKET_EDIT_UNIT_CREATE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_unit_create_100;
95856 phandlers->send[PACKET_EDIT_UNIT_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_unit_remove_100;
95857 phandlers->send[PACKET_EDIT_CITY_CREATE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_city_create_100;
95858 phandlers->send[PACKET_EDIT_PLAYER_CREATE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_player_create_100;
95859 phandlers->send[PACKET_EDIT_PLAYER_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_player_remove_100;
95860 phandlers->send[PACKET_EDIT_PLAYER].packet = (int(*)(struct connection *, const void *)) send_packet_edit_player_100;
95861 phandlers->send[PACKET_EDIT_PLAYER_VISION].packet = (int(*)(struct connection *, const void *)) send_packet_edit_player_vision_100;
95862 phandlers->send[PACKET_EDIT_GAME].packet = (int(*)(struct connection *, const void *)) send_packet_edit_game_100;
95863 phandlers->send[PACKET_EDIT_SCENARIO_DESC].packet = (int(*)(struct connection *, const void *)) send_packet_edit_scenario_desc_100;
95864 phandlers->receive[PACKET_PROCESSING_STARTED] = (void *(*)(struct connection *)) receive_packet_processing_started_100;
95865 phandlers->receive[PACKET_PROCESSING_FINISHED] = (void *(*)(struct connection *)) receive_packet_processing_finished_100;
95866 phandlers->receive[PACKET_SERVER_JOIN_REPLY] = (void *(*)(struct connection *)) receive_packet_server_join_reply_100;
95867 phandlers->receive[PACKET_AUTHENTICATION_REQ] = (void *(*)(struct connection *)) receive_packet_authentication_req_100;
95868 phandlers->receive[PACKET_SERVER_SHUTDOWN] = (void *(*)(struct connection *)) receive_packet_server_shutdown_100;
95869 phandlers->receive[PACKET_ENDGAME_REPORT] = (void *(*)(struct connection *)) receive_packet_endgame_report_100;
95870 phandlers->receive[PACKET_ENDGAME_PLAYER] = (void *(*)(struct connection *)) receive_packet_endgame_player_100;
95871 phandlers->receive[PACKET_GAME_INFO] = (void *(*)(struct connection *)) receive_packet_game_info_100;
95872 phandlers->receive[PACKET_CALENDAR_INFO] = (void *(*)(struct connection *)) receive_packet_calendar_info_100;
95873 phandlers->receive[PACKET_TIMEOUT_INFO] = (void *(*)(struct connection *)) receive_packet_timeout_info_100;
95874 phandlers->receive[PACKET_MAP_INFO] = (void *(*)(struct connection *)) receive_packet_map_info_100;
95875 phandlers->receive[PACKET_NUKE_TILE_INFO] = (void *(*)(struct connection *)) receive_packet_nuke_tile_info_100;
95876 phandlers->receive[PACKET_TEAM_NAME_INFO] = (void *(*)(struct connection *)) receive_packet_team_name_info_100;
95877 phandlers->receive[PACKET_ACHIEVEMENT_INFO] = (void *(*)(struct connection *)) receive_packet_achievement_info_100;
95878 phandlers->receive[PACKET_CHAT_MSG] = (void *(*)(struct connection *)) receive_packet_chat_msg_100;
95879 phandlers->receive[PACKET_EARLY_CHAT_MSG] = (void *(*)(struct connection *)) receive_packet_early_chat_msg_100;
95880 phandlers->receive[PACKET_CONNECT_MSG] = (void *(*)(struct connection *)) receive_packet_connect_msg_100;
95881 phandlers->receive[PACKET_SERVER_INFO] = (void *(*)(struct connection *)) receive_packet_server_info_100;
95882 phandlers->receive[PACKET_PLAYER_REMOVE] = (void *(*)(struct connection *)) receive_packet_player_remove_100;
95883 phandlers->receive[PACKET_PLAYER_INFO] = (void *(*)(struct connection *)) receive_packet_player_info_100;
95884 phandlers->receive[PACKET_PLAYER_DIPLSTATE] = (void *(*)(struct connection *)) receive_packet_player_diplstate_100;
95885 phandlers->receive[PACKET_RESEARCH_INFO] = (void *(*)(struct connection *)) receive_packet_research_info_100;
95886 phandlers->receive[PACKET_UNKNOWN_RESEARCH] = (void *(*)(struct connection *)) receive_packet_unknown_research_100;
95887 phandlers->receive[PACKET_DIPLOMACY_INIT_MEETING] = (void *(*)(struct connection *)) receive_packet_diplomacy_init_meeting_100;
95888 phandlers->receive[PACKET_DIPLOMACY_CANCEL_MEETING] = (void *(*)(struct connection *)) receive_packet_diplomacy_cancel_meeting_100;
95889 phandlers->receive[PACKET_DIPLOMACY_CREATE_CLAUSE] = (void *(*)(struct connection *)) receive_packet_diplomacy_create_clause_100;
95890 phandlers->receive[PACKET_DIPLOMACY_REMOVE_CLAUSE] = (void *(*)(struct connection *)) receive_packet_diplomacy_remove_clause_100;
95891 phandlers->receive[PACKET_DIPLOMACY_ACCEPT_TREATY] = (void *(*)(struct connection *)) receive_packet_diplomacy_accept_treaty_100;
95892 phandlers->receive[PACKET_PAGE_MSG] = (void *(*)(struct connection *)) receive_packet_page_msg_100;
95893 phandlers->receive[PACKET_PAGE_MSG_PART] = (void *(*)(struct connection *)) receive_packet_page_msg_part_100;
95894 phandlers->receive[PACKET_CONN_INFO] = (void *(*)(struct connection *)) receive_packet_conn_info_100;
95895 phandlers->receive[PACKET_CONN_PING_INFO] = (void *(*)(struct connection *)) receive_packet_conn_ping_info_100;
95896 phandlers->receive[PACKET_CONN_PING] = (void *(*)(struct connection *)) receive_packet_conn_ping_100;
95897 phandlers->receive[PACKET_END_PHASE] = (void *(*)(struct connection *)) receive_packet_end_phase_100;
95898 phandlers->receive[PACKET_START_PHASE] = (void *(*)(struct connection *)) receive_packet_start_phase_100;
95899 phandlers->receive[PACKET_NEW_YEAR] = (void *(*)(struct connection *)) receive_packet_new_year_100;
95900 phandlers->receive[PACKET_BEGIN_TURN] = (void *(*)(struct connection *)) receive_packet_begin_turn_100;
95901 phandlers->receive[PACKET_END_TURN] = (void *(*)(struct connection *)) receive_packet_end_turn_100;
95902 phandlers->receive[PACKET_FREEZE_CLIENT] = (void *(*)(struct connection *)) receive_packet_freeze_client_100;
95903 phandlers->receive[PACKET_THAW_CLIENT] = (void *(*)(struct connection *)) receive_packet_thaw_client_100;
95904 phandlers->receive[PACKET_SPACESHIP_INFO] = (void *(*)(struct connection *)) receive_packet_spaceship_info_100;
95905 phandlers->receive[PACKET_RULESET_UNIT] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_100;
95906 phandlers->receive[PACKET_RULESET_UNIT_BONUS] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_bonus_100;
95907 phandlers->receive[PACKET_RULESET_UNIT_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_flag_100;
95908 phandlers->receive[PACKET_RULESET_UNIT_CLASS_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_class_flag_100;
95909 phandlers->receive[PACKET_RULESET_GAME] = (void *(*)(struct connection *)) receive_packet_ruleset_game_100;
95910 phandlers->receive[PACKET_RULESET_SPECIALIST] = (void *(*)(struct connection *)) receive_packet_ruleset_specialist_100;
95911 phandlers->receive[PACKET_RULESET_GOVERNMENT_RULER_TITLE] = (void *(*)(struct connection *)) receive_packet_ruleset_government_ruler_title_100;
95912 phandlers->receive[PACKET_RULESET_TECH] = (void *(*)(struct connection *)) receive_packet_ruleset_tech_100;
95913 phandlers->receive[PACKET_RULESET_TECH_CLASS] = (void *(*)(struct connection *)) receive_packet_ruleset_tech_class_100;
95914 phandlers->receive[PACKET_RULESET_TECH_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_tech_flag_100;
95915 phandlers->receive[PACKET_RULESET_GOVERNMENT] = (void *(*)(struct connection *)) receive_packet_ruleset_government_100;
95916 phandlers->receive[PACKET_RULESET_TERRAIN_CONTROL] = (void *(*)(struct connection *)) receive_packet_ruleset_terrain_control_100;
95917 phandlers->receive[PACKET_RULESETS_READY] = (void *(*)(struct connection *)) receive_packet_rulesets_ready_100;
95918 phandlers->receive[PACKET_RULESET_NATION_SETS] = (void *(*)(struct connection *)) receive_packet_ruleset_nation_sets_100;
95919 phandlers->receive[PACKET_RULESET_NATION_GROUPS] = (void *(*)(struct connection *)) receive_packet_ruleset_nation_groups_100;
95920 phandlers->receive[PACKET_RULESET_NATION] = (void *(*)(struct connection *)) receive_packet_ruleset_nation_100;
95921 phandlers->receive[PACKET_NATION_AVAILABILITY] = (void *(*)(struct connection *)) receive_packet_nation_availability_100;
95922 phandlers->receive[PACKET_RULESET_STYLE] = (void *(*)(struct connection *)) receive_packet_ruleset_style_100;
95923 phandlers->receive[PACKET_RULESET_CITY] = (void *(*)(struct connection *)) receive_packet_ruleset_city_100;
95924 phandlers->receive[PACKET_RULESET_BUILDING] = (void *(*)(struct connection *)) receive_packet_ruleset_building_100;
95925 phandlers->receive[PACKET_RULESET_TERRAIN] = (void *(*)(struct connection *)) receive_packet_ruleset_terrain_100;
95926 phandlers->receive[PACKET_RULESET_TERRAIN_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_terrain_flag_100;
95927 phandlers->receive[PACKET_RULESET_UNIT_CLASS] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_class_100;
95928 phandlers->receive[PACKET_RULESET_EXTRA] = (void *(*)(struct connection *)) receive_packet_ruleset_extra_100;
95929 phandlers->receive[PACKET_RULESET_EXTRA_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_extra_flag_100;
95930 phandlers->receive[PACKET_RULESET_BASE] = (void *(*)(struct connection *)) receive_packet_ruleset_base_100;
95931 phandlers->receive[PACKET_RULESET_ROAD] = (void *(*)(struct connection *)) receive_packet_ruleset_road_100;
95932 phandlers->receive[PACKET_RULESET_GOODS] = (void *(*)(struct connection *)) receive_packet_ruleset_goods_100;
95933 phandlers->receive[PACKET_RULESET_DISASTER] = (void *(*)(struct connection *)) receive_packet_ruleset_disaster_100;
95934 phandlers->receive[PACKET_RULESET_ACHIEVEMENT] = (void *(*)(struct connection *)) receive_packet_ruleset_achievement_100;
95935 phandlers->receive[PACKET_RULESET_TRADE] = (void *(*)(struct connection *)) receive_packet_ruleset_trade_100;
95936 phandlers->receive[PACKET_RULESET_ACTION] = (void *(*)(struct connection *)) receive_packet_ruleset_action_100;
95937 phandlers->receive[PACKET_RULESET_ACTION_ENABLER] = (void *(*)(struct connection *)) receive_packet_ruleset_action_enabler_100;
95938 phandlers->receive[PACKET_RULESET_ACTION_AUTO] = (void *(*)(struct connection *)) receive_packet_ruleset_action_auto_100;
95939 phandlers->receive[PACKET_RULESET_MUSIC] = (void *(*)(struct connection *)) receive_packet_ruleset_music_100;
95940 phandlers->receive[PACKET_RULESET_MULTIPLIER] = (void *(*)(struct connection *)) receive_packet_ruleset_multiplier_100;
95941 phandlers->receive[PACKET_RULESET_CLAUSE] = (void *(*)(struct connection *)) receive_packet_ruleset_clause_100;
95942 phandlers->receive[PACKET_RULESET_SUMMARY] = (void *(*)(struct connection *)) receive_packet_ruleset_summary_100;
95943 phandlers->receive[PACKET_RULESET_DESCRIPTION_PART] = (void *(*)(struct connection *)) receive_packet_ruleset_description_part_100;
95944 phandlers->receive[PACKET_SINGLE_WANT_HACK_REPLY] = (void *(*)(struct connection *)) receive_packet_single_want_hack_reply_100;
95945 phandlers->receive[PACKET_RULESET_CHOICES] = (void *(*)(struct connection *)) receive_packet_ruleset_choices_100;
95946 phandlers->receive[PACKET_GAME_LOAD] = (void *(*)(struct connection *)) receive_packet_game_load_100;
95947 phandlers->receive[PACKET_SERVER_SETTING_CONTROL] = (void *(*)(struct connection *)) receive_packet_server_setting_control_100;
95948 phandlers->receive[PACKET_SERVER_SETTING_CONST] = (void *(*)(struct connection *)) receive_packet_server_setting_const_100;
95949 phandlers->receive[PACKET_SERVER_SETTING_BOOL] = (void *(*)(struct connection *)) receive_packet_server_setting_bool_100;
95950 phandlers->receive[PACKET_SERVER_SETTING_INT] = (void *(*)(struct connection *)) receive_packet_server_setting_int_100;
95951 phandlers->receive[PACKET_SERVER_SETTING_STR] = (void *(*)(struct connection *)) receive_packet_server_setting_str_100;
95952 phandlers->receive[PACKET_SERVER_SETTING_ENUM] = (void *(*)(struct connection *)) receive_packet_server_setting_enum_100;
95953 phandlers->receive[PACKET_SERVER_SETTING_BITWISE] = (void *(*)(struct connection *)) receive_packet_server_setting_bitwise_100;
95954 phandlers->receive[PACKET_SET_TOPOLOGY] = (void *(*)(struct connection *)) receive_packet_set_topology_100;
95955 phandlers->receive[PACKET_RULESET_EFFECT] = (void *(*)(struct connection *)) receive_packet_ruleset_effect_100;
95956 phandlers->receive[PACKET_RULESET_RESOURCE] = (void *(*)(struct connection *)) receive_packet_ruleset_resource_100;
95957 phandlers->receive[PACKET_SCENARIO_INFO] = (void *(*)(struct connection *)) receive_packet_scenario_info_100;
95958 phandlers->receive[PACKET_SCENARIO_DESCRIPTION] = (void *(*)(struct connection *)) receive_packet_scenario_description_100;
95959 phandlers->receive[PACKET_VOTE_NEW] = (void *(*)(struct connection *)) receive_packet_vote_new_100;
95960 phandlers->receive[PACKET_VOTE_UPDATE] = (void *(*)(struct connection *)) receive_packet_vote_update_100;
95961 phandlers->receive[PACKET_VOTE_REMOVE] = (void *(*)(struct connection *)) receive_packet_vote_remove_100;
95962 phandlers->receive[PACKET_VOTE_RESOLVE] = (void *(*)(struct connection *)) receive_packet_vote_resolve_100;
95963 phandlers->receive[PACKET_EDIT_OBJECT_CREATED] = (void *(*)(struct connection *)) receive_packet_edit_object_created_100;
95964 phandlers->receive[PACKET_PLAY_MUSIC] = (void *(*)(struct connection *)) receive_packet_play_music_100;
95965 phandlers->receive[PACKET_WEB_PLAYER_INFO_ADDITION] = (void *(*)(struct connection *)) receive_packet_web_player_info_addition_100;
95966 phandlers->receive[PACKET_WEB_RULESET_UNIT_ADDITION] = (void *(*)(struct connection *)) receive_packet_web_ruleset_unit_addition_100;
95967 }
95968}
95969
95970 void packet_handlers_fill_capability(struct packet_handlers *phandlers,
95971 const char *capability)
95972{
95973 if (has_capability("ids32", capability)) {
95974 log_packet_detailed("PACKET_CITY_RALLY_POINT: using variant=100 cap=%s", capability);
95975 phandlers->send[PACKET_CITY_RALLY_POINT].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_city_rally_point_100;
95976 phandlers->receive[PACKET_CITY_RALLY_POINT] = (void *(*)(struct connection *)) receive_packet_city_rally_point_100;
95977 } else if (!has_capability("ids32", capability)) {
95978 log_packet_detailed("PACKET_CITY_RALLY_POINT: using variant=101 cap=%s", capability);
95979 phandlers->send[PACKET_CITY_RALLY_POINT].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_city_rally_point_101;
95980 phandlers->receive[PACKET_CITY_RALLY_POINT] = (void *(*)(struct connection *)) receive_packet_city_rally_point_101;
95981 } else {
95982 log_error("Unknown PACKET_CITY_RALLY_POINT variant for cap %s", capability);
95983 }
95984 if (has_capability("ids32", capability)) {
95985 log_packet_detailed("PACKET_WORKER_TASK: using variant=100 cap=%s", capability);
95986 phandlers->send[PACKET_WORKER_TASK].packet = (int(*)(struct connection *, const void *)) send_packet_worker_task_100;
95987 phandlers->receive[PACKET_WORKER_TASK] = (void *(*)(struct connection *)) receive_packet_worker_task_100;
95988 } else if (!has_capability("ids32", capability)) {
95989 log_packet_detailed("PACKET_WORKER_TASK: using variant=101 cap=%s", capability);
95990 phandlers->send[PACKET_WORKER_TASK].packet = (int(*)(struct connection *, const void *)) send_packet_worker_task_101;
95991 phandlers->receive[PACKET_WORKER_TASK] = (void *(*)(struct connection *)) receive_packet_worker_task_101;
95992 } else {
95993 log_error("Unknown PACKET_WORKER_TASK variant for cap %s", capability);
95994 }
95995 if (is_server()) {
95996 if (has_capability("ids32", capability)) {
95997 log_packet_detailed("PACKET_INVESTIGATE_STARTED: using variant=100 cap=%s", capability);
95998 phandlers->send[PACKET_INVESTIGATE_STARTED].packet = (int(*)(struct connection *, const void *)) send_packet_investigate_started_100;
95999 } else if (!has_capability("ids32", capability)) {
96000 log_packet_detailed("PACKET_INVESTIGATE_STARTED: using variant=101 cap=%s", capability);
96001 phandlers->send[PACKET_INVESTIGATE_STARTED].packet = (int(*)(struct connection *, const void *)) send_packet_investigate_started_101;
96002 } else {
96003 log_error("Unknown PACKET_INVESTIGATE_STARTED variant for cap %s", capability);
96004 }
96005 if (has_capability("ids32", capability)) {
96006 log_packet_detailed("PACKET_INVESTIGATE_FINISHED: using variant=100 cap=%s", capability);
96007 phandlers->send[PACKET_INVESTIGATE_FINISHED].packet = (int(*)(struct connection *, const void *)) send_packet_investigate_finished_100;
96008 } else if (!has_capability("ids32", capability)) {
96009 log_packet_detailed("PACKET_INVESTIGATE_FINISHED: using variant=101 cap=%s", capability);
96010 phandlers->send[PACKET_INVESTIGATE_FINISHED].packet = (int(*)(struct connection *, const void *)) send_packet_investigate_finished_101;
96011 } else {
96012 log_error("Unknown PACKET_INVESTIGATE_FINISHED variant for cap %s", capability);
96013 }
96014 if (has_capability("ids32", capability)) {
96015 log_packet_detailed("PACKET_TILE_INFO: using variant=100 cap=%s", capability);
96016 phandlers->send[PACKET_TILE_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_tile_info_100;
96017 } else if (!has_capability("ids32", capability)) {
96018 log_packet_detailed("PACKET_TILE_INFO: using variant=101 cap=%s", capability);
96019 phandlers->send[PACKET_TILE_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_tile_info_101;
96020 } else {
96021 log_error("Unknown PACKET_TILE_INFO variant for cap %s", capability);
96022 }
96023 if (has_capability("ids32", capability)) {
96024 log_packet_detailed("PACKET_CITY_REMOVE: using variant=100 cap=%s", capability);
96025 phandlers->send[PACKET_CITY_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_city_remove_100;
96026 } else if (!has_capability("ids32", capability)) {
96027 log_packet_detailed("PACKET_CITY_REMOVE: using variant=101 cap=%s", capability);
96028 phandlers->send[PACKET_CITY_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_city_remove_101;
96029 } else {
96030 log_error("Unknown PACKET_CITY_REMOVE variant for cap %s", capability);
96031 }
96032 if (has_capability("ids32", capability) && has_capability("city-original", capability)) {
96033 log_packet_detailed("PACKET_CITY_INFO: using variant=100 cap=%s", capability);
96034 phandlers->send[PACKET_CITY_INFO].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_city_info_100;
96035 } else if (has_capability("ids32", capability) && !has_capability("city-original", capability)) {
96036 log_packet_detailed("PACKET_CITY_INFO: using variant=101 cap=%s", capability);
96037 phandlers->send[PACKET_CITY_INFO].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_city_info_101;
96038 } else if (has_capability("city-original", capability) && !has_capability("ids32", capability)) {
96039 log_packet_detailed("PACKET_CITY_INFO: using variant=102 cap=%s", capability);
96040 phandlers->send[PACKET_CITY_INFO].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_city_info_102;
96041 } else if (!has_capability("ids32", capability) && !has_capability("city-original", capability)) {
96042 log_packet_detailed("PACKET_CITY_INFO: using variant=103 cap=%s", capability);
96043 phandlers->send[PACKET_CITY_INFO].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_city_info_103;
96044 } else {
96045 log_error("Unknown PACKET_CITY_INFO variant for cap %s", capability);
96046 }
96047 if (has_capability("ids32", capability)) {
96048 log_packet_detailed("PACKET_CITY_NATIONALITIES: using variant=100 cap=%s", capability);
96049 phandlers->send[PACKET_CITY_NATIONALITIES].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_city_nationalities_100;
96050 } else if (!has_capability("ids32", capability)) {
96051 log_packet_detailed("PACKET_CITY_NATIONALITIES: using variant=101 cap=%s", capability);
96052 phandlers->send[PACKET_CITY_NATIONALITIES].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_city_nationalities_101;
96053 } else {
96054 log_error("Unknown PACKET_CITY_NATIONALITIES variant for cap %s", capability);
96055 }
96056 if (has_capability("ids32", capability)) {
96057 log_packet_detailed("PACKET_CITY_SHORT_INFO: using variant=100 cap=%s", capability);
96058 phandlers->send[PACKET_CITY_SHORT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_city_short_info_100;
96059 } else if (!has_capability("ids32", capability)) {
96060 log_packet_detailed("PACKET_CITY_SHORT_INFO: using variant=101 cap=%s", capability);
96061 phandlers->send[PACKET_CITY_SHORT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_city_short_info_101;
96062 } else {
96063 log_error("Unknown PACKET_CITY_SHORT_INFO variant for cap %s", capability);
96064 }
96065 if (has_capability("ids32", capability)) {
96066 log_packet_detailed("PACKET_TRADE_ROUTE_INFO: using variant=100 cap=%s", capability);
96067 phandlers->send[PACKET_TRADE_ROUTE_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_trade_route_info_100;
96068 } else if (!has_capability("ids32", capability)) {
96069 log_packet_detailed("PACKET_TRADE_ROUTE_INFO: using variant=101 cap=%s", capability);
96070 phandlers->send[PACKET_TRADE_ROUTE_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_trade_route_info_101;
96071 } else {
96072 log_error("Unknown PACKET_TRADE_ROUTE_INFO variant for cap %s", capability);
96073 }
96074 if (has_capability("ids32", capability)) {
96075 log_packet_detailed("PACKET_CITY_NAME_SUGGESTION_INFO: using variant=100 cap=%s", capability);
96076 phandlers->send[PACKET_CITY_NAME_SUGGESTION_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_city_name_suggestion_info_100;
96077 } else if (!has_capability("ids32", capability)) {
96078 log_packet_detailed("PACKET_CITY_NAME_SUGGESTION_INFO: using variant=101 cap=%s", capability);
96079 phandlers->send[PACKET_CITY_NAME_SUGGESTION_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_city_name_suggestion_info_101;
96080 } else {
96081 log_error("Unknown PACKET_CITY_NAME_SUGGESTION_INFO variant for cap %s", capability);
96082 }
96083 if (has_capability("ids32", capability)) {
96084 log_packet_detailed("PACKET_CITY_SABOTAGE_LIST: using variant=100 cap=%s", capability);
96085 phandlers->send[PACKET_CITY_SABOTAGE_LIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_sabotage_list_100;
96086 } else if (!has_capability("ids32", capability)) {
96087 log_packet_detailed("PACKET_CITY_SABOTAGE_LIST: using variant=101 cap=%s", capability);
96088 phandlers->send[PACKET_CITY_SABOTAGE_LIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_sabotage_list_101;
96089 } else {
96090 log_error("Unknown PACKET_CITY_SABOTAGE_LIST variant for cap %s", capability);
96091 }
96092 if (has_capability("ids32", capability)) {
96093 log_packet_detailed("PACKET_UNIT_REMOVE: using variant=100 cap=%s", capability);
96094 phandlers->send[PACKET_UNIT_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_unit_remove_100;
96095 } else if (!has_capability("ids32", capability)) {
96096 log_packet_detailed("PACKET_UNIT_REMOVE: using variant=101 cap=%s", capability);
96097 phandlers->send[PACKET_UNIT_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_unit_remove_101;
96098 } else {
96099 log_error("Unknown PACKET_UNIT_REMOVE variant for cap %s", capability);
96100 }
96101 if (has_capability("ids32", capability)) {
96102 log_packet_detailed("PACKET_UNIT_INFO: using variant=100 cap=%s", capability);
96103 phandlers->send[PACKET_UNIT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_unit_info_100;
96104 } else if (!has_capability("ids32", capability)) {
96105 log_packet_detailed("PACKET_UNIT_INFO: using variant=101 cap=%s", capability);
96106 phandlers->send[PACKET_UNIT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_unit_info_101;
96107 } else {
96108 log_error("Unknown PACKET_UNIT_INFO variant for cap %s", capability);
96109 }
96110 if (has_capability("ids32", capability)) {
96111 log_packet_detailed("PACKET_UNIT_SHORT_INFO: using variant=100 cap=%s", capability);
96112 phandlers->send[PACKET_UNIT_SHORT_INFO].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_unit_short_info_100;
96113 } else if (!has_capability("ids32", capability)) {
96114 log_packet_detailed("PACKET_UNIT_SHORT_INFO: using variant=101 cap=%s", capability);
96115 phandlers->send[PACKET_UNIT_SHORT_INFO].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_unit_short_info_101;
96116 } else {
96117 log_error("Unknown PACKET_UNIT_SHORT_INFO variant for cap %s", capability);
96118 }
96119 if (has_capability("ids32", capability)) {
96120 log_packet_detailed("PACKET_UNIT_COMBAT_INFO: using variant=100 cap=%s", capability);
96121 phandlers->send[PACKET_UNIT_COMBAT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_unit_combat_info_100;
96122 } else if (!has_capability("ids32", capability)) {
96123 log_packet_detailed("PACKET_UNIT_COMBAT_INFO: using variant=101 cap=%s", capability);
96124 phandlers->send[PACKET_UNIT_COMBAT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_unit_combat_info_101;
96125 } else {
96126 log_error("Unknown PACKET_UNIT_COMBAT_INFO variant for cap %s", capability);
96127 }
96128 if (has_capability("ids32", capability)) {
96129 log_packet_detailed("PACKET_UNIT_ACTION_ANSWER: using variant=100 cap=%s", capability);
96130 phandlers->send[PACKET_UNIT_ACTION_ANSWER].packet = (int(*)(struct connection *, const void *)) send_packet_unit_action_answer_100;
96131 } else if (!has_capability("ids32", capability)) {
96132 log_packet_detailed("PACKET_UNIT_ACTION_ANSWER: using variant=101 cap=%s", capability);
96133 phandlers->send[PACKET_UNIT_ACTION_ANSWER].packet = (int(*)(struct connection *, const void *)) send_packet_unit_action_answer_101;
96134 } else {
96135 log_error("Unknown PACKET_UNIT_ACTION_ANSWER variant for cap %s", capability);
96136 }
96137 if (has_capability("ids32", capability)) {
96138 log_packet_detailed("PACKET_UNIT_ACTIONS: using variant=100 cap=%s", capability);
96139 phandlers->send[PACKET_UNIT_ACTIONS].packet = (int(*)(struct connection *, const void *)) send_packet_unit_actions_100;
96140 } else if (!has_capability("ids32", capability)) {
96141 log_packet_detailed("PACKET_UNIT_ACTIONS: using variant=101 cap=%s", capability);
96142 phandlers->send[PACKET_UNIT_ACTIONS].packet = (int(*)(struct connection *, const void *)) send_packet_unit_actions_101;
96143 } else {
96144 log_error("Unknown PACKET_UNIT_ACTIONS variant for cap %s", capability);
96145 }
96146 if (has_capability("rsdesc32", capability)) {
96147 log_packet_detailed("PACKET_RULESET_CONTROL: using variant=100 cap=%s", capability);
96148 phandlers->send[PACKET_RULESET_CONTROL].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_control_100;
96149 } else if (!has_capability("rsdesc32", capability)) {
96150 log_packet_detailed("PACKET_RULESET_CONTROL: using variant=101 cap=%s", capability);
96151 phandlers->send[PACKET_RULESET_CONTROL].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_control_101;
96152 } else {
96153 log_error("Unknown PACKET_RULESET_CONTROL variant for cap %s", capability);
96154 }
96155 if (has_capability("ids32", capability)) {
96156 log_packet_detailed("PACKET_WEB_CITY_INFO_ADDITION: using variant=100 cap=%s", capability);
96157 phandlers->send[PACKET_WEB_CITY_INFO_ADDITION].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_web_city_info_addition_100;
96158 } else if (!has_capability("ids32", capability)) {
96159 log_packet_detailed("PACKET_WEB_CITY_INFO_ADDITION: using variant=101 cap=%s", capability);
96160 phandlers->send[PACKET_WEB_CITY_INFO_ADDITION].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_web_city_info_addition_101;
96161 } else {
96162 log_error("Unknown PACKET_WEB_CITY_INFO_ADDITION variant for cap %s", capability);
96163 }
96164 if (has_capability("ids32", capability)) {
96165 log_packet_detailed("PACKET_CITY_SELL: using variant=100 cap=%s", capability);
96166 phandlers->receive[PACKET_CITY_SELL] = (void *(*)(struct connection *)) receive_packet_city_sell_100;
96167 } else if (!has_capability("ids32", capability)) {
96168 log_packet_detailed("PACKET_CITY_SELL: using variant=101 cap=%s", capability);
96169 phandlers->receive[PACKET_CITY_SELL] = (void *(*)(struct connection *)) receive_packet_city_sell_101;
96170 } else {
96171 log_error("Unknown PACKET_CITY_SELL variant for cap %s", capability);
96172 }
96173 if (has_capability("ids32", capability)) {
96174 log_packet_detailed("PACKET_CITY_BUY: using variant=100 cap=%s", capability);
96175 phandlers->receive[PACKET_CITY_BUY] = (void *(*)(struct connection *)) receive_packet_city_buy_100;
96176 } else if (!has_capability("ids32", capability)) {
96177 log_packet_detailed("PACKET_CITY_BUY: using variant=101 cap=%s", capability);
96178 phandlers->receive[PACKET_CITY_BUY] = (void *(*)(struct connection *)) receive_packet_city_buy_101;
96179 } else {
96180 log_error("Unknown PACKET_CITY_BUY variant for cap %s", capability);
96181 }
96182 if (has_capability("ids32", capability)) {
96183 log_packet_detailed("PACKET_CITY_CHANGE: using variant=100 cap=%s", capability);
96184 phandlers->receive[PACKET_CITY_CHANGE] = (void *(*)(struct connection *)) receive_packet_city_change_100;
96185 } else if (!has_capability("ids32", capability)) {
96186 log_packet_detailed("PACKET_CITY_CHANGE: using variant=101 cap=%s", capability);
96187 phandlers->receive[PACKET_CITY_CHANGE] = (void *(*)(struct connection *)) receive_packet_city_change_101;
96188 } else {
96189 log_error("Unknown PACKET_CITY_CHANGE variant for cap %s", capability);
96190 }
96191 if (has_capability("ids32", capability)) {
96192 log_packet_detailed("PACKET_CITY_WORKLIST: using variant=100 cap=%s", capability);
96193 phandlers->receive[PACKET_CITY_WORKLIST] = (void *(*)(struct connection *)) receive_packet_city_worklist_100;
96194 } else if (!has_capability("ids32", capability)) {
96195 log_packet_detailed("PACKET_CITY_WORKLIST: using variant=101 cap=%s", capability);
96196 phandlers->receive[PACKET_CITY_WORKLIST] = (void *(*)(struct connection *)) receive_packet_city_worklist_101;
96197 } else {
96198 log_error("Unknown PACKET_CITY_WORKLIST variant for cap %s", capability);
96199 }
96200 if (has_capability("ids32", capability)) {
96201 log_packet_detailed("PACKET_CITY_MAKE_SPECIALIST: using variant=100 cap=%s", capability);
96202 phandlers->receive[PACKET_CITY_MAKE_SPECIALIST] = (void *(*)(struct connection *)) receive_packet_city_make_specialist_100;
96203 } else if (!has_capability("ids32", capability)) {
96204 log_packet_detailed("PACKET_CITY_MAKE_SPECIALIST: using variant=101 cap=%s", capability);
96205 phandlers->receive[PACKET_CITY_MAKE_SPECIALIST] = (void *(*)(struct connection *)) receive_packet_city_make_specialist_101;
96206 } else {
96207 log_error("Unknown PACKET_CITY_MAKE_SPECIALIST variant for cap %s", capability);
96208 }
96209 if (has_capability("ids32", capability)) {
96210 log_packet_detailed("PACKET_CITY_MAKE_WORKER: using variant=100 cap=%s", capability);
96211 phandlers->receive[PACKET_CITY_MAKE_WORKER] = (void *(*)(struct connection *)) receive_packet_city_make_worker_100;
96212 } else if (!has_capability("ids32", capability)) {
96213 log_packet_detailed("PACKET_CITY_MAKE_WORKER: using variant=101 cap=%s", capability);
96214 phandlers->receive[PACKET_CITY_MAKE_WORKER] = (void *(*)(struct connection *)) receive_packet_city_make_worker_101;
96215 } else {
96216 log_error("Unknown PACKET_CITY_MAKE_WORKER variant for cap %s", capability);
96217 }
96218 if (has_capability("ids32", capability)) {
96219 log_packet_detailed("PACKET_CITY_CHANGE_SPECIALIST: using variant=100 cap=%s", capability);
96220 phandlers->receive[PACKET_CITY_CHANGE_SPECIALIST] = (void *(*)(struct connection *)) receive_packet_city_change_specialist_100;
96221 } else if (!has_capability("ids32", capability)) {
96222 log_packet_detailed("PACKET_CITY_CHANGE_SPECIALIST: using variant=101 cap=%s", capability);
96223 phandlers->receive[PACKET_CITY_CHANGE_SPECIALIST] = (void *(*)(struct connection *)) receive_packet_city_change_specialist_101;
96224 } else {
96225 log_error("Unknown PACKET_CITY_CHANGE_SPECIALIST variant for cap %s", capability);
96226 }
96227 if (has_capability("ids32", capability)) {
96228 log_packet_detailed("PACKET_CITY_RENAME: using variant=100 cap=%s", capability);
96229 phandlers->receive[PACKET_CITY_RENAME] = (void *(*)(struct connection *)) receive_packet_city_rename_100;
96230 } else if (!has_capability("ids32", capability)) {
96231 log_packet_detailed("PACKET_CITY_RENAME: using variant=101 cap=%s", capability);
96232 phandlers->receive[PACKET_CITY_RENAME] = (void *(*)(struct connection *)) receive_packet_city_rename_101;
96233 } else {
96234 log_error("Unknown PACKET_CITY_RENAME variant for cap %s", capability);
96235 }
96236 if (has_capability("ids32", capability)) {
96237 log_packet_detailed("PACKET_CITY_OPTIONS_REQ: using variant=100 cap=%s", capability);
96238 phandlers->receive[PACKET_CITY_OPTIONS_REQ] = (void *(*)(struct connection *)) receive_packet_city_options_req_100;
96239 } else if (!has_capability("ids32", capability)) {
96240 log_packet_detailed("PACKET_CITY_OPTIONS_REQ: using variant=101 cap=%s", capability);
96241 phandlers->receive[PACKET_CITY_OPTIONS_REQ] = (void *(*)(struct connection *)) receive_packet_city_options_req_101;
96242 } else {
96243 log_error("Unknown PACKET_CITY_OPTIONS_REQ variant for cap %s", capability);
96244 }
96245 if (has_capability("ids32", capability)) {
96246 log_packet_detailed("PACKET_CITY_REFRESH: using variant=100 cap=%s", capability);
96247 phandlers->receive[PACKET_CITY_REFRESH] = (void *(*)(struct connection *)) receive_packet_city_refresh_100;
96248 } else if (!has_capability("ids32", capability)) {
96249 log_packet_detailed("PACKET_CITY_REFRESH: using variant=101 cap=%s", capability);
96250 phandlers->receive[PACKET_CITY_REFRESH] = (void *(*)(struct connection *)) receive_packet_city_refresh_101;
96251 } else {
96252 log_error("Unknown PACKET_CITY_REFRESH variant for cap %s", capability);
96253 }
96254 if (has_capability("ids32", capability)) {
96255 log_packet_detailed("PACKET_CITY_NAME_SUGGESTION_REQ: using variant=100 cap=%s", capability);
96256 phandlers->receive[PACKET_CITY_NAME_SUGGESTION_REQ] = (void *(*)(struct connection *)) receive_packet_city_name_suggestion_req_100;
96257 } else if (!has_capability("ids32", capability)) {
96258 log_packet_detailed("PACKET_CITY_NAME_SUGGESTION_REQ: using variant=101 cap=%s", capability);
96259 phandlers->receive[PACKET_CITY_NAME_SUGGESTION_REQ] = (void *(*)(struct connection *)) receive_packet_city_name_suggestion_req_101;
96260 } else {
96261 log_error("Unknown PACKET_CITY_NAME_SUGGESTION_REQ variant for cap %s", capability);
96262 }
96263 if (has_capability("ids32", capability)) {
96264 log_packet_detailed("PACKET_UNIT_SSCS_SET: using variant=100 cap=%s", capability);
96265 phandlers->receive[PACKET_UNIT_SSCS_SET] = (void *(*)(struct connection *)) receive_packet_unit_sscs_set_100;
96266 } else if (!has_capability("ids32", capability)) {
96267 log_packet_detailed("PACKET_UNIT_SSCS_SET: using variant=101 cap=%s", capability);
96268 phandlers->receive[PACKET_UNIT_SSCS_SET] = (void *(*)(struct connection *)) receive_packet_unit_sscs_set_101;
96269 } else {
96270 log_error("Unknown PACKET_UNIT_SSCS_SET variant for cap %s", capability);
96271 }
96272 if (has_capability("ids32", capability)) {
96273 log_packet_detailed("PACKET_UNIT_ORDERS: using variant=100 cap=%s", capability);
96274 phandlers->receive[PACKET_UNIT_ORDERS] = (void *(*)(struct connection *)) receive_packet_unit_orders_100;
96275 } else if (!has_capability("ids32", capability)) {
96276 log_packet_detailed("PACKET_UNIT_ORDERS: using variant=101 cap=%s", capability);
96277 phandlers->receive[PACKET_UNIT_ORDERS] = (void *(*)(struct connection *)) receive_packet_unit_orders_101;
96278 } else {
96279 log_error("Unknown PACKET_UNIT_ORDERS variant for cap %s", capability);
96280 }
96281 if (has_capability("ids32", capability)) {
96282 log_packet_detailed("PACKET_UNIT_SERVER_SIDE_AGENT_SET: using variant=100 cap=%s", capability);
96283 phandlers->receive[PACKET_UNIT_SERVER_SIDE_AGENT_SET] = (void *(*)(struct connection *)) receive_packet_unit_server_side_agent_set_100;
96284 } else if (!has_capability("ids32", capability)) {
96285 log_packet_detailed("PACKET_UNIT_SERVER_SIDE_AGENT_SET: using variant=101 cap=%s", capability);
96286 phandlers->receive[PACKET_UNIT_SERVER_SIDE_AGENT_SET] = (void *(*)(struct connection *)) receive_packet_unit_server_side_agent_set_101;
96287 } else {
96288 log_error("Unknown PACKET_UNIT_SERVER_SIDE_AGENT_SET variant for cap %s", capability);
96289 }
96290 if (has_capability("ids32", capability)) {
96291 log_packet_detailed("PACKET_UNIT_ACTION_QUERY: using variant=100 cap=%s", capability);
96292 phandlers->receive[PACKET_UNIT_ACTION_QUERY] = (void *(*)(struct connection *)) receive_packet_unit_action_query_100;
96293 } else if (!has_capability("ids32", capability)) {
96294 log_packet_detailed("PACKET_UNIT_ACTION_QUERY: using variant=101 cap=%s", capability);
96295 phandlers->receive[PACKET_UNIT_ACTION_QUERY] = (void *(*)(struct connection *)) receive_packet_unit_action_query_101;
96296 } else {
96297 log_error("Unknown PACKET_UNIT_ACTION_QUERY variant for cap %s", capability);
96298 }
96299 if (has_capability("ids32", capability)) {
96300 log_packet_detailed("PACKET_UNIT_DO_ACTION: using variant=100 cap=%s", capability);
96301 phandlers->receive[PACKET_UNIT_DO_ACTION] = (void *(*)(struct connection *)) receive_packet_unit_do_action_100;
96302 } else if (!has_capability("ids32", capability)) {
96303 log_packet_detailed("PACKET_UNIT_DO_ACTION: using variant=101 cap=%s", capability);
96304 phandlers->receive[PACKET_UNIT_DO_ACTION] = (void *(*)(struct connection *)) receive_packet_unit_do_action_101;
96305 } else {
96306 log_error("Unknown PACKET_UNIT_DO_ACTION variant for cap %s", capability);
96307 }
96308 if (has_capability("ids32", capability)) {
96309 log_packet_detailed("PACKET_UNIT_GET_ACTIONS: using variant=100 cap=%s", capability);
96310 phandlers->receive[PACKET_UNIT_GET_ACTIONS] = (void *(*)(struct connection *)) receive_packet_unit_get_actions_100;
96311 } else if (!has_capability("ids32", capability)) {
96312 log_packet_detailed("PACKET_UNIT_GET_ACTIONS: using variant=101 cap=%s", capability);
96313 phandlers->receive[PACKET_UNIT_GET_ACTIONS] = (void *(*)(struct connection *)) receive_packet_unit_get_actions_101;
96314 } else {
96315 log_error("Unknown PACKET_UNIT_GET_ACTIONS variant for cap %s", capability);
96316 }
96317 if (has_capability("ids32", capability)) {
96318 log_packet_detailed("PACKET_UNIT_CHANGE_ACTIVITY: using variant=100 cap=%s", capability);
96319 phandlers->receive[PACKET_UNIT_CHANGE_ACTIVITY] = (void *(*)(struct connection *)) receive_packet_unit_change_activity_100;
96320 } else if (!has_capability("ids32", capability)) {
96321 log_packet_detailed("PACKET_UNIT_CHANGE_ACTIVITY: using variant=101 cap=%s", capability);
96322 phandlers->receive[PACKET_UNIT_CHANGE_ACTIVITY] = (void *(*)(struct connection *)) receive_packet_unit_change_activity_101;
96323 } else {
96324 log_error("Unknown PACKET_UNIT_CHANGE_ACTIVITY variant for cap %s", capability);
96325 }
96326 if (has_capability("ids32", capability)) {
96327 log_packet_detailed("PACKET_EDIT_UNIT_REMOVE_BY_ID: using variant=100 cap=%s", capability);
96328 phandlers->receive[PACKET_EDIT_UNIT_REMOVE_BY_ID] = (void *(*)(struct connection *)) receive_packet_edit_unit_remove_by_id_100;
96329 } else if (!has_capability("ids32", capability)) {
96330 log_packet_detailed("PACKET_EDIT_UNIT_REMOVE_BY_ID: using variant=101 cap=%s", capability);
96331 phandlers->receive[PACKET_EDIT_UNIT_REMOVE_BY_ID] = (void *(*)(struct connection *)) receive_packet_edit_unit_remove_by_id_101;
96332 } else {
96333 log_error("Unknown PACKET_EDIT_UNIT_REMOVE_BY_ID variant for cap %s", capability);
96334 }
96335 if (has_capability("ids32", capability)) {
96336 log_packet_detailed("PACKET_EDIT_UNIT: using variant=100 cap=%s", capability);
96337 phandlers->receive[PACKET_EDIT_UNIT] = (void *(*)(struct connection *)) receive_packet_edit_unit_100;
96338 } else if (!has_capability("ids32", capability)) {
96339 log_packet_detailed("PACKET_EDIT_UNIT: using variant=101 cap=%s", capability);
96340 phandlers->receive[PACKET_EDIT_UNIT] = (void *(*)(struct connection *)) receive_packet_edit_unit_101;
96341 } else {
96342 log_error("Unknown PACKET_EDIT_UNIT variant for cap %s", capability);
96343 }
96344 if (has_capability("ids32", capability)) {
96345 log_packet_detailed("PACKET_EDIT_CITY_REMOVE: using variant=100 cap=%s", capability);
96346 phandlers->receive[PACKET_EDIT_CITY_REMOVE] = (void *(*)(struct connection *)) receive_packet_edit_city_remove_100;
96347 } else if (!has_capability("ids32", capability)) {
96348 log_packet_detailed("PACKET_EDIT_CITY_REMOVE: using variant=101 cap=%s", capability);
96349 phandlers->receive[PACKET_EDIT_CITY_REMOVE] = (void *(*)(struct connection *)) receive_packet_edit_city_remove_101;
96350 } else {
96351 log_error("Unknown PACKET_EDIT_CITY_REMOVE variant for cap %s", capability);
96352 }
96353 if (has_capability("ids32", capability)) {
96354 log_packet_detailed("PACKET_EDIT_CITY: using variant=100 cap=%s", capability);
96355 phandlers->receive[PACKET_EDIT_CITY] = (void *(*)(struct connection *)) receive_packet_edit_city_100;
96356 } else if (!has_capability("ids32", capability)) {
96357 log_packet_detailed("PACKET_EDIT_CITY: using variant=101 cap=%s", capability);
96358 phandlers->receive[PACKET_EDIT_CITY] = (void *(*)(struct connection *)) receive_packet_edit_city_101;
96359 } else {
96360 log_error("Unknown PACKET_EDIT_CITY variant for cap %s", capability);
96361 }
96362 } else {
96363 if (has_capability("ids32", capability)) {
96364 log_packet_detailed("PACKET_CITY_SELL: using variant=100 cap=%s", capability);
96365 phandlers->send[PACKET_CITY_SELL].packet = (int(*)(struct connection *, const void *)) send_packet_city_sell_100;
96366 } else if (!has_capability("ids32", capability)) {
96367 log_packet_detailed("PACKET_CITY_SELL: using variant=101 cap=%s", capability);
96368 phandlers->send[PACKET_CITY_SELL].packet = (int(*)(struct connection *, const void *)) send_packet_city_sell_101;
96369 } else {
96370 log_error("Unknown PACKET_CITY_SELL variant for cap %s", capability);
96371 }
96372 if (has_capability("ids32", capability)) {
96373 log_packet_detailed("PACKET_CITY_BUY: using variant=100 cap=%s", capability);
96374 phandlers->send[PACKET_CITY_BUY].packet = (int(*)(struct connection *, const void *)) send_packet_city_buy_100;
96375 } else if (!has_capability("ids32", capability)) {
96376 log_packet_detailed("PACKET_CITY_BUY: using variant=101 cap=%s", capability);
96377 phandlers->send[PACKET_CITY_BUY].packet = (int(*)(struct connection *, const void *)) send_packet_city_buy_101;
96378 } else {
96379 log_error("Unknown PACKET_CITY_BUY variant for cap %s", capability);
96380 }
96381 if (has_capability("ids32", capability)) {
96382 log_packet_detailed("PACKET_CITY_CHANGE: using variant=100 cap=%s", capability);
96383 phandlers->send[PACKET_CITY_CHANGE].packet = (int(*)(struct connection *, const void *)) send_packet_city_change_100;
96384 } else if (!has_capability("ids32", capability)) {
96385 log_packet_detailed("PACKET_CITY_CHANGE: using variant=101 cap=%s", capability);
96386 phandlers->send[PACKET_CITY_CHANGE].packet = (int(*)(struct connection *, const void *)) send_packet_city_change_101;
96387 } else {
96388 log_error("Unknown PACKET_CITY_CHANGE variant for cap %s", capability);
96389 }
96390 if (has_capability("ids32", capability)) {
96391 log_packet_detailed("PACKET_CITY_WORKLIST: using variant=100 cap=%s", capability);
96392 phandlers->send[PACKET_CITY_WORKLIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_worklist_100;
96393 } else if (!has_capability("ids32", capability)) {
96394 log_packet_detailed("PACKET_CITY_WORKLIST: using variant=101 cap=%s", capability);
96395 phandlers->send[PACKET_CITY_WORKLIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_worklist_101;
96396 } else {
96397 log_error("Unknown PACKET_CITY_WORKLIST variant for cap %s", capability);
96398 }
96399 if (has_capability("ids32", capability)) {
96400 log_packet_detailed("PACKET_CITY_MAKE_SPECIALIST: using variant=100 cap=%s", capability);
96401 phandlers->send[PACKET_CITY_MAKE_SPECIALIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_make_specialist_100;
96402 } else if (!has_capability("ids32", capability)) {
96403 log_packet_detailed("PACKET_CITY_MAKE_SPECIALIST: using variant=101 cap=%s", capability);
96404 phandlers->send[PACKET_CITY_MAKE_SPECIALIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_make_specialist_101;
96405 } else {
96406 log_error("Unknown PACKET_CITY_MAKE_SPECIALIST variant for cap %s", capability);
96407 }
96408 if (has_capability("ids32", capability)) {
96409 log_packet_detailed("PACKET_CITY_MAKE_WORKER: using variant=100 cap=%s", capability);
96410 phandlers->send[PACKET_CITY_MAKE_WORKER].packet = (int(*)(struct connection *, const void *)) send_packet_city_make_worker_100;
96411 } else if (!has_capability("ids32", capability)) {
96412 log_packet_detailed("PACKET_CITY_MAKE_WORKER: using variant=101 cap=%s", capability);
96413 phandlers->send[PACKET_CITY_MAKE_WORKER].packet = (int(*)(struct connection *, const void *)) send_packet_city_make_worker_101;
96414 } else {
96415 log_error("Unknown PACKET_CITY_MAKE_WORKER variant for cap %s", capability);
96416 }
96417 if (has_capability("ids32", capability)) {
96418 log_packet_detailed("PACKET_CITY_CHANGE_SPECIALIST: using variant=100 cap=%s", capability);
96419 phandlers->send[PACKET_CITY_CHANGE_SPECIALIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_change_specialist_100;
96420 } else if (!has_capability("ids32", capability)) {
96421 log_packet_detailed("PACKET_CITY_CHANGE_SPECIALIST: using variant=101 cap=%s", capability);
96422 phandlers->send[PACKET_CITY_CHANGE_SPECIALIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_change_specialist_101;
96423 } else {
96424 log_error("Unknown PACKET_CITY_CHANGE_SPECIALIST variant for cap %s", capability);
96425 }
96426 if (has_capability("ids32", capability)) {
96427 log_packet_detailed("PACKET_CITY_RENAME: using variant=100 cap=%s", capability);
96428 phandlers->send[PACKET_CITY_RENAME].packet = (int(*)(struct connection *, const void *)) send_packet_city_rename_100;
96429 } else if (!has_capability("ids32", capability)) {
96430 log_packet_detailed("PACKET_CITY_RENAME: using variant=101 cap=%s", capability);
96431 phandlers->send[PACKET_CITY_RENAME].packet = (int(*)(struct connection *, const void *)) send_packet_city_rename_101;
96432 } else {
96433 log_error("Unknown PACKET_CITY_RENAME variant for cap %s", capability);
96434 }
96435 if (has_capability("ids32", capability)) {
96436 log_packet_detailed("PACKET_CITY_OPTIONS_REQ: using variant=100 cap=%s", capability);
96437 phandlers->send[PACKET_CITY_OPTIONS_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_city_options_req_100;
96438 } else if (!has_capability("ids32", capability)) {
96439 log_packet_detailed("PACKET_CITY_OPTIONS_REQ: using variant=101 cap=%s", capability);
96440 phandlers->send[PACKET_CITY_OPTIONS_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_city_options_req_101;
96441 } else {
96442 log_error("Unknown PACKET_CITY_OPTIONS_REQ variant for cap %s", capability);
96443 }
96444 if (has_capability("ids32", capability)) {
96445 log_packet_detailed("PACKET_CITY_REFRESH: using variant=100 cap=%s", capability);
96446 phandlers->send[PACKET_CITY_REFRESH].packet = (int(*)(struct connection *, const void *)) send_packet_city_refresh_100;
96447 } else if (!has_capability("ids32", capability)) {
96448 log_packet_detailed("PACKET_CITY_REFRESH: using variant=101 cap=%s", capability);
96449 phandlers->send[PACKET_CITY_REFRESH].packet = (int(*)(struct connection *, const void *)) send_packet_city_refresh_101;
96450 } else {
96451 log_error("Unknown PACKET_CITY_REFRESH variant for cap %s", capability);
96452 }
96453 if (has_capability("ids32", capability)) {
96454 log_packet_detailed("PACKET_CITY_NAME_SUGGESTION_REQ: using variant=100 cap=%s", capability);
96455 phandlers->send[PACKET_CITY_NAME_SUGGESTION_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_city_name_suggestion_req_100;
96456 } else if (!has_capability("ids32", capability)) {
96457 log_packet_detailed("PACKET_CITY_NAME_SUGGESTION_REQ: using variant=101 cap=%s", capability);
96458 phandlers->send[PACKET_CITY_NAME_SUGGESTION_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_city_name_suggestion_req_101;
96459 } else {
96460 log_error("Unknown PACKET_CITY_NAME_SUGGESTION_REQ variant for cap %s", capability);
96461 }
96462 if (has_capability("ids32", capability)) {
96463 log_packet_detailed("PACKET_UNIT_SSCS_SET: using variant=100 cap=%s", capability);
96464 phandlers->send[PACKET_UNIT_SSCS_SET].packet = (int(*)(struct connection *, const void *)) send_packet_unit_sscs_set_100;
96465 } else if (!has_capability("ids32", capability)) {
96466 log_packet_detailed("PACKET_UNIT_SSCS_SET: using variant=101 cap=%s", capability);
96467 phandlers->send[PACKET_UNIT_SSCS_SET].packet = (int(*)(struct connection *, const void *)) send_packet_unit_sscs_set_101;
96468 } else {
96469 log_error("Unknown PACKET_UNIT_SSCS_SET variant for cap %s", capability);
96470 }
96471 if (has_capability("ids32", capability)) {
96472 log_packet_detailed("PACKET_UNIT_ORDERS: using variant=100 cap=%s", capability);
96473 phandlers->send[PACKET_UNIT_ORDERS].packet = (int(*)(struct connection *, const void *)) send_packet_unit_orders_100;
96474 } else if (!has_capability("ids32", capability)) {
96475 log_packet_detailed("PACKET_UNIT_ORDERS: using variant=101 cap=%s", capability);
96476 phandlers->send[PACKET_UNIT_ORDERS].packet = (int(*)(struct connection *, const void *)) send_packet_unit_orders_101;
96477 } else {
96478 log_error("Unknown PACKET_UNIT_ORDERS variant for cap %s", capability);
96479 }
96480 if (has_capability("ids32", capability)) {
96481 log_packet_detailed("PACKET_UNIT_SERVER_SIDE_AGENT_SET: using variant=100 cap=%s", capability);
96482 phandlers->send[PACKET_UNIT_SERVER_SIDE_AGENT_SET].packet = (int(*)(struct connection *, const void *)) send_packet_unit_server_side_agent_set_100;
96483 } else if (!has_capability("ids32", capability)) {
96484 log_packet_detailed("PACKET_UNIT_SERVER_SIDE_AGENT_SET: using variant=101 cap=%s", capability);
96485 phandlers->send[PACKET_UNIT_SERVER_SIDE_AGENT_SET].packet = (int(*)(struct connection *, const void *)) send_packet_unit_server_side_agent_set_101;
96486 } else {
96487 log_error("Unknown PACKET_UNIT_SERVER_SIDE_AGENT_SET variant for cap %s", capability);
96488 }
96489 if (has_capability("ids32", capability)) {
96490 log_packet_detailed("PACKET_UNIT_ACTION_QUERY: using variant=100 cap=%s", capability);
96491 phandlers->send[PACKET_UNIT_ACTION_QUERY].packet = (int(*)(struct connection *, const void *)) send_packet_unit_action_query_100;
96492 } else if (!has_capability("ids32", capability)) {
96493 log_packet_detailed("PACKET_UNIT_ACTION_QUERY: using variant=101 cap=%s", capability);
96494 phandlers->send[PACKET_UNIT_ACTION_QUERY].packet = (int(*)(struct connection *, const void *)) send_packet_unit_action_query_101;
96495 } else {
96496 log_error("Unknown PACKET_UNIT_ACTION_QUERY variant for cap %s", capability);
96497 }
96498 if (has_capability("ids32", capability)) {
96499 log_packet_detailed("PACKET_UNIT_DO_ACTION: using variant=100 cap=%s", capability);
96500 phandlers->send[PACKET_UNIT_DO_ACTION].packet = (int(*)(struct connection *, const void *)) send_packet_unit_do_action_100;
96501 } else if (!has_capability("ids32", capability)) {
96502 log_packet_detailed("PACKET_UNIT_DO_ACTION: using variant=101 cap=%s", capability);
96503 phandlers->send[PACKET_UNIT_DO_ACTION].packet = (int(*)(struct connection *, const void *)) send_packet_unit_do_action_101;
96504 } else {
96505 log_error("Unknown PACKET_UNIT_DO_ACTION variant for cap %s", capability);
96506 }
96507 if (has_capability("ids32", capability)) {
96508 log_packet_detailed("PACKET_UNIT_GET_ACTIONS: using variant=100 cap=%s", capability);
96509 phandlers->send[PACKET_UNIT_GET_ACTIONS].packet = (int(*)(struct connection *, const void *)) send_packet_unit_get_actions_100;
96510 } else if (!has_capability("ids32", capability)) {
96511 log_packet_detailed("PACKET_UNIT_GET_ACTIONS: using variant=101 cap=%s", capability);
96512 phandlers->send[PACKET_UNIT_GET_ACTIONS].packet = (int(*)(struct connection *, const void *)) send_packet_unit_get_actions_101;
96513 } else {
96514 log_error("Unknown PACKET_UNIT_GET_ACTIONS variant for cap %s", capability);
96515 }
96516 if (has_capability("ids32", capability)) {
96517 log_packet_detailed("PACKET_UNIT_CHANGE_ACTIVITY: using variant=100 cap=%s", capability);
96518 phandlers->send[PACKET_UNIT_CHANGE_ACTIVITY].packet = (int(*)(struct connection *, const void *)) send_packet_unit_change_activity_100;
96519 } else if (!has_capability("ids32", capability)) {
96520 log_packet_detailed("PACKET_UNIT_CHANGE_ACTIVITY: using variant=101 cap=%s", capability);
96521 phandlers->send[PACKET_UNIT_CHANGE_ACTIVITY].packet = (int(*)(struct connection *, const void *)) send_packet_unit_change_activity_101;
96522 } else {
96523 log_error("Unknown PACKET_UNIT_CHANGE_ACTIVITY variant for cap %s", capability);
96524 }
96525 if (has_capability("ids32", capability)) {
96526 log_packet_detailed("PACKET_EDIT_UNIT_REMOVE_BY_ID: using variant=100 cap=%s", capability);
96527 phandlers->send[PACKET_EDIT_UNIT_REMOVE_BY_ID].packet = (int(*)(struct connection *, const void *)) send_packet_edit_unit_remove_by_id_100;
96528 } else if (!has_capability("ids32", capability)) {
96529 log_packet_detailed("PACKET_EDIT_UNIT_REMOVE_BY_ID: using variant=101 cap=%s", capability);
96530 phandlers->send[PACKET_EDIT_UNIT_REMOVE_BY_ID].packet = (int(*)(struct connection *, const void *)) send_packet_edit_unit_remove_by_id_101;
96531 } else {
96532 log_error("Unknown PACKET_EDIT_UNIT_REMOVE_BY_ID variant for cap %s", capability);
96533 }
96534 if (has_capability("ids32", capability)) {
96535 log_packet_detailed("PACKET_EDIT_UNIT: using variant=100 cap=%s", capability);
96536 phandlers->send[PACKET_EDIT_UNIT].packet = (int(*)(struct connection *, const void *)) send_packet_edit_unit_100;
96537 } else if (!has_capability("ids32", capability)) {
96538 log_packet_detailed("PACKET_EDIT_UNIT: using variant=101 cap=%s", capability);
96539 phandlers->send[PACKET_EDIT_UNIT].packet = (int(*)(struct connection *, const void *)) send_packet_edit_unit_101;
96540 } else {
96541 log_error("Unknown PACKET_EDIT_UNIT variant for cap %s", capability);
96542 }
96543 if (has_capability("ids32", capability)) {
96544 log_packet_detailed("PACKET_EDIT_CITY_REMOVE: using variant=100 cap=%s", capability);
96545 phandlers->send[PACKET_EDIT_CITY_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_city_remove_100;
96546 } else if (!has_capability("ids32", capability)) {
96547 log_packet_detailed("PACKET_EDIT_CITY_REMOVE: using variant=101 cap=%s", capability);
96548 phandlers->send[PACKET_EDIT_CITY_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_city_remove_101;
96549 } else {
96550 log_error("Unknown PACKET_EDIT_CITY_REMOVE variant for cap %s", capability);
96551 }
96552 if (has_capability("ids32", capability)) {
96553 log_packet_detailed("PACKET_EDIT_CITY: using variant=100 cap=%s", capability);
96554 phandlers->send[PACKET_EDIT_CITY].packet = (int(*)(struct connection *, const void *)) send_packet_edit_city_100;
96555 } else if (!has_capability("ids32", capability)) {
96556 log_packet_detailed("PACKET_EDIT_CITY: using variant=101 cap=%s", capability);
96557 phandlers->send[PACKET_EDIT_CITY].packet = (int(*)(struct connection *, const void *)) send_packet_edit_city_101;
96558 } else {
96559 log_error("Unknown PACKET_EDIT_CITY variant for cap %s", capability);
96560 }
96561 if (has_capability("ids32", capability)) {
96562 log_packet_detailed("PACKET_INVESTIGATE_STARTED: using variant=100 cap=%s", capability);
96563 phandlers->receive[PACKET_INVESTIGATE_STARTED] = (void *(*)(struct connection *)) receive_packet_investigate_started_100;
96564 } else if (!has_capability("ids32", capability)) {
96565 log_packet_detailed("PACKET_INVESTIGATE_STARTED: using variant=101 cap=%s", capability);
96566 phandlers->receive[PACKET_INVESTIGATE_STARTED] = (void *(*)(struct connection *)) receive_packet_investigate_started_101;
96567 } else {
96568 log_error("Unknown PACKET_INVESTIGATE_STARTED variant for cap %s", capability);
96569 }
96570 if (has_capability("ids32", capability)) {
96571 log_packet_detailed("PACKET_INVESTIGATE_FINISHED: using variant=100 cap=%s", capability);
96572 phandlers->receive[PACKET_INVESTIGATE_FINISHED] = (void *(*)(struct connection *)) receive_packet_investigate_finished_100;
96573 } else if (!has_capability("ids32", capability)) {
96574 log_packet_detailed("PACKET_INVESTIGATE_FINISHED: using variant=101 cap=%s", capability);
96575 phandlers->receive[PACKET_INVESTIGATE_FINISHED] = (void *(*)(struct connection *)) receive_packet_investigate_finished_101;
96576 } else {
96577 log_error("Unknown PACKET_INVESTIGATE_FINISHED variant for cap %s", capability);
96578 }
96579 if (has_capability("ids32", capability)) {
96580 log_packet_detailed("PACKET_TILE_INFO: using variant=100 cap=%s", capability);
96581 phandlers->receive[PACKET_TILE_INFO] = (void *(*)(struct connection *)) receive_packet_tile_info_100;
96582 } else if (!has_capability("ids32", capability)) {
96583 log_packet_detailed("PACKET_TILE_INFO: using variant=101 cap=%s", capability);
96584 phandlers->receive[PACKET_TILE_INFO] = (void *(*)(struct connection *)) receive_packet_tile_info_101;
96585 } else {
96586 log_error("Unknown PACKET_TILE_INFO variant for cap %s", capability);
96587 }
96588 if (has_capability("ids32", capability)) {
96589 log_packet_detailed("PACKET_CITY_REMOVE: using variant=100 cap=%s", capability);
96590 phandlers->receive[PACKET_CITY_REMOVE] = (void *(*)(struct connection *)) receive_packet_city_remove_100;
96591 } else if (!has_capability("ids32", capability)) {
96592 log_packet_detailed("PACKET_CITY_REMOVE: using variant=101 cap=%s", capability);
96593 phandlers->receive[PACKET_CITY_REMOVE] = (void *(*)(struct connection *)) receive_packet_city_remove_101;
96594 } else {
96595 log_error("Unknown PACKET_CITY_REMOVE variant for cap %s", capability);
96596 }
96597 if (has_capability("ids32", capability) && has_capability("city-original", capability)) {
96598 log_packet_detailed("PACKET_CITY_INFO: using variant=100 cap=%s", capability);
96599 phandlers->receive[PACKET_CITY_INFO] = (void *(*)(struct connection *)) receive_packet_city_info_100;
96600 } else if (has_capability("ids32", capability) && !has_capability("city-original", capability)) {
96601 log_packet_detailed("PACKET_CITY_INFO: using variant=101 cap=%s", capability);
96602 phandlers->receive[PACKET_CITY_INFO] = (void *(*)(struct connection *)) receive_packet_city_info_101;
96603 } else if (has_capability("city-original", capability) && !has_capability("ids32", capability)) {
96604 log_packet_detailed("PACKET_CITY_INFO: using variant=102 cap=%s", capability);
96605 phandlers->receive[PACKET_CITY_INFO] = (void *(*)(struct connection *)) receive_packet_city_info_102;
96606 } else if (!has_capability("ids32", capability) && !has_capability("city-original", capability)) {
96607 log_packet_detailed("PACKET_CITY_INFO: using variant=103 cap=%s", capability);
96608 phandlers->receive[PACKET_CITY_INFO] = (void *(*)(struct connection *)) receive_packet_city_info_103;
96609 } else {
96610 log_error("Unknown PACKET_CITY_INFO variant for cap %s", capability);
96611 }
96612 if (has_capability("ids32", capability)) {
96613 log_packet_detailed("PACKET_CITY_NATIONALITIES: using variant=100 cap=%s", capability);
96614 phandlers->receive[PACKET_CITY_NATIONALITIES] = (void *(*)(struct connection *)) receive_packet_city_nationalities_100;
96615 } else if (!has_capability("ids32", capability)) {
96616 log_packet_detailed("PACKET_CITY_NATIONALITIES: using variant=101 cap=%s", capability);
96617 phandlers->receive[PACKET_CITY_NATIONALITIES] = (void *(*)(struct connection *)) receive_packet_city_nationalities_101;
96618 } else {
96619 log_error("Unknown PACKET_CITY_NATIONALITIES variant for cap %s", capability);
96620 }
96621 if (has_capability("ids32", capability)) {
96622 log_packet_detailed("PACKET_CITY_SHORT_INFO: using variant=100 cap=%s", capability);
96623 phandlers->receive[PACKET_CITY_SHORT_INFO] = (void *(*)(struct connection *)) receive_packet_city_short_info_100;
96624 } else if (!has_capability("ids32", capability)) {
96625 log_packet_detailed("PACKET_CITY_SHORT_INFO: using variant=101 cap=%s", capability);
96626 phandlers->receive[PACKET_CITY_SHORT_INFO] = (void *(*)(struct connection *)) receive_packet_city_short_info_101;
96627 } else {
96628 log_error("Unknown PACKET_CITY_SHORT_INFO variant for cap %s", capability);
96629 }
96630 if (has_capability("ids32", capability)) {
96631 log_packet_detailed("PACKET_TRADE_ROUTE_INFO: using variant=100 cap=%s", capability);
96632 phandlers->receive[PACKET_TRADE_ROUTE_INFO] = (void *(*)(struct connection *)) receive_packet_trade_route_info_100;
96633 } else if (!has_capability("ids32", capability)) {
96634 log_packet_detailed("PACKET_TRADE_ROUTE_INFO: using variant=101 cap=%s", capability);
96635 phandlers->receive[PACKET_TRADE_ROUTE_INFO] = (void *(*)(struct connection *)) receive_packet_trade_route_info_101;
96636 } else {
96637 log_error("Unknown PACKET_TRADE_ROUTE_INFO variant for cap %s", capability);
96638 }
96639 if (has_capability("ids32", capability)) {
96640 log_packet_detailed("PACKET_CITY_NAME_SUGGESTION_INFO: using variant=100 cap=%s", capability);
96641 phandlers->receive[PACKET_CITY_NAME_SUGGESTION_INFO] = (void *(*)(struct connection *)) receive_packet_city_name_suggestion_info_100;
96642 } else if (!has_capability("ids32", capability)) {
96643 log_packet_detailed("PACKET_CITY_NAME_SUGGESTION_INFO: using variant=101 cap=%s", capability);
96644 phandlers->receive[PACKET_CITY_NAME_SUGGESTION_INFO] = (void *(*)(struct connection *)) receive_packet_city_name_suggestion_info_101;
96645 } else {
96646 log_error("Unknown PACKET_CITY_NAME_SUGGESTION_INFO variant for cap %s", capability);
96647 }
96648 if (has_capability("ids32", capability)) {
96649 log_packet_detailed("PACKET_CITY_SABOTAGE_LIST: using variant=100 cap=%s", capability);
96650 phandlers->receive[PACKET_CITY_SABOTAGE_LIST] = (void *(*)(struct connection *)) receive_packet_city_sabotage_list_100;
96651 } else if (!has_capability("ids32", capability)) {
96652 log_packet_detailed("PACKET_CITY_SABOTAGE_LIST: using variant=101 cap=%s", capability);
96653 phandlers->receive[PACKET_CITY_SABOTAGE_LIST] = (void *(*)(struct connection *)) receive_packet_city_sabotage_list_101;
96654 } else {
96655 log_error("Unknown PACKET_CITY_SABOTAGE_LIST variant for cap %s", capability);
96656 }
96657 if (has_capability("ids32", capability)) {
96658 log_packet_detailed("PACKET_UNIT_REMOVE: using variant=100 cap=%s", capability);
96659 phandlers->receive[PACKET_UNIT_REMOVE] = (void *(*)(struct connection *)) receive_packet_unit_remove_100;
96660 } else if (!has_capability("ids32", capability)) {
96661 log_packet_detailed("PACKET_UNIT_REMOVE: using variant=101 cap=%s", capability);
96662 phandlers->receive[PACKET_UNIT_REMOVE] = (void *(*)(struct connection *)) receive_packet_unit_remove_101;
96663 } else {
96664 log_error("Unknown PACKET_UNIT_REMOVE variant for cap %s", capability);
96665 }
96666 if (has_capability("ids32", capability)) {
96667 log_packet_detailed("PACKET_UNIT_INFO: using variant=100 cap=%s", capability);
96668 phandlers->receive[PACKET_UNIT_INFO] = (void *(*)(struct connection *)) receive_packet_unit_info_100;
96669 } else if (!has_capability("ids32", capability)) {
96670 log_packet_detailed("PACKET_UNIT_INFO: using variant=101 cap=%s", capability);
96671 phandlers->receive[PACKET_UNIT_INFO] = (void *(*)(struct connection *)) receive_packet_unit_info_101;
96672 } else {
96673 log_error("Unknown PACKET_UNIT_INFO variant for cap %s", capability);
96674 }
96675 if (has_capability("ids32", capability)) {
96676 log_packet_detailed("PACKET_UNIT_SHORT_INFO: using variant=100 cap=%s", capability);
96677 phandlers->receive[PACKET_UNIT_SHORT_INFO] = (void *(*)(struct connection *)) receive_packet_unit_short_info_100;
96678 } else if (!has_capability("ids32", capability)) {
96679 log_packet_detailed("PACKET_UNIT_SHORT_INFO: using variant=101 cap=%s", capability);
96680 phandlers->receive[PACKET_UNIT_SHORT_INFO] = (void *(*)(struct connection *)) receive_packet_unit_short_info_101;
96681 } else {
96682 log_error("Unknown PACKET_UNIT_SHORT_INFO variant for cap %s", capability);
96683 }
96684 if (has_capability("ids32", capability)) {
96685 log_packet_detailed("PACKET_UNIT_COMBAT_INFO: using variant=100 cap=%s", capability);
96686 phandlers->receive[PACKET_UNIT_COMBAT_INFO] = (void *(*)(struct connection *)) receive_packet_unit_combat_info_100;
96687 } else if (!has_capability("ids32", capability)) {
96688 log_packet_detailed("PACKET_UNIT_COMBAT_INFO: using variant=101 cap=%s", capability);
96689 phandlers->receive[PACKET_UNIT_COMBAT_INFO] = (void *(*)(struct connection *)) receive_packet_unit_combat_info_101;
96690 } else {
96691 log_error("Unknown PACKET_UNIT_COMBAT_INFO variant for cap %s", capability);
96692 }
96693 if (has_capability("ids32", capability)) {
96694 log_packet_detailed("PACKET_UNIT_ACTION_ANSWER: using variant=100 cap=%s", capability);
96695 phandlers->receive[PACKET_UNIT_ACTION_ANSWER] = (void *(*)(struct connection *)) receive_packet_unit_action_answer_100;
96696 } else if (!has_capability("ids32", capability)) {
96697 log_packet_detailed("PACKET_UNIT_ACTION_ANSWER: using variant=101 cap=%s", capability);
96698 phandlers->receive[PACKET_UNIT_ACTION_ANSWER] = (void *(*)(struct connection *)) receive_packet_unit_action_answer_101;
96699 } else {
96700 log_error("Unknown PACKET_UNIT_ACTION_ANSWER variant for cap %s", capability);
96701 }
96702 if (has_capability("ids32", capability)) {
96703 log_packet_detailed("PACKET_UNIT_ACTIONS: using variant=100 cap=%s", capability);
96704 phandlers->receive[PACKET_UNIT_ACTIONS] = (void *(*)(struct connection *)) receive_packet_unit_actions_100;
96705 } else if (!has_capability("ids32", capability)) {
96706 log_packet_detailed("PACKET_UNIT_ACTIONS: using variant=101 cap=%s", capability);
96707 phandlers->receive[PACKET_UNIT_ACTIONS] = (void *(*)(struct connection *)) receive_packet_unit_actions_101;
96708 } else {
96709 log_error("Unknown PACKET_UNIT_ACTIONS variant for cap %s", capability);
96710 }
96711 if (has_capability("rsdesc32", capability)) {
96712 log_packet_detailed("PACKET_RULESET_CONTROL: using variant=100 cap=%s", capability);
96713 phandlers->receive[PACKET_RULESET_CONTROL] = (void *(*)(struct connection *)) receive_packet_ruleset_control_100;
96714 } else if (!has_capability("rsdesc32", capability)) {
96715 log_packet_detailed("PACKET_RULESET_CONTROL: using variant=101 cap=%s", capability);
96716 phandlers->receive[PACKET_RULESET_CONTROL] = (void *(*)(struct connection *)) receive_packet_ruleset_control_101;
96717 } else {
96718 log_error("Unknown PACKET_RULESET_CONTROL variant for cap %s", capability);
96719 }
96720 if (has_capability("ids32", capability)) {
96721 log_packet_detailed("PACKET_WEB_CITY_INFO_ADDITION: using variant=100 cap=%s", capability);
96722 phandlers->receive[PACKET_WEB_CITY_INFO_ADDITION] = (void *(*)(struct connection *)) receive_packet_web_city_info_addition_100;
96723 } else if (!has_capability("ids32", capability)) {
96724 log_packet_detailed("PACKET_WEB_CITY_INFO_ADDITION: using variant=101 cap=%s", capability);
96725 phandlers->receive[PACKET_WEB_CITY_INFO_ADDITION] = (void *(*)(struct connection *)) receive_packet_web_city_info_addition_101;
96726 } else {
96727 log_error("Unknown PACKET_WEB_CITY_INFO_ADDITION variant for cap %s", capability);
96728 }
96729 }
96730}
are_action_probabilitys_equal
bool are_action_probabilitys_equal(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:6760
MAX_NUM_ACTIONS
#define MAX_NUM_ACTIONS
Definition actions.h:296
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
has_capability
bool has_capability(const char *cap, const char *capstr)
Definition capability.c:77
capability.h
our_capability
const char *const our_capability
Definition capstr.c:32
capstr.h
FEELING_LAST
@ FEELING_LAST
Definition city.h:277
resources
char * resources
Definition comments.c:35
disasters
char * disasters
Definition comments.c:43
conn_description
const char * conn_description(const struct connection *pconn)
Definition connection.c:473
connection.h
conn_list_iterate
#define conn_list_iterate(connlist, pconn)
Definition connection.h:113
conn_list_iterate_end
#define conn_list_iterate_end
Definition connection.h:115
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:1067
plocation_elem_new
struct plocation * plocation_elem_new(int number)
Definition dataio_raw.c:1081
airlift
static void airlift(QVariant data1, QVariant data2)
Definition dialogs.cpp:1816
caption
const char * caption
Definition dialogs_g.h:36
headline
const char const char * headline
Definition dialogs_g.h:37
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:73
giver
int int initiated_from int int giver
Definition diplodlg_g.h:28
counterpart
int counterpart
Definition diplodlg_g.h:25
diplomat_investigate
bool diplomat_investigate(struct player *pplayer, struct unit *pdiplomat, struct city *pcity, const struct action *paction)
Definition diplomats.c:325
id
int int id
Definition editgui_g.h:28
effects
struct effect_list * effects[EFT_COUNT]
Definition effects.c:120
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
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:79
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:382
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:380
Nation_type_id
int Nation_type_id
Definition fc_types.h:350
Terrain_type_id
int Terrain_type_id
Definition fc_types.h:343
action_id
int action_id
Definition fc_types.h:359
SP_MAX
#define SP_MAX
Definition fc_types.h:379
Specialist_type_id
int Specialist_type_id
Definition fc_types.h:345
Government_type_id
int Government_type_id
Definition fc_types.h:351
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
spaceship_place_type
spaceship_place_type
Definition fc_types.h:1148
Unit_type_id
int Unit_type_id
Definition fc_types.h:352
MAX_NUM_TECH_LIST
#define MAX_NUM_TECH_LIST
Definition fc_types.h:44
O_LAST
@ O_LAST
Definition fc_types.h:91
Multiplier_type_id
int Multiplier_type_id
Definition fc_types.h:356
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:70
target_extra_id
static int target_extra_id
Definition action_dialog.c:70
owner
struct city * owner
Definition citydlg.c:219
load_filename
static void load_filename(const char *filename)
Definition pages.c:2838
scenario_authors
static GtkWidget * scenario_authors
Definition pages.c:64
type
GType type
Definition repodlgs.c:1312
hash
static GHashTable * hash
Definition wldlg.c:320
persistent
static GtkWidget * persistent
Definition rallypointdlg.c:40
leader_name
static char * leader_name
Definition dialogs.c:96
B_LAST
#define B_LAST
Definition improvement.h:42
name
const char * name
Definition inputfile.c:127
log.h
fc_assert_msg
#define fc_assert_msg(condition, message,...)
Definition log.h:181
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:116
global_warming
void global_warming(int effect)
Definition maphand.c:103
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:506
num_nation_sets
static int num_nation_sets
Definition nation.c:47
num_nation_groups
static int num_nation_groups
Definition nation.c:49
nations
static struct nation_type * nations
Definition nation.c:45
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
ATTRIBUTE_CHUNK_SIZE
#define ATTRIBUTE_CHUNK_SIZE
Definition packets.h:65
SEND_PACKET_START
#define SEND_PACKET_START(packet_type)
Definition packets.h:151
RECEIVE_PACKET_START
#define RECEIVE_PACKET_START(packet_type, result)
Definition packets.h:169
SEND_PACKET_END
#define SEND_PACKET_END(packet_type)
Definition packets.h:159
report_type
report_type
Definition packets.h:73
RECEIVE_PACKET_FIELD_ERROR
#define RECEIVE_PACKET_FIELD_ERROR(field,...)
Definition packets.h:193
MAX_LEN_ROUTE
#define MAX_LEN_ROUTE
Definition packets.h:44
RECEIVE_PACKET_END
#define RECEIVE_PACKET_END(result)
Definition packets.h:184
authentication_type
authentication_type
Definition packets.h:88
receive_packet_city_info_103
static struct packet_city_info * receive_packet_city_info_103(struct connection *pc)
Definition packets_gen.c:20703
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:9783
receive_packet_set_topology_100
static struct packet_set_topology * receive_packet_set_topology_100(struct connection *pc)
Definition packets_gen.c:82474
receive_packet_chat_msg_100
static struct packet_chat_msg * receive_packet_chat_msg_100(struct connection *pc)
Definition packets_gen.c:10476
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:30828
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:63202
receive_packet_edit_tile_100
static struct packet_edit_tile * receive_packet_edit_tile_100(struct connection *pc)
Definition packets_gen.c:86121
receive_packet_city_rename_101
static struct packet_city_rename * receive_packet_city_rename_101(struct connection *pc)
Definition packets_gen.c:29125
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:50933
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:88804
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:55027
send_packet_edit_unit_101
static int send_packet_edit_unit_101(struct connection *pc, const struct packet_edit_unit *packet)
Definition packets_gen.c:88266
lsend_packet_ruleset_summary
void lsend_packet_ruleset_summary(struct conn_list *dest, const struct packet_ruleset_summary *packet)
Definition packets_gen.c:78537
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:49553
send_packet_unit_remove_101
static int send_packet_unit_remove_101(struct connection *pc, const struct packet_unit_remove *packet)
Definition packets_gen.c:37909
dsend_packet_city_make_worker
int dsend_packet_city_make_worker(struct connection *pc, int city_id16, int city_id32, int tile_id)
Definition packets_gen.c:28461
receive_packet_thaw_client_100
static struct packet_thaw_client * receive_packet_thaw_client_100(struct connection *pc)
Definition packets_gen.c:52904
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:49121
send_packet_unit_combat_info_101
static int send_packet_unit_combat_info_101(struct connection *pc, const struct packet_unit_combat_info *packet)
Definition packets_gen.c:42536
send_packet_conn_ping
int send_packet_conn_ping(struct connection *pc)
Definition packets_gen.c:52056
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:49390
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:3187
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:48744
receive_packet_unit_actions_100
static struct packet_unit_actions * receive_packet_unit_actions_100(struct connection *pc)
Definition packets_gen.c:46768
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:35564
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:50315
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:66796
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:35952
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:31982
receive_packet_tile_info_101
static struct packet_tile_info * receive_packet_tile_info_101(struct connection *pc)
Definition packets_gen.c:3867
delta_stats_reset
void delta_stats_reset(void)
Definition packets_gen.c:47
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:11360
send_packet_vote_resolve
int send_packet_vote_resolve(struct connection *pc, const struct packet_vote_resolve *packet)
Definition packets_gen.c:84957
lsend_packet_start_phase
void lsend_packet_start_phase(struct conn_list *dest, const struct packet_start_phase *packet)
Definition packets_gen.c:52545
lsend_packet_ruleset_building
void lsend_packet_ruleset_building(struct conn_list *dest, const struct packet_ruleset_building *packet)
Definition packets_gen.c:66020
send_packet_edit_city
int send_packet_edit_city(struct connection *pc, const struct packet_edit_city *packet)
Definition packets_gen.c:92349
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:82454
lsend_packet_new_year
void lsend_packet_new_year(struct conn_list *dest, const struct packet_new_year *packet)
Definition packets_gen.c:52786
receive_packet_game_info_100
static struct packet_game_info * receive_packet_game_info_100(struct connection *pc)
Definition packets_gen.c:4454
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:79146
lsend_packet_endgame_player
void lsend_packet_endgame_player(struct conn_list *dest, const struct packet_endgame_player *packet)
Definition packets_gen.c:3264
send_packet_player_attribute_block_100
static int send_packet_player_attribute_block_100(struct connection *pc)
Definition packets_gen.c:35790
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:74860
send_packet_conn_pong_100
static int send_packet_conn_pong_100(struct connection *pc)
Definition packets_gen.c:52078
send_packet_ruleset_game
int send_packet_ruleset_game(struct connection *pc, const struct packet_ruleset_game *packet)
Definition packets_gen.c:58375
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:57036
send_packet_unknown_research
int send_packet_unknown_research(struct connection *pc, const struct packet_unknown_research *packet)
Definition packets_gen.c:37322
lsend_packet_tile_info
void lsend_packet_tile_info(struct conn_list *dest, const struct packet_tile_info *packet)
Definition packets_gen.c:4439
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:36271
receive_packet_ruleset_control_100
static struct packet_ruleset_control * receive_packet_ruleset_control_100(struct connection *pc)
Definition packets_gen.c:76320
send_packet_ruleset_resource
int send_packet_ruleset_resource(struct connection *pc, const struct packet_ruleset_resource *packet)
Definition packets_gen.c:83330
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:44365
dsend_packet_player_rates
int dsend_packet_player_rates(struct connection *pc, int tax, int luxury, int science)
Definition packets_gen.c:35401
dsend_packet_spaceship_place
int dsend_packet_spaceship_place(struct connection *pc, enum spaceship_place_type type, int num)
Definition packets_gen.c:53166
send_packet_processing_finished_100
static int send_packet_processing_finished_100(struct connection *pc)
Definition packets_gen.c:1131
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:56578
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:86754
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:53520
lsend_packet_edit_player
void lsend_packet_edit_player(struct conn_list *dest, const struct packet_edit_player *packet)
Definition packets_gen.c:93721
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:61351
send_packet_end_turn
int send_packet_end_turn(struct connection *pc)
Definition packets_gen.c:52848
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:24749
send_packet_ruleset_achievement
int send_packet_ruleset_achievement(struct connection *pc, const struct packet_ruleset_achievement *packet)
Definition packets_gen.c:72785
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:74385
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:93842
receive_packet_unit_do_action_101
static struct packet_unit_do_action * receive_packet_unit_do_action_101(struct connection *pc)
Definition packets_gen.c:45329
send_packet_city_rename_101
static int send_packet_city_rename_101(struct connection *pc, const struct packet_city_rename *packet)
Definition packets_gen.c:29209
receive_packet_conn_ping_100
static struct packet_conn_ping * receive_packet_conn_ping_100(struct connection *pc)
Definition packets_gen.c:52038
receive_packet_city_change_101
static struct packet_city_change * receive_packet_city_change_101(struct connection *pc)
Definition packets_gen.c:27145
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:88792
receive_packet_ruleset_control_101
static struct packet_ruleset_control * receive_packet_ruleset_control_101(struct connection *pc)
Definition packets_gen.c:77346
receive_packet_unit_remove_101
static struct packet_unit_remove * receive_packet_unit_remove_101(struct connection *pc)
Definition packets_gen.c:37830
lsend_packet_research_info
void lsend_packet_research_info(struct conn_list *dest, const struct packet_research_info *packet)
Definition packets_gen.c:37155
send_packet_worker_task
int send_packet_worker_task(struct connection *pc, const struct packet_worker_task *packet)
Definition packets_gen.c:32553
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:95648
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:75752
lsend_packet_map_info
void lsend_packet_map_info(struct conn_list *dest, const struct packet_map_info *packet)
Definition packets_gen.c:9892
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:61938
receive_packet_ruleset_city_100
static struct packet_ruleset_city * receive_packet_ruleset_city_100(struct connection *pc)
Definition packets_gen.c:64647
receive_packet_ruleset_choices_100
static struct packet_ruleset_choices * receive_packet_ruleset_choices_100(struct connection *pc)
Definition packets_gen.c:79014
dsend_packet_connect_msg
int dsend_packet_connect_msg(struct connection *pc, const char *message)
Definition packets_gen.c:11437
receive_packet_rulesets_ready_100
static struct packet_rulesets_ready * receive_packet_rulesets_ready_100(struct connection *pc)
Definition packets_gen.c:61306
receive_packet_city_sell_101
static struct packet_city_sell * receive_packet_city_sell_101(struct connection *pc)
Definition packets_gen.c:26439
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:85388
send_packet_city_sabotage_list_101
static int send_packet_city_sabotage_list_101(struct connection *pc, const struct packet_city_sabotage_list *packet)
Definition packets_gen.c:31104
lsend_packet_game_load
void lsend_packet_game_load(struct conn_list *dest, const struct packet_game_load *packet)
Definition packets_gen.c:79472
lsend_packet_ruleset_achievement
void lsend_packet_ruleset_achievement(struct conn_list *dest, const struct packet_ruleset_achievement *packet)
Definition packets_gen.c:72797
receive_packet_ruleset_unit_100
static struct packet_ruleset_unit * receive_packet_ruleset_unit_100(struct connection *pc)
Definition packets_gen.c:53901
receive_packet_unit_info_101
static struct packet_unit_info * receive_packet_unit_info_101(struct connection *pc)
Definition packets_gen.c:39501
receive_packet_report_req_100
static struct packet_report_req * receive_packet_report_req_100(struct connection *pc)
Definition packets_gen.c:51025
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:61923
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:30640
receive_packet_unit_action_query_101
static struct packet_unit_action_query * receive_packet_unit_action_query_101(struct connection *pc)
Definition packets_gen.c:44610
send_packet_ruleset_government
int send_packet_ruleset_government(struct connection *pc, const struct packet_ruleset_government *packet)
Definition packets_gen.c:60815
receive_packet_city_nationalities_101
static struct packet_city_nationalities * receive_packet_city_nationalities_101(struct connection *pc)
Definition packets_gen.c:24013
receive_packet_city_name_suggestion_info_101
static struct packet_city_name_suggestion_info * receive_packet_city_name_suggestion_info_101(struct connection *pc)
Definition packets_gen.c:30475
receive_packet_city_info_100
static struct packet_city_info * receive_packet_city_info_100(struct connection *pc)
Definition packets_gen.c:12168
send_packet_web_city_info_addition_101
static int send_packet_web_city_info_addition_101(struct connection *pc, const struct packet_web_city_info_addition *packet, bool force_to_send)
Definition packets_gen.c:95127
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:94431
send_packet_unit_remove
int send_packet_unit_remove(struct connection *pc, const struct packet_unit_remove *packet)
Definition packets_gen.c:37984
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:2652
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:24479
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:35164
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:83541
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:86023
receive_packet_ruleset_multiplier_100
static struct packet_ruleset_multiplier * receive_packet_ruleset_multiplier_100(struct connection *pc)
Definition packets_gen.c:75079
receive_packet_tile_info_100
static struct packet_tile_info * receive_packet_tile_info_100(struct connection *pc)
Definition packets_gen.c:3289
receive_packet_page_msg_100
static struct packet_page_msg * receive_packet_page_msg_100(struct connection *pc)
Definition packets_gen.c:50569
receive_packet_vote_update_100
static struct packet_vote_update * receive_packet_vote_update_100(struct connection *pc)
Definition packets_gen.c:84369
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:86312
lsend_packet_ruleset_multiplier
void lsend_packet_ruleset_multiplier(struct conn_list *dest, const struct packet_ruleset_multiplier *packet)
Definition packets_gen.c:75718
receive_packet_unit_action_answer_101
static struct packet_unit_action_answer * receive_packet_unit_action_answer_101(struct connection *pc)
Definition packets_gen.c:45907
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:10096
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:76029
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:45053
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:59980
send_packet_edit_check_tiles_100
static int send_packet_edit_check_tiles_100(struct connection *pc)
Definition packets_gen.c:85226
dsend_packet_unit_do_action
int dsend_packet_unit_do_action(struct connection *pc, int actor_id16, int actor_id32, int target_id, int sub_tgt_id, const char *name, action_id action_type)
Definition packets_gen.c:45609
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:2883
send_packet_conn_ping_100
static int send_packet_conn_ping_100(struct connection *pc)
Definition packets_gen.c:52048
dsend_packet_diplomacy_cancel_meeting
int dsend_packet_diplomacy_cancel_meeting(struct connection *pc, int counterpart, int initiated_from)
Definition packets_gen.c:48844
receive_packet_endgame_report_100
static struct packet_endgame_report * receive_packet_endgame_report_100(struct connection *pc)
Definition packets_gen.c:2979
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:79386
send_packet_edit_city_remove_101
static int send_packet_edit_city_remove_101(struct connection *pc, const struct packet_edit_city_remove *packet)
Definition packets_gen.c:89035
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:74125
dsend_packet_player_remove
int dsend_packet_player_remove(struct connection *pc, int playerno)
Definition packets_gen.c:32736
packet_has_game_info_flag
bool packet_has_game_info_flag(enum packet_type type)
Definition packets_gen.c:570
lsend_packet_ruleset_city
void lsend_packet_ruleset_city(struct conn_list *dest, const struct packet_ruleset_city *packet)
Definition packets_gen.c:65121
send_packet_edit_recalculate_borders_100
static int send_packet_edit_recalculate_borders_100(struct connection *pc)
Definition packets_gen.c:85196
send_packet_edit_game
int send_packet_edit_game(struct connection *pc, const struct packet_edit_game *packet)
Definition packets_gen.c:94257
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:44880
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:48837
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:50551
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:42141
send_packet_nation_availability
int send_packet_nation_availability(struct connection *pc, const struct packet_nation_availability *packet)
Definition packets_gen.c:64397
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:61060
dlsend_packet_city_remove
void dlsend_packet_city_remove(struct conn_list *dest, int city_id16, int city_id32)
Definition packets_gen.c:12150
dsend_packet_authentication_req
int dsend_packet_authentication_req(struct connection *pc, enum authentication_type type, const char *message)
Definition packets_gen.c:2312
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:61911
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:31260
lsend_packet_ruleset_unit
void lsend_packet_ruleset_unit(struct conn_list *dest, const struct packet_ruleset_unit *packet)
Definition packets_gen.c:56290
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:80633
dsend_packet_unit_action_answer
int dsend_packet_unit_action_answer(struct connection *pc, int actor_id16, int actor_id32, int target_id, int cost, action_id action_type, int request_kind)
Definition packets_gen.c:46187
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:44847
dsend_packet_diplomacy_init_meeting_req
int dsend_packet_diplomacy_init_meeting_req(struct connection *pc, int counterpart)
Definition packets_gen.c:48268
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:76816
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:28080
receive_packet_investigate_started_101
static struct packet_investigate_started * receive_packet_investigate_started_101(struct connection *pc)
Definition packets_gen.c:1332
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:81834
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:68195
receive_packet_spaceship_info_100
static struct packet_spaceship_info * receive_packet_spaceship_info_100(struct connection *pc)
Definition packets_gen.c:53194
send_packet_ruleset_multiplier
int send_packet_ruleset_multiplier(struct connection *pc, const struct packet_ruleset_multiplier *packet)
Definition packets_gen.c:75706
receive_packet_city_worklist_100
static struct packet_city_worklist * receive_packet_city_worklist_100(struct connection *pc)
Definition packets_gen.c:27373
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:70181
receive_packet_unit_orders_101
static struct packet_unit_orders * receive_packet_unit_orders_101(struct connection *pc)
Definition packets_gen.c:43555
lsend_packet_unit_remove
void lsend_packet_unit_remove(struct conn_list *dest, const struct packet_unit_remove *packet)
Definition packets_gen.c:37996
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:49954
send_packet_city_rename
int send_packet_city_rename(struct connection *pc, const struct packet_city_rename *packet)
Definition packets_gen.c:29290
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:86911
receive_packet_ruleset_game_100
static struct packet_ruleset_game * receive_packet_ruleset_game_100(struct connection *pc)
Definition packets_gen.c:57051
dlsend_packet_diplomacy_init_meeting
void dlsend_packet_diplomacy_init_meeting(struct conn_list *dest, int counterpart, int initiated_from)
Definition packets_gen.c:48479
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:56605
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:23745
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:50364
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:10630
send_packet_endgame_player
int send_packet_endgame_player(struct connection *pc, const struct packet_endgame_player *packet)
Definition packets_gen.c:3252
lsend_packet_ruleset_clause
void lsend_packet_ruleset_clause(struct conn_list *dest, const struct packet_ruleset_clause *packet)
Definition packets_gen.c:76305
send_packet_new_year
int send_packet_new_year(struct connection *pc, const struct packet_new_year *packet)
Definition packets_gen.c:52774
receive_packet_edit_mode_100
static struct packet_edit_mode * receive_packet_edit_mode_100(struct connection *pc)
Definition packets_gen.c:85047
receive_packet_spaceship_place_100
static struct packet_spaceship_place * receive_packet_spaceship_place_100(struct connection *pc)
Definition packets_gen.c:52979
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:78867
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:70972
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:81154
send_packet_ruleset_road
int send_packet_ruleset_road(struct connection *pc, const struct packet_ruleset_road *packet)
Definition packets_gen.c:71465
lsend_packet_chat_msg
void lsend_packet_chat_msg(struct conn_list *dest, const struct packet_chat_msg *packet)
Definition packets_gen.c:10787
dlsend_packet_city_name_suggestion_info
void dlsend_packet_city_name_suggestion_info(struct conn_list *dest, int unit_id16, int unit_id32, const char *name)
Definition packets_gen.c:30670
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:56801
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:94113
dsend_packet_edit_city_remove
int dsend_packet_edit_city_remove(struct connection *pc, int id16, int id32)
Definition packets_gen.c:89112
send_packet_ruleset_city
int send_packet_ruleset_city(struct connection *pc, const struct packet_ruleset_city *packet)
Definition packets_gen.c:65109
receive_packet_city_remove_101
static struct packet_city_remove * receive_packet_city_remove_101(struct connection *pc)
Definition packets_gen.c:11937
send_packet_ruleset_goods
int send_packet_ruleset_goods(struct connection *pc, const struct packet_ruleset_goods *packet)
Definition packets_gen.c:72016
dsend_packet_unit_sscs_set
int dsend_packet_unit_sscs_set(struct connection *pc, int unit_id16, int unit_id32, enum unit_ss_data_type type, int value)
Definition packets_gen.c:43126
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:1891
lsend_packet_begin_turn
void lsend_packet_begin_turn(struct conn_list *dest)
Definition packets_gen.c:52823
send_packet_thaw_client_100
static int send_packet_thaw_client_100(struct connection *pc)
Definition packets_gen.c:52914
receive_packet_unit_sscs_set_101
static struct packet_unit_sscs_set * receive_packet_unit_sscs_set_101(struct connection *pc)
Definition packets_gen.c:42908
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:45024
dsend_packet_investigate_finished
int dsend_packet_investigate_finished(struct connection *pc, int unit_id16, int unit_id32, int city_id16, int city_id32)
Definition packets_gen.c:1879
receive_packet_ruleset_building_100
static struct packet_ruleset_building * receive_packet_ruleset_building_100(struct connection *pc)
Definition packets_gen.c:65136
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:78552
delta_stats_report
void delta_stats_report(void)
Definition packets_gen.c:45
send_packet_processing_finished
int send_packet_processing_finished(struct connection *pc)
Definition packets_gen.c:1139
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:2399
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:56813
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:35292
send_packet_page_msg
int send_packet_page_msg(struct connection *pc, const struct packet_page_msg *packet)
Definition packets_gen.c:50837
send_packet_conn_pong
int send_packet_conn_pong(struct connection *pc)
Definition packets_gen.c:52086
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:25777
send_packet_player_multiplier
int send_packet_player_multiplier(struct connection *pc, const struct packet_player_multiplier *packet)
Definition packets_gen.c:36721
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:64523
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:1989
lsend_packet_endgame_report
void lsend_packet_endgame_report(struct conn_list *dest, const struct packet_endgame_report *packet)
Definition packets_gen.c:3108
send_packet_endgame_report
int send_packet_endgame_report(struct connection *pc, const struct packet_endgame_report *packet)
Definition packets_gen.c:3096
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:64869
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:84722
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:80118
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:11839
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:88824
send_packet_city_remove
int send_packet_city_remove(struct connection *pc, const struct packet_city_remove *packet)
Definition packets_gen.c:12121
dsend_packet_city_remove
int dsend_packet_city_remove(struct connection *pc, int city_id16, int city_id32)
Definition packets_gen.c:12140
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:80279
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:59066
lsend_packet_conn_info
void lsend_packet_conn_info(struct conn_list *dest, const struct packet_conn_info *packet)
Definition packets_gen.c:51586
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:85538
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:43337
send_packet_server_info
int send_packet_server_info(struct connection *pc, const struct packet_server_info *packet)
Definition packets_gen.c:11712
receive_packet_achievement_info_100
static struct packet_achievement_info * receive_packet_achievement_info_100(struct connection *pc)
Definition packets_gen.c:10283
receive_packet_authentication_reply_100
static struct packet_authentication_reply * receive_packet_authentication_reply_100(struct connection *pc)
Definition packets_gen.c:2330
receive_packet_unit_server_side_agent_set_101
static struct packet_unit_server_side_agent_set * receive_packet_unit_server_side_agent_set_101(struct connection *pc)
Definition packets_gen.c:44159
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:2064
receive_packet_map_info_100
static struct packet_map_info * receive_packet_map_info_100(struct connection *pc)
Definition packets_gen.c:9684
receive_packet_server_info_100
static struct packet_server_info * receive_packet_server_info_100(struct connection *pc)
Definition packets_gen.c:11454
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:78928
receive_packet_city_remove_100
static struct packet_city_remove * receive_packet_city_remove_100(struct connection *pc)
Definition packets_gen.c:11745
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:81184
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:45631
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:87024
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:6615
send_packet_freeze_client_100
static int send_packet_freeze_client_100(struct connection *pc)
Definition packets_gen.c:52877
receive_packet_spaceship_launch_100
static struct packet_spaceship_launch * receive_packet_spaceship_launch_100(struct connection *pc)
Definition packets_gen.c:52941
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:44334
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:11113
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:30272
receive_packet_unit_actions_101
static struct packet_unit_actions * receive_packet_unit_actions_101(struct connection *pc)
Definition packets_gen.c:47201
receive_packet_nation_availability_100
static struct packet_nation_availability * receive_packet_nation_availability_100(struct connection *pc)
Definition packets_gen.c:64105
send_packet_ruleset_extra
int send_packet_ruleset_extra(struct connection *pc, const struct packet_ruleset_extra *packet)
Definition packets_gen.c:69958
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:23508
lsend_packet_ruleset_action
void lsend_packet_ruleset_action(struct conn_list *dest, const struct packet_ruleset_action *packet)
Definition packets_gen.c:73593
receive_packet_ruleset_effect_100
static struct packet_ruleset_effect * receive_packet_ruleset_effect_100(struct connection *pc)
Definition packets_gen.c:82628
send_packet_unit_actions
int send_packet_unit_actions(struct connection *pc, const struct packet_unit_actions *packet)
Definition packets_gen.c:47626
dsend_packet_edit_unit_remove_by_id
int dsend_packet_edit_unit_remove_by_id(struct connection *pc, int id16, int id32)
Definition packets_gen.c:87344
receive_packet_player_multiplier_100
static struct packet_player_multiplier * receive_packet_player_multiplier_100(struct connection *pc)
Definition packets_gen.c:36445
receive_packet_unit_get_actions_101
static struct packet_unit_get_actions * receive_packet_unit_get_actions_101(struct connection *pc)
Definition packets_gen.c:46475
send_packet_city_worklist_101
static int send_packet_city_worklist_101(struct connection *pc, const struct packet_city_worklist *packet)
Definition packets_gen.c:27630
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:60093
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:60219
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:43976
receive_packet_save_scenario_100
static struct packet_save_scenario * receive_packet_save_scenario_100(struct connection *pc)
Definition packets_gen.c:83918
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:85427
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:26251
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:50327
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:2001
send_packet_investigate_finished_101
static int send_packet_investigate_finished_101(struct connection *pc, const struct packet_investigate_finished *packet)
Definition packets_gen.c:1786
receive_packet_investigate_finished_101
static struct packet_investigate_finished * receive_packet_investigate_finished_101(struct connection *pc)
Definition packets_gen.c:1702
send_packet_ruleset_summary
int send_packet_ruleset_summary(struct connection *pc, const struct packet_ruleset_summary *packet)
Definition packets_gen.c:78525
lsend_packet_ruleset_extra
void lsend_packet_ruleset_extra(struct conn_list *dest, const struct packet_ruleset_extra *packet)
Definition packets_gen.c:69970
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:85907
receive_packet_edit_game_100
static struct packet_edit_game * receive_packet_edit_game_100(struct connection *pc)
Definition packets_gen.c:93980
packet_handlers_fill_capability
void packet_handlers_fill_capability(struct packet_handlers *phandlers, const char *capability)
Definition packets_gen.c:95970
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:11724
send_packet_city_sell_101
static int send_packet_city_sell_101(struct connection *pc, const struct packet_city_sell *packet)
Definition packets_gen.c:26523
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:62368
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:87125
send_packet_city_rally_point_101
static int send_packet_city_rally_point_101(struct connection *pc, const struct packet_city_rally_point *packet, bool force_to_send)
Definition packets_gen.c:31786
send_packet_city_name_suggestion_req_101
static int send_packet_city_name_suggestion_req_101(struct connection *pc, const struct packet_city_name_suggestion_req *packet)
Definition packets_gen.c:30207
receive_packet_edit_player_100
static struct packet_edit_player * receive_packet_edit_player_100(struct connection *pc)
Definition packets_gen.c:92705
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:61299
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:78847
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:49966
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:47779
receive_packet_ruleset_trade_100
static struct packet_ruleset_trade * receive_packet_ruleset_trade_100(struct connection *pc)
Definition packets_gen.c:72812
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:59191
send_packet_scenario_info
int send_packet_scenario_info(struct connection *pc, const struct packet_scenario_info *packet)
Definition packets_gen.c:83744
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:80852
send_packet_ruleset_base
int send_packet_ruleset_base(struct connection *pc, const struct packet_ruleset_base *packet)
Definition packets_gen.c:70507
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:86787
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:69985
send_packet_ruleset_control_101
static int send_packet_ruleset_control_101(struct connection *pc, const struct packet_ruleset_control *packet)
Definition packets_gen.c:77842
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:93736
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:9907
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:80822
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:95636
dsend_packet_city_sell
int dsend_packet_city_sell(struct connection *pc, int city_id16, int city_id32, int build_id)
Definition packets_gen.c:26616
lsend_packet_ruleset_music
void lsend_packet_ruleset_music(struct conn_list *dest, const struct packet_ruleset_music *packet)
Definition packets_gen.c:75064
send_packet_ruleset_choices
int send_packet_ruleset_choices(struct connection *pc, const struct packet_ruleset_choices *packet)
Definition packets_gen.c:79290
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:88565
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:79824
receive_packet_timeout_info_100
static struct packet_timeout_info * receive_packet_timeout_info_100(struct connection *pc)
Definition packets_gen.c:9499
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:72946
receive_packet_ruleset_tech_100
static struct packet_ruleset_tech * receive_packet_ruleset_tech_100(struct connection *pc)
Definition packets_gen.c:59206
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:48191
dsend_packet_chat_msg_req
int dsend_packet_chat_msg_req(struct connection *pc, const char *message)
Definition packets_gen.c:11274
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:2015
send_packet_play_music
int send_packet_play_music(struct connection *pc, const struct packet_play_music *packet)
Definition packets_gen.c:94760
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:41247
dsend_packet_city_name_suggestion_info
int dsend_packet_city_name_suggestion_info(struct connection *pc, int unit_id16, int unit_id32, const char *name)
Definition packets_gen.c:30659
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:80426
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:37505
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:28480
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:3580
receive_packet_city_rename_100
static struct packet_city_rename * receive_packet_city_rename_100(struct connection *pc)
Definition packets_gen.c:28952
receive_packet_investigate_started_100
static struct packet_investigate_started * receive_packet_investigate_started_100(struct connection *pc)
Definition packets_gen.c:1159
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:86059
send_packet_city_change
int send_packet_city_change(struct connection *pc, const struct packet_city_change *packet)
Definition packets_gen.c:27341
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:79854
send_packet_processing_started
int send_packet_processing_started(struct connection *pc)
Definition packets_gen.c:1109
dsend_packet_city_make_specialist
int dsend_packet_city_make_specialist(struct connection *pc, int city_id16, int city_id32, int tile_id)
Definition packets_gen.c:28092
receive_packet_vote_new_100
static struct packet_vote_new * receive_packet_vote_new_100(struct connection *pc)
Definition packets_gen.c:84081
receive_packet_unit_orders_100
static struct packet_unit_orders * receive_packet_unit_orders_100(struct connection *pc)
Definition packets_gen.c:43146
send_packet_report_req
int send_packet_report_req(struct connection *pc, const struct packet_report_req *packet)
Definition packets_gen.c:51169
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:49397
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:93194
send_packet_vote_submit
int send_packet_vote_submit(struct connection *pc, const struct packet_vote_submit *packet)
Definition packets_gen.c:85027
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:26239
receive_packet_unit_info_100
static struct packet_unit_info * receive_packet_unit_info_100(struct connection *pc)
Definition packets_gen.c:38031
receive_packet_new_year_100
static struct packet_new_year * receive_packet_new_year_100(struct connection *pc)
Definition packets_gen.c:52578
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:23520
packet_functional_capability
const char *const packet_functional_capability
Definition packets_gen.c:32
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:1945
send_packet_chat_msg
int send_packet_chat_msg(struct connection *pc, const struct packet_chat_msg *packet)
Definition packets_gen.c:10775
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:50055
lsend_packet_ruleset_control
void lsend_packet_ruleset_control(struct conn_list *dest, const struct packet_ruleset_control *packet)
Definition packets_gen.c:78376
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:85968
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:45597
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:50232
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:2521
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:11101
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:59510
receive_packet_city_buy_100
static struct packet_city_buy * receive_packet_city_buy_100(struct connection *pc)
Definition packets_gen.c:26635
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:87056
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:74656
dsend_packet_nuke_tile_info
int dsend_packet_nuke_tile_info(struct connection *pc, int tile)
Definition packets_gen.c:10060
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:36942
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:28449
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:78621
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:9279
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:49666
dsend_packet_diplomacy_cancel_meeting_req
int dsend_packet_diplomacy_cancel_meeting_req(struct connection *pc, int counterpart)
Definition packets_gen.c:48643
send_packet_unit_orders
int send_packet_unit_orders(struct connection *pc, const struct packet_unit_orders *packet)
Definition packets_gen.c:43956
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:52019
receive_packet_city_make_specialist_101
static struct packet_city_make_specialist * receive_packet_city_make_specialist_101(struct connection *pc)
Definition packets_gen.c:27915
dsend_packet_player_tech_goal
int dsend_packet_player_tech_goal(struct connection *pc, int tech)
Definition packets_gen.c:37651
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:73843
send_packet_player_rates
int send_packet_player_rates(struct connection *pc, const struct packet_player_rates *packet)
Definition packets_gen.c:35389
send_packet_player_diplstate
int send_packet_player_diplstate(struct connection *pc, const struct packet_player_diplstate *packet)
Definition packets_gen.c:36425
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:92666
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:80148
receive_packet_endgame_player_100
static struct packet_endgame_player * receive_packet_endgame_player_100(struct connection *pc)
Definition packets_gen.c:3115
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:27826
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:85323
dsend_packet_city_change
int dsend_packet_city_change(struct connection *pc, int city_id16, int city_id32, int production_kind, int production_value)
Definition packets_gen.c:27353
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:48660
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:31233
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:86625
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:29759
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:51796
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:48996
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:10268
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:52245
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:86486
receive_packet_city_nationalities_100
static struct packet_city_nationalities * receive_packet_city_nationalities_100(struct connection *pc)
Definition packets_gen.c:23535
lsend_packet_ruleset_effect
void lsend_packet_ruleset_effect(struct conn_list *dest, const struct packet_ruleset_effect *packet)
Definition packets_gen.c:83045
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:75725
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:84210
send_packet_city_refresh
int send_packet_city_refresh(struct connection *pc, const struct packet_city_refresh *packet)
Definition packets_gen.c:29966
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:42126
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:26704
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:30065
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:50120
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:46175
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:83833
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:67829
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:68207
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:11128
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:9583
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:48872
receive_packet_unit_change_activity_101
static struct packet_unit_change_activity * receive_packet_unit_change_activity_101(struct connection *pc)
Definition packets_gen.c:47884
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:93948
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:78985
receive_packet_web_city_info_addition_101
static struct packet_web_city_info_addition * receive_packet_web_city_info_addition_101(struct connection *pc)
Definition packets_gen.c:95021
receive_packet_city_info_102
static struct packet_city_info * receive_packet_city_info_102(struct connection *pc)
Definition packets_gen.c:17848
receive_packet_ruleset_terrain_100
static struct packet_ruleset_terrain * receive_packet_ruleset_terrain_100(struct connection *pc)
Definition packets_gen.c:66035
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:68018
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:33793
send_packet_end_phase
int send_packet_end_phase(struct connection *pc)
Definition packets_gen.c:52372
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:86091
lsend_packet_ruleset_disaster
void lsend_packet_ruleset_disaster(struct conn_list *dest, const struct packet_ruleset_disaster *packet)
Definition packets_gen.c:72486
receive_packet_city_make_worker_101
static struct packet_city_make_worker * receive_packet_city_make_worker_101(struct connection *pc)
Definition packets_gen.c:28284
lsend_packet_spaceship_info
void lsend_packet_spaceship_info(struct conn_list *dest, const struct packet_spaceship_info *packet)
Definition packets_gen.c:53886
send_packet_worker_task_101
static int send_packet_worker_task_101(struct connection *pc, const struct packet_worker_task *packet)
Definition packets_gen.c:32424
dsend_packet_diplomacy_init_meeting
int dsend_packet_diplomacy_init_meeting(struct connection *pc, int counterpart, int initiated_from)
Definition packets_gen.c:48469
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:25613
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:92369
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:83987
send_packet_ruleset_terrain
int send_packet_ruleset_terrain(struct connection *pc, const struct packet_ruleset_terrain *packet)
Definition packets_gen.c:67594
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:56927
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:85792
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:30386
lsend_packet_page_msg
void lsend_packet_page_msg(struct conn_list *dest, const struct packet_page_msg *packet)
Definition packets_gen.c:50849
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:44959
send_packet_player_info
int send_packet_player_info(struct connection *pc, const struct packet_player_info *packet)
Definition packets_gen.c:35010
dsend_packet_city_change_specialist
int dsend_packet_city_change_specialist(struct connection *pc, int city_id16, int city_id32, Specialist_type_id from, Specialist_type_id to)
Definition packets_gen.c:28932
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:35677
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:29659
receive_packet_city_short_info_101
static struct packet_city_short_info * receive_packet_city_short_info_101(struct connection *pc)
Definition packets_gen.c:25052
send_packet_end_phase_100
static int send_packet_end_phase_100(struct connection *pc)
Definition packets_gen.c:52364
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:2786
send_packet_ruleset_clause
int send_packet_ruleset_clause(struct connection *pc, const struct packet_ruleset_clause *packet)
Definition packets_gen.c:76293
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:49109
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:32148
receive_packet_ruleset_government_100
static struct packet_ruleset_government * receive_packet_ruleset_government_100(struct connection *pc)
Definition packets_gen.c:60343
send_packet_spaceship_launch_100
static int send_packet_spaceship_launch_100(struct connection *pc)
Definition packets_gen.c:52951
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:24467
send_packet_trade_route_info_101
static int send_packet_trade_route_info_101(struct connection *pc, const struct packet_trade_route_info *packet)
Definition packets_gen.c:26094
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:92601
dsend_packet_edit_startpos
int dsend_packet_edit_startpos(struct connection *pc, int id, bool removal, int tag)
Definition packets_gen.c:86012
receive_packet_ruleset_music_100
static struct packet_ruleset_music * receive_packet_ruleset_music_100(struct connection *pc)
Definition packets_gen.c:74683
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:45192
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:2774
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:67844
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:78698
send_packet_end_turn_100
static int send_packet_end_turn_100(struct connection *pc)
Definition packets_gen.c:52840
receive_packet_connect_msg_100
static struct packet_connect_msg * receive_packet_connect_msg_100(struct connection *pc)
Definition packets_gen.c:11291
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:25598
lsend_packet_ruleset_government
void lsend_packet_ruleset_government(struct conn_list *dest, const struct packet_ruleset_government *packet)
Definition packets_gen.c:60827
send_packet_ruleset_tech
int send_packet_ruleset_tech(struct connection *pc, const struct packet_ruleset_tech *packet)
Definition packets_gen.c:59839
send_packet_tile_info_101
static int send_packet_tile_info_101(struct connection *pc, const struct packet_tile_info *packet)
Definition packets_gen.c:4158
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:9976
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:81472
dsend_packet_city_refresh
int dsend_packet_city_refresh(struct connection *pc, int city_id16, int city_id32)
Definition packets_gen.c:29978
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:73608
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:47670
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:49822
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:35099
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:35758
receive_packet_edit_unit_101
static struct packet_edit_unit * receive_packet_edit_unit_101(struct connection *pc)
Definition packets_gen.c:87965
send_packet_ruleset_nation
int send_packet_ruleset_nation(struct connection *pc, const struct packet_ruleset_nation *packet)
Definition packets_gen.c:64078
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:28195
send_packet_unit_actions_101
static int send_packet_unit_actions_101(struct connection *pc, const struct packet_unit_actions *packet)
Definition packets_gen.c:47402
send_packet_server_shutdown_100
static int send_packet_server_shutdown_100(struct connection *pc)
Definition packets_gen.c:2486
send_packet_begin_turn
int send_packet_begin_turn(struct connection *pc)
Definition packets_gen.c:52811
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:56590
send_packet_city_short_info_101
static int send_packet_city_short_info_101(struct connection *pc, const struct packet_city_short_info *packet)
Definition packets_gen.c:25309
receive_packet_edit_unit_remove_by_id_101
static struct packet_edit_unit_remove_by_id * receive_packet_edit_unit_remove_by_id_101(struct connection *pc)
Definition packets_gen.c:87198
send_packet_unit_change_activity_101
static int send_packet_unit_change_activity_101(struct connection *pc, const struct packet_unit_change_activity *packet)
Definition packets_gen.c:47993
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:42694
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:70362
dlsend_packet_nuke_tile_info
void dlsend_packet_nuke_tile_info(struct conn_list *dest, int tile)
Definition packets_gen.c:10069
receive_packet_client_info_100
static struct packet_client_info * receive_packet_client_info_100(struct connection *pc)
Definition packets_gen.c:52136
send_packet_unit_action_answer_101
static int send_packet_unit_action_answer_101(struct connection *pc, const struct packet_unit_action_answer *packet)
Definition packets_gen.c:46046
send_packet_connect_msg
int send_packet_connect_msg(struct connection *pc, const struct packet_connect_msg *packet)
Definition packets_gen.c:11425
receive_packet_unit_remove_100
static struct packet_unit_remove * receive_packet_unit_remove_100(struct connection *pc)
Definition packets_gen.c:37668
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:82832
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:57661
receive_packet_calendar_info_100
static struct packet_calendar_info * receive_packet_calendar_info_100(struct connection *pc)
Definition packets_gen.c:9116
receive_packet_city_refresh_101
static struct packet_city_refresh * receive_packet_city_refresh_101(struct connection *pc)
Definition packets_gen.c:29832
send_packet_player_remove
int send_packet_player_remove(struct connection *pc, const struct packet_player_remove *packet)
Definition packets_gen.c:32724
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:49141
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:95268
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:48631
receive_packet_play_music_100
static struct packet_play_music * receive_packet_play_music_100(struct connection *pc)
Definition packets_gen.c:94626
lsend_packet_worker_task
void lsend_packet_worker_task(struct conn_list *dest, const struct packet_worker_task *packet)
Definition packets_gen.c:32565
dsend_packet_player_phase_done
int dsend_packet_player_phase_done(struct connection *pc, int turn)
Definition packets_gen.c:35176
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:42803
send_packet_investigate_started
int send_packet_investigate_started(struct connection *pc, const struct packet_investigate_started *packet)
Definition packets_gen.c:1497
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:10956
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:45770
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:30302
send_packet_investigate_finished
int send_packet_investigate_finished(struct connection *pc, const struct packet_investigate_finished *packet)
Definition packets_gen.c:1867
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:94695
send_packet_client_heartbeat
int send_packet_client_heartbeat(struct connection *pc)
Definition packets_gen.c:52116
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:25586
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:94596
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:36577
send_packet_authentication_reply
int send_packet_authentication_reply(struct connection *pc, const struct packet_authentication_reply *packet)
Definition packets_gen.c:2464
send_packet_edit_player
int send_packet_edit_player(struct connection *pc, const struct packet_edit_player *packet)
Definition packets_gen.c:93709
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:28599
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:88893
receive_packet_ruleset_style_100
static struct packet_ruleset_style * receive_packet_ruleset_style_100(struct connection *pc)
Definition packets_gen.c:64424
dsend_packet_investigate_started
int dsend_packet_investigate_started(struct connection *pc, int unit_id16, int unit_id32, int city_id16, int city_id32)
Definition packets_gen.c:1509
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:89848
lsend_packet_ruleset_base
void lsend_packet_ruleset_base(struct conn_list *dest, const struct packet_ruleset_base *packet)
Definition packets_gen.c:70519
dsend_packet_game_load
int dsend_packet_game_load(struct connection *pc, bool load_successful, const char *load_filename)
Definition packets_gen.c:79479
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:49265
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:42114
receive_packet_end_turn_100
static struct packet_end_turn * receive_packet_end_turn_100(struct connection *pc)
Definition packets_gen.c:52830
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:67817
lsend_packet_unit_info
void lsend_packet_unit_info(struct conn_list *dest, const struct packet_unit_info *packet)
Definition packets_gen.c:40959
dsend_packet_player_change_government
int dsend_packet_player_change_government(struct connection *pc, Government_type_id government)
Definition packets_gen.c:35576
lsend_packet_ruleset_resource
void lsend_packet_ruleset_resource(struct conn_list *dest, const struct packet_ruleset_resource *packet)
Definition packets_gen.c:83342
send_packet_unit_get_actions_101
static int send_packet_unit_get_actions_101(struct connection *pc, const struct packet_unit_get_actions *packet)
Definition packets_gen.c:46604
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:84500
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:49409
receive_packet_vote_remove_100
static struct packet_vote_remove * receive_packet_vote_remove_100(struct connection *pc)
Definition packets_gen.c:84653
lsend_packet_ruleset_specialist
void lsend_packet_ruleset_specialist(struct conn_list *dest, const struct packet_ruleset_specialist *packet)
Definition packets_gen.c:58917
send_packet_conn_info
int send_packet_conn_info(struct connection *pc, const struct packet_conn_info *packet)
Definition packets_gen.c:51574
lsend_packet_play_music
void lsend_packet_play_music(struct conn_list *dest, const struct packet_play_music *packet)
Definition packets_gen.c:94772
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:37574
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:48122
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:27040
send_packet_game_info
int send_packet_game_info(struct connection *pc, const struct packet_game_info *packet)
Definition packets_gen.c:9096
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:71744
dsend_packet_edit_player_create
int dsend_packet_edit_player_create(struct connection *pc, int tag)
Definition packets_gen.c:92515
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:30652
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:3039
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:82122
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:95231
receive_packet_city_change_specialist_101
static struct packet_city_change_specialist * receive_packet_city_change_specialist_101(struct connection *pc)
Definition packets_gen.c:28704
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:87332
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:50539
receive_packet_vote_resolve_100
static struct packet_vote_resolve * receive_packet_vote_resolve_100(struct connection *pc)
Definition packets_gen.c:84807
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:50345
receive_packet_ruleset_resource_100
static struct packet_ruleset_resource * receive_packet_ruleset_resource_100(struct connection *pc)
Definition packets_gen.c:83060
receive_packet_research_info_100
static struct packet_research_info * receive_packet_research_info_100(struct connection *pc)
Definition packets_gen.c:36751
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:51104
send_packet_investigate_started_101
static int send_packet_investigate_started_101(struct connection *pc, const struct packet_investigate_started *packet)
Definition packets_gen.c:1416
receive_packet_ruleset_goods_100
static struct packet_ruleset_goods * receive_packet_ruleset_goods_100(struct connection *pc)
Definition packets_gen.c:71492
send_packet_edit_recalculate_borders
int send_packet_edit_recalculate_borders(struct connection *pc)
Definition packets_gen.c:85204
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:51385
send_packet_set_topology
int send_packet_set_topology(struct connection *pc, const struct packet_set_topology *packet)
Definition packets_gen.c:82608
send_packet_city_info_102
static int send_packet_city_info_102(struct connection *pc, const struct packet_city_info *packet, bool force_to_send)
Definition packets_gen.c:19105
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:94891
send_packet_spaceship_place
int send_packet_spaceship_place(struct connection *pc, const struct packet_spaceship_place *packet)
Definition packets_gen.c:53154
dlsend_packet_start_phase
void dlsend_packet_start_phase(struct conn_list *dest, int phase)
Definition packets_gen.c:52561
dsend_packet_unit_actions
int dsend_packet_unit_actions(struct connection *pc, int actor_unit_id16, int actor_unit_id32, int target_unit_id16, int target_unit_id32, int target_city_id16, int target_city_id32, int target_tile_id, int target_extra_id, int request_kind, const struct act_prob *action_probabilities)
Definition packets_gen.c:47638
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:60120
lsend_packet_ruleset_tech
void lsend_packet_ruleset_tech(struct conn_list *dest, const struct packet_ruleset_tech *packet)
Definition packets_gen.c:59851
send_packet_authentication_req
int send_packet_authentication_req(struct connection *pc, const struct packet_authentication_req *packet)
Definition packets_gen.c:2300
lsend_packet_ruleset_trade
void lsend_packet_ruleset_trade(struct conn_list *dest, const struct packet_ruleset_trade *packet)
Definition packets_gen.c:73071
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:85186
send_packet_map_info
int send_packet_map_info(struct connection *pc, const struct packet_map_info *packet)
Definition packets_gen.c:9880
send_packet_city_options_req_101
static int send_packet_city_options_req_101(struct connection *pc, const struct packet_city_options_req *packet)
Definition packets_gen.c:29578
send_packet_freeze_client
int send_packet_freeze_client(struct connection *pc)
Definition packets_gen.c:52885
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:36070
send_packet_tile_info
int send_packet_tile_info(struct connection *pc, const struct packet_tile_info *packet)
Definition packets_gen.c:4427
send_packet_edit_unit
int send_packet_edit_unit(struct connection *pc, const struct packet_edit_unit *packet)
Definition packets_gen.c:88545
receive_packet_scenario_description_100
static struct packet_scenario_description * receive_packet_scenario_description_100(struct connection *pc)
Definition packets_gen.c:83764
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:78782
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:52468
dsend_packet_player_research
int dsend_packet_player_research(struct connection *pc, int tech)
Definition packets_gen.c:37488
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:56828
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:29321
receive_packet_client_heartbeat_100
static struct packet_client_heartbeat * receive_packet_client_heartbeat_100(struct connection *pc)
Definition packets_gen.c:52098
receive_packet_begin_turn_100
static struct packet_begin_turn * receive_packet_begin_turn_100(struct connection *pc)
Definition packets_gen.c:52793
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:1613
receive_packet_processing_started_100
static struct packet_processing_started * receive_packet_processing_started_100(struct connection *pc)
Definition packets_gen.c:1091
receive_packet_investigate_finished_100
static struct packet_investigate_finished * receive_packet_investigate_finished_100(struct connection *pc)
Definition packets_gen.c:1529
dsend_packet_city_rename
int dsend_packet_city_rename(struct connection *pc, int city_id16, int city_id32, const char *name)
Definition packets_gen.c:29302
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:10041
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:57024
receive_packet_trade_route_info_101
static struct packet_trade_route_info * receive_packet_trade_route_info_101(struct connection *pc)
Definition packets_gen.c:25930
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:85216
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:58649
send_packet_unit_short_info_101
static int send_packet_unit_short_info_101(struct connection *pc, const struct packet_unit_short_info *packet, bool force_to_send)
Definition packets_gen.c:41831
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:82543
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:70084
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:72250
send_packet_city_info_101
static int send_packet_city_info_101(struct connection *pc, const struct packet_city_info *packet, bool force_to_send)
Definition packets_gen.c:16259
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:48497
receive_packet_ruleset_disaster_100
static struct packet_ruleset_disaster * receive_packet_ruleset_disaster_100(struct connection *pc)
Definition packets_gen.c:72043
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:61287
dsend_packet_unit_get_actions
int dsend_packet_unit_get_actions(struct connection *pc, int actor_unit_id16, int actor_unit_id32, int target_unit_id16, int target_unit_id32, int target_tile_id, int target_extra_id, int request_kind)
Definition packets_gen.c:46745
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:49698
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:74110
receive_packet_ruleset_nation_100
static struct packet_ruleset_nation * receive_packet_ruleset_nation_100(struct connection *pc)
Definition packets_gen.c:62393
send_packet_city_buy
int send_packet_city_buy(struct connection *pc, const struct packet_city_buy *packet)
Definition packets_gen.c:26911
dlsend_packet_game_load
void dlsend_packet_game_load(struct conn_list *dest, bool load_successful, const char *load_filename)
Definition packets_gen.c:79489
dsend_packet_edit_object_created
int dsend_packet_edit_object_created(struct connection *pc, int tag, int id)
Definition packets_gen.c:94608
dsend_packet_city_buy
int dsend_packet_city_buy(struct connection *pc, int city_id16, int city_id32)
Definition packets_gen.c:26923
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:56704
receive_packet_city_sell_100
static struct packet_city_sell * receive_packet_city_sell_100(struct connection *pc)
Definition packets_gen.c:26266
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:94411
packet_name
const char * packet_name(enum packet_type type)
Definition packets_gen.c:49
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:75386
receive_packet_scenario_info_100
static struct packet_scenario_info * receive_packet_scenario_info_100(struct connection *pc)
Definition packets_gen.c:83357
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:69047
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:49378
send_packet_ruleset_trade
int send_packet_ruleset_trade(struct connection *pc, const struct packet_ruleset_trade *packet)
Definition packets_gen.c:73059
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:35499
send_packet_player_ready
int send_packet_player_ready(struct connection *pc, const struct packet_player_ready *packet)
Definition packets_gen.c:2957
send_packet_city_make_worker_101
static int send_packet_city_make_worker_101(struct connection *pc, const struct packet_city_make_worker *packet)
Definition packets_gen.c:28368
receive_packet_edit_unit_100
static struct packet_edit_unit * receive_packet_edit_unit_100(struct connection *pc)
Definition packets_gen.c:87362
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:49986
send_packet_city_nationalities_101
static int send_packet_city_nationalities_101(struct connection *pc, const struct packet_city_nationalities *packet, bool force_to_send)
Definition packets_gen.c:24225
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:79507
receive_packet_player_remove_100
static struct packet_player_remove * receive_packet_player_remove_100(struct connection *pc)
Definition packets_gen.c:32580
receive_packet_vote_submit_100
static struct packet_vote_submit * receive_packet_vote_submit_100(struct connection *pc)
Definition packets_gen.c:84969
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:50458
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:10053
lsend_packet_freeze_client
void lsend_packet_freeze_client(struct conn_list *dest)
Definition packets_gen.c:52897
dlsend_packet_diplomacy_cancel_meeting
void dlsend_packet_diplomacy_cancel_meeting(struct conn_list *dest, int counterpart, int initiated_from)
Definition packets_gen.c:48854
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:56456
receive_packet_city_buy_101
static struct packet_city_buy * receive_packet_city_buy_101(struct connection *pc)
Definition packets_gen.c:26777
lsend_packet_nation_availability
void lsend_packet_nation_availability(struct conn_list *dest, const struct packet_nation_availability *packet)
Definition packets_gen.c:64409
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:87036
receive_packet_unit_combat_info_101
static struct packet_unit_combat_info * receive_packet_unit_combat_info_101(struct connection *pc)
Definition packets_gen.c:42408
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:87661
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:28920
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:67621
dsend_packet_unit_remove
int dsend_packet_unit_remove(struct connection *pc, int unit_id16, int unit_id32)
Definition packets_gen.c:38003
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:95243
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:94515
send_packet_calendar_info
int send_packet_calendar_info(struct connection *pc, const struct packet_calendar_info *packet)
Definition packets_gen.c:9479
receive_packet_unknown_research_100
static struct packet_unknown_research * receive_packet_unknown_research_100(struct connection *pc)
Definition packets_gen.c:37170
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:35593
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:32654
send_packet_city_change_specialist_101
static int send_packet_city_change_specialist_101(struct connection *pc, const struct packet_city_change_specialist *packet)
Definition packets_gen.c:28823
receive_packet_city_rally_point_101
static struct packet_city_rally_point * receive_packet_city_rally_point_101(struct connection *pc)
Definition packets_gen.c:31625
receive_packet_authentication_req_100
static struct packet_authentication_req * receive_packet_authentication_req_100(struct connection *pc)
Definition packets_gen.c:2125
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:49678
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:94277
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:27742
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:85254
receive_packet_player_ready_100
static struct packet_player_ready * receive_packet_player_ready_100(struct connection *pc)
Definition packets_gen.c:2807
send_packet_edit_city_101
static int send_packet_edit_city_101(struct connection *pc, const struct packet_edit_city *packet)
Definition packets_gen.c:91471
send_packet_vote_remove
int send_packet_vote_remove(struct connection *pc, const struct packet_vote_remove *packet)
Definition packets_gen.c:84787
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:46733
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:48090
receive_packet_city_refresh_100
static struct packet_city_refresh * receive_packet_city_refresh_100(struct connection *pc)
Definition packets_gen.c:29690
dsend_packet_start_phase
int dsend_packet_start_phase(struct connection *pc, int phase)
Definition packets_gen.c:52552
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:44070
receive_packet_game_load_100
static struct packet_game_load * receive_packet_game_load_100(struct connection *pc)
Definition packets_gen.c:79310
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:85108
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:79985
lsend_packet_ruleset_style
void lsend_packet_ruleset_style(struct conn_list *dest, const struct packet_ruleset_style *packet)
Definition packets_gen.c:64632
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:11262
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:52031
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:11583
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:65561
send_packet_city_refresh_101
static int send_packet_city_refresh_101(struct connection *pc, const struct packet_city_refresh *packet)
Definition packets_gen.c:29901
send_packet_city_change_101
static int send_packet_city_change_101(struct connection *pc, const struct packet_city_change *packet)
Definition packets_gen.c:27244
dsend_packet_unit_action_query
int dsend_packet_unit_action_query(struct connection *pc, int actor_id16, int actor_id32, int target_id, action_id action_type, int request_kind)
Definition packets_gen.c:44859
lsend_packet_end_phase
void lsend_packet_end_phase(struct conn_list *dest)
Definition packets_gen.c:52384
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:86766
dsend_packet_edit_player_remove
int dsend_packet_edit_player_remove(struct connection *pc, int id)
Definition packets_gen.c:92678
dsend_packet_unit_type_upgrade
int dsend_packet_unit_type_upgrade(struct connection *pc, Unit_type_id type)
Definition packets_gen.c:45036
send_packet_ruleset_action
int send_packet_ruleset_action(struct connection *pc, const struct packet_ruleset_action *packet)
Definition packets_gen.c:73581
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:42679
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:46338
dsend_packet_unit_server_side_agent_set
int dsend_packet_unit_server_side_agent_set(struct connection *pc, int unit_id16, int unit_id32, enum server_side_agent agent)
Definition packets_gen.c:44346
receive_packet_player_diplstate_100
static struct packet_player_diplstate * receive_packet_player_diplstate_100(struct connection *pc)
Definition packets_gen.c:36100
receive_packet_edit_city_100
static struct packet_edit_city * receive_packet_edit_city_100(struct connection *pc)
Definition packets_gen.c:89130
receive_packet_conn_pong_100
static struct packet_conn_pong * receive_packet_conn_pong_100(struct connection *pc)
Definition packets_gen.c:52068
receive_packet_edit_city_101
static struct packet_edit_city * receive_packet_edit_city_101(struct connection *pc)
Definition packets_gen.c:90751
dsend_packet_city_worklist
int dsend_packet_city_worklist(struct connection *pc, int city_id16, int city_id32, const struct worklist *worklist)
Definition packets_gen.c:27723
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:59866
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:89100
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:48285
send_packet_ruleset_effect
int send_packet_ruleset_effect(struct connection *pc, const struct packet_ruleset_effect *packet)
Definition packets_gen.c:83033
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:73354
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:80999
receive_packet_ruleset_action_100
static struct packet_ruleset_action * receive_packet_ruleset_action_100(struct connection *pc)
Definition packets_gen.c:73086
send_packet_city_name_suggestion_info_101
static int send_packet_city_name_suggestion_info_101(struct connection *pc, const struct packet_city_name_suggestion_info *packet)
Definition packets_gen.c:30559
send_packet_edit_mode
int send_packet_edit_mode(struct connection *pc, const struct packet_edit_mode *packet)
Definition packets_gen.c:85165
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:78460
dsend_packet_player_place_infra
int dsend_packet_player_place_infra(struct connection *pc, int tile, int extra)
Definition packets_gen.c:35770
send_packet_ruleset_style
int send_packet_ruleset_style(struct connection *pc, const struct packet_ruleset_style *packet)
Definition packets_gen.c:64620
receive_packet_ruleset_road_100
static struct packet_ruleset_road * receive_packet_ruleset_road_100(struct connection *pc)
Definition packets_gen.c:70534
send_packet_ruleset_disaster
int send_packet_ruleset_disaster(struct connection *pc, const struct packet_ruleset_disaster *packet)
Definition packets_gen.c:72474
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:46969
receive_packet_unit_short_info_101
static struct packet_unit_short_info * receive_packet_unit_short_info_101(struct connection *pc)
Definition packets_gen.c:41556
lsend_packet_server_shutdown
void lsend_packet_server_shutdown(struct conn_list *dest)
Definition packets_gen.c:2506
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:94346
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:50334
receive_packet_player_info_100
static struct packet_player_info * receive_packet_player_info_100(struct connection *pc)
Definition packets_gen.c:32763
send_packet_ruleset_unit
int send_packet_ruleset_unit(struct connection *pc, const struct packet_ruleset_unit *packet)
Definition packets_gen.c:56278
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:72647
send_packet_unit_info_101
static int send_packet_unit_info_101(struct connection *pc, const struct packet_unit_info *packet)
Definition packets_gen.c:40188
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:10802
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:67720
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:92532
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:58932
send_packet_vote_update
int send_packet_vote_update(struct connection *pc, const struct packet_vote_update *packet)
Definition packets_gen.c:84633
dsend_packet_save_scenario
int dsend_packet_save_scenario(struct connection *pc, const char *name)
Definition packets_gen.c:84064
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:35030
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:1243
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:85919
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:62356
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:2105
dsend_packet_unit_change_activity
int dsend_packet_unit_change_activity(struct connection *pc, int unit_id16, int unit_id32, enum unit_activity activity, int target)
Definition packets_gen.c:48102
receive_packet_city_info_101
static struct packet_city_info * receive_packet_city_info_101(struct connection *pc)
Definition packets_gen.c:15019
send_packet_edit_startpos
int send_packet_edit_startpos(struct connection *pc, const struct packet_edit_startpos *packet)
Definition packets_gen.c:86000
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:60328
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:85628
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:24494
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:44489
send_packet_edit_tile
int send_packet_edit_tile(struct connection *pc, const struct packet_edit_tile *packet)
Definition packets_gen.c:86466
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:49429
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:79654
send_packet_city_remove_101
static int send_packet_city_remove_101(struct connection *pc, const struct packet_city_remove *packet)
Definition packets_gen.c:12031
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:35420
dsend_packet_city_name_suggestion_req
int dsend_packet_city_name_suggestion_req(struct connection *pc, int unit_id16, int unit_id32)
Definition packets_gen.c:30284
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:81804
lsend_packet_achievement_info
void lsend_packet_achievement_info(struct conn_list *dest, const struct packet_achievement_info *packet)
Definition packets_gen.c:10461
send_packet_edit_check_tiles
int send_packet_edit_check_tiles(struct connection *pc)
Definition packets_gen.c:85234
send_packet_ruleset_control
int send_packet_ruleset_control(struct connection *pc, const struct packet_ruleset_control *packet)
Definition packets_gen.c:78364
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:11197
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:31245
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:94787
send_packet_unit_do_action_101
static int send_packet_unit_do_action_101(struct connection *pc, const struct packet_unit_do_action *packet)
Definition packets_gen.c:45468
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:35828
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:49935
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:52677
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:59179
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:48825
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:42269
receive_packet_conn_info_100
static struct packet_conn_info * receive_packet_conn_info_100(struct connection *pc)
Definition packets_gen.c:51208
send_packet_thaw_client
int send_packet_thaw_client(struct connection *pc)
Definition packets_gen.c:52922
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:29036
receive_packet_ruleset_extra_100
static struct packet_ruleset_extra * receive_packet_ruleset_extra_100(struct connection *pc)
Definition packets_gen.c:68222
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:92503
send_packet_unit_info
int send_packet_unit_info(struct connection *pc, const struct packet_unit_info *packet)
Definition packets_gen.c:40947
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:74098
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:2219
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:27457
send_packet_rulesets_ready_100
static int send_packet_rulesets_ready_100(struct connection *pc)
Definition packets_gen.c:61316
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:37639
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:48450
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:50149
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:38716
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:10256
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:85669
receive_packet_server_shutdown_100
static struct packet_server_shutdown * receive_packet_server_shutdown_100(struct connection *pc)
Definition packets_gen.c:2476
dsend_packet_single_want_hack_reply
int dsend_packet_single_want_hack_reply(struct connection *pc, bool you_have_hack)
Definition packets_gen.c:78997
send_packet_client_heartbeat_100
static int send_packet_client_heartbeat_100(struct connection *pc)
Definition packets_gen.c:52108
send_packet_server_shutdown
int send_packet_server_shutdown(struct connection *pc)
Definition packets_gen.c:2494
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:29405
send_packet_research_info
int send_packet_research_info(struct connection *pc, const struct packet_research_info *packet)
Definition packets_gen.c:37143
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:80456
receive_packet_edit_city_remove_101
static struct packet_edit_city_remove * receive_packet_edit_city_remove_101(struct connection *pc)
Definition packets_gen.c:88966
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:37411
receive_packet_freeze_client_100
static struct packet_freeze_client * receive_packet_freeze_client_100(struct connection *pc)
Definition packets_gen.c:52867
send_packet_vote_new
int send_packet_vote_new(struct connection *pc, const struct packet_vote_new *packet)
Definition packets_gen.c:84339
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:43114
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:60105
send_packet_scenario_description
int send_packet_scenario_description(struct connection *pc, const struct packet_scenario_description *packet)
Definition packets_gen.c:83898
send_packet_player_attribute_block
int send_packet_player_attribute_block(struct connection *pc)
Definition packets_gen.c:35798
send_packet_unit_sscs_set_101
static int send_packet_unit_sscs_set_101(struct connection *pc, const struct packet_unit_sscs_set *packet)
Definition packets_gen.c:43017
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:61609
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:48566
receive_packet_city_sabotage_list_101
static struct packet_city_sabotage_list * receive_packet_city_sabotage_list_101(struct connection *pc)
Definition packets_gen.c:30965
send_packet_achievement_info
int send_packet_achievement_info(struct connection *pc, const struct packet_achievement_info *packet)
Definition packets_gen.c:10449
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:95436
receive_packet_start_phase_100
static struct packet_start_phase * receive_packet_start_phase_100(struct connection *pc)
Definition packets_gen.c:52399
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:95354
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:46209
dsend_packet_report_req
int dsend_packet_report_req(struct connection *pc, enum report_type type)
Definition packets_gen.c:51181
receive_packet_player_research_100
static struct packet_player_research * receive_packet_player_research_100(struct connection *pc)
Definition packets_gen.c:37342
lsend_packet_ruleset_goods
void lsend_packet_ruleset_goods(struct conn_list *dest, const struct packet_ruleset_goods *packet)
Definition packets_gen.c:72028
send_packet_edit_unit_remove_by_id_101
static int send_packet_edit_unit_remove_by_id_101(struct connection *pc, const struct packet_edit_unit_remove_by_id *packet)
Definition packets_gen.c:87267
send_packet_spaceship_launch
int send_packet_spaceship_launch(struct connection *pc)
Definition packets_gen.c:52959
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:10182
lsend_packet_end_turn
void lsend_packet_end_turn(struct conn_list *dest)
Definition packets_gen.c:52860
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:95562
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:49947
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:60842
send_packet_spaceship_info
int send_packet_spaceship_info(struct connection *pc, const struct packet_spaceship_info *packet)
Definition packets_gen.c:53874
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:64244
send_packet_city_buy_101
static int send_packet_city_buy_101(struct connection *pc, const struct packet_city_buy *packet)
Definition packets_gen.c:26846
dsend_packet_city_options_req
int dsend_packet_city_options_req(struct connection *pc, int city_id16, int city_id32, bv_city_options options)
Definition packets_gen.c:29671
receive_packet_edit_startpos_100
static struct packet_edit_startpos * receive_packet_edit_startpos_100(struct connection *pc)
Definition packets_gen.c:85932
receive_packet_ruleset_specialist_100
static struct packet_ruleset_specialist * receive_packet_ruleset_specialist_100(struct connection *pc)
Definition packets_gen.c:58402
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:50998
lsend_packet_ruleset_game
void lsend_packet_ruleset_game(struct conn_list *dest, const struct packet_ruleset_game *packet)
Definition packets_gen.c:58387
send_packet_ruleset_building
int send_packet_ruleset_building(struct connection *pc, const struct packet_ruleset_building *packet)
Definition packets_gen.c:66008
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:13423
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:50708
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:51010
lsend_packet_ruleset_nation
void lsend_packet_ruleset_nation(struct conn_list *dest, const struct packet_ruleset_nation *packet)
Definition packets_gen.c:64090
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:48256
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:10366
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:85640
dlsend_packet_unit_remove
void dlsend_packet_unit_remove(struct conn_list *dest, int unit_id16, int unit_id32)
Definition packets_gen.c:38013
receive_packet_ruleset_summary_100
static struct packet_ruleset_summary * receive_packet_ruleset_summary_100(struct connection *pc)
Definition packets_gen.c:78391
lsend_packet_rulesets_ready
void lsend_packet_rulesets_ready(struct conn_list *dest)
Definition packets_gen.c:61336
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:37244
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:62133
receive_packet_ruleset_clause_100
static struct packet_ruleset_clause * receive_packet_ruleset_clause_100(struct connection *pc)
Definition packets_gen.c:75787
dsend_packet_diplomacy_accept_treaty_req
int dsend_packet_diplomacy_accept_treaty_req(struct connection *pc, int counterpart)
Definition packets_gen.c:50132
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:95466
receive_packet_city_options_req_101
static struct packet_city_options_req * receive_packet_city_options_req_101(struct connection *pc)
Definition packets_gen.c:29494
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:84883
send_packet_unit_server_side_agent_set_101
static int send_packet_unit_server_side_agent_set_101(struct connection *pc, const struct packet_unit_server_side_agent_set *packet)
Definition packets_gen.c:44253
receive_packet_end_phase_100
static struct packet_end_phase * receive_packet_end_phase_100(struct connection *pc)
Definition packets_gen.c:52354
send_packet_processing_started_100
static int send_packet_processing_started_100(struct connection *pc)
Definition packets_gen.c:1101
send_packet_rulesets_ready
int send_packet_rulesets_ready(struct connection *pc)
Definition packets_gen.c:61324
receive_packet_worker_task_101
static struct packet_worker_task * receive_packet_worker_task_101(struct connection *pc)
Definition packets_gen.c:32285
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:92438
lsend_packet_city_remove
void lsend_packet_city_remove(struct conn_list *dest, const struct packet_city_remove *packet)
Definition packets_gen.c:12133
send_packet_timeout_info
int send_packet_timeout_info(struct connection *pc, const struct packet_timeout_info *packet)
Definition packets_gen.c:9664
send_packet_player_research
int send_packet_player_research(struct connection *pc, const struct packet_player_research *packet)
Definition packets_gen.c:37476
send_packet_ruleset_music
int send_packet_ruleset_music(struct connection *pc, const struct packet_ruleset_music *packet)
Definition packets_gen.c:75052
send_packet_start_phase
int send_packet_start_phase(struct connection *pc, const struct packet_start_phase *packet)
Definition packets_gen.c:52533
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:37747
receive_packet_worker_task_100
static struct packet_worker_task * receive_packet_worker_task_100(struct connection *pc)
Definition packets_gen.c:32009
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:70193
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:28111
send_packet_city_worklist
int send_packet_city_worklist(struct connection *pc, const struct packet_city_worklist *packet)
Definition packets_gen.c:27711
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:88679
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:48462
receive_packet_city_name_suggestion_req_101
static struct packet_city_name_suggestion_req * receive_packet_city_name_suggestion_req_101(struct connection *pc)
Definition packets_gen.c:30138
lsend_packet_ruleset_road
void lsend_packet_ruleset_road(struct conn_list *dest, const struct packet_ruleset_road *packet)
Definition packets_gen.c:71477
send_packet_city_info_103
static int send_packet_city_info_103(struct connection *pc, const struct packet_city_info *packet, bool force_to_send)
Definition packets_gen.c:21945
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:48369
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:78713
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:29996
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:31421
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:60316
lsend_packet_thaw_client
void lsend_packet_thaw_client(struct conn_list *dest)
Definition packets_gen.c:52934
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:78686
receive_packet_ruleset_base_100
static struct packet_ruleset_base * receive_packet_ruleset_base_100(struct connection *pc)
Definition packets_gen.c:70208
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:84999
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:93960
receive_packet_city_worklist_101
static struct packet_city_worklist * receive_packet_city_worklist_101(struct connection *pc)
Definition packets_gen.c:27546
send_packet_city_make_specialist_101
static int send_packet_city_make_specialist_101(struct connection *pc, const struct packet_city_make_specialist *packet)
Definition packets_gen.c:27999
dsend_packet_edit_toggle_fogofwar
int dsend_packet_edit_toggle_fogofwar(struct connection *pc, int player)
Definition packets_gen.c:85400
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:53073
lsend_packet_ruleset_terrain
void lsend_packet_ruleset_terrain(struct conn_list *dest, const struct packet_ruleset_terrain *packet)
Definition packets_gen.c:67606
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:26350
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:51601
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:30689
receive_packet_city_change_100
static struct packet_city_change * receive_packet_city_change_100(struct connection *pc)
Definition packets_gen.c:26941
send_packet_unit_orders_101
static int send_packet_unit_orders_101(struct connection *pc, const struct packet_unit_orders *packet)
Definition packets_gen.c:43746
receive_packet_processing_finished_100
static struct packet_processing_finished * receive_packet_processing_finished_100(struct connection *pc)
Definition packets_gen.c:1121
send_packet_begin_turn_100
static int send_packet_begin_turn_100(struct connection *pc)
Definition packets_gen.c:52803
receive_packet_ruleset_achievement_100
static struct packet_ruleset_achievement * receive_packet_ruleset_achievement_100(struct connection *pc)
Definition packets_gen.c:72501
send_packet_unit_action_query_101
static int send_packet_unit_action_query_101(struct connection *pc, const struct packet_unit_action_query *packet)
Definition packets_gen.c:44734
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:74668
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:56305
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:60575
send_packet_ruleset_specialist
int send_packet_ruleset_specialist(struct connection *pc, const struct packet_ruleset_specialist *packet)
Definition packets_gen.c:58905
dsend_packet_player_ready
int dsend_packet_player_ready(struct connection *pc, int player_no, bool is_ready)
Definition packets_gen.c:2969
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:40974
send_packet_client_info
int send_packet_client_info(struct connection *pc, const struct packet_client_info *packet)
Definition packets_gen.c:52342
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:83186
packet_handlers_fill_initial
void packet_handlers_fill_initial(struct packet_handlers *phandlers)
Definition packets_gen.c:95655
send_packet_game_load
int send_packet_game_load(struct connection *pc, const struct packet_game_load *packet)
Definition packets_gen.c:79460
dsend_packet_edit_mode
int dsend_packet_edit_mode(struct connection *pc, bool state)
Definition packets_gen.c:85177
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:35780
send_packet_city_sell
int send_packet_city_sell(struct connection *pc, const struct packet_city_sell *packet)
Definition packets_gen.c:26604
receive_packet_player_rates_100
static struct packet_player_rates * receive_packet_player_rates_100(struct connection *pc)
Definition packets_gen.c:35193
send_packet_save_scenario
int send_packet_save_scenario(struct connection *pc, const struct packet_save_scenario *packet)
Definition packets_gen.c:84052
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:50864
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:42667
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:31994
packet_type
packet_type
Definition packets_gen.h:1883
PACKET_PLAYER_MULTIPLIER
@ PACKET_PLAYER_MULTIPLIER
Definition packets_gen.h:2059
PACKET_DIPLOMACY_ACCEPT_TREATY
@ PACKET_DIPLOMACY_ACCEPT_TREATY
Definition packets_gen.h:1963
PACKET_PLAYER_CHANGE_GOVERNMENT
@ PACKET_PLAYER_CHANGE_GOVERNMENT
Definition packets_gen.h:1930
PACKET_WEB_PLAYER_INFO_ADDITION
@ PACKET_WEB_PLAYER_INFO_ADDITION
Definition packets_gen.h:2074
PACKET_SAVE_SCENARIO
@ PACKET_SAVE_SCENARIO
Definition packets_gen.h:2010
PACKET_RULESET_MULTIPLIER
@ PACKET_RULESET_MULTIPLIER
Definition packets_gen.h:2060
PACKET_THAW_CLIENT
@ PACKET_THAW_CLIENT
Definition packets_gen.h:1976
PACKET_EDIT_TOGGLE_FOGOFWAR
@ PACKET_EDIT_TOGGLE_FOGOFWAR
Definition packets_gen.h:2019
PACKET_EDIT_MODE
@ PACKET_EDIT_MODE
Definition packets_gen.h:2016
PACKET_RULESET_MUSIC
@ PACKET_RULESET_MUSIC
Definition packets_gen.h:2057
PACKET_LAST
@ PACKET_LAST
Definition packets_gen.h:2078
PACKET_RULESET_GOODS
@ PACKET_RULESET_GOODS
Definition packets_gen.h:2065
PACKET_ENDGAME_PLAYER
@ PACKET_ENDGAME_PLAYER
Definition packets_gen.h:2040
PACKET_UNIT_ACTION_ANSWER
@ PACKET_UNIT_ACTION_ANSWER
Definition packets_gen.h:1949
PACKET_EDIT_PLAYER
@ PACKET_EDIT_PLAYER
Definition packets_gen.h:2034
PACKET_DIPLOMACY_CANCEL_MEETING_REQ
@ PACKET_DIPLOMACY_CANCEL_MEETING_REQ
Definition packets_gen.h:1956
PACKET_SERVER_SETTING_ENUM
@ PACKET_SERVER_SETTING_ENUM
Definition packets_gen.h:2005
PACKET_SET_TOPOLOGY
@ PACKET_SET_TOPOLOGY
Definition packets_gen.h:2070
PACKET_WEB_CITY_INFO_ADDITION
@ PACKET_WEB_CITY_INFO_ADDITION
Definition packets_gen.h:2073
PACKET_CONN_PING
@ PACKET_CONN_PING
Definition packets_gen.h:1951
PACKET_CITY_MAKE_WORKER
@ PACKET_CITY_MAKE_WORKER
Definition packets_gen.h:1917
PACKET_CITY_OPTIONS_REQ
@ PACKET_CITY_OPTIONS_REQ
Definition packets_gen.h:1920
PACKET_VOTE_UPDATE
@ PACKET_VOTE_UPDATE
Definition packets_gen.h:2012
PACKET_CITY_NAME_SUGGESTION_INFO
@ PACKET_CITY_NAME_SUGGESTION_INFO
Definition packets_gen.h:1923
PACKET_CITY_CHANGE
@ PACKET_CITY_CHANGE
Definition packets_gen.h:1914
PACKET_UNIT_SSCS_SET
@ PACKET_UNIT_SSCS_SET
Definition packets_gen.h:1943
PACKET_PROCESSING_STARTED
@ PACKET_PROCESSING_STARTED
Definition packets_gen.h:1884
PACKET_UNIT_DO_ACTION
@ PACKET_UNIT_DO_ACTION
Definition packets_gen.h:1948
PACKET_UNIT_REMOVE
@ PACKET_UNIT_REMOVE
Definition packets_gen.h:1938
PACKET_END_PHASE
@ PACKET_END_PHASE
Definition packets_gen.h:1970
PACKET_SERVER_SETTING_INT
@ PACKET_SERVER_SETTING_INT
Definition packets_gen.h:2003
PACKET_RULESET_EXTRA
@ PACKET_RULESET_EXTRA
Definition packets_gen.h:2049
PACKET_EDIT_PLAYER_CREATE
@ PACKET_EDIT_PLAYER_CREATE
Definition packets_gen.h:2032
PACKET_EDIT_GAME
@ PACKET_EDIT_GAME
Definition packets_gen.h:2036
PACKET_CONN_PING_INFO
@ PACKET_CONN_PING_INFO
Definition packets_gen.h:1968
PACKET_END_TURN
@ PACKET_END_TURN
Definition packets_gen.h:1974
PACKET_EDIT_TILE_EXTRA
@ PACKET_EDIT_TILE_EXTRA
Definition packets_gen.h:2021
PACKET_SPACESHIP_PLACE
@ PACKET_SPACESHIP_PLACE
Definition packets_gen.h:1978
PACKET_NEW_YEAR
@ PACKET_NEW_YEAR
Definition packets_gen.h:1972
PACKET_NATION_SELECT_REQ
@ PACKET_NATION_SELECT_REQ
Definition packets_gen.h:1892
PACKET_ENDGAME_REPORT
@ PACKET_ENDGAME_REPORT
Definition packets_gen.h:1894
PACKET_RULESET_ACTION_AUTO
@ PACKET_RULESET_ACTION_AUTO
Definition packets_gen.h:2069
PACKET_UNIT_COMBAT_INFO
@ PACKET_UNIT_COMBAT_INFO
Definition packets_gen.h:1941
PACKET_RULESETS_READY
@ PACKET_RULESETS_READY
Definition packets_gen.h:2042
PACKET_UNIT_SHORT_INFO
@ PACKET_UNIT_SHORT_INFO
Definition packets_gen.h:1940
PACKET_SERVER_JOIN_REQ
@ PACKET_SERVER_JOIN_REQ
Definition packets_gen.h:1886
PACKET_REPORT_REQ
@ PACKET_REPORT_REQ
Definition packets_gen.h:1966
PACKET_RULESET_UNIT_CLASS_FLAG
@ PACKET_RULESET_UNIT_CLASS_FLAG
Definition packets_gen.h:2047
PACKET_RULESET_TECH_CLASS
@ PACKET_RULESET_TECH_CLASS
Definition packets_gen.h:1891
PACKET_EDIT_CITY_CREATE
@ PACKET_EDIT_CITY_CREATE
Definition packets_gen.h:2029
PACKET_SINGLE_WANT_HACK_REPLY
@ PACKET_SINGLE_WANT_HACK_REPLY
Definition packets_gen.h:1997
PACKET_GAME_INFO
@ PACKET_GAME_INFO
Definition packets_gen.h:1898
PACKET_DIPLOMACY_INIT_MEETING_REQ
@ PACKET_DIPLOMACY_INIT_MEETING_REQ
Definition packets_gen.h:1954
PACKET_PROCESSING_FINISHED
@ PACKET_PROCESSING_FINISHED
Definition packets_gen.h:1885
PACKET_RULESET_ACTION
@ PACKET_RULESET_ACTION
Definition packets_gen.h:2063
PACKET_PLAYER_ATTRIBUTE_BLOCK
@ PACKET_PLAYER_ATTRIBUTE_BLOCK
Definition packets_gen.h:1933
PACKET_CITY_SELL
@ PACKET_CITY_SELL
Definition packets_gen.h:1912
PACKET_CITY_NAME_SUGGESTION_REQ
@ PACKET_CITY_NAME_SUGGESTION_REQ
Definition packets_gen.h:1922
PACKET_UNKNOWN_RESEARCH
@ PACKET_UNKNOWN_RESEARCH
Definition packets_gen.h:1942
PACKET_CHAT_MSG_REQ
@ PACKET_CHAT_MSG_REQ
Definition packets_gen.h:1905
PACKET_NUKE_TILE_INFO
@ PACKET_NUKE_TILE_INFO
Definition packets_gen.h:1900
PACKET_PLAYER_DIPLSTATE
@ PACKET_PLAYER_DIPLSTATE
Definition packets_gen.h:1935
PACKET_RULESET_TECH
@ PACKET_RULESET_TECH
Definition packets_gen.h:1985
PACKET_CLIENT_HEARTBEAT
@ PACKET_CLIENT_HEARTBEAT
Definition packets_gen.h:2071
PACKET_RULESET_ROAD
@ PACKET_RULESET_ROAD
Definition packets_gen.h:2038
PACKET_RULESET_NATION_SETS
@ PACKET_RULESET_NATION_SETS
Definition packets_gen.h:2053
PACKET_CITY_SABOTAGE_LIST
@ PACKET_CITY_SABOTAGE_LIST
Definition packets_gen.h:1924
PACKET_MAP_INFO
@ PACKET_MAP_INFO
Definition packets_gen.h:1899
PACKET_RULESET_CLAUSE
@ PACKET_RULESET_CLAUSE
Definition packets_gen.h:2076
PACKET_DIPLOMACY_CREATE_CLAUSE_REQ
@ PACKET_DIPLOMACY_CREATE_CLAUSE_REQ
Definition packets_gen.h:1958
PACKET_CITY_BUY
@ PACKET_CITY_BUY
Definition packets_gen.h:1913
PACKET_CHAT_MSG
@ PACKET_CHAT_MSG
Definition packets_gen.h:1904
PACKET_EDIT_CITY_REMOVE
@ PACKET_EDIT_CITY_REMOVE
Definition packets_gen.h:2030
PACKET_EDIT_STARTPOS
@ PACKET_EDIT_STARTPOS
Definition packets_gen.h:2022
PACKET_SERVER_SETTING_CONST
@ PACKET_SERVER_SETTING_CONST
Definition packets_gen.h:2001
PACKET_PLAYER_RESEARCH
@ PACKET_PLAYER_RESEARCH
Definition packets_gen.h:1931
PACKET_BEGIN_TURN
@ PACKET_BEGIN_TURN
Definition packets_gen.h:1973
PACKET_RULESET_TERRAIN_CONTROL
@ PACKET_RULESET_TERRAIN_CONTROL
Definition packets_gen.h:1987
PACKET_PLAYER_PHASE_DONE
@ PACKET_PLAYER_PHASE_DONE
Definition packets_gen.h:1928
PACKET_GAME_LOAD
@ PACKET_GAME_LOAD
Definition packets_gen.h:1999
PACKET_PLAYER_REMOVE
@ PACKET_PLAYER_REMOVE
Definition packets_gen.h:1926
PACKET_CLIENT_INFO
@ PACKET_CLIENT_INFO
Definition packets_gen.h:1969
PACKET_CITY_WORKLIST
@ PACKET_CITY_WORKLIST
Definition packets_gen.h:1915
PACKET_DIPLOMACY_CANCEL_MEETING
@ PACKET_DIPLOMACY_CANCEL_MEETING
Definition packets_gen.h:1957
PACKET_UNIT_TYPE_UPGRADE
@ PACKET_UNIT_TYPE_UPGRADE
Definition packets_gen.h:1947
PACKET_START_PHASE
@ PACKET_START_PHASE
Definition packets_gen.h:1971
PACKET_AUTHENTICATION_REPLY
@ PACKET_AUTHENTICATION_REPLY
Definition packets_gen.h:1889
PACKET_SPACESHIP_INFO
@ PACKET_SPACESHIP_INFO
Definition packets_gen.h:1979
PACKET_UNIT_GET_ACTIONS
@ PACKET_UNIT_GET_ACTIONS
Definition packets_gen.h:1950
PACKET_PLAYER_ATTRIBUTE_CHUNK
@ PACKET_PLAYER_ATTRIBUTE_CHUNK
Definition packets_gen.h:1934
PACKET_RULESET_TERRAIN_FLAG
@ PACKET_RULESET_TERRAIN_FLAG
Definition packets_gen.h:2048
PACKET_CITY_MAKE_SPECIALIST
@ PACKET_CITY_MAKE_SPECIALIST
Definition packets_gen.h:1916
PACKET_RULESET_ACHIEVEMENT
@ PACKET_RULESET_ACHIEVEMENT
Definition packets_gen.h:2050
PACKET_RULESET_EFFECT
@ PACKET_RULESET_EFFECT
Definition packets_gen.h:2007
PACKET_RULESET_DISASTER
@ PACKET_RULESET_DISASTER
Definition packets_gen.h:2041
PACKET_RULESET_CONTROL
@ PACKET_RULESET_CONTROL
Definition packets_gen.h:1995
PACKET_SINGLE_WANT_HACK_REQ
@ PACKET_SINGLE_WANT_HACK_REQ
Definition packets_gen.h:1996
PACKET_PLAYER_PLACE_INFRA
@ PACKET_PLAYER_PLACE_INFRA
Definition packets_gen.h:1937
PACKET_VOTE_NEW
@ PACKET_VOTE_NEW
Definition packets_gen.h:2011
PACKET_AUTHENTICATION_REQ
@ PACKET_AUTHENTICATION_REQ
Definition packets_gen.h:1888
PACKET_RULESET_TRADE
@ PACKET_RULESET_TRADE
Definition packets_gen.h:2044
PACKET_EDIT_PLAYER_REMOVE
@ PACKET_EDIT_PLAYER_REMOVE
Definition packets_gen.h:2033
PACKET_CONN_INFO
@ PACKET_CONN_INFO
Definition packets_gen.h:1967
PACKET_SERVER_SETTING_BITWISE
@ PACKET_SERVER_SETTING_BITWISE
Definition packets_gen.h:2006
PACKET_EDIT_TILE_TERRAIN
@ PACKET_EDIT_TILE_TERRAIN
Definition packets_gen.h:2020
PACKET_DIPLOMACY_INIT_MEETING
@ PACKET_DIPLOMACY_INIT_MEETING
Definition packets_gen.h:1955
PACKET_RULESET_SUMMARY
@ PACKET_RULESET_SUMMARY
Definition packets_gen.h:2068
PACKET_UNIT_ACTION_QUERY
@ PACKET_UNIT_ACTION_QUERY
Definition packets_gen.h:1946
PACKET_PLAY_MUSIC
@ PACKET_PLAY_MUSIC
Definition packets_gen.h:2062
PACKET_TRADE_ROUTE_INFO
@ PACKET_TRADE_ROUTE_INFO
Definition packets_gen.h:2066
PACKET_RULESET_STYLE
@ PACKET_RULESET_STYLE
Definition packets_gen.h:2056
PACKET_RULESET_CITY
@ PACKET_RULESET_CITY
Definition packets_gen.h:1990
PACKET_CITY_NATIONALITIES
@ PACKET_CITY_NATIONALITIES
Definition packets_gen.h:1925
PACKET_EDIT_SCENARIO_DESC
@ PACKET_EDIT_SCENARIO_DESC
Definition packets_gen.h:1896
PACKET_FREEZE_CLIENT
@ PACKET_FREEZE_CLIENT
Definition packets_gen.h:1975
PACKET_VOTE_RESOLVE
@ PACKET_VOTE_RESOLVE
Definition packets_gen.h:2014
PACKET_EDIT_UNIT_CREATE
@ PACKET_EDIT_UNIT_CREATE
Definition packets_gen.h:2025
PACKET_TIMEOUT_INFO
@ PACKET_TIMEOUT_INFO
Definition packets_gen.h:2061
PACKET_RULESET_GAME
@ PACKET_RULESET_GAME
Definition packets_gen.h:1982
PACKET_UNIT_CHANGE_ACTIVITY
@ PACKET_UNIT_CHANGE_ACTIVITY
Definition packets_gen.h:2039
PACKET_EDIT_UNIT_REMOVE
@ PACKET_EDIT_UNIT_REMOVE
Definition packets_gen.h:2026
PACKET_RULESET_UNIT_FLAG
@ PACKET_RULESET_UNIT_FLAG
Definition packets_gen.h:2046
PACKET_DIPLOMACY_REMOVE_CLAUSE
@ PACKET_DIPLOMACY_REMOVE_CLAUSE
Definition packets_gen.h:1961
PACKET_TILE_INFO
@ PACKET_TILE_INFO
Definition packets_gen.h:1897
PACKET_EDIT_OBJECT_CREATED
@ PACKET_EDIT_OBJECT_CREATED
Definition packets_gen.h:2037
PACKET_CITY_SHORT_INFO
@ PACKET_CITY_SHORT_INFO
Definition packets_gen.h:1911
PACKET_CALENDAR_INFO
@ PACKET_CALENDAR_INFO
Definition packets_gen.h:2072
PACKET_SERVER_JOIN_REPLY
@ PACKET_SERVER_JOIN_REPLY
Definition packets_gen.h:1887
PACKET_SERVER_SETTING_STR
@ PACKET_SERVER_SETTING_STR
Definition packets_gen.h:2004
PACKET_VOTE_SUBMIT
@ PACKET_VOTE_SUBMIT
Definition packets_gen.h:2015
PACKET_EDIT_PLAYER_VISION
@ PACKET_EDIT_PLAYER_VISION
Definition packets_gen.h:2035
PACKET_SCENARIO_INFO
@ PACKET_SCENARIO_INFO
Definition packets_gen.h:2009
PACKET_EDIT_CHECK_TILES
@ PACKET_EDIT_CHECK_TILES
Definition packets_gen.h:2018
PACKET_RULESET_CHOICES
@ PACKET_RULESET_CHOICES
Definition packets_gen.h:1998
PACKET_CITY_CHANGE_SPECIALIST
@ PACKET_CITY_CHANGE_SPECIALIST
Definition packets_gen.h:1918
PACKET_RULESET_SPECIALIST
@ PACKET_RULESET_SPECIALIST
Definition packets_gen.h:1983
PACKET_CITY_REFRESH
@ PACKET_CITY_REFRESH
Definition packets_gen.h:1921
PACKET_CITY_REMOVE
@ PACKET_CITY_REMOVE
Definition packets_gen.h:1909
PACKET_UNIT_INFO
@ PACKET_UNIT_INFO
Definition packets_gen.h:1939
PACKET_RULESET_NATION_GROUPS
@ PACKET_RULESET_NATION_GROUPS
Definition packets_gen.h:1988
PACKET_CONNECT_MSG
@ PACKET_CONNECT_MSG
Definition packets_gen.h:1906
PACKET_EARLY_CHAT_MSG
@ PACKET_EARLY_CHAT_MSG
Definition packets_gen.h:1907
PACKET_RULESET_UNIT_CLASS
@ PACKET_RULESET_UNIT_CLASS
Definition packets_gen.h:1993
PACKET_PLAYER_INFO
@ PACKET_PLAYER_INFO
Definition packets_gen.h:1927
PACKET_EDIT_TILE
@ PACKET_EDIT_TILE
Definition packets_gen.h:2024
PACKET_PLAYER_READY
@ PACKET_PLAYER_READY
Definition packets_gen.h:1893
PACKET_WEB_RULESET_UNIT_ADDITION
@ PACKET_WEB_RULESET_UNIT_ADDITION
Definition packets_gen.h:2075
PACKET_SERVER_SHUTDOWN
@ PACKET_SERVER_SHUTDOWN
Definition packets_gen.h:1890
PACKET_RULESET_TERRAIN
@ PACKET_RULESET_TERRAIN
Definition packets_gen.h:1992
PACKET_RULESET_EXTRA_FLAG
@ PACKET_RULESET_EXTRA_FLAG
Definition packets_gen.h:2043
PACKET_RULESET_DESCRIPTION_PART
@ PACKET_RULESET_DESCRIPTION_PART
Definition packets_gen.h:2064
PACKET_EDIT_UNIT
@ PACKET_EDIT_UNIT
Definition packets_gen.h:2028
PACKET_RULESET_BASE
@ PACKET_RULESET_BASE
Definition packets_gen.h:1994
PACKET_SERVER_SETTING_BOOL
@ PACKET_SERVER_SETTING_BOOL
Definition packets_gen.h:2002
PACKET_RESEARCH_INFO
@ PACKET_RESEARCH_INFO
Definition packets_gen.h:1936
PACKET_CONN_PONG
@ PACKET_CONN_PONG
Definition packets_gen.h:1952
PACKET_EDIT_RECALCULATE_BORDERS
@ PACKET_EDIT_RECALCULATE_BORDERS
Definition packets_gen.h:2017
PACKET_PAGE_MSG_PART
@ PACKET_PAGE_MSG_PART
Definition packets_gen.h:2067
PACKET_EDIT_CITY
@ PACKET_EDIT_CITY
Definition packets_gen.h:2031
PACKET_RULESET_UNIT
@ PACKET_RULESET_UNIT
Definition packets_gen.h:1981
PACKET_PLAYER_TECH_GOAL
@ PACKET_PLAYER_TECH_GOAL
Definition packets_gen.h:1932
PACKET_UNIT_ACTIONS
@ PACKET_UNIT_ACTIONS
Definition packets_gen.h:1953
PACKET_INVESTIGATE_FINISHED
@ PACKET_INVESTIGATE_FINISHED
Definition packets_gen.h:1903
PACKET_RULESET_ACTION_ENABLER
@ PACKET_RULESET_ACTION_ENABLER
Definition packets_gen.h:2052
PACKET_INVESTIGATE_STARTED
@ PACKET_INVESTIGATE_STARTED
Definition packets_gen.h:1902
PACKET_CITY_RALLY_POINT
@ PACKET_CITY_RALLY_POINT
Definition packets_gen.h:1980
PACKET_RULESET_UNIT_BONUS
@ PACKET_RULESET_UNIT_BONUS
Definition packets_gen.h:2045
PACKET_RULESET_BUILDING
@ PACKET_RULESET_BUILDING
Definition packets_gen.h:1991
PACKET_RULESET_NATION
@ PACKET_RULESET_NATION
Definition packets_gen.h:1989
PACKET_UNIT_SERVER_SIDE_AGENT_SET
@ PACKET_UNIT_SERVER_SIDE_AGENT_SET
Definition packets_gen.h:1945
PACKET_SERVER_INFO
@ PACKET_SERVER_INFO
Definition packets_gen.h:1908
PACKET_RULESET_GOVERNMENT_RULER_TITLE
@ PACKET_RULESET_GOVERNMENT_RULER_TITLE
Definition packets_gen.h:1984
PACKET_SPACESHIP_LAUNCH
@ PACKET_SPACESHIP_LAUNCH
Definition packets_gen.h:1977
PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ
@ PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ
Definition packets_gen.h:1960
PACKET_DIPLOMACY_ACCEPT_TREATY_REQ
@ PACKET_DIPLOMACY_ACCEPT_TREATY_REQ
Definition packets_gen.h:1962
PACKET_DIPLOMACY_CREATE_CLAUSE
@ PACKET_DIPLOMACY_CREATE_CLAUSE
Definition packets_gen.h:1959
PACKET_RULESET_GOVERNMENT
@ PACKET_RULESET_GOVERNMENT
Definition packets_gen.h:1986
PACKET_SCENARIO_DESCRIPTION
@ PACKET_SCENARIO_DESCRIPTION
Definition packets_gen.h:1895
PACKET_SERVER_SETTING_CONTROL
@ PACKET_SERVER_SETTING_CONTROL
Definition packets_gen.h:2000
PACKET_ACHIEVEMENT_INFO
@ PACKET_ACHIEVEMENT_INFO
Definition packets_gen.h:2055
PACKET_PAGE_MSG
@ PACKET_PAGE_MSG
Definition packets_gen.h:1965
PACKET_RULESET_TECH_FLAG
@ PACKET_RULESET_TECH_FLAG
Definition packets_gen.h:2051
PACKET_RULESET_RESOURCE
@ PACKET_RULESET_RESOURCE
Definition packets_gen.h:2008
PACKET_UNIT_ORDERS
@ PACKET_UNIT_ORDERS
Definition packets_gen.h:1944
PACKET_EDIT_UNIT_REMOVE_BY_ID
@ PACKET_EDIT_UNIT_REMOVE_BY_ID
Definition packets_gen.h:2027
PACKET_EDIT_STARTPOS_FULL
@ PACKET_EDIT_STARTPOS_FULL
Definition packets_gen.h:2023
PACKET_DIPLOMACY_CANCEL_PACT
@ PACKET_DIPLOMACY_CANCEL_PACT
Definition packets_gen.h:1964
PACKET_TEAM_NAME_INFO
@ PACKET_TEAM_NAME_INFO
Definition packets_gen.h:1901
PACKET_CITY_INFO
@ PACKET_CITY_INFO
Definition packets_gen.h:1910
PACKET_PLAYER_RATES
@ PACKET_PLAYER_RATES
Definition packets_gen.h:1929
PACKET_NATION_AVAILABILITY
@ PACKET_NATION_AVAILABILITY
Definition packets_gen.h:2054
PACKET_CITY_RENAME
@ PACKET_CITY_RENAME
Definition packets_gen.h:1919
PACKET_VOTE_REMOVE
@ PACKET_VOTE_REMOVE
Definition packets_gen.h:2013
PACKET_WORKER_TASK
@ PACKET_WORKER_TASK
Definition packets_gen.h:2058
parts
int parts
Definition packhand.c:130
lines
char * lines
Definition packhand.c:129
len
int len
Definition packhand.c:125
gives_shared_vision
bool gives_shared_vision(const struct player *me, const struct player *them)
Definition player.c:1461
are_requirements_equal
bool are_requirements_equal(const struct requirement *req1, const struct requirement *req2)
Definition requirements.c:1296
compat
static struct compatibility compat[]
Definition savecompat.c:101
connections
static struct connection connections[MAX_NUM_CONNECTIONS]
Definition sernet.c:94
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:2395
act_prob
Definition fc_types.h:1092
agent
Definition agents.h:40
connection
Definition connection.h:141
connection::received
struct genhash ** received
Definition connection.h:266
connection::handlers
const struct packet_handlers * handlers
Definition connection.h:267
connection::phs
struct connection::@59 phs
connection::capability
char capability[MAX_LEN_CAPSTR]
Definition connection.h:176
connection::sent
struct genhash ** sent
Definition connection.h:265
connection::used
bool used
Definition connection.h:144
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:281
packet_achievement_info::id
int id
Definition packets_gen.h:282
packet_achievement_info::gained
bool gained
Definition packets_gen.h:283
packet_achievement_info::first
bool first
Definition packets_gen.h:284
packet_authentication_reply
Definition packets_gen.h:67
packet_authentication_reply::password
char password[MAX_LEN_PASSWORD]
Definition packets_gen.h:68
packet_authentication_req
Definition packets_gen.h:62
packet_authentication_req::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:64
packet_authentication_req::type
enum authentication_type type
Definition packets_gen.h:63
packet_begin_turn
Definition packets_gen.h:926
packet_calendar_info
Definition packets_gen.h:253
packet_calendar_info::positive_year_label
char positive_year_label[MAX_LEN_NAME]
Definition packets_gen.h:254
packet_calendar_info::calendar_skip_0
bool calendar_skip_0
Definition packets_gen.h:258
packet_calendar_info::negative_year_label
char negative_year_label[MAX_LEN_NAME]
Definition packets_gen.h:255
packet_calendar_info::calendar_fragments
int calendar_fragments
Definition packets_gen.h:256
packet_calendar_info::calendar_fragment_name
char calendar_fragment_name[MAX_CALENDAR_FRAGMENTS][MAX_LEN_NAME]
Definition packets_gen.h:257
packet_chat_msg_req
Definition packets_gen.h:305
packet_chat_msg_req::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:306
packet_chat_msg
Definition packets_gen.h:287
packet_chat_msg::phase
int phase
Definition packets_gen.h:292
packet_chat_msg::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:288
packet_chat_msg::conn_id
int conn_id
Definition packets_gen.h:293
packet_chat_msg::event
enum event_type event
Definition packets_gen.h:290
packet_chat_msg::turn
int turn
Definition packets_gen.h:291
packet_chat_msg::tile
int tile
Definition packets_gen.h:289
packet_city_buy
Definition packets_gen.h:422
packet_city_buy::city_id16
int city_id16
Definition packets_gen.h:423
packet_city_buy::city_id32
int city_id32
Definition packets_gen.h:424
packet_city_change_specialist
Definition packets_gen.h:452
packet_city_change_specialist::to
Specialist_type_id to
Definition packets_gen.h:456
packet_city_change_specialist::city_id32
int city_id32
Definition packets_gen.h:454
packet_city_change_specialist::city_id16
int city_id16
Definition packets_gen.h:453
packet_city_change_specialist::from
Specialist_type_id from
Definition packets_gen.h:455
packet_city_change
Definition packets_gen.h:427
packet_city_change::production_kind
int production_kind
Definition packets_gen.h:430
packet_city_change::city_id16
int city_id16
Definition packets_gen.h:428
packet_city_change::production_value
int production_value
Definition packets_gen.h:431
packet_city_change::city_id32
int city_id32
Definition packets_gen.h:429
packet_city_info
Definition packets_gen.h:326
packet_city_info::style
int style
Definition packets_gen.h:334
packet_city_info::last_turns_shield_surplus
int last_turns_shield_surplus
Definition packets_gen.h:365
packet_city_info::usage
int usage[O_LAST]
Definition packets_gen.h:350
packet_city_info::before_change_shields
int before_change_shields
Definition packets_gen.h:362
packet_city_info::ppl_content
int ppl_content[FEELING_LAST]
Definition packets_gen.h:337
packet_city_info::city_options
bv_city_options city_options
Definition packets_gen.h:376
packet_city_info::id32
int id32
Definition packets_gen.h:328
packet_city_info::capital
enum capital_type capital
Definition packets_gen.h:335
packet_city_info::surplus
int surplus[O_LAST]
Definition packets_gen.h:345
packet_city_info::ppl_unhappy
int ppl_unhappy[FEELING_LAST]
Definition packets_gen.h:338
packet_city_info::original
int original
Definition packets_gen.h:331
packet_city_info::citizen_base
int citizen_base[O_LAST]
Definition packets_gen.h:349
packet_city_info::changed_from_kind
int changed_from_kind
Definition packets_gen.h:360
packet_city_info::specialists
int specialists[SP_MAX]
Definition packets_gen.h:341
packet_city_info::changed_from_value
int changed_from_value
Definition packets_gen.h:361
packet_city_info::ppl_angry
int ppl_angry[FEELING_LAST]
Definition packets_gen.h:339
packet_city_info::food_stock
int food_stock
Definition packets_gen.h:351
packet_city_info::specialists_size
int specialists_size
Definition packets_gen.h:340
packet_city_info::owner
int owner
Definition packets_gen.h:330
packet_city_info::walls
int walls
Definition packets_gen.h:371
packet_city_info::improvements
bv_imprs improvements
Definition packets_gen.h:375
packet_city_info::shield_stock
int shield_stock
Definition packets_gen.h:352
packet_city_info::was_happy
bool was_happy
Definition packets_gen.h:369
packet_city_info::worklist
struct worklist worklist
Definition packets_gen.h:374
packet_city_info::steal
int steal
Definition packets_gen.h:373
packet_city_info::airlift
int airlift
Definition packets_gen.h:366
packet_city_info::did_buy
bool did_buy
Definition packets_gen.h:367
packet_city_info::turn_founded
int turn_founded
Definition packets_gen.h:358
packet_city_info::buy_cost
int buy_cost
Definition packets_gen.h:344
packet_city_info::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:377
packet_city_info::pollution
int pollution
Definition packets_gen.h:354
packet_city_info::trade_route_count
int trade_route_count
Definition packets_gen.h:353
packet_city_info::ppl_happy
int ppl_happy[FEELING_LAST]
Definition packets_gen.h:336
packet_city_info::did_sell
bool did_sell
Definition packets_gen.h:368
packet_city_info::production_value
int production_value
Definition packets_gen.h:357
packet_city_info::prod
int prod[O_LAST]
Definition packets_gen.h:348
packet_city_info::caravan_shields
int caravan_shields
Definition packets_gen.h:364
packet_city_info::illness_trade
int illness_trade
Definition packets_gen.h:355
packet_city_info::culture
int culture
Definition packets_gen.h:343
packet_city_info::diplomat_investigate
bool diplomat_investigate
Definition packets_gen.h:370
packet_city_info::unhappy_penalty
int unhappy_penalty[O_LAST]
Definition packets_gen.h:347
packet_city_info::history
int history
Definition packets_gen.h:342
packet_city_info::turn_last_built
int turn_last_built
Definition packets_gen.h:359
packet_city_info::city_image
int city_image
Definition packets_gen.h:372
packet_city_info::disbanded_shields
int disbanded_shields
Definition packets_gen.h:363
packet_city_info::id16
int id16
Definition packets_gen.h:327
packet_city_info::production_kind
int production_kind
Definition packets_gen.h:356
packet_city_info::tile
int tile
Definition packets_gen.h:329
packet_city_info::size
int size
Definition packets_gen.h:332
packet_city_info::city_radius_sq
int city_radius_sq
Definition packets_gen.h:333
packet_city_info::waste
int waste[O_LAST]
Definition packets_gen.h:346
packet_city_make_specialist
Definition packets_gen.h:440
packet_city_make_specialist::tile_id
int tile_id
Definition packets_gen.h:443
packet_city_make_specialist::city_id32
int city_id32
Definition packets_gen.h:442
packet_city_make_specialist::city_id16
int city_id16
Definition packets_gen.h:441
packet_city_make_worker
Definition packets_gen.h:446
packet_city_make_worker::tile_id
int tile_id
Definition packets_gen.h:449
packet_city_make_worker::city_id32
int city_id32
Definition packets_gen.h:448
packet_city_make_worker::city_id16
int city_id16
Definition packets_gen.h:447
packet_city_name_suggestion_info
Definition packets_gen.h:481
packet_city_name_suggestion_info::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:484
packet_city_name_suggestion_info::unit_id16
int unit_id16
Definition packets_gen.h:482
packet_city_name_suggestion_info::unit_id32
int unit_id32
Definition packets_gen.h:483
packet_city_name_suggestion_req
Definition packets_gen.h:476
packet_city_name_suggestion_req::unit_id32
int unit_id32
Definition packets_gen.h:478
packet_city_name_suggestion_req::unit_id16
int unit_id16
Definition packets_gen.h:477
packet_city_nationalities
Definition packets_gen.h:380
packet_city_nationalities::nation_id
int nation_id[MAX_CITY_NATIONALITIES]
Definition packets_gen.h:384
packet_city_nationalities::id16
int id16
Definition packets_gen.h:381
packet_city_nationalities::id32
int id32
Definition packets_gen.h:382
packet_city_nationalities::nation_citizens
int nation_citizens[MAX_CITY_NATIONALITIES]
Definition packets_gen.h:385
packet_city_nationalities::nationalities_count
int nationalities_count
Definition packets_gen.h:383
packet_city_options_req
Definition packets_gen.h:465
packet_city_options_req::city_id16
int city_id16
Definition packets_gen.h:466
packet_city_options_req::city_id32
int city_id32
Definition packets_gen.h:467
packet_city_options_req::options
bv_city_options options
Definition packets_gen.h:468
packet_city_rally_point
Definition packets_gen.h:497
packet_city_rally_point::city_id32
int city_id32
Definition packets_gen.h:499
packet_city_rally_point::persistent
bool persistent
Definition packets_gen.h:501
packet_city_rally_point::orders
struct unit_order orders[MAX_LEN_ROUTE]
Definition packets_gen.h:503
packet_city_rally_point::city_id16
int city_id16
Definition packets_gen.h:498
packet_city_rally_point::vigilant
bool vigilant
Definition packets_gen.h:502
packet_city_rally_point::length
int length
Definition packets_gen.h:500
packet_city_refresh
Definition packets_gen.h:471
packet_city_refresh::city_id16
int city_id16
Definition packets_gen.h:472
packet_city_refresh::city_id32
int city_id32
Definition packets_gen.h:473
packet_city_remove
Definition packets_gen.h:321
packet_city_remove::city_id16
int city_id16
Definition packets_gen.h:322
packet_city_remove::city_id32
int city_id32
Definition packets_gen.h:323
packet_city_rename
Definition packets_gen.h:459
packet_city_rename::city_id32
int city_id32
Definition packets_gen.h:461
packet_city_rename::city_id16
int city_id16
Definition packets_gen.h:460
packet_city_rename::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:462
packet_city_sabotage_list
Definition packets_gen.h:487
packet_city_sabotage_list::actor_id16
int actor_id16
Definition packets_gen.h:488
packet_city_sabotage_list::request_kind
int request_kind
Definition packets_gen.h:494
packet_city_sabotage_list::improvements
bv_imprs improvements
Definition packets_gen.h:492
packet_city_sabotage_list::city_id32
int city_id32
Definition packets_gen.h:491
packet_city_sabotage_list::city_id16
int city_id16
Definition packets_gen.h:490
packet_city_sabotage_list::actor_id32
int actor_id32
Definition packets_gen.h:489
packet_city_sabotage_list::act_id
action_id act_id
Definition packets_gen.h:493
packet_city_sell
Definition packets_gen.h:416
packet_city_sell::city_id32
int city_id32
Definition packets_gen.h:418
packet_city_sell::build_id
int build_id
Definition packets_gen.h:419
packet_city_sell::city_id16
int city_id16
Definition packets_gen.h:417
packet_city_short_info
Definition packets_gen.h:388
packet_city_short_info::walls
int walls
Definition packets_gen.h:397
packet_city_short_info::style
int style
Definition packets_gen.h:394
packet_city_short_info::size
int size
Definition packets_gen.h:393
packet_city_short_info::improvements
bv_imprs improvements
Definition packets_gen.h:401
packet_city_short_info::capital
enum capital_type capital
Definition packets_gen.h:395
packet_city_short_info::owner
int owner
Definition packets_gen.h:392
packet_city_short_info::city_image
int city_image
Definition packets_gen.h:400
packet_city_short_info::happy
bool happy
Definition packets_gen.h:398
packet_city_short_info::unhappy
bool unhappy
Definition packets_gen.h:399
packet_city_short_info::tile
int tile
Definition packets_gen.h:391
packet_city_short_info::occupied
bool occupied
Definition packets_gen.h:396
packet_city_short_info::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:402
packet_city_short_info::id32
int id32
Definition packets_gen.h:390
packet_city_short_info::id16
int id16
Definition packets_gen.h:389
packet_city_worklist
Definition packets_gen.h:434
packet_city_worklist::worklist
struct worklist worklist
Definition packets_gen.h:437
packet_city_worklist::city_id16
int city_id16
Definition packets_gen.h:435
packet_city_worklist::city_id32
int city_id32
Definition packets_gen.h:436
packet_client_heartbeat
Definition packets_gen.h:902
packet_client_info
Definition packets_gen.h:906
packet_client_info::distribution
char distribution[MAX_LEN_NAME]
Definition packets_gen.h:909
packet_client_info::emerg_version
int emerg_version
Definition packets_gen.h:908
packet_client_info::gui
enum gui_type gui
Definition packets_gen.h:907
packet_conn_info
Definition packets_gen.h:876
packet_conn_info::capability
char capability[MAX_LEN_CAPSTR]
Definition packets_gen.h:885
packet_conn_info::established
bool established
Definition packets_gen.h:879
packet_conn_info::observer
bool observer
Definition packets_gen.h:880
packet_conn_info::used
bool used
Definition packets_gen.h:878
packet_conn_info::addr
char addr[MAX_LEN_ADDR]
Definition packets_gen.h:884
packet_conn_info::player_num
int player_num
Definition packets_gen.h:881
packet_conn_info::username
char username[MAX_LEN_NAME]
Definition packets_gen.h:883
packet_conn_info::id
int id
Definition packets_gen.h:877
packet_conn_info::access_level
enum cmdlevel access_level
Definition packets_gen.h:882
packet_conn_ping_info
Definition packets_gen.h:888
packet_conn_ping_info::connections
int connections
Definition packets_gen.h:889
packet_conn_ping_info::ping_time
float ping_time[MAX_NUM_CONNECTIONS]
Definition packets_gen.h:891
packet_conn_ping_info::conn_id
int conn_id[MAX_NUM_CONNECTIONS]
Definition packets_gen.h:890
packet_conn_ping
Definition packets_gen.h:894
packet_conn_pong
Definition packets_gen.h:898
packet_connect_msg
Definition packets_gen.h:309
packet_connect_msg::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:310
packet_diplomacy_accept_treaty_req
Definition packets_gen.h:845
packet_diplomacy_accept_treaty_req::counterpart
int counterpart
Definition packets_gen.h:846
packet_diplomacy_accept_treaty
Definition packets_gen.h:849
packet_diplomacy_accept_treaty::I_accepted
bool I_accepted
Definition packets_gen.h:851
packet_diplomacy_accept_treaty::counterpart
int counterpart
Definition packets_gen.h:850
packet_diplomacy_accept_treaty::other_accepted
bool other_accepted
Definition packets_gen.h:852
packet_diplomacy_cancel_meeting_req
Definition packets_gen.h:808
packet_diplomacy_cancel_meeting_req::counterpart
int counterpart
Definition packets_gen.h:809
packet_diplomacy_cancel_meeting
Definition packets_gen.h:812
packet_diplomacy_cancel_meeting::counterpart
int counterpart
Definition packets_gen.h:813
packet_diplomacy_cancel_meeting::initiated_from
int initiated_from
Definition packets_gen.h:814
packet_diplomacy_cancel_pact
Definition packets_gen.h:855
packet_diplomacy_cancel_pact::other_player_id
int other_player_id
Definition packets_gen.h:856
packet_diplomacy_cancel_pact::clause
enum clause_type clause
Definition packets_gen.h:857
packet_diplomacy_create_clause_req
Definition packets_gen.h:817
packet_diplomacy_create_clause_req::value
int value
Definition packets_gen.h:821
packet_diplomacy_create_clause_req::giver
int giver
Definition packets_gen.h:819
packet_diplomacy_create_clause_req::counterpart
int counterpart
Definition packets_gen.h:818
packet_diplomacy_create_clause_req::type
enum clause_type type
Definition packets_gen.h:820
packet_diplomacy_create_clause
Definition packets_gen.h:824
packet_diplomacy_create_clause::giver
int giver
Definition packets_gen.h:826
packet_diplomacy_create_clause::type
enum clause_type type
Definition packets_gen.h:827
packet_diplomacy_create_clause::counterpart
int counterpart
Definition packets_gen.h:825
packet_diplomacy_create_clause::value
int value
Definition packets_gen.h:828
packet_diplomacy_init_meeting_req
Definition packets_gen.h:799
packet_diplomacy_init_meeting_req::counterpart
int counterpart
Definition packets_gen.h:800
packet_diplomacy_init_meeting
Definition packets_gen.h:803
packet_diplomacy_init_meeting::initiated_from
int initiated_from
Definition packets_gen.h:805
packet_diplomacy_init_meeting::counterpart
int counterpart
Definition packets_gen.h:804
packet_diplomacy_remove_clause_req
Definition packets_gen.h:831
packet_diplomacy_remove_clause_req::type
enum clause_type type
Definition packets_gen.h:834
packet_diplomacy_remove_clause_req::giver
int giver
Definition packets_gen.h:833
packet_diplomacy_remove_clause_req::counterpart
int counterpart
Definition packets_gen.h:832
packet_diplomacy_remove_clause_req::value
int value
Definition packets_gen.h:835
packet_diplomacy_remove_clause
Definition packets_gen.h:838
packet_diplomacy_remove_clause::counterpart
int counterpart
Definition packets_gen.h:839
packet_diplomacy_remove_clause::value
int value
Definition packets_gen.h:842
packet_diplomacy_remove_clause::giver
int giver
Definition packets_gen.h:840
packet_diplomacy_remove_clause::type
enum clause_type type
Definition packets_gen.h:841
packet_early_chat_msg
Definition packets_gen.h:296
packet_early_chat_msg::event
enum event_type event
Definition packets_gen.h:299
packet_early_chat_msg::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:297
packet_early_chat_msg::phase
int phase
Definition packets_gen.h:301
packet_early_chat_msg::conn_id
int conn_id
Definition packets_gen.h:302
packet_early_chat_msg::turn
int turn
Definition packets_gen.h:300
packet_early_chat_msg::tile
int tile
Definition packets_gen.h:298
packet_edit_check_tiles
Definition packets_gen.h:1667
packet_edit_city_create
Definition packets_gen.h:1754
packet_edit_city_create::size
int size
Definition packets_gen.h:1757
packet_edit_city_create::tag
int tag
Definition packets_gen.h:1758
packet_edit_city_create::owner
int owner
Definition packets_gen.h:1755
packet_edit_city_create::tile
int tile
Definition packets_gen.h:1756
packet_edit_city_remove
Definition packets_gen.h:1761
packet_edit_city_remove::id16
int id16
Definition packets_gen.h:1762
packet_edit_city_remove::id32
int id32
Definition packets_gen.h:1763
packet_edit_city
Definition packets_gen.h:1766
packet_edit_city::turn_founded
int turn_founded
Definition packets_gen.h:1790
packet_edit_city::turn_last_built
int turn_last_built
Definition packets_gen.h:1791
packet_edit_city::production_value
int production_value
Definition packets_gen.h:1794
packet_edit_city::specialists_size
int specialists_size
Definition packets_gen.h:1778
packet_edit_city::ppl_content
int ppl_content[5]
Definition packets_gen.h:1775
packet_edit_city::shield_stock
int shield_stock
Definition packets_gen.h:1781
packet_edit_city::specialists
int specialists[SP_MAX]
Definition packets_gen.h:1779
packet_edit_city::built
int built[B_LAST]
Definition packets_gen.h:1792
packet_edit_city::steal
int steal
Definition packets_gen.h:1789
packet_edit_city::ppl_angry
int ppl_angry[5]
Definition packets_gen.h:1777
packet_edit_city::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:1769
packet_edit_city::ppl_happy
int ppl_happy[5]
Definition packets_gen.h:1774
packet_edit_city::was_happy
bool was_happy
Definition packets_gen.h:1786
packet_edit_city::anarchy
int anarchy
Definition packets_gen.h:1787
packet_edit_city::production_kind
int production_kind
Definition packets_gen.h:1793
packet_edit_city::did_sell
bool did_sell
Definition packets_gen.h:1785
packet_edit_city::debug
bool debug
Definition packets_gen.h:1783
packet_edit_city::did_buy
bool did_buy
Definition packets_gen.h:1784
packet_edit_city::history
int history
Definition packets_gen.h:1773
packet_edit_city::rapture
int rapture
Definition packets_gen.h:1788
packet_edit_city::original
int original
Definition packets_gen.h:1771
packet_edit_city::airlift
bool airlift
Definition packets_gen.h:1782
packet_edit_city::food_stock
int food_stock
Definition packets_gen.h:1780
packet_edit_city::id16
int id16
Definition packets_gen.h:1767
packet_edit_city::city_options
bv_city_options city_options
Definition packets_gen.h:1795
packet_edit_city::id32
int id32
Definition packets_gen.h:1768
packet_edit_city::owner
int owner
Definition packets_gen.h:1770
packet_edit_city::ppl_unhappy
int ppl_unhappy[5]
Definition packets_gen.h:1776
packet_edit_city::size
int size
Definition packets_gen.h:1772
packet_edit_game
Definition packets_gen.h:1841
packet_edit_game::ruleset_locked
bool ruleset_locked
Definition packets_gen.h:1850
packet_edit_game::scenario_players
bool scenario_players
Definition packets_gen.h:1846
packet_edit_game::lake_flooding
bool lake_flooding
Definition packets_gen.h:1849
packet_edit_game::startpos_nations
bool startpos_nations
Definition packets_gen.h:1847
packet_edit_game::scenario_name
char scenario_name[256]
Definition packets_gen.h:1843
packet_edit_game::prevent_new_cities
bool prevent_new_cities
Definition packets_gen.h:1848
packet_edit_game::scenario
bool scenario
Definition packets_gen.h:1842
packet_edit_game::scenario_authors
char scenario_authors[MAX_LEN_PACKET/3]
Definition packets_gen.h:1844
packet_edit_game::scenario_random
bool scenario_random
Definition packets_gen.h:1845
packet_edit_mode
Definition packets_gen.h:1659
packet_edit_mode::state
bool state
Definition packets_gen.h:1660
packet_edit_object_created
Definition packets_gen.h:1857
packet_edit_object_created::id
int id
Definition packets_gen.h:1859
packet_edit_object_created::tag
int tag
Definition packets_gen.h:1858
packet_edit_player_create
Definition packets_gen.h:1798
packet_edit_player_create::tag
int tag
Definition packets_gen.h:1799
packet_edit_player_remove
Definition packets_gen.h:1802
packet_edit_player_remove::id
int id
Definition packets_gen.h:1803
packet_edit_player_vision
Definition packets_gen.h:1834
packet_edit_player_vision::tile
int tile
Definition packets_gen.h:1836
packet_edit_player_vision::known
bool known
Definition packets_gen.h:1837
packet_edit_player_vision::player
int player
Definition packets_gen.h:1835
packet_edit_player_vision::size
int size
Definition packets_gen.h:1838
packet_edit_player
Definition packets_gen.h:1806
packet_edit_player::ranked_username
char ranked_username[MAX_LEN_NAME]
Definition packets_gen.h:1810
packet_edit_player::gold
int gold
Definition packets_gen.h:1822
packet_edit_player::team
int team
Definition packets_gen.h:1816
packet_edit_player::scenario_reserved
bool scenario_reserved
Definition packets_gen.h:1831
packet_edit_player::nation
Nation_type_id nation
Definition packets_gen.h:1815
packet_edit_player::user_turns
int user_turns
Definition packets_gen.h:1811
packet_edit_player::tax
int tax
Definition packets_gen.h:1823
packet_edit_player::ai
bool ai
Definition packets_gen.h:1830
packet_edit_player::luxury
int luxury
Definition packets_gen.h:1825
packet_edit_player::nturns_idle
int nturns_idle
Definition packets_gen.h:1818
packet_edit_player::username
char username[MAX_LEN_NAME]
Definition packets_gen.h:1809
packet_edit_player::revolution_finishes
int revolution_finishes
Definition packets_gen.h:1820
packet_edit_player::is_male
bool is_male
Definition packets_gen.h:1812
packet_edit_player::science
int science
Definition packets_gen.h:1824
packet_edit_player::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1808
packet_edit_player::embassy
bv_player embassy
Definition packets_gen.h:1821
packet_edit_player::phase_done
bool phase_done
Definition packets_gen.h:1817
packet_edit_player::id
int id
Definition packets_gen.h:1807
packet_edit_player::government
Government_type_id government
Definition packets_gen.h:1813
packet_edit_player::inventions
bool inventions[A_LAST+1]
Definition packets_gen.h:1829
packet_edit_player::bulbs_researched
int bulbs_researched
Definition packets_gen.h:1828
packet_edit_player::is_alive
bool is_alive
Definition packets_gen.h:1819
packet_edit_player::researching
int researching
Definition packets_gen.h:1827
packet_edit_player::future_tech
int future_tech
Definition packets_gen.h:1826
packet_edit_player::target_government
Government_type_id target_government
Definition packets_gen.h:1814
packet_edit_recalculate_borders
Definition packets_gen.h:1663
packet_edit_scenario_desc
Definition packets_gen.h:1853
packet_edit_scenario_desc::scenario_desc
char scenario_desc[MAX_LEN_CONTENT]
Definition packets_gen.h:1854
packet_edit_startpos_full
Definition packets_gen.h:1695
packet_edit_startpos_full::id
int id
Definition packets_gen.h:1696
packet_edit_startpos_full::exclude
bool exclude
Definition packets_gen.h:1697
packet_edit_startpos_full::nations
bv_startpos_nations nations
Definition packets_gen.h:1698
packet_edit_startpos
Definition packets_gen.h:1689
packet_edit_startpos::removal
bool removal
Definition packets_gen.h:1691
packet_edit_startpos::tag
int tag
Definition packets_gen.h:1692
packet_edit_startpos::id
int id
Definition packets_gen.h:1690
packet_edit_tile_extra
Definition packets_gen.h:1681
packet_edit_tile_extra::tile
int tile
Definition packets_gen.h:1682
packet_edit_tile_extra::extra_type_id
int extra_type_id
Definition packets_gen.h:1683
packet_edit_tile_extra::removal
bool removal
Definition packets_gen.h:1684
packet_edit_tile_extra::size
int size
Definition packets_gen.h:1686
packet_edit_tile_extra::eowner
int eowner
Definition packets_gen.h:1685
packet_edit_tile_terrain
Definition packets_gen.h:1675
packet_edit_tile_terrain::size
int size
Definition packets_gen.h:1678
packet_edit_tile_terrain::tile
int tile
Definition packets_gen.h:1676
packet_edit_tile_terrain::terrain
Terrain_type_id terrain
Definition packets_gen.h:1677
packet_edit_tile
Definition packets_gen.h:1701
packet_edit_tile::resource
Resource_type_id resource
Definition packets_gen.h:1704
packet_edit_tile::startpos_nation
Nation_type_id startpos_nation
Definition packets_gen.h:1706
packet_edit_tile::eowner
int eowner
Definition packets_gen.h:1707
packet_edit_tile::label
char label[MAX_LEN_NAME]
Definition packets_gen.h:1708
packet_edit_tile::extras
bv_extras extras
Definition packets_gen.h:1703
packet_edit_tile::tile
int tile
Definition packets_gen.h:1702
packet_edit_tile::terrain
Terrain_type_id terrain
Definition packets_gen.h:1705
packet_edit_toggle_fogofwar
Definition packets_gen.h:1671
packet_edit_toggle_fogofwar::player
int player
Definition packets_gen.h:1672
packet_edit_unit_create
Definition packets_gen.h:1711
packet_edit_unit_create::tag
int tag
Definition packets_gen.h:1716
packet_edit_unit_create::count
int count
Definition packets_gen.h:1715
packet_edit_unit_create::type
Unit_type_id type
Definition packets_gen.h:1714
packet_edit_unit_create::tile
int tile
Definition packets_gen.h:1713
packet_edit_unit_create::owner
int owner
Definition packets_gen.h:1712
packet_edit_unit_remove_by_id
Definition packets_gen.h:1726
packet_edit_unit_remove_by_id::id32
int id32
Definition packets_gen.h:1728
packet_edit_unit_remove_by_id::id16
int id16
Definition packets_gen.h:1727
packet_edit_unit_remove
Definition packets_gen.h:1719
packet_edit_unit_remove::count
int count
Definition packets_gen.h:1723
packet_edit_unit_remove::tile
int tile
Definition packets_gen.h:1721
packet_edit_unit_remove::owner
int owner
Definition packets_gen.h:1720
packet_edit_unit_remove::type
Unit_type_id type
Definition packets_gen.h:1722
packet_edit_unit
Definition packets_gen.h:1731
packet_edit_unit::owner
int owner
Definition packets_gen.h:1735
packet_edit_unit::activity_count
int activity_count
Definition packets_gen.h:1743
packet_edit_unit::stay
bool stay
Definition packets_gen.h:1751
packet_edit_unit::moved
bool moved
Definition packets_gen.h:1746
packet_edit_unit::transported_by16
int transported_by16
Definition packets_gen.h:1749
packet_edit_unit::debug
bool debug
Definition packets_gen.h:1745
packet_edit_unit::transported_by32
int transported_by32
Definition packets_gen.h:1750
packet_edit_unit::paradropped
bool paradropped
Definition packets_gen.h:1747
packet_edit_unit::done_moving
bool done_moving
Definition packets_gen.h:1748
packet_edit_unit::homecity32
int homecity32
Definition packets_gen.h:1737
packet_edit_unit::id16
int id16
Definition packets_gen.h:1732
packet_edit_unit::moves_left
int moves_left
Definition packets_gen.h:1738
packet_edit_unit::id32
int id32
Definition packets_gen.h:1733
packet_edit_unit::homecity16
int homecity16
Definition packets_gen.h:1736
packet_edit_unit::hp
int hp
Definition packets_gen.h:1739
packet_edit_unit::utype
Unit_type_id utype
Definition packets_gen.h:1734
packet_edit_unit::activity
enum unit_activity activity
Definition packets_gen.h:1742
packet_edit_unit::fuel
int fuel
Definition packets_gen.h:1741
packet_edit_unit::veteran
int veteran
Definition packets_gen.h:1740
packet_edit_unit::activity_base
Base_type_id activity_base
Definition packets_gen.h:1744
packet_end_phase
Definition packets_gen.h:912
packet_end_turn
Definition packets_gen.h:930
packet_endgame_player
Definition packets_gen.h:94
packet_endgame_player::category_num
int category_num
Definition packets_gen.h:95
packet_endgame_player::winner
bool winner
Definition packets_gen.h:99
packet_endgame_player::player_id
int player_id
Definition packets_gen.h:96
packet_endgame_player::category_score
int category_score[32]
Definition packets_gen.h:98
packet_endgame_player::score
int score
Definition packets_gen.h:97
packet_endgame_report
Definition packets_gen.h:88
packet_endgame_report::category_name
char category_name[32][MAX_LEN_NAME]
Definition packets_gen.h:90
packet_endgame_report::category_num
int category_num
Definition packets_gen.h:89
packet_endgame_report::player_num
int player_num
Definition packets_gen.h:91
packet_freeze_client
Definition packets_gen.h:934
packet_game_info
Definition packets_gen.h:119
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:149
packet_game_info::min_trade_route_val
int min_trade_route_val
Definition packets_gen.h:160
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:158
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:139
packet_game_info::citizen_partisans_pct
int citizen_partisans_pct
Definition packets_gen.h:146
packet_game_info::restrictinfra
bool restrictinfra
Definition packets_gen.h:218
packet_game_info::celebratesize
int celebratesize
Definition packets_gen.h:140
packet_game_info::goods_selection
enum goods_selection_method goods_selection
Definition packets_gen.h:161
packet_game_info::borders
enum borders_mode borders
Definition packets_gen.h:133
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:121
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:120
packet_game_info::forced_science
int forced_science
Definition packets_gen.h:157
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:165
packet_game_info::gold_upkeep_style
enum gold_upkeep_style gold_upkeep_style
Definition packets_gen.h:167
packet_game_info::pop_report_zeroes
int pop_report_zeroes
Definition packets_gen.h:142
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:143
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:126
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:137
packet_game_info::diplomacy
enum diplomacy_mode diplomacy
Definition packets_gen.h:151
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:159
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:141
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:129
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:249
packet_game_info::conquest_convert_pct
int conquest_convert_pct
Definition packets_gen.h:145
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::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:148
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:127
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:144
packet_game_info::forced_gold
int forced_gold
Definition packets_gen.h:155
packet_game_info::global_advances
bool global_advances[A_LAST]
Definition packets_gen.h:163
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:245
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:128
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:123
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:246
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:153
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:166
packet_game_info::phase_mode
enum phase_mode_type phase_mode
Definition packets_gen.h:207
packet_game_info::airlift_from_always_enabled
bool airlift_from_always_enabled
Definition packets_gen.h:124
packet_game_info::caravan_bonus_style
enum caravan_bonus_style caravan_bonus_style
Definition packets_gen.h:135
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:248
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:150
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:131
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::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:134
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:138
packet_game_info::border_city_permanent_radius_sq
int border_city_permanent_radius_sq
Definition packets_gen.h:132
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:136
packet_game_info::persistent_ready
enum persistent_ready persistent_ready
Definition packets_gen.h:122
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:125
packet_game_info::fogofwar
bool fogofwar
Definition packets_gen.h:152
packet_game_info::small_wonder_visibility
enum wonder_visib_type small_wonder_visibility
Definition packets_gen.h:250
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:154
packet_game_info::combat_odds_scaled_veterancy
bool combat_odds_scaled_veterancy
Definition packets_gen.h:191
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:247
packet_game_info::border_city_radius_sq
int border_city_radius_sq
Definition packets_gen.h:130
packet_game_info::global_warming
bool global_warming
Definition packets_gen.h:164
packet_game_info::citymindist
int citymindist
Definition packets_gen.h:147
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:156
packet_game_info::global_advance_count
int global_advance_count
Definition packets_gen.h:162
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:1509
packet_game_load::load_successful
bool load_successful
Definition packets_gen.h:1510
packet_game_load::load_filename
char load_filename[MAX_LEN_PACKET]
Definition packets_gen.h:1511
packet_handlers
Definition packets.h:97
packet_handlers::force_to_send
int(* force_to_send)(struct connection *pconn, const void *packet, bool force_to_send)
Definition packets.h:101
packet_handlers::no_packet
int(* no_packet)(struct connection *pconn)
Definition packets.h:99
packet_handlers::packet
int(* packet)(struct connection *pconn, const void *packet)
Definition packets.h:100
packet_handlers::send
union packet_handlers::@67 send[PACKET_LAST]
packet_handlers::receive
void *(* receive[PACKET_LAST])(struct connection *pconn)
Definition packets.h:104
packet_investigate_finished
Definition packets_gen.h:38
packet_investigate_finished::unit_id16
int unit_id16
Definition packets_gen.h:39
packet_investigate_finished::city_id32
int city_id32
Definition packets_gen.h:42
packet_investigate_finished::city_id16
int city_id16
Definition packets_gen.h:41
packet_investigate_finished::unit_id32
int unit_id32
Definition packets_gen.h:40
packet_investigate_started
Definition packets_gen.h:31
packet_investigate_started::city_id32
int city_id32
Definition packets_gen.h:35
packet_investigate_started::unit_id16
int unit_id16
Definition packets_gen.h:32
packet_investigate_started::city_id16
int city_id16
Definition packets_gen.h:34
packet_investigate_started::unit_id32
int unit_id32
Definition packets_gen.h:33
packet_map_info
Definition packets_gen.h:266
packet_map_info::ysize
int ysize
Definition packets_gen.h:268
packet_map_info::topology_id
int topology_id
Definition packets_gen.h:269
packet_map_info::xsize
int xsize
Definition packets_gen.h:267
packet_nation_availability
Definition packets_gen.h:1180
packet_nation_availability::ncount
int ncount
Definition packets_gen.h:1181
packet_nation_availability::is_pickable
bool is_pickable[MAX_NUM_NATIONS]
Definition packets_gen.h:1182
packet_nation_availability::nationset_change
bool nationset_change
Definition packets_gen.h:1183
packet_nation_select_req
Definition packets_gen.h:75
packet_nation_select_req::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:79
packet_nation_select_req::nation_no
Nation_type_id nation_no
Definition packets_gen.h:77
packet_nation_select_req::player_no
int player_no
Definition packets_gen.h:76
packet_nation_select_req::is_male
bool is_male
Definition packets_gen.h:78
packet_nation_select_req::style
int style
Definition packets_gen.h:80
packet_new_year
Definition packets_gen.h:920
packet_new_year::year
int year
Definition packets_gen.h:921
packet_new_year::turn
int turn
Definition packets_gen.h:923
packet_new_year::fragments
int fragments
Definition packets_gen.h:922
packet_nuke_tile_info
Definition packets_gen.h:272
packet_nuke_tile_info::tile
int tile
Definition packets_gen.h:273
packet_page_msg_part
Definition packets_gen.h:868
packet_page_msg_part::lines
char lines[MAX_LEN_CONTENT]
Definition packets_gen.h:869
packet_page_msg
Definition packets_gen.h:860
packet_page_msg::event
enum event_type event
Definition packets_gen.h:863
packet_page_msg::headline
char headline[MAX_LEN_MSG]
Definition packets_gen.h:862
packet_page_msg::parts
int parts
Definition packets_gen.h:865
packet_page_msg::caption
char caption[MAX_LEN_MSG]
Definition packets_gen.h:861
packet_page_msg::len
int len
Definition packets_gen.h:864
packet_play_music
Definition packets_gen.h:1862
packet_play_music::tag
char tag[MAX_LEN_NAME]
Definition packets_gen.h:1863
packet_player_attribute_block
Definition packets_gen.h:587
packet_player_attribute_chunk
Definition packets_gen.h:591
packet_player_attribute_chunk::chunk_length
int chunk_length
Definition packets_gen.h:594
packet_player_attribute_chunk::data
unsigned char data[ATTRIBUTE_CHUNK_SIZE]
Definition packets_gen.h:595
packet_player_attribute_chunk::total_length
int total_length
Definition packets_gen.h:593
packet_player_attribute_chunk::offset
int offset
Definition packets_gen.h:592
packet_player_change_government
Definition packets_gen.h:578
packet_player_change_government::government
Government_type_id government
Definition packets_gen.h:579
packet_player_diplstate
Definition packets_gen.h:598
packet_player_diplstate::plr1
int plr1
Definition packets_gen.h:600
packet_player_diplstate::diplstate_id
int diplstate_id
Definition packets_gen.h:599
packet_player_diplstate::type
enum diplstate_type type
Definition packets_gen.h:602
packet_player_diplstate::has_reason_to_cancel
int has_reason_to_cancel
Definition packets_gen.h:604
packet_player_diplstate::turns_left
int turns_left
Definition packets_gen.h:603
packet_player_diplstate::plr2
int plr2
Definition packets_gen.h:601
packet_player_diplstate::contact_turns_left
int contact_turns_left
Definition packets_gen.h:605
packet_player_info
Definition packets_gen.h:519
packet_player_info::ai_skill_level
enum ai_level ai_skill_level
Definition packets_gen.h:549
packet_player_info::phase_done
bool phase_done
Definition packets_gen.h:536
packet_player_info::is_alive
bool is_alive
Definition packets_gen.h:539
packet_player_info::is_male
bool is_male
Definition packets_gen.h:525
packet_player_info::luxury
int luxury
Definition packets_gen.h:543
packet_player_info::turns_alive
int turns_alive
Definition packets_gen.h:538
packet_player_info::color_red
int color_red
Definition packets_gen.h:557
packet_player_info::is_ready
bool is_ready
Definition packets_gen.h:535
packet_player_info::multiplier
int multiplier[MAX_NUM_MULTIPLIERS]
Definition packets_gen.h:563
packet_player_info::username
char username[MAX_LEN_NAME]
Definition packets_gen.h:522
packet_player_info::tech_upkeep
int tech_upkeep
Definition packets_gen.h:545
packet_player_info::style
int style
Definition packets_gen.h:531
packet_player_info::culture
int culture
Definition packets_gen.h:553
packet_player_info::flags
bv_plr_flags flags
Definition packets_gen.h:560
packet_player_info::mood
enum mood_type mood
Definition packets_gen.h:530
packet_player_info::color_green
int color_green
Definition packets_gen.h:558
packet_player_info::color_valid
bool color_valid
Definition packets_gen.h:555
packet_player_info::gives_shared_vision
bv_player gives_shared_vision
Definition packets_gen.h:551
packet_player_info::team
int team
Definition packets_gen.h:534
packet_player_info::love
int love[MAX_NUM_PLAYER_SLOTS]
Definition packets_gen.h:554
packet_player_info::was_created
bool was_created
Definition packets_gen.h:526
packet_player_info::target_government
Government_type_id target_government
Definition packets_gen.h:528
packet_player_info::multiplier_target
int multiplier_target[MAX_NUM_MULTIPLIERS]
Definition packets_gen.h:564
packet_player_info::real_embassy
bool real_embassy[MAX_NUM_PLAYER_SLOTS]
Definition packets_gen.h:529
packet_player_info::is_connected
bool is_connected
Definition packets_gen.h:547
packet_player_info::unassigned_user
bool unassigned_user
Definition packets_gen.h:523
packet_player_info::multiplier_changed
int multiplier_changed[MAX_NUM_MULTIPLIERS]
Definition packets_gen.h:565
packet_player_info::nturns_idle
int nturns_idle
Definition packets_gen.h:537
packet_player_info::score
int score
Definition packets_gen.h:524
packet_player_info::multip_count
int multip_count
Definition packets_gen.h:562
packet_player_info::nation
Nation_type_id nation
Definition packets_gen.h:533
packet_player_info::science_cost
int science_cost
Definition packets_gen.h:546
packet_player_info::barbarian_type
enum barbarian_type barbarian_type
Definition packets_gen.h:550
packet_player_info::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:521
packet_player_info::government
Government_type_id government
Definition packets_gen.h:527
packet_player_info::wonders
int wonders[B_LAST]
Definition packets_gen.h:561
packet_player_info::tax
int tax
Definition packets_gen.h:541
packet_player_info::music_style
int music_style
Definition packets_gen.h:532
packet_player_info::history
int history
Definition packets_gen.h:552
packet_player_info::science
int science
Definition packets_gen.h:542
packet_player_info::gold
int gold
Definition packets_gen.h:540
packet_player_info::revolution_finishes
int revolution_finishes
Definition packets_gen.h:548
packet_player_info::color_changeable
bool color_changeable
Definition packets_gen.h:556
packet_player_info::color_blue
int color_blue
Definition packets_gen.h:559
packet_player_info::infrapoints
int infrapoints
Definition packets_gen.h:544
packet_player_info::playerno
int playerno
Definition packets_gen.h:520
packet_player_multiplier
Definition packets_gen.h:608
packet_player_multiplier::count
int count
Definition packets_gen.h:609
packet_player_multiplier::multipliers
int multipliers[MAX_NUM_MULTIPLIERS]
Definition packets_gen.h:610
packet_player_phase_done
Definition packets_gen.h:568
packet_player_phase_done::turn
int turn
Definition packets_gen.h:569
packet_player_place_infra
Definition packets_gen.h:582
packet_player_place_infra::tile
int tile
Definition packets_gen.h:583
packet_player_place_infra::extra
int extra
Definition packets_gen.h:584
packet_player_rates
Definition packets_gen.h:572
packet_player_rates::science
int science
Definition packets_gen.h:575
packet_player_rates::luxury
int luxury
Definition packets_gen.h:574
packet_player_rates::tax
int tax
Definition packets_gen.h:573
packet_player_ready
Definition packets_gen.h:83
packet_player_ready::player_no
int player_no
Definition packets_gen.h:84
packet_player_ready::is_ready
bool is_ready
Definition packets_gen.h:85
packet_player_remove
Definition packets_gen.h:515
packet_player_remove::playerno
int playerno
Definition packets_gen.h:516
packet_player_research
Definition packets_gen.h:629
packet_player_research::tech
int tech
Definition packets_gen.h:630
packet_player_tech_goal
Definition packets_gen.h:633
packet_player_tech_goal::tech
int tech
Definition packets_gen.h:634
packet_processing_finished
Definition packets_gen.h:27
packet_processing_started
Definition packets_gen.h:23
packet_report_req
Definition packets_gen.h:872
packet_report_req::type
enum report_type type
Definition packets_gen.h:873
packet_research_info
Definition packets_gen.h:613
packet_research_info::tech_goal
int tech_goal
Definition packets_gen.h:620
packet_research_info::researching
int researching
Definition packets_gen.h:617
packet_research_info::inventions
char inventions[A_LAST+1]
Definition packets_gen.h:622
packet_research_info::techs_researched
int techs_researched
Definition packets_gen.h:615
packet_research_info::id
int id
Definition packets_gen.h:614
packet_research_info::future_tech
int future_tech
Definition packets_gen.h:616
packet_research_info::bulbs_researched
int bulbs_researched
Definition packets_gen.h:619
packet_research_info::researching_cost
int researching_cost
Definition packets_gen.h:618
packet_research_info::total_bulbs_prod
int total_bulbs_prod
Definition packets_gen.h:621
packet_ruleset_achievement
Definition packets_gen.h:1373
packet_ruleset_achievement::id
int id
Definition packets_gen.h:1374
packet_ruleset_achievement::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1376
packet_ruleset_achievement::unique
bool unique
Definition packets_gen.h:1378
packet_ruleset_achievement::value
int value
Definition packets_gen.h:1379
packet_ruleset_achievement::type
enum achievement_type type
Definition packets_gen.h:1377
packet_ruleset_achievement::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1375
packet_ruleset_action_auto
Definition packets_gen.h:1412
packet_ruleset_action_auto::id
int id
Definition packets_gen.h:1413
packet_ruleset_action_auto::alternatives
action_id alternatives[MAX_NUM_ACTIONS]
Definition packets_gen.h:1418
packet_ruleset_action_auto::reqs_count
int reqs_count
Definition packets_gen.h:1415
packet_ruleset_action_auto::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1416
packet_ruleset_action_auto::alternatives_count
int alternatives_count
Definition packets_gen.h:1417
packet_ruleset_action_auto::cause
enum action_auto_perf_cause cause
Definition packets_gen.h:1414
packet_ruleset_action_enabler
Definition packets_gen.h:1404
packet_ruleset_action_enabler::enabled_action
action_id enabled_action
Definition packets_gen.h:1405
packet_ruleset_action_enabler::actor_reqs_count
int actor_reqs_count
Definition packets_gen.h:1406
packet_ruleset_action_enabler::actor_reqs
struct requirement actor_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1407
packet_ruleset_action_enabler::target_reqs
struct requirement target_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1409
packet_ruleset_action_enabler::target_reqs_count
int target_reqs_count
Definition packets_gen.h:1408
packet_ruleset_action
Definition packets_gen.h:1389
packet_ruleset_action::quiet
bool quiet
Definition packets_gen.h:1392
packet_ruleset_action::sub_tgt_kind
enum action_sub_target_kind sub_tgt_kind
Definition packets_gen.h:1398
packet_ruleset_action::act_kind
enum action_actor_kind act_kind
Definition packets_gen.h:1396
packet_ruleset_action::actor_consuming_always
bool actor_consuming_always
Definition packets_gen.h:1395
packet_ruleset_action::blocked_by
bv_actions blocked_by
Definition packets_gen.h:1401
packet_ruleset_action::max_distance
int max_distance
Definition packets_gen.h:1400
packet_ruleset_action::id
action_id id
Definition packets_gen.h:1390
packet_ruleset_action::min_distance
int min_distance
Definition packets_gen.h:1399
packet_ruleset_action::sub_results
bv_action_sub_results sub_results
Definition packets_gen.h:1394
packet_ruleset_action::ui_name
char ui_name[MAX_LEN_NAME]
Definition packets_gen.h:1391
packet_ruleset_action::tgt_kind
enum action_target_kind tgt_kind
Definition packets_gen.h:1397
packet_ruleset_action::result
enum action_result result
Definition packets_gen.h:1393
packet_ruleset_base
Definition packets_gen.h:1326
packet_ruleset_base::vision_subs_sq
int vision_subs_sq
Definition packets_gen.h:1332
packet_ruleset_base::vision_invis_sq
int vision_invis_sq
Definition packets_gen.h:1331
packet_ruleset_base::border_sq
int border_sq
Definition packets_gen.h:1329
packet_ruleset_base::vision_main_sq
int vision_main_sq
Definition packets_gen.h:1330
packet_ruleset_base::gui_type
enum base_gui_type gui_type
Definition packets_gen.h:1328
packet_ruleset_base::id
int id
Definition packets_gen.h:1327
packet_ruleset_building
Definition packets_gen.h:1203
packet_ruleset_building::flags
bv_impr_flags flags
Definition packets_gen.h:1217
packet_ruleset_building::id
Impr_type_id id
Definition packets_gen.h:1204
packet_ruleset_building::build_cost
int build_cost
Definition packets_gen.h:1214
packet_ruleset_building::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1220
packet_ruleset_building::obs_reqs
struct requirement obs_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1213
packet_ruleset_building::upkeep
int upkeep
Definition packets_gen.h:1215
packet_ruleset_building::soundtag_alt
char soundtag_alt[MAX_LEN_NAME]
Definition packets_gen.h:1219
packet_ruleset_building::reqs_count
int reqs_count
Definition packets_gen.h:1210
packet_ruleset_building::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1211
packet_ruleset_building::genus
enum impr_genus_id genus
Definition packets_gen.h:1205
packet_ruleset_building::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1206
packet_ruleset_building::soundtag
char soundtag[MAX_LEN_NAME]
Definition packets_gen.h:1218
packet_ruleset_building::sabotage
int sabotage
Definition packets_gen.h:1216
packet_ruleset_building::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1207
packet_ruleset_building::obs_count
int obs_count
Definition packets_gen.h:1212
packet_ruleset_building::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1208
packet_ruleset_building::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1209
packet_ruleset_choices
Definition packets_gen.h:1504
packet_ruleset_choices::ruleset_count
int ruleset_count
Definition packets_gen.h:1505
packet_ruleset_choices::rulesets
char rulesets[MAX_NUM_RULESETS][MAX_RULESET_NAME_LENGTH]
Definition packets_gen.h:1506
packet_ruleset_city
Definition packets_gen.h:1192
packet_ruleset_city::citizens_graphic
char citizens_graphic[MAX_LEN_NAME]
Definition packets_gen.h:1196
packet_ruleset_city::style_id
int style_id
Definition packets_gen.h:1193
packet_ruleset_city::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1194
packet_ruleset_city::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1195
packet_ruleset_city::reqs_count
int reqs_count
Definition packets_gen.h:1197
packet_ruleset_city::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1200
packet_ruleset_city::graphic
char graphic[MAX_LEN_NAME]
Definition packets_gen.h:1199
packet_ruleset_city::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1198
packet_ruleset_clause
Definition packets_gen.h:1445
packet_ruleset_clause::type
enum clause_type type
Definition packets_gen.h:1446
packet_ruleset_clause::receiver_reqs
struct requirement receiver_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1451
packet_ruleset_clause::receiver_reqs_count
int receiver_reqs_count
Definition packets_gen.h:1450
packet_ruleset_clause::giver_reqs_count
int giver_reqs_count
Definition packets_gen.h:1448
packet_ruleset_clause::enabled
bool enabled
Definition packets_gen.h:1447
packet_ruleset_clause::giver_reqs
struct requirement giver_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1449
packet_ruleset_control
Definition packets_gen.h:1454
packet_ruleset_control::num_goods_types
int num_goods_types
Definition packets_gen.h:1464
packet_ruleset_control::preferred_soundset
char preferred_soundset[MAX_LEN_NAME]
Definition packets_gen.h:1478
packet_ruleset_control::desc_length32
int desc_length32
Definition packets_gen.h:1485
packet_ruleset_control::num_styles
int num_styles
Definition packets_gen.h:1468
packet_ruleset_control::num_extra_types
int num_extra_types
Definition packets_gen.h:1460
packet_ruleset_control::num_unit_types
int num_unit_types
Definition packets_gen.h:1456
packet_ruleset_control::version
char version[MAX_LEN_NAME]
Definition packets_gen.h:1482
packet_ruleset_control::num_impr_types
int num_impr_types
Definition packets_gen.h:1457
packet_ruleset_control::nation_count
int nation_count
Definition packets_gen.h:1471
packet_ruleset_control::num_road_types
int num_road_types
Definition packets_gen.h:1462
packet_ruleset_control::terrain_count
int terrain_count
Definition packets_gen.h:1473
packet_ruleset_control::preferred_tileset
char preferred_tileset[MAX_LEN_NAME]
Definition packets_gen.h:1477
packet_ruleset_control::popup_tech_help
bool popup_tech_help
Definition packets_gen.h:1480
packet_ruleset_control::num_music_styles
int num_music_styles
Definition packets_gen.h:1469
packet_ruleset_control::num_tech_types
int num_tech_types
Definition packets_gen.h:1459
packet_ruleset_control::government_count
int government_count
Definition packets_gen.h:1470
packet_ruleset_control::styles_count
int styles_count
Definition packets_gen.h:1472
packet_ruleset_control::num_disaster_types
int num_disaster_types
Definition packets_gen.h:1465
packet_ruleset_control::alt_dir
char alt_dir[MAX_LEN_NAME]
Definition packets_gen.h:1483
packet_ruleset_control::num_achievement_types
int num_achievement_types
Definition packets_gen.h:1466
packet_ruleset_control::num_specialist_types
int num_specialist_types
Definition packets_gen.h:1474
packet_ruleset_control::preferred_musicset
char preferred_musicset[MAX_LEN_NAME]
Definition packets_gen.h:1479
packet_ruleset_control::num_tech_classes
int num_tech_classes
Definition packets_gen.h:1458
packet_ruleset_control::num_unit_classes
int num_unit_classes
Definition packets_gen.h:1455
packet_ruleset_control::num_resource_types
int num_resource_types
Definition packets_gen.h:1463
packet_ruleset_control::num_multipliers
int num_multipliers
Definition packets_gen.h:1467
packet_ruleset_control::desc_length16
int desc_length16
Definition packets_gen.h:1484
packet_ruleset_control::num_nation_sets
int num_nation_sets
Definition packets_gen.h:1476
packet_ruleset_control::num_nation_groups
int num_nation_groups
Definition packets_gen.h:1475
packet_ruleset_control::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1481
packet_ruleset_control::num_base_types
int num_base_types
Definition packets_gen.h:1461
packet_ruleset_description_part
Definition packets_gen.h:1492
packet_ruleset_description_part::text
char text[MAX_LEN_CONTENT]
Definition packets_gen.h:1493
packet_ruleset_disaster
Definition packets_gen.h:1363
packet_ruleset_disaster::frequency
int frequency
Definition packets_gen.h:1369
packet_ruleset_disaster::id
int id
Definition packets_gen.h:1364
packet_ruleset_disaster::reqs_count
int reqs_count
Definition packets_gen.h:1367
packet_ruleset_disaster::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1366
packet_ruleset_disaster::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1368
packet_ruleset_disaster::effects
bv_disaster_effects effects
Definition packets_gen.h:1370
packet_ruleset_disaster::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1365
packet_ruleset_effect
Definition packets_gen.h:1590
packet_ruleset_effect::reqs_count
int reqs_count
Definition packets_gen.h:1595
packet_ruleset_effect::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1596
packet_ruleset_effect::multiplier
Multiplier_type_id multiplier
Definition packets_gen.h:1594
packet_ruleset_effect::effect_value
int effect_value
Definition packets_gen.h:1592
packet_ruleset_effect::has_multiplier
bool has_multiplier
Definition packets_gen.h:1593
packet_ruleset_effect::effect_type
enum effect_type effect_type
Definition packets_gen.h:1591
packet_ruleset_extra_flag
Definition packets_gen.h:1320
packet_ruleset_extra_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1323
packet_ruleset_extra_flag::id
int id
Definition packets_gen.h:1321
packet_ruleset_extra_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1322
packet_ruleset_extra
Definition packets_gen.h:1278
packet_ruleset_extra::id
int id
Definition packets_gen.h:1279
packet_ruleset_extra::removal_time
int removal_time
Definition packets_gen.h:1307
packet_ruleset_extra::defense_bonus
int defense_bonus
Definition packets_gen.h:1310
packet_ruleset_extra::infracost
int infracost
Definition packets_gen.h:1309
packet_ruleset_extra::native_to
bv_unit_classes native_to
Definition packets_gen.h:1312
packet_ruleset_extra::appearance_reqs_count
int appearance_reqs_count
Definition packets_gen.h:1297
packet_ruleset_extra::build_time_factor
int build_time_factor
Definition packets_gen.h:1306
packet_ruleset_extra::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1293
packet_ruleset_extra::generated
bool generated
Definition packets_gen.h:1304
packet_ruleset_extra::disappearance_reqs_count
int disappearance_reqs_count
Definition packets_gen.h:1300
packet_ruleset_extra::appearance_chance
int appearance_chance
Definition packets_gen.h:1296
packet_ruleset_extra::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1291
packet_ruleset_extra::rmcauses
bv_rmcauses rmcauses
Definition packets_gen.h:1284
packet_ruleset_extra::act_gfx_alt2
char act_gfx_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1287
packet_ruleset_extra::removal_time_factor
int removal_time_factor
Definition packets_gen.h:1308
packet_ruleset_extra::reqs_count
int reqs_count
Definition packets_gen.h:1292
packet_ruleset_extra::buildable
bool buildable
Definition packets_gen.h:1303
packet_ruleset_extra::disappearance_reqs
struct requirement disappearance_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1301
packet_ruleset_extra::flags
bv_extra_flags flags
Definition packets_gen.h:1313
packet_ruleset_extra::act_gfx_alt
char act_gfx_alt[MAX_LEN_NAME]
Definition packets_gen.h:1286
packet_ruleset_extra::hidden_by
bv_extras hidden_by
Definition packets_gen.h:1314
packet_ruleset_extra::activity_gfx
char activity_gfx[MAX_LEN_NAME]
Definition packets_gen.h:1285
packet_ruleset_extra::build_time
int build_time
Definition packets_gen.h:1305
packet_ruleset_extra::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1281
packet_ruleset_extra::eus
enum extra_unit_seen_type eus
Definition packets_gen.h:1311
packet_ruleset_extra::appearance_reqs
struct requirement appearance_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1298
packet_ruleset_extra::category
int category
Definition packets_gen.h:1282
packet_ruleset_extra::disappearance_chance
int disappearance_chance
Definition packets_gen.h:1299
packet_ruleset_extra::rmreqs_count
int rmreqs_count
Definition packets_gen.h:1294
packet_ruleset_extra::bridged_over
bv_extras bridged_over
Definition packets_gen.h:1315
packet_ruleset_extra::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1280
packet_ruleset_extra::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1290
packet_ruleset_extra::rmact_gfx_alt
char rmact_gfx_alt[MAX_LEN_NAME]
Definition packets_gen.h:1289
packet_ruleset_extra::rmact_gfx
char rmact_gfx[MAX_LEN_NAME]
Definition packets_gen.h:1288
packet_ruleset_extra::conflicts
bv_extras conflicts
Definition packets_gen.h:1316
packet_ruleset_extra::rmreqs
struct requirement rmreqs[MAX_NUM_REQS]
Definition packets_gen.h:1295
packet_ruleset_extra::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1317
packet_ruleset_extra::visibility_req
int visibility_req
Definition packets_gen.h:1302
packet_ruleset_extra::causes
bv_causes causes
Definition packets_gen.h:1283
packet_ruleset_game
Definition packets_gen.h:1043
packet_ruleset_game::work_raise_chance
int work_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:1054
packet_ruleset_game::base_raise_chance
int base_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:1053
packet_ruleset_game::global_init_techs
int global_init_techs[MAX_NUM_TECH_LIST]
Definition packets_gen.h:1046
packet_ruleset_game::veteran_levels
int veteran_levels
Definition packets_gen.h:1049
packet_ruleset_game::move_bonus
int move_bonus[MAX_VET_LEVELS]
Definition packets_gen.h:1052
packet_ruleset_game::global_init_techs_count
int global_init_techs_count
Definition packets_gen.h:1045
packet_ruleset_game::background_red
int background_red
Definition packets_gen.h:1055
packet_ruleset_game::veteran_name
char veteran_name[MAX_VET_LEVELS][MAX_LEN_NAME]
Definition packets_gen.h:1050
packet_ruleset_game::global_init_buildings
Impr_type_id global_init_buildings[MAX_NUM_BUILDING_LIST]
Definition packets_gen.h:1048
packet_ruleset_game::global_init_buildings_count
int global_init_buildings_count
Definition packets_gen.h:1047
packet_ruleset_game::default_specialist
int default_specialist
Definition packets_gen.h:1044
packet_ruleset_game::background_green
int background_green
Definition packets_gen.h:1056
packet_ruleset_game::power_fact
int power_fact[MAX_VET_LEVELS]
Definition packets_gen.h:1051
packet_ruleset_game::background_blue
int background_blue
Definition packets_gen.h:1057
packet_ruleset_goods
Definition packets_gen.h:1350
packet_ruleset_goods::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1360
packet_ruleset_goods::flags
bv_goods_flags flags
Definition packets_gen.h:1359
packet_ruleset_goods::from_pct
int from_pct
Definition packets_gen.h:1356
packet_ruleset_goods::onetime_pct
int onetime_pct
Definition packets_gen.h:1358
packet_ruleset_goods::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1352
packet_ruleset_goods::reqs_count
int reqs_count
Definition packets_gen.h:1354
packet_ruleset_goods::to_pct
int to_pct
Definition packets_gen.h:1357
packet_ruleset_goods::id
int id
Definition packets_gen.h:1351
packet_ruleset_goods::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1353
packet_ruleset_goods::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1355
packet_ruleset_government_ruler_title
Definition packets_gen.h:1072
packet_ruleset_government_ruler_title::nation
Nation_type_id nation
Definition packets_gen.h:1074
packet_ruleset_government_ruler_title::female_title
char female_title[MAX_LEN_NAME]
Definition packets_gen.h:1076
packet_ruleset_government_ruler_title::gov
Government_type_id gov
Definition packets_gen.h:1073
packet_ruleset_government_ruler_title::male_title
char male_title[MAX_LEN_NAME]
Definition packets_gen.h:1075
packet_ruleset_government
Definition packets_gen.h:1109
packet_ruleset_government::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1116
packet_ruleset_government::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1114
packet_ruleset_government::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1113
packet_ruleset_government::id
Government_type_id id
Definition packets_gen.h:1110
packet_ruleset_government::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1115
packet_ruleset_government::reqs_count
int reqs_count
Definition packets_gen.h:1111
packet_ruleset_government::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1112
packet_ruleset_government::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1117
packet_ruleset_multiplier
Definition packets_gen.h:1429
packet_ruleset_multiplier::stop
int stop
Definition packets_gen.h:1432
packet_ruleset_multiplier::step
int step
Definition packets_gen.h:1433
packet_ruleset_multiplier::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1438
packet_ruleset_multiplier::id
Multiplier_type_id id
Definition packets_gen.h:1430
packet_ruleset_multiplier::offset
int offset
Definition packets_gen.h:1435
packet_ruleset_multiplier::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1441
packet_ruleset_multiplier::def
int def
Definition packets_gen.h:1434
packet_ruleset_multiplier::start
int start
Definition packets_gen.h:1431
packet_ruleset_multiplier::minimum_turns
int minimum_turns
Definition packets_gen.h:1437
packet_ruleset_multiplier::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1439
packet_ruleset_multiplier::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1442
packet_ruleset_multiplier::factor
int factor
Definition packets_gen.h:1436
packet_ruleset_multiplier::reqs_count
int reqs_count
Definition packets_gen.h:1440
packet_ruleset_music
Definition packets_gen.h:1421
packet_ruleset_music::music_combat
char music_combat[MAX_LEN_NAME]
Definition packets_gen.h:1424
packet_ruleset_music::id
int id
Definition packets_gen.h:1422
packet_ruleset_music::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1426
packet_ruleset_music::reqs_count
int reqs_count
Definition packets_gen.h:1425
packet_ruleset_music::music_peaceful
char music_peaceful[MAX_LEN_NAME]
Definition packets_gen.h:1423
packet_ruleset_nation_groups
Definition packets_gen.h:1146
packet_ruleset_nation_groups::ngroups
int ngroups
Definition packets_gen.h:1147
packet_ruleset_nation_groups::groups
char groups[MAX_NUM_NATION_GROUPS][MAX_LEN_NAME]
Definition packets_gen.h:1148
packet_ruleset_nation_groups::hidden
bool hidden[MAX_NUM_NATION_GROUPS]
Definition packets_gen.h:1149
packet_ruleset_nation_sets
Definition packets_gen.h:1139
packet_ruleset_nation_sets::rule_names
char rule_names[MAX_NUM_NATION_SETS][MAX_LEN_NAME]
Definition packets_gen.h:1142
packet_ruleset_nation_sets::names
char names[MAX_NUM_NATION_SETS][MAX_LEN_NAME]
Definition packets_gen.h:1141
packet_ruleset_nation_sets::nsets
int nsets
Definition packets_gen.h:1140
packet_ruleset_nation_sets::descriptions
char descriptions[MAX_NUM_NATION_SETS][MAX_LEN_MSG]
Definition packets_gen.h:1143
packet_ruleset_nation
Definition packets_gen.h:1152
packet_ruleset_nation::ngroups
int ngroups
Definition packets_gen.h:1169
packet_ruleset_nation::init_techs
int init_techs[MAX_NUM_TECH_LIST]
Definition packets_gen.h:1173
packet_ruleset_nation::leader_name
char leader_name[MAX_NUM_LEADERS][MAX_LEN_NAME]
Definition packets_gen.h:1163
packet_ruleset_nation::style
int style
Definition packets_gen.h:1161
packet_ruleset_nation::is_playable
bool is_playable
Definition packets_gen.h:1165
packet_ruleset_nation::id
Nation_type_id id
Definition packets_gen.h:1153
packet_ruleset_nation::noun_plural
char noun_plural[MAX_LEN_NAME]
Definition packets_gen.h:1157
packet_ruleset_nation::init_units_count
int init_units_count
Definition packets_gen.h:1174
packet_ruleset_nation::adjective
char adjective[MAX_LEN_NAME]
Definition packets_gen.h:1155
packet_ruleset_nation::init_buildings
Impr_type_id init_buildings[MAX_NUM_BUILDING_LIST]
Definition packets_gen.h:1177
packet_ruleset_nation::init_units
Unit_type_id init_units[MAX_NUM_UNIT_LIST]
Definition packets_gen.h:1175
packet_ruleset_nation::init_techs_count
int init_techs_count
Definition packets_gen.h:1172
packet_ruleset_nation::leader_is_male
bool leader_is_male[MAX_NUM_LEADERS]
Definition packets_gen.h:1164
packet_ruleset_nation::translation_domain
char translation_domain[MAX_LEN_NAME]
Definition packets_gen.h:1154
packet_ruleset_nation::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1158
packet_ruleset_nation::init_government_id
Government_type_id init_government_id
Definition packets_gen.h:1171
packet_ruleset_nation::leader_count
int leader_count
Definition packets_gen.h:1162
packet_ruleset_nation::groups
int groups[MAX_NUM_NATION_GROUPS]
Definition packets_gen.h:1170
packet_ruleset_nation::barbarian_type
enum barbarian_type barbarian_type
Definition packets_gen.h:1166
packet_ruleset_nation::sets
int sets[MAX_NUM_NATION_SETS]
Definition packets_gen.h:1168
packet_ruleset_nation::init_buildings_count
int init_buildings_count
Definition packets_gen.h:1176
packet_ruleset_nation::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1159
packet_ruleset_nation::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1156
packet_ruleset_nation::legend
char legend[MAX_LEN_MSG]
Definition packets_gen.h:1160
packet_ruleset_nation::nsets
int nsets
Definition packets_gen.h:1167
packet_ruleset_resource
Definition packets_gen.h:1599
packet_ruleset_resource::id
int id
Definition packets_gen.h:1600
packet_ruleset_resource::output
int output[O_LAST]
Definition packets_gen.h:1601
packet_ruleset_road
Definition packets_gen.h:1335
packet_ruleset_road::flags
bv_road_flags flags
Definition packets_gen.h:1347
packet_ruleset_road::tile_incr_const
int tile_incr_const[O_LAST]
Definition packets_gen.h:1342
packet_ruleset_road::gui_type
enum road_gui_type gui_type
Definition packets_gen.h:1337
packet_ruleset_road::integrates
bv_max_extras integrates
Definition packets_gen.h:1346
packet_ruleset_road::move_cost
int move_cost
Definition packets_gen.h:1340
packet_ruleset_road::compat
enum road_compat compat
Definition packets_gen.h:1345
packet_ruleset_road::move_mode
enum road_move_mode move_mode
Definition packets_gen.h:1341
packet_ruleset_road::first_reqs_count
int first_reqs_count
Definition packets_gen.h:1338
packet_ruleset_road::tile_bonus
int tile_bonus[O_LAST]
Definition packets_gen.h:1344
packet_ruleset_road::tile_incr
int tile_incr[O_LAST]
Definition packets_gen.h:1343
packet_ruleset_road::id
int id
Definition packets_gen.h:1336
packet_ruleset_road::first_reqs
struct requirement first_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1339
packet_ruleset_specialist
Definition packets_gen.h:1060
packet_ruleset_specialist::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1063
packet_ruleset_specialist::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1066
packet_ruleset_specialist::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1068
packet_ruleset_specialist::id
Specialist_type_id id
Definition packets_gen.h:1061
packet_ruleset_specialist::reqs_count
int reqs_count
Definition packets_gen.h:1067
packet_ruleset_specialist::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1069
packet_ruleset_specialist::short_name
char short_name[MAX_LEN_NAME]
Definition packets_gen.h:1064
packet_ruleset_specialist::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1065
packet_ruleset_specialist::plural_name
char plural_name[MAX_LEN_NAME]
Definition packets_gen.h:1062
packet_ruleset_style
Definition packets_gen.h:1186
packet_ruleset_style::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1188
packet_ruleset_style::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1189
packet_ruleset_style::id
int id
Definition packets_gen.h:1187
packet_ruleset_summary
Definition packets_gen.h:1488
packet_ruleset_summary::text
char text[MAX_LEN_CONTENT]
Definition packets_gen.h:1489
packet_ruleset_tech_class
Definition packets_gen.h:1096
packet_ruleset_tech_class::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1098
packet_ruleset_tech_class::id
int id
Definition packets_gen.h:1097
packet_ruleset_tech_class::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1099
packet_ruleset_tech_class::cost_pct
int cost_pct
Definition packets_gen.h:1100
packet_ruleset_tech_flag
Definition packets_gen.h:1103
packet_ruleset_tech_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1105
packet_ruleset_tech_flag::id
int id
Definition packets_gen.h:1104
packet_ruleset_tech_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1106
packet_ruleset_tech
Definition packets_gen.h:1079
packet_ruleset_tech::research_reqs_count
int research_reqs_count
Definition packets_gen.h:1082
packet_ruleset_tech::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1089
packet_ruleset_tech::removed
bool removed
Definition packets_gen.h:1085
packet_ruleset_tech::research_reqs
struct requirement research_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1083
packet_ruleset_tech::id
int id
Definition packets_gen.h:1080
packet_ruleset_tech::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1092
packet_ruleset_tech::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1090
packet_ruleset_tech::num_reqs
int num_reqs
Definition packets_gen.h:1088
packet_ruleset_tech::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1093
packet_ruleset_tech::flags
bv_tech_flags flags
Definition packets_gen.h:1086
packet_ruleset_tech::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1091
packet_ruleset_tech::tclass
int tclass
Definition packets_gen.h:1084
packet_ruleset_tech::root_req
int root_req
Definition packets_gen.h:1081
packet_ruleset_tech::cost
float cost
Definition packets_gen.h:1087
packet_ruleset_terrain_control
Definition packets_gen.h:1120
packet_ruleset_terrain_control::lake_max_size
int lake_max_size
Definition packets_gen.h:1125
packet_ruleset_terrain_control::min_start_native_area
int min_start_native_area
Definition packets_gen.h:1126
packet_ruleset_terrain_control::ocean_reclaim_requirement_pct
int ocean_reclaim_requirement_pct
Definition packets_gen.h:1121
packet_ruleset_terrain_control::pythagorean_diagonal
bool pythagorean_diagonal
Definition packets_gen.h:1129
packet_ruleset_terrain_control::terrain_thaw_requirement_pct
int terrain_thaw_requirement_pct
Definition packets_gen.h:1123
packet_ruleset_terrain_control::infrapoints
bool infrapoints
Definition packets_gen.h:1130
packet_ruleset_terrain_control::gui_type_base0
char gui_type_base0[MAX_LEN_NAME]
Definition packets_gen.h:1131
packet_ruleset_terrain_control::move_fragments
int move_fragments
Definition packets_gen.h:1127
packet_ruleset_terrain_control::land_channel_requirement_pct
int land_channel_requirement_pct
Definition packets_gen.h:1122
packet_ruleset_terrain_control::igter_cost
int igter_cost
Definition packets_gen.h:1128
packet_ruleset_terrain_control::gui_type_base1
char gui_type_base1[MAX_LEN_NAME]
Definition packets_gen.h:1132
packet_ruleset_terrain_control::terrain_freeze_requirement_pct
int terrain_freeze_requirement_pct
Definition packets_gen.h:1124
packet_ruleset_terrain_flag
Definition packets_gen.h:1261
packet_ruleset_terrain_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1263
packet_ruleset_terrain_flag::id
int id
Definition packets_gen.h:1262
packet_ruleset_terrain_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1264
packet_ruleset_terrain
Definition packets_gen.h:1223
packet_ruleset_terrain::cultivate_time
int cultivate_time
Definition packets_gen.h:1241
packet_ruleset_terrain::irrigation_food_incr
int irrigation_food_incr
Definition packets_gen.h:1244
packet_ruleset_terrain::base_time
int base_time
Definition packets_gen.h:1238
packet_ruleset_terrain::transform_result
Terrain_type_id transform_result
Definition packets_gen.h:1249
packet_ruleset_terrain::tclass
int tclass
Definition packets_gen.h:1225
packet_ruleset_terrain::mining_shield_incr
int mining_shield_incr
Definition packets_gen.h:1246
packet_ruleset_terrain::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1258
packet_ruleset_terrain::clean_fallout_time
int clean_fallout_time
Definition packets_gen.h:1253
packet_ruleset_terrain::irrigation_time
int irrigation_time
Definition packets_gen.h:1245
packet_ruleset_terrain::placing_time
int placing_time
Definition packets_gen.h:1251
packet_ruleset_terrain::flags
bv_terrain_flags flags
Definition packets_gen.h:1226
packet_ruleset_terrain::transform_time
int transform_time
Definition packets_gen.h:1250
packet_ruleset_terrain::defense_bonus
int defense_bonus
Definition packets_gen.h:1233
packet_ruleset_terrain::resources
Resource_type_id resources[MAX_RESOURCE_TYPES]
Definition packets_gen.h:1236
packet_ruleset_terrain::plant_time
int plant_time
Definition packets_gen.h:1243
packet_ruleset_terrain::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1230
packet_ruleset_terrain::num_resources
int num_resources
Definition packets_gen.h:1235
packet_ruleset_terrain::output
int output[O_LAST]
Definition packets_gen.h:1234
packet_ruleset_terrain::animal
int animal
Definition packets_gen.h:1248
packet_ruleset_terrain::color_red
int color_red
Definition packets_gen.h:1255
packet_ruleset_terrain::native_to
bv_unit_classes native_to
Definition packets_gen.h:1227
packet_ruleset_terrain::pillage_time
int pillage_time
Definition packets_gen.h:1254
packet_ruleset_terrain::cultivate_result
Terrain_type_id cultivate_result
Definition packets_gen.h:1240
packet_ruleset_terrain::color_green
int color_green
Definition packets_gen.h:1256
packet_ruleset_terrain::road_time
int road_time
Definition packets_gen.h:1239
packet_ruleset_terrain::plant_result
Terrain_type_id plant_result
Definition packets_gen.h:1242
packet_ruleset_terrain::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1228
packet_ruleset_terrain::clean_pollution_time
int clean_pollution_time
Definition packets_gen.h:1252
packet_ruleset_terrain::road_output_incr_pct
int road_output_incr_pct[O_LAST]
Definition packets_gen.h:1237
packet_ruleset_terrain::movement_cost
int movement_cost
Definition packets_gen.h:1232
packet_ruleset_terrain::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1231
packet_ruleset_terrain::mining_time
int mining_time
Definition packets_gen.h:1247
packet_ruleset_terrain::id
Terrain_type_id id
Definition packets_gen.h:1224
packet_ruleset_terrain::color_blue
int color_blue
Definition packets_gen.h:1257
packet_ruleset_terrain::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1229
packet_ruleset_trade
Definition packets_gen.h:1382
packet_ruleset_trade::cancelling
enum trade_route_illegal_cancelling cancelling
Definition packets_gen.h:1385
packet_ruleset_trade::trade_pct
int trade_pct
Definition packets_gen.h:1384
packet_ruleset_trade::id
int id
Definition packets_gen.h:1383
packet_ruleset_trade::bonus_type
enum trade_route_bonus_type bonus_type
Definition packets_gen.h:1386
packet_ruleset_unit_bonus
Definition packets_gen.h:1023
packet_ruleset_unit_bonus::type
enum combat_bonus_type type
Definition packets_gen.h:1026
packet_ruleset_unit_bonus::unit
Unit_type_id unit
Definition packets_gen.h:1024
packet_ruleset_unit_bonus::quiet
bool quiet
Definition packets_gen.h:1028
packet_ruleset_unit_bonus::value
int value
Definition packets_gen.h:1027
packet_ruleset_unit_bonus::flag
enum unit_type_flag_id flag
Definition packets_gen.h:1025
packet_ruleset_unit_class_flag
Definition packets_gen.h:1037
packet_ruleset_unit_class_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1039
packet_ruleset_unit_class_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1040
packet_ruleset_unit_class_flag::id
int id
Definition packets_gen.h:1038
packet_ruleset_unit_class
Definition packets_gen.h:1267
packet_ruleset_unit_class::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1270
packet_ruleset_unit_class::flags
bv_unit_class_flags flags
Definition packets_gen.h:1274
packet_ruleset_unit_class::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1269
packet_ruleset_unit_class::non_native_def_pct
int non_native_def_pct
Definition packets_gen.h:1273
packet_ruleset_unit_class::hp_loss_pct
int hp_loss_pct
Definition packets_gen.h:1272
packet_ruleset_unit_class::id
int id
Definition packets_gen.h:1268
packet_ruleset_unit_class::min_speed
int min_speed
Definition packets_gen.h:1271
packet_ruleset_unit_class::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1275
packet_ruleset_unit_flag
Definition packets_gen.h:1031
packet_ruleset_unit_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1033
packet_ruleset_unit_flag::id
int id
Definition packets_gen.h:1032
packet_ruleset_unit_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1034
packet_ruleset_unit
Definition packets_gen.h:972
packet_ruleset_unit::paratroopers_range
int paratroopers_range
Definition packets_gen.h:1001
packet_ruleset_unit::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:977
packet_ruleset_unit::vlayer
enum vision_layer vlayer
Definition packets_gen.h:1016
packet_ruleset_unit::tp_defense
enum transp_def_type tp_defense
Definition packets_gen.h:1011
packet_ruleset_unit::unit_class_id
int unit_class_id
Definition packets_gen.h:982
packet_ruleset_unit::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:975
packet_ruleset_unit::vision_radius_sq
int vision_radius_sq
Definition packets_gen.h:991
packet_ruleset_unit::obsoleted_by
int obsoleted_by
Definition packets_gen.h:995
packet_ruleset_unit::upkeep
int upkeep[O_LAST]
Definition packets_gen.h:1000
packet_ruleset_unit::power_fact
int power_fact[MAX_VET_LEVELS]
Definition packets_gen.h:1004
packet_ruleset_unit::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:974
packet_ruleset_unit::hp
int hp
Definition packets_gen.h:993
packet_ruleset_unit::pop_cost
int pop_cost
Definition packets_gen.h:984
packet_ruleset_unit::city_slots
int city_slots
Definition packets_gen.h:1010
packet_ruleset_unit::firepower
int firepower
Definition packets_gen.h:994
packet_ruleset_unit::fuel
int fuel
Definition packets_gen.h:998
packet_ruleset_unit::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:976
packet_ruleset_unit::convert_time
int convert_time
Definition packets_gen.h:997
packet_ruleset_unit::sound_fight_alt
char sound_fight_alt[MAX_LEN_NAME]
Definition packets_gen.h:981
packet_ruleset_unit::disembarks
bv_unit_classes disembarks
Definition packets_gen.h:1015
packet_ruleset_unit::veteran_levels
int veteran_levels
Definition packets_gen.h:1002
packet_ruleset_unit::move_rate
int move_rate
Definition packets_gen.h:987
packet_ruleset_unit::attack_strength
int attack_strength
Definition packets_gen.h:985
packet_ruleset_unit::cargo
bv_unit_classes cargo
Definition packets_gen.h:1012
packet_ruleset_unit::build_cost
int build_cost
Definition packets_gen.h:983
packet_ruleset_unit::transport_capacity
int transport_capacity
Definition packets_gen.h:992
packet_ruleset_unit::flags
bv_unit_type_flags flags
Definition packets_gen.h:1018
packet_ruleset_unit::sound_move_alt
char sound_move_alt[MAX_LEN_NAME]
Definition packets_gen.h:979
packet_ruleset_unit::happy_cost
int happy_cost
Definition packets_gen.h:999
packet_ruleset_unit::worker
bool worker
Definition packets_gen.h:1020
packet_ruleset_unit::targets
bv_unit_classes targets
Definition packets_gen.h:1013
packet_ruleset_unit::tech_requirement
int tech_requirement
Definition packets_gen.h:988
packet_ruleset_unit::defense_strength
int defense_strength
Definition packets_gen.h:986
packet_ruleset_unit::build_reqs
struct requirement build_reqs[MAX_NUM_REQS]
Definition packets_gen.h:990
packet_ruleset_unit::base_raise_chance
int base_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:1006
packet_ruleset_unit::work_raise_chance
int work_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:1007
packet_ruleset_unit::sound_fight
char sound_fight[MAX_LEN_NAME]
Definition packets_gen.h:980
packet_ruleset_unit::embarks
bv_unit_classes embarks
Definition packets_gen.h:1014
packet_ruleset_unit::build_reqs_count
int build_reqs_count
Definition packets_gen.h:989
packet_ruleset_unit::city_size
int city_size
Definition packets_gen.h:1009
packet_ruleset_unit::bombard_rate
int bombard_rate
Definition packets_gen.h:1008
packet_ruleset_unit::veteran_name
char veteran_name[MAX_VET_LEVELS][MAX_LEN_NAME]
Definition packets_gen.h:1003
packet_ruleset_unit::converted_to
int converted_to
Definition packets_gen.h:996
packet_ruleset_unit::sound_move
char sound_move[MAX_LEN_NAME]
Definition packets_gen.h:978
packet_ruleset_unit::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1017
packet_ruleset_unit::roles
bv_unit_type_roles roles
Definition packets_gen.h:1019
packet_ruleset_unit::id
Unit_type_id id
Definition packets_gen.h:973
packet_ruleset_unit::move_bonus
int move_bonus[MAX_VET_LEVELS]
Definition packets_gen.h:1005
packet_rulesets_ready
Definition packets_gen.h:1135
packet_save_scenario
Definition packets_gen.h:1625
packet_save_scenario::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1626
packet_scenario_description
Definition packets_gen.h:1621
packet_scenario_description::description
char description[MAX_LEN_CONTENT]
Definition packets_gen.h:1622
packet_scenario_info
Definition packets_gen.h:1604
packet_scenario_info::lake_flooding
bool lake_flooding
Definition packets_gen.h:1612
packet_scenario_info::req_caps
char req_caps[257]
Definition packets_gen.h:1618
packet_scenario_info::datafile
char datafile[MAX_LEN_NAME]
Definition packets_gen.h:1616
packet_scenario_info::have_resources
bool have_resources
Definition packets_gen.h:1617
packet_scenario_info::is_scenario
bool is_scenario
Definition packets_gen.h:1605
packet_scenario_info::ruleset_locked
bool ruleset_locked
Definition packets_gen.h:1615
packet_scenario_info::allow_ai_type_fallback
bool allow_ai_type_fallback
Definition packets_gen.h:1614
packet_scenario_info::players
bool players
Definition packets_gen.h:1608
packet_scenario_info::authors
char authors[MAX_LEN_PACKET/3]
Definition packets_gen.h:1607
packet_scenario_info::name
char name[256]
Definition packets_gen.h:1606
packet_scenario_info::prevent_new_cities
bool prevent_new_cities
Definition packets_gen.h:1611
packet_scenario_info::handmade
bool handmade
Definition packets_gen.h:1613
packet_scenario_info::startpos_nations
bool startpos_nations
Definition packets_gen.h:1609
packet_scenario_info::save_random
bool save_random
Definition packets_gen.h:1610
packet_server_info
Definition packets_gen.h:313
packet_server_info::major_version
int major_version
Definition packets_gen.h:315
packet_server_info::version_label
char version_label[48]
Definition packets_gen.h:314
packet_server_info::patch_version
int patch_version
Definition packets_gen.h:317
packet_server_info::minor_version
int minor_version
Definition packets_gen.h:316
packet_server_info::emerg_version
int emerg_version
Definition packets_gen.h:318
packet_server_join_reply
Definition packets_gen.h:54
packet_server_join_reply::challenge_file
char challenge_file[4095]
Definition packets_gen.h:58
packet_server_join_reply::you_can_join
bool you_can_join
Definition packets_gen.h:55
packet_server_join_reply::conn_id
int conn_id
Definition packets_gen.h:59
packet_server_join_reply::capability
char capability[512]
Definition packets_gen.h:57
packet_server_join_reply::message
char message[1536]
Definition packets_gen.h:56
packet_server_join_req
Definition packets_gen.h:45
packet_server_join_req::version_label
char version_label[48]
Definition packets_gen.h:48
packet_server_join_req::capability
char capability[512]
Definition packets_gen.h:47
packet_server_join_req::minor_version
int minor_version
Definition packets_gen.h:50
packet_server_join_req::patch_version
int patch_version
Definition packets_gen.h:51
packet_server_join_req::major_version
int major_version
Definition packets_gen.h:49
packet_server_join_req::username
char username[48]
Definition packets_gen.h:46
packet_server_setting_bitwise
Definition packets_gen.h:1573
packet_server_setting_bitwise::support_names
char support_names[64][MAX_LEN_NAME]
Definition packets_gen.h:1582
packet_server_setting_bitwise::val
int val
Definition packets_gen.h:1579
packet_server_setting_bitwise::initial_setting
bool initial_setting
Definition packets_gen.h:1577
packet_server_setting_bitwise::bits_num
int bits_num
Definition packets_gen.h:1581
packet_server_setting_bitwise::default_val
int default_val
Definition packets_gen.h:1580
packet_server_setting_bitwise::is_changeable
bool is_changeable
Definition packets_gen.h:1576
packet_server_setting_bitwise::pretty_names
char pretty_names[64][MAX_LEN_ENUM]
Definition packets_gen.h:1583
packet_server_setting_bitwise::setdef
enum setting_default_level setdef
Definition packets_gen.h:1578
packet_server_setting_bitwise::is_visible
bool is_visible
Definition packets_gen.h:1575
packet_server_setting_bitwise::id
int id
Definition packets_gen.h:1574
packet_server_setting_bool
Definition packets_gen.h:1528
packet_server_setting_bool::val
bool val
Definition packets_gen.h:1534
packet_server_setting_bool::setdef
enum setting_default_level setdef
Definition packets_gen.h:1533
packet_server_setting_bool::is_changeable
bool is_changeable
Definition packets_gen.h:1531
packet_server_setting_bool::is_visible
bool is_visible
Definition packets_gen.h:1530
packet_server_setting_bool::default_val
bool default_val
Definition packets_gen.h:1535
packet_server_setting_bool::id
int id
Definition packets_gen.h:1529
packet_server_setting_bool::initial_setting
bool initial_setting
Definition packets_gen.h:1532
packet_server_setting_const
Definition packets_gen.h:1520
packet_server_setting_const::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1522
packet_server_setting_const::category
int category
Definition packets_gen.h:1525
packet_server_setting_const::short_help
char short_help[MAX_LEN_PACKET]
Definition packets_gen.h:1523
packet_server_setting_const::id
int id
Definition packets_gen.h:1521
packet_server_setting_const::extra_help
char extra_help[MAX_LEN_PACKET]
Definition packets_gen.h:1524
packet_server_setting_control
Definition packets_gen.h:1514
packet_server_setting_control::categories_num
int categories_num
Definition packets_gen.h:1516
packet_server_setting_control::settings_num
int settings_num
Definition packets_gen.h:1515
packet_server_setting_control::category_names
char category_names[256][MAX_LEN_NAME]
Definition packets_gen.h:1517
packet_server_setting_enum
Definition packets_gen.h:1560
packet_server_setting_enum::initial_setting
bool initial_setting
Definition packets_gen.h:1564
packet_server_setting_enum::is_visible
bool is_visible
Definition packets_gen.h:1562
packet_server_setting_enum::is_changeable
bool is_changeable
Definition packets_gen.h:1563
packet_server_setting_enum::setdef
enum setting_default_level setdef
Definition packets_gen.h:1565
packet_server_setting_enum::default_val
int default_val
Definition packets_gen.h:1567
packet_server_setting_enum::values_num
int values_num
Definition packets_gen.h:1568
packet_server_setting_enum::id
int id
Definition packets_gen.h:1561
packet_server_setting_enum::val
int val
Definition packets_gen.h:1566
packet_server_setting_enum::pretty_names
char pretty_names[64][MAX_LEN_ENUM]
Definition packets_gen.h:1570
packet_server_setting_enum::support_names
char support_names[64][MAX_LEN_NAME]
Definition packets_gen.h:1569
packet_server_setting_int
Definition packets_gen.h:1538
packet_server_setting_int::is_changeable
bool is_changeable
Definition packets_gen.h:1541
packet_server_setting_int::max_val
int max_val
Definition packets_gen.h:1547
packet_server_setting_int::is_visible
bool is_visible
Definition packets_gen.h:1540
packet_server_setting_int::min_val
int min_val
Definition packets_gen.h:1546
packet_server_setting_int::id
int id
Definition packets_gen.h:1539
packet_server_setting_int::val
int val
Definition packets_gen.h:1544
packet_server_setting_int::initial_setting
bool initial_setting
Definition packets_gen.h:1542
packet_server_setting_int::default_val
int default_val
Definition packets_gen.h:1545
packet_server_setting_int::setdef
enum setting_default_level setdef
Definition packets_gen.h:1543
packet_server_setting_str
Definition packets_gen.h:1550
packet_server_setting_str::default_val
char default_val[MAX_LEN_PACKET]
Definition packets_gen.h:1557
packet_server_setting_str::id
int id
Definition packets_gen.h:1551
packet_server_setting_str::val
char val[MAX_LEN_PACKET]
Definition packets_gen.h:1556
packet_server_setting_str::is_visible
bool is_visible
Definition packets_gen.h:1552
packet_server_setting_str::setdef
enum setting_default_level setdef
Definition packets_gen.h:1555
packet_server_setting_str::initial_setting
bool initial_setting
Definition packets_gen.h:1554
packet_server_setting_str::is_changeable
bool is_changeable
Definition packets_gen.h:1553
packet_server_shutdown
Definition packets_gen.h:71
packet_set_topology
Definition packets_gen.h:1586
packet_set_topology::topology_id
int topology_id
Definition packets_gen.h:1587
packet_single_want_hack_reply
Definition packets_gen.h:1500
packet_single_want_hack_reply::you_have_hack
bool you_have_hack
Definition packets_gen.h:1501
packet_single_want_hack_req
Definition packets_gen.h:1496
packet_single_want_hack_req::token
char token[MAX_LEN_NAME]
Definition packets_gen.h:1497
packet_spaceship_info
Definition packets_gen.h:951
packet_spaceship_info::sship_state
int sship_state
Definition packets_gen.h:953
packet_spaceship_info::propulsion
int propulsion
Definition packets_gen.h:958
packet_spaceship_info::habitation
int habitation
Definition packets_gen.h:959
packet_spaceship_info::mass
int mass
Definition packets_gen.h:964
packet_spaceship_info::life_support
int life_support
Definition packets_gen.h:960
packet_spaceship_info::structure
bv_spaceship_structure structure
Definition packets_gen.h:965
packet_spaceship_info::structurals
int structurals
Definition packets_gen.h:954
packet_spaceship_info::fuel
int fuel
Definition packets_gen.h:957
packet_spaceship_info::population
int population
Definition packets_gen.h:963
packet_spaceship_info::success_rate
float success_rate
Definition packets_gen.h:968
packet_spaceship_info::player_num
int player_num
Definition packets_gen.h:952
packet_spaceship_info::launch_year
int launch_year
Definition packets_gen.h:962
packet_spaceship_info::travel_time
float travel_time
Definition packets_gen.h:969
packet_spaceship_info::energy_rate
float energy_rate
Definition packets_gen.h:967
packet_spaceship_info::solar_panels
int solar_panels
Definition packets_gen.h:961
packet_spaceship_info::support_rate
float support_rate
Definition packets_gen.h:966
packet_spaceship_info::modules
int modules
Definition packets_gen.h:956
packet_spaceship_info::components
int components
Definition packets_gen.h:955
packet_spaceship_launch
Definition packets_gen.h:942
packet_spaceship_place
Definition packets_gen.h:946
packet_spaceship_place::num
int num
Definition packets_gen.h:948
packet_spaceship_place::type
enum spaceship_place_type type
Definition packets_gen.h:947
packet_start_phase
Definition packets_gen.h:916
packet_start_phase::phase
int phase
Definition packets_gen.h:917
packet_team_name_info
Definition packets_gen.h:276
packet_team_name_info::team_name
char team_name[MAX_LEN_NAME]
Definition packets_gen.h:278
packet_team_name_info::team_id
int team_id
Definition packets_gen.h:277
packet_thaw_client
Definition packets_gen.h:938
packet_tile_info
Definition packets_gen.h:102
packet_tile_info::resource
Resource_type_id resource
Definition packets_gen.h:111
packet_tile_info::extras
bv_extras extras
Definition packets_gen.h:112
packet_tile_info::place_turn
int place_turn
Definition packets_gen.h:114
packet_tile_info::placing
int placing
Definition packets_gen.h:113
packet_tile_info::owner
int owner
Definition packets_gen.h:106
packet_tile_info::known
enum known_type known
Definition packets_gen.h:105
packet_tile_info::label
char label[MAX_LEN_MAP_LABEL]
Definition packets_gen.h:116
packet_tile_info::extras_owner
int extras_owner
Definition packets_gen.h:107
packet_tile_info::tile
int tile
Definition packets_gen.h:103
packet_tile_info::continent
Continent_id continent
Definition packets_gen.h:104
packet_tile_info::terrain
Terrain_type_id terrain
Definition packets_gen.h:110
packet_tile_info::worked32
int worked32
Definition packets_gen.h:109
packet_tile_info::spec_sprite
char spec_sprite[MAX_LEN_NAME]
Definition packets_gen.h:115
packet_tile_info::worked16
int worked16
Definition packets_gen.h:108
packet_timeout_info
Definition packets_gen.h:261
packet_timeout_info::seconds_to_phasedone
float seconds_to_phasedone
Definition packets_gen.h:262
packet_timeout_info::last_turn_change_time
float last_turn_change_time
Definition packets_gen.h:263
packet_trade_route_info
Definition packets_gen.h:405
packet_trade_route_info::city16
int city16
Definition packets_gen.h:406
packet_trade_route_info::value
int value
Definition packets_gen.h:411
packet_trade_route_info::partner16
int partner16
Definition packets_gen.h:409
packet_trade_route_info::city32
int city32
Definition packets_gen.h:407
packet_trade_route_info::partner32
int partner32
Definition packets_gen.h:410
packet_trade_route_info::goods
Goods_type_id goods
Definition packets_gen.h:413
packet_trade_route_info::direction
enum route_direction direction
Definition packets_gen.h:412
packet_trade_route_info::index
int index
Definition packets_gen.h:408
packet_unit_action_answer
Definition packets_gen.h:760
packet_unit_action_answer::request_kind
int request_kind
Definition packets_gen.h:766
packet_unit_action_answer::actor_id32
int actor_id32
Definition packets_gen.h:762
packet_unit_action_answer::action_type
action_id action_type
Definition packets_gen.h:765
packet_unit_action_answer::cost
int cost
Definition packets_gen.h:764
packet_unit_action_answer::target_id
int target_id
Definition packets_gen.h:763
packet_unit_action_answer::actor_id16
int actor_id16
Definition packets_gen.h:761
packet_unit_action_query
Definition packets_gen.h:739
packet_unit_action_query::target_id
int target_id
Definition packets_gen.h:742
packet_unit_action_query::actor_id32
int actor_id32
Definition packets_gen.h:741
packet_unit_action_query::request_kind
int request_kind
Definition packets_gen.h:744
packet_unit_action_query::actor_id16
int actor_id16
Definition packets_gen.h:740
packet_unit_action_query::action_type
action_id action_type
Definition packets_gen.h:743
packet_unit_actions
Definition packets_gen.h:779
packet_unit_actions::actor_unit_id16
int actor_unit_id16
Definition packets_gen.h:780
packet_unit_actions::target_city_id16
int target_city_id16
Definition packets_gen.h:784
packet_unit_actions::target_unit_id16
int target_unit_id16
Definition packets_gen.h:782
packet_unit_actions::action_probabilities
struct act_prob action_probabilities[MAX_NUM_ACTIONS]
Definition packets_gen.h:789
packet_unit_actions::actor_unit_id32
int actor_unit_id32
Definition packets_gen.h:781
packet_unit_actions::target_city_id32
int target_city_id32
Definition packets_gen.h:785
packet_unit_actions::target_extra_id
int target_extra_id
Definition packets_gen.h:787
packet_unit_actions::request_kind
int request_kind
Definition packets_gen.h:788
packet_unit_actions::target_unit_id32
int target_unit_id32
Definition packets_gen.h:783
packet_unit_actions::target_tile_id
int target_tile_id
Definition packets_gen.h:786
packet_unit_change_activity
Definition packets_gen.h:792
packet_unit_change_activity::unit_id16
int unit_id16
Definition packets_gen.h:793
packet_unit_change_activity::activity
enum unit_activity activity
Definition packets_gen.h:795
packet_unit_change_activity::target
int target
Definition packets_gen.h:796
packet_unit_change_activity::unit_id32
int unit_id32
Definition packets_gen.h:794
packet_unit_combat_info
Definition packets_gen.h:704
packet_unit_combat_info::attacker_unit_id16
int attacker_unit_id16
Definition packets_gen.h:705
packet_unit_combat_info::defender_hp
int defender_hp
Definition packets_gen.h:710
packet_unit_combat_info::attacker_hp
int attacker_hp
Definition packets_gen.h:709
packet_unit_combat_info::defender_unit_id16
int defender_unit_id16
Definition packets_gen.h:707
packet_unit_combat_info::make_att_veteran
bool make_att_veteran
Definition packets_gen.h:711
packet_unit_combat_info::attacker_unit_id32
int attacker_unit_id32
Definition packets_gen.h:706
packet_unit_combat_info::defender_unit_id32
int defender_unit_id32
Definition packets_gen.h:708
packet_unit_combat_info::make_def_veteran
bool make_def_veteran
Definition packets_gen.h:712
packet_unit_do_action
Definition packets_gen.h:751
packet_unit_do_action::action_type
action_id action_type
Definition packets_gen.h:757
packet_unit_do_action::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:756
packet_unit_do_action::sub_tgt_id
int sub_tgt_id
Definition packets_gen.h:755
packet_unit_do_action::actor_id32
int actor_id32
Definition packets_gen.h:753
packet_unit_do_action::actor_id16
int actor_id16
Definition packets_gen.h:752
packet_unit_do_action::target_id
int target_id
Definition packets_gen.h:754
packet_unit_get_actions
Definition packets_gen.h:769
packet_unit_get_actions::target_unit_id32
int target_unit_id32
Definition packets_gen.h:773
packet_unit_get_actions::target_extra_id
int target_extra_id
Definition packets_gen.h:775
packet_unit_get_actions::target_tile_id
int target_tile_id
Definition packets_gen.h:774
packet_unit_get_actions::actor_unit_id32
int actor_unit_id32
Definition packets_gen.h:771
packet_unit_get_actions::target_unit_id16
int target_unit_id16
Definition packets_gen.h:772
packet_unit_get_actions::actor_unit_id16
int actor_unit_id16
Definition packets_gen.h:770
packet_unit_get_actions::request_kind
int request_kind
Definition packets_gen.h:776
packet_unit_info
Definition packets_gen.h:642
packet_unit_info::movesleft
int movesleft
Definition packets_gen.h:663
packet_unit_info::upkeep
int upkeep[O_LAST]
Definition packets_gen.h:651
packet_unit_info::carrying
int carrying
Definition packets_gen.h:662
packet_unit_info::action_decision_want
enum action_decision action_decision_want
Definition packets_gen.h:680
packet_unit_info::homecity32
int homecity32
Definition packets_gen.h:650
packet_unit_info::owner
int owner
Definition packets_gen.h:645
packet_unit_info::id16
int id16
Definition packets_gen.h:643
packet_unit_info::has_orders
bool has_orders
Definition packets_gen.h:674
packet_unit_info::orders
struct unit_order orders[MAX_LEN_ROUTE]
Definition packets_gen.h:679
packet_unit_info::fuel
int fuel
Definition packets_gen.h:665
packet_unit_info::activity
enum unit_activity activity
Definition packets_gen.h:669
packet_unit_info::activity_tgt
int activity_tgt
Definition packets_gen.h:670
packet_unit_info::nationality
int nationality
Definition packets_gen.h:646
packet_unit_info::transported
bool transported
Definition packets_gen.h:656
packet_unit_info::goto_tile
int goto_tile
Definition packets_gen.h:668
packet_unit_info::transported_by16
int transported_by16
Definition packets_gen.h:660
packet_unit_info::orders_index
int orders_index
Definition packets_gen.h:676
packet_unit_info::type
Unit_type_id type
Definition packets_gen.h:659
packet_unit_info::changed_from
enum unit_activity changed_from
Definition packets_gen.h:671
packet_unit_info::orders_length
int orders_length
Definition packets_gen.h:675
packet_unit_info::id32
int id32
Definition packets_gen.h:644
packet_unit_info::veteran
int veteran
Definition packets_gen.h:652
packet_unit_info::orders_repeat
bool orders_repeat
Definition packets_gen.h:677
packet_unit_info::activity_count
int activity_count
Definition packets_gen.h:666
packet_unit_info::occupied
bool occupied
Definition packets_gen.h:655
packet_unit_info::action_decision_tile
int action_decision_tile
Definition packets_gen.h:681
packet_unit_info::transported_by32
int transported_by32
Definition packets_gen.h:661
packet_unit_info::battlegroup
int battlegroup
Definition packets_gen.h:673
packet_unit_info::facing
enum direction8 facing
Definition packets_gen.h:648
packet_unit_info::orders_vigilant
bool orders_vigilant
Definition packets_gen.h:678
packet_unit_info::hp
int hp
Definition packets_gen.h:664
packet_unit_info::changed_from_count
int changed_from_count
Definition packets_gen.h:667
packet_unit_info::stay
bool stay
Definition packets_gen.h:658
packet_unit_info::tile
int tile
Definition packets_gen.h:647
packet_unit_info::homecity16
int homecity16
Definition packets_gen.h:649
packet_unit_info::ssa_controller
enum server_side_agent ssa_controller
Definition packets_gen.h:653
packet_unit_info::done_moving
bool done_moving
Definition packets_gen.h:657
packet_unit_info::paradropped
bool paradropped
Definition packets_gen.h:654
packet_unit_info::changed_from_tgt
int changed_from_tgt
Definition packets_gen.h:672
packet_unit_orders
Definition packets_gen.h:722
packet_unit_orders::src_tile
int src_tile
Definition packets_gen.h:725
packet_unit_orders::length
int length
Definition packets_gen.h:726
packet_unit_orders::unit_id16
int unit_id16
Definition packets_gen.h:723
packet_unit_orders::dest_tile
int dest_tile
Definition packets_gen.h:730
packet_unit_orders::repeat
bool repeat
Definition packets_gen.h:727
packet_unit_orders::vigilant
bool vigilant
Definition packets_gen.h:728
packet_unit_orders::unit_id32
int unit_id32
Definition packets_gen.h:724
packet_unit_orders::orders
struct unit_order orders[MAX_LEN_ROUTE]
Definition packets_gen.h:729
packet_unit_remove
Definition packets_gen.h:637
packet_unit_remove::unit_id16
int unit_id16
Definition packets_gen.h:638
packet_unit_remove::unit_id32
int unit_id32
Definition packets_gen.h:639
packet_unit_server_side_agent_set
Definition packets_gen.h:733
packet_unit_server_side_agent_set::unit_id32
int unit_id32
Definition packets_gen.h:735
packet_unit_server_side_agent_set::unit_id16
int unit_id16
Definition packets_gen.h:734
packet_unit_server_side_agent_set::agent
enum server_side_agent agent
Definition packets_gen.h:736
packet_unit_short_info
Definition packets_gen.h:684
packet_unit_short_info::id16
int id16
Definition packets_gen.h:685
packet_unit_short_info::activity
int activity
Definition packets_gen.h:695
packet_unit_short_info::packet_use
int packet_use
Definition packets_gen.h:699
packet_unit_short_info::tile
int tile
Definition packets_gen.h:688
packet_unit_short_info::transported
bool transported
Definition packets_gen.h:693
packet_unit_short_info::transported_by32
int transported_by32
Definition packets_gen.h:698
packet_unit_short_info::hp
int hp
Definition packets_gen.h:694
packet_unit_short_info::veteran
int veteran
Definition packets_gen.h:691
packet_unit_short_info::type
Unit_type_id type
Definition packets_gen.h:690
packet_unit_short_info::owner
int owner
Definition packets_gen.h:687
packet_unit_short_info::occupied
bool occupied
Definition packets_gen.h:692
packet_unit_short_info::info_city_id32
int info_city_id32
Definition packets_gen.h:701
packet_unit_short_info::info_city_id16
int info_city_id16
Definition packets_gen.h:700
packet_unit_short_info::facing
enum direction8 facing
Definition packets_gen.h:689
packet_unit_short_info::transported_by16
int transported_by16
Definition packets_gen.h:697
packet_unit_short_info::id32
int id32
Definition packets_gen.h:686
packet_unit_short_info::activity_tgt
int activity_tgt
Definition packets_gen.h:696
packet_unit_sscs_set
Definition packets_gen.h:715
packet_unit_sscs_set::type
enum unit_ss_data_type type
Definition packets_gen.h:718
packet_unit_sscs_set::unit_id16
int unit_id16
Definition packets_gen.h:716
packet_unit_sscs_set::value
int value
Definition packets_gen.h:719
packet_unit_sscs_set::unit_id32
int unit_id32
Definition packets_gen.h:717
packet_unit_type_upgrade
Definition packets_gen.h:747
packet_unit_type_upgrade::type
Unit_type_id type
Definition packets_gen.h:748
packet_unknown_research
Definition packets_gen.h:625
packet_unknown_research::id
int id
Definition packets_gen.h:626
packet_vote_new
Definition packets_gen.h:1629
packet_vote_new::flags
int flags
Definition packets_gen.h:1634
packet_vote_new::vote_no
int vote_no
Definition packets_gen.h:1630
packet_vote_new::desc
char desc[512]
Definition packets_gen.h:1632
packet_vote_new::percent_required
int percent_required
Definition packets_gen.h:1633
packet_vote_new::user
char user[MAX_LEN_NAME]
Definition packets_gen.h:1631
packet_vote_remove
Definition packets_gen.h:1645
packet_vote_remove::vote_no
int vote_no
Definition packets_gen.h:1646
packet_vote_resolve
Definition packets_gen.h:1649
packet_vote_resolve::passed
bool passed
Definition packets_gen.h:1651
packet_vote_resolve::vote_no
int vote_no
Definition packets_gen.h:1650
packet_vote_submit
Definition packets_gen.h:1654
packet_vote_submit::vote_no
int vote_no
Definition packets_gen.h:1655
packet_vote_submit::value
int value
Definition packets_gen.h:1656
packet_vote_update
Definition packets_gen.h:1637
packet_vote_update::abstain
int abstain
Definition packets_gen.h:1641
packet_vote_update::num_voters
int num_voters
Definition packets_gen.h:1642
packet_vote_update::yes
int yes
Definition packets_gen.h:1639
packet_vote_update::no
int no
Definition packets_gen.h:1640
packet_vote_update::vote_no
int vote_no
Definition packets_gen.h:1638
packet_web_city_info_addition
Definition packets_gen.h:1866
packet_web_city_info_addition::id32
int id32
Definition packets_gen.h:1868
packet_web_city_info_addition::id16
int id16
Definition packets_gen.h:1867
packet_web_city_info_addition::granary_size
int granary_size
Definition packets_gen.h:1869
packet_web_city_info_addition::granary_turns
int granary_turns
Definition packets_gen.h:1870
packet_web_player_info_addition
Definition packets_gen.h:1873
packet_web_player_info_addition::expected_income
int expected_income
Definition packets_gen.h:1875
packet_web_player_info_addition::playerno
int playerno
Definition packets_gen.h:1874
packet_web_ruleset_unit_addition
Definition packets_gen.h:1878
packet_web_ruleset_unit_addition::utype_actions
bv_actions utype_actions
Definition packets_gen.h:1880
packet_web_ruleset_unit_addition::id
Unit_type_id id
Definition packets_gen.h:1879
packet_worker_task
Definition packets_gen.h:506
packet_worker_task::tile_id
int tile_id
Definition packets_gen.h:509
packet_worker_task::city_id16
int city_id16
Definition packets_gen.h:507
packet_worker_task::city_id32
int city_id32
Definition packets_gen.h:508
packet_worker_task::activity
enum unit_activity activity
Definition packets_gen.h:510
packet_worker_task::want
int want
Definition packets_gen.h:512
packet_worker_task::tgt
int tgt
Definition packets_gen.h:511
player
Definition player.h:249
plocation
Definition dataio_raw.h:63
plocation::sub_location
struct plocation * sub_location
Definition dataio_raw.h:78
plocation::name
char * name
Definition dataio_raw.h:72
plocation::number
int number
Definition dataio_raw.h:69
requirement
Definition requirements.h:80
team
Definition team.c:40
terrain
Definition terrain.h:176
tile
Definition tile.h:49
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:161
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
bool
#define bool
Definition support.h:61
A_LAST
#define A_LAST
Definition tech.h:45
terrain_count
Terrain_type_id terrain_count(void)
Definition terrain.c:106
MAX_RESOURCE_TYPES
#define MAX_RESOURCE_TYPES
Definition terrain.h:67
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:61
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