1/* 2 3Max used id: 4============ 5 6Max id: 253 7 8Packets are not ordered by their id, but by their category. New packet 9with higher id may get added to existing category, and not to the end of file. 10For this reason it's important to keep information about max id currently 11in use updated here. So we know what ids are safe to use when adding new 12packets. 13 14Range 256:511 is reserved for freeciv-web specific packets. 15 16 17Syntax: 18 19 Comments: 20 ========= 21 22 Supported are: c-style (/ * * /), c++-style (//) and python style 23 (#). Empty lines will be ignored. 24 25 Typedef lines: 26 ============== 27 28 Start with "type" and have the format "type <alias> = <src>". You 29 can now use <alias> at every place a type is expected. Nested type 30 defs are possible. 31 32 Packets: 33 ======== 34 35 A packet definition starts with a header line, contains variable 36 field declarations, and ends with a single line containing the word 37 "end". 38 39 PACKET_<PACKET_NAME>=<packet num>; [<packet flags>] 40 <type1> <field1>; [<field flags>] 41 <type2> <field2>; [<field flags>] 42 ... 43 end 44 45 Header line: 46 ------------ 47 48 The header line contains the packet name. The packet name is used 49 for the naming of the generated code struct and functions: 50 struct packet_*; 51 send_packet_* 52 dsend_packet_* 53 dlsend_packet_* 54 lsend_packet_* 55 receive_packet_* 56 handle_packet_* 57 58 The header line also contains the packet number. The packet number 59 is used as a numeric identification of a packet between the client 60 and server. The packet number shall never change for an existing 61 packet without the adding of a mandatory capability. Packets which 62 are used for the capability checking PACKET_PROCESSING_STARTED, 63 PACKET_PROCESSING_FINISHED, PACKET_SERVER_JOIN_REQ and 64 PACKET_SERVER_JOIN_REPLY are excluded here. These packets should 65 never change their number. The packet number can be freely chosen 66 as long as it is below 65536 and unique. For backward compatibility 67 reasons, packets used for the initial protocol (notably before 68 checking the capabilities) must be in range 0-255. 69 70 Packet flags: 71 ------------- 72 73 Packet flags is a comma separated list of: 74 75 is-info: a second packet with the same content can be discarded 76 WARNING: this flag is dangerous and should not be used for 77 a packet that contains information that may be changed in 78 the client outside of the reception of that packet, or for 79 any packet with side effects at the client. 80 81 is-game-info: same as is-info, but the state is reset every time a 82 connection changes of player target. 83 84 force: sending functions will take an extra argument 'force_to_send' 85 to force to send the packet (at least an empty one). In this 86 case, the is-info or is-game-info flags are ignored. It has no 87 effect if the packets doesn't have the is-info or is-game-info 88 flags. 89 90 cancel(PACKET_number): Cancel a packet with the same key (must be the 91 same key type at the start of the packet), useful for is-info packets. 92 93 pre-send: 94 post-recv: 95 post-send: generate calls to pre-send, post-receive and post-send 96 hooks. These hooks are named: pre_send_packet_*, 97 post_receive_packet_* and post_send_packet_*. The user has to 98 provide these. These functions may be used to do extra 99 preparations, conversions or checks. 100 101 no-delta: don't use the delta protocol. This is useful for 102 packets which contain always different data 103 (packet_generic_integer) or are only sent once 104 (packet_req_join_game). Sadly this also disables the use of 0 as 105 the default value. 106 107 no-packet: don't generate a packet argument for the send 108 function. Currently only used by packet_generic_empty. 109 110 no-handle: don't generate handle_* prototypes. The generated 111 switch statements (server/hand_gen.c, client/packhand_gen.c) 112 doesn't include code for this packet. You have to handle this by 113 yourself. This may be required for special packets which are 114 handled early in the sequence. 115 116 handle-via-packet: force the packet type of the handle 117 function. Otherwise the fields are passed to the handle function. 118 This is invoked automatically for packets with more than 5 fields 119 or packets whose names are of the form foo_ruleset. 120 121 handle-per-conn: normally the first parameter of the handle 122 function is the player. handle-per-conn changes this to the 123 connection the packet came from. 124 125 dsend: request the creation of a dsend_packet_* function. This is 126 similar to a send function but instead of taking a packet struct 127 as a parameter, it takes the fields of the packet as parameters. 128 129 lsend: request the creation of a lsend_packet_* function. This 130 function sends to list of connections instead of just one 131 connection, which is the case for the other send functions. 132 133 cs: a packet which is sent from the client to the server 134 135 sc: a packet which is sent from the server to the client 136 137 Each other packet line has the format "<type> <fields>;<flags>". 138 139 Type: 140 ---- 141 142 <type> is an alias or a basic type. A basic type has the format 143 "<dataio-type>(<public-type>)". Exception here is the float 144 type. You can specify with the dataio-type "float<number>" the 145 transmission of a float in a uint32 multiplied by this factor. 146 147 Fields: 148 ------- 149 150 Comma seperated list of names. Each name can have zero, one or 151 two array declarations. So "x", "x[10]" and "x[20][10]" is 152 possible. The array size in the "[]" can be specified plain as a 153 term. In this case all elements will be transmitted. If this is 154 not-desired you can specify the amount of elements to be 155 transfered by given the number. So the extended format is 156 "[<full-array-size>:<elements-to-transfer>]". elements-to-transfer 157 is relative to the packet. 158 159 Field flags: 160 ------------ 161 162 key: create multiple entries in the cache indexed by the key set 163 (set of all fields which have the key attribute). This allow a 164 better delta compression. 165 166 diff: use the array-diff feature. This will reduce the amount of 167 traffic for large arrays in which only a few elements change. 168 169 add-cap: only transfer this field if the given capability is 170 available at runtime. If you have a capability named 171 "new_version" a field line may look like this: 172 TILE tile; add-cap(new_version) 173 when making an optional capability mandatory, go through and remove 174 the add-cap flag for it while leaving the field intact. 175 176 remove-cap: don't transfer this field if the given capability is 177 available at runtime. When making an optional capability manditory, 178 go through and remove entirely any fields marked as remove-cap with 179 that capability. 180*/ 181 182# typedefs for numbers 183type BOOL = bool8(bool) 184type SFLOAT10x3 = sfloat100(float) 185type SFLOAT10x7 = sfloat1000000(float) 186type SINT8 = sint8(int) 187type SINT16 = sint16(int) 188type SINT32 = sint32(int) 189type UFLOAT10x3 = ufloat100(float) 190type UFLOAT = ufloat10000(float) 191type UINT8 = uint8(int) 192type UINT16 = uint16(int) 193type UINT32 = uint32(int) 194 195# typedefs for arrays/structs 196type MEMORY = memory(unsigned char) 197type REQUIREMENT = requirement(struct requirement) 198type ACT_PROB = action_probability(struct act_prob) 199type STRING = string(char) 200# A string vector encoded to a string outside the packet and field system. 201# Marking it this way is useful as documentation. The marking can also be 202# used in non vanilla generate_packets.py packet generators. 203type STRVEC = STRING 204type TECH_LIST = tech_list(int) 205type UNIT_LIST = unit_list(int) 206type BUILDING_LIST = building_list(int) 207type WORKLIST = worklist(struct worklist) 208 209# typedefs for enums 210type ACHIEVEMENT_TYPE = uint8(enum achievement_type) 211type ACTIVITY = uint8(enum unit_activity) 212type AIRLIFTING_STYLE = uint8(enum airlifting_style) 213type PERSISTENT_READY = uint8(enum persistent_ready) 214type VICTORY_CONDITIONS = uint8(enum victory_condition_type) 215type TECH_UPKEEP_STYLE = uint8(enum tech_upkeep_style) 216type AUTH_TYPE = uint8(enum authentication_type) 217type BARBARIAN_TYPE = uint8(enum barbarian_type) 218type BASE_GUI = uint8(enum base_gui_type) 219type BORDERS_MODE = uint8(enum borders_mode) 220type CLAUSE = uint8(enum clause_type) 221type CMDLEVEL = uint8(enum cmdlevel) 222type DIPLOMACY_MODE = uint8(enum diplomacy_mode) 223type DIPLSTATE_TYPE = uint8(enum diplstate_type) 224type DIRECTION = sint8(enum direction8) 225type EFFECT_TYPE = uint8(enum effect_type) 226type EVENT = sint16(enum event_type) 227type GUI_TYPE = uint8(enum gui_type) 228type IMPR_GENUS = uint8(enum impr_genus_id) 229type KNOWN = uint8(enum known_type) 230type MOOD = uint8(enum mood_type) 231type ORDERS = uint8(enum unit_orders) 232type PHASE_MODE = uint8(enum phase_mode_types) 233type PLACE_TYPE = uint8(enum spaceship_place_type) 234type REPORT_TYPE = uint8(enum report_type) 235type SSET_CLASS = uint8(enum sset_class) 236type SSET_TYPE = uint8(enum sset_type) 237type ROAD_COMPAT = uint8(enum road_compat) 238type FTM = uint8(enum free_tech_method) 239type GLS = uint8(enum gameloss_style) 240type UTYF = uint8(enum unit_type_flag_id) 241type CBONUS_TYPE = uint8(enum combat_bonus_type) 242type TRI = uint8(enum traderoute_illegal_cancelling) 243type MOVE_MODE = uint8(enum road_move_mode) 244type GEN_ACTION = uint8(enum gen_action) 245type ACTION_DECISION = uint8(enum action_decision) 246type REVOLENTYPE = uint8(enum revolen_type) 247type HAPPYBORDERSTYPE = uint8(enum happyborders_type) 248type TECH_COST_STYLE = uint8(enum tech_cost_style) 249type TECH_LEAKAGE_STYLE = uint8(enum tech_leakage_style) 250type GOLD_UPKEEP_STYLE = uint8(enum gold_upkeep_style) 251type TR_BONUS_TYPE = uint8(enum traderoute_bonus_type) 252 253# typedefs for bit vectors 254type BV_EXTRA_FLAGS = bitvector(bv_extra_flags) 255type BV_BASE_FLAGS = bitvector(bv_base_flags) 256type BV_EXTRAS = bitvector(bv_extras) 257type BV_BASES = bitvector(bv_bases) 258type BV_ROADS = bitvector(bv_roads) 259type BV_ROAD_FLAGS = bitvector(bv_road_flags) 260type BV_CITY_OPTIONS = bitvector(bv_city_options) 261type BV_IMPR_FLAGS = bitvector(bv_impr_flags) 262type BV_IMPRS = bitvector(bv_imprs) 263type BV_PLAYER = bitvector(bv_player) 264type BV_SPECIAL = bitvector(bv_special) 265type BV_STARTPOS_NATIONS= bitvector(bv_startpos_nations) 266type BV_TECH_FLAGS = bitvector(bv_tech_flags) 267type BV_TERRAIN_FLAGS = bitvector(bv_terrain_flags) 268type BV_UCLASS_FLAGS = bitvector(bv_unit_class_flags) 269type BV_UNIT_CLASSES = bitvector(bv_unit_classes) 270type BV_UTYPE_FLAGS = bitvector(bv_unit_type_flags) 271type BV_UTYPE_ROLES = bitvector(bv_unit_type_roles) 272type BV_DISASTER_EFFECTS = bitvector(bv_disaster_effects) 273type BV_SPACESHIP_STRUCT = bitvector(bv_spaceship_structure) 274 275# typedefs for IDs 276type EXTRA = SINT8 277type BASE = sint8(Base_type_id) 278type ROAD = sint8(Road_type_id) 279type CITY = UINT16 280# city id, with space for special values 281type CITYSPE = SINT32 282type CONNECTION = SINT16 283type CONTINENT = sint16(Continent_id) 284type GOVERNMENT = sint8(Government_type_id) 285type IMPROVEMENT = uint8(Impr_type_id) 286type MULTIPLIER = uint8(Multiplier_type_id) 287type NATION = sint16(Nation_type_id) 288type PLAYER = UINT8 289type RESEARCH = UINT8 290type RESOURCE = uint8(Resource_type_id) 291type SPECIALIST = uint8(Specialist_type_id) 292type TEAM = UINT8 293type TECH = UINT8 294type TERRAIN = uint8(Terrain_type_id) 295type TILE = SINT32 296type UNIT = UINT16 297type UNIT_TYPE = uint8(Unit_type_id) 298 299# other typedefs 300type CITY_COORD = UINT8 301type GOLD = UINT32 302type HP = UINT8 303type PERCENT = UINT8 304type MOVEFRAGS = UINT16 # units of TERRAIN_CONTROL.move_fragments 305type PHASE = SINT16 306type TURN = SINT16 307type XYSIZE = UINT16 308type YEAR16 = SINT16 309type YEAR32 = SINT32 310type CITIZENS = UINT8 311 312/**************************************************** 313The remaining lines are the definition of the packets. These are 314grouped together. There are the following groups: 315 General 316 Login/pregame/endgame 317 Info 318 Chat/event 319 City 320 Player 321 Unit 322 Diplomacy 323 Report 324 Connection 325 New turn 326 Spaceship 327 Ruleset 328 Scenario 329 Voting 330 Editor 331****************************************************/ 332 333 334/************** General packets **********************/ 335 336# For compatibility with older versions, this number cannot be changed. 337# Used in initial protocol. 338PACKET_PROCESSING_STARTED = 0; sc 339end 340 341# For compatibility with older versions, this number cannot be changed. 342# Used in initial protocol. 343PACKET_PROCESSING_FINISHED = 1; sc 344end 345 346/************** Login/pregame/endgame packets **********************/ 347 348# This packet is the first real (freeciv specific) packet send by the 349# client. The player hasn't been accepted yet. 350# For compatibility with older versions, this number cannot be changed. 351# Used in initial protocol. 352# 48 used instead of MAX_LEN_NAME to keep compatibility with old versions 353# even if MAX_LEN_NAME changes. Similarly 512 instead of MAX_LEN_CAPSTR. 354PACKET_SERVER_JOIN_REQ = 4; cs, dsend, no-delta, no-handle 355 STRING username[48]; 356 STRING capability[512]; 357 STRING version_label[48]; 358 UINT32 major_version, minor_version, patch_version; 359end 360 361# ... and the server replies. 362# For compatibility with older versions, this number cannot be changed. 363# Used in initial protocol. 364PACKET_SERVER_JOIN_REPLY = 5; sc, no-delta, post-send, post-recv 365 BOOL you_can_join; 366 STRING message[1536]; /* MAX_LEN_MSG */ 367 STRING capability[512]; /* MAX_LEN_CAPSTR */ 368 STRING challenge_file[4095]; /* MAX_LEN_PATH */ 369 # clients conn id as known in server 370 CONNECTION conn_id; 371end 372 373# Used in initial protocol. 374PACKET_AUTHENTICATION_REQ = 6; sc, handle-per-conn, dsend 375 AUTH_TYPE type; 376 STRING message[MAX_LEN_MSG]; /* explain to the client if there's a problem */ 377end 378 379# Used in initial protocol. 380PACKET_AUTHENTICATION_REPLY = 7; cs, no-handle 381 STRING password[MAX_LEN_PASSWORD]; 382end 383 384 385PACKET_SERVER_SHUTDOWN = 8; sc, lsend 386end 387 388PACKET_NATION_SELECT_REQ = 10; cs, handle-per-conn, dsend 389 PLAYER player_no; 390 NATION nation_no; 391 BOOL is_male; 392 STRING name[MAX_LEN_NAME]; 393 UINT8 style; 394end 395 396PACKET_PLAYER_READY = 11; cs, dsend 397 PLAYER player_no; 398 BOOL is_ready; 399end 400 401PACKET_ENDGAME_REPORT = 12; sc, lsend, no-delta, handle-via-packet 402 UINT8 category_num; 403 STRING category_name[32:category_num][MAX_LEN_NAME]; 404 405 UINT8 player_num; 406end 407 408PACKET_ENDGAME_PLAYER = 223; sc, lsend, no-delta, handle-via-packet 409 UINT8 category_num; 410 PLAYER player_id; 411 UINT16 score; 412 UINT32 category_score[32:category_num]; 413 BOOL winner; 414end 415 416/************** Info packets **********************/ 417 418# Use of is-game-info on this packet is dangerous but speeds things up 419# greatly. Packet spam from excess sending of tiles has slowed the client 420# greatly in the past. However see the comment on is-game-info at the top 421# about the dangers. 422PACKET_TILE_INFO = 15; sc, lsend, is-game-info 423 TILE tile; key 424 425 CONTINENT continent; 426 KNOWN known; 427 PLAYER owner; 428 PLAYER extras_owner; 429 CITY worked; 430 431 TERRAIN terrain; 432 RESOURCE resource; 433 BV_EXTRAS extras; 434 STRING spec_sprite[MAX_LEN_NAME]; 435 STRING label[MAX_LEN_NAME]; 436end 437 438# The variables in the packet are listed in alphabetical order. 439PACKET_GAME_INFO = 16; sc, is-info 440 UINT8 add_to_size_limit; 441 UINT8 aifill; 442 PERSISTENT_READY persistent_ready; 443 AIRLIFTING_STYLE airlifting_style; 444 UINT8 angrycitizen; 445 SINT16 base_pollution; 446 UINT8 base_tech_cost; 447 UINT16 border_city_radius_sq; 448 UINT8 border_size_effect; 449 SINT16 border_city_permanent_radius_sq; 450 BORDERS_MODE borders; 451 UINT32 base_bribe_cost; 452 UINT32 culture_vic_points; 453 UINT16 culture_vic_lead; 454 UINT16 culture_migration_pml; 455 BOOL calendar_skip_0; 456 /* size limit for cities before they can celebrate */ 457 UINT8 celebratesize; 458 BOOL changable_tax; 459 UINT8 pop_report_zeroes; 460 BOOL citizen_nationality; 461 UINT16 citizen_convert_speed; 462 UINT8 citizen_partisans_pct; 463 UINT8 citymindist; 464 UINT32 cooling; 465 UINT32 coolinglevel; 466 DIPLOMACY_MODE diplomacy; 467 BOOL fogofwar; 468 UINT8 food_cost; 469 UINT32 foodbox; 470 UINT8 forced_gold; 471 UINT8 forced_luxury; 472 UINT8 forced_science; 473 UINT8 fulltradesize; 474 /* True if at least one civilization has researched a tech */ 475 BOOL global_advances[A_LAST]; diff 476 BOOL global_warming; 477 UINT32 globalwarming; 478 GOLD gold; 479 GOLD_UPKEEP_STYLE gold_upkeep_style; 480 REVOLENTYPE revolentype; 481 GOVERNMENT default_government_id; 482 GOVERNMENT government_during_revolution_id; 483 UINT8 granary_food_inc; 484 UINT8 granary_food_ini[MAX_GRANARY_INIS]; 485 UINT8 granary_num_inis; 486 PLAYER great_wonder_owners[B_LAST]; diff 487 UINT8 happy_cost; 488 HAPPYBORDERSTYPE happyborders; 489 UINT32 heating; 490 UINT16 illness_base_factor; 491 UINT8 illness_min_size; 492 BOOL illness_on; 493 UINT16 illness_pollution_factor; 494 UINT16 illness_trade_infection; 495 UINT8 init_city_radius_sq; 496 /* If set, editing is allowed */ 497 BOOL is_edit_mode; 498 /* TRUE only in pregame for "new" (not loaded) games */ 499 BOOL is_new_game; 500 BOOL killcitizen; 501 BOOL killstack; 502 UINT8 min_city_center_output[O_LAST]; 503 STRING negative_year_label[MAX_LEN_NAME]; 504 UINT8 notradesize; 505 BOOL nuclear_winter; 506 UINT32 nuclearwinter; 507 PHASE phase; 508 PHASE_MODE phase_mode; 509 BOOL pillage_select; 510 BOOL tech_steal_allow_holes; 511 BOOL tech_trade_allow_holes; 512 BOOL tech_trade_loss_allow_holes; 513 BOOL tech_parasite_allow_holes; 514 BOOL tech_loss_allow_holes; 515 STRING positive_year_label[MAX_LEN_NAME]; 516 UINT8 rapturedelay; 517 UINT16 disasters; 518 BOOL restrictinfra; 519 BOOL unreachable_protects; 520 UINT32 sciencebox; 521 UINT32 shieldbox; 522 UINT32 skill_level; 523 BOOL slow_invasions; 524 VICTORY_CONDITIONS victory_conditions; 525 BOOL team_pooled_research; 526 UINT32 tech; 527 TECH_COST_STYLE tech_cost_style; 528 TECH_LEAKAGE_STYLE tech_leakage; 529 UINT16 tech_upkeep_divider; 530 TECH_UPKEEP_STYLE tech_upkeep_style; 531 SINT16 techloss_forgiveness; add-cap(techloss_forgiveness) 532 FTM free_tech_method; 533 GLS gameloss_style; 534 UINT32 timeout; 535 UINT32 first_timeout; 536 BOOL tired_attack; 537 UINT16 trademindist; 538 BOOL force_trade_route; 539 BOOL trading_city; 540 BOOL trading_gold; 541 BOOL trading_tech; 542 TURN turn; 543 UINT32 warminglevel; 544 YEAR16 year16; 545 YEAR32 year32; add-cap(year32) 546 BOOL year_0_hack; 547 UINT16 calendar_fragments; 548 UINT16 fragment_count; 549 STRING calendar_fragment_name[MAX_CALENDAR_FRAGMENTS][MAX_LEN_NAME]; 550 BOOL civil_war_enabled; 551 BOOL paradrop_to_transport; 552end 553 554# This cannot have is-info set. Sending the same value a second time after a 555# while has passed means a completely reset timeout. 556PACKET_TIMEOUT_INFO = 244; sc 557 SFLOAT10x3 seconds_to_phasedone; 558 SFLOAT10x3 last_turn_change_time; 559end 560 561PACKET_MAP_INFO = 17; sc, lsend 562 XYSIZE xsize; 563 XYSIZE ysize; 564 UINT8 topology_id; 565end 566 567PACKET_NUKE_TILE_INFO = 18; sc, dsend,lsend 568 TILE tile; 569end 570 571PACKET_TEAM_NAME_INFO = 19; sc, lsend 572 TEAM team_id; key 573 STRING team_name[MAX_LEN_NAME]; 574end 575 576PACKET_ACHIEVEMENT_INFO = 238; sc, lsend 577 UINT8 id; 578 BOOL gained; 579 BOOL first; 580end 581 582/************** Chat/event packets **********************/ 583 584/* This MUST have identical structure to PACKET_EARLY_CHAT_MSG as there's casting 585 * the two. */ 586PACKET_CHAT_MSG = 25; sc, lsend 587 STRING message[MAX_LEN_MSG]; 588 TILE tile; 589 EVENT event; 590 TURN turn; 591 PHASE phase; 592 CONNECTION conn_id; 593end 594 595/* This MUST have identical structure to PACKET_CHAT_MSG as there's casting 596 * the two. */ 597PACKET_EARLY_CHAT_MSG = 28; sc, lsend 598 STRING message[MAX_LEN_MSG]; 599 TILE tile; 600 EVENT event; 601 TURN turn; 602 PHASE phase; 603 CONNECTION conn_id; 604end 605 606PACKET_CHAT_MSG_REQ = 26; cs, handle-per-conn, dsend 607 STRING message[MAX_LEN_MSG]; 608end 609 610# Used in initial protocol. 611PACKET_CONNECT_MSG = 27; sc, dsend 612 STRING message[MAX_LEN_MSG]; 613end 614 615/************** City packets **********************/ 616 617PACKET_CITY_REMOVE = 30; sc, dsend, lsend, cancel(PACKET_CITY_INFO), cancel(PACKET_CITY_SHORT_INFO) 618 CITY city_id; 619end 620 621PACKET_CITY_INFO = 31; sc, lsend, is-game-info, force, cancel(PACKET_CITY_SHORT_INFO) 622 CITY id; key 623 TILE tile; 624 625 PLAYER owner; 626 CITIZENS size; 627 UINT8 city_radius_sq; 628 UINT8 style; 629 630 CITIZENS ppl_happy[FEELING_LAST]; 631 CITIZENS ppl_content[FEELING_LAST]; 632 CITIZENS ppl_unhappy[FEELING_LAST]; 633 CITIZENS ppl_angry[FEELING_LAST]; 634 635 UINT8 specialists_size; 636 CITIZENS specialists[SP_MAX:specialists_size]; 637 638 UINT8 nationalities_count; 639 PLAYER nation_id[MAX_NUM_PLAYER_SLOTS:nationalities_count]; 640 CITIZENS nation_citizens[MAX_NUM_PLAYER_SLOTS:nationalities_count]; 641 642 UINT16 history; 643 UINT16 culture; 644 645 SINT16 surplus[O_LAST]; 646 UINT16 waste[O_LAST]; 647 SINT16 unhappy_penalty[O_LAST]; 648 UINT16 prod[O_LAST]; 649 SINT16 citizen_base[O_LAST]; 650 SINT16 usage[O_LAST]; 651 652 # Food stock can be temporarily negative while server is disbanding 653 # units which drain it by their upkeep. 654 SINT16 food_stock; 655 UINT16 shield_stock; 656 657 UINT16 trade[MAX_TRADE_ROUTES]; 658 UINT8 trade_value[MAX_TRADE_ROUTES]; 659 660 UINT16 pollution; 661 UINT16 illness_trade; 662 663 UINT8 production_kind; 664 UINT8 production_value; 665 666 TURN turn_founded; 667 TURN turn_last_built; 668 UINT8 changed_from_kind; 669 UINT8 changed_from_value; 670 UINT16 before_change_shields; 671 UINT16 disbanded_shields; 672 UINT16 caravan_shields; 673 UINT16 last_turns_shield_surplus; 674 675 UINT8 airlift; 676 BOOL did_buy, did_sell, was_happy; 677 678 BOOL diplomat_investigate; 679 UINT8 walls; 680 SINT8 city_image; 681 682 WORKLIST worklist; 683 684 BV_IMPRS improvements; 685 BV_CITY_OPTIONS city_options; 686 STRING name[MAX_LEN_NAME]; 687end 688 689PACKET_CITY_SHORT_INFO = 32; sc, lsend, is-game-info, cancel(PACKET_CITY_INFO) 690 CITY id; key 691 TILE tile; 692 693 PLAYER owner; 694 UINT8 size; 695 UINT8 style; 696 697 BOOL occupied; 698 UINT8 walls; 699 700 BOOL happy; 701 BOOL unhappy; 702 703 SINT8 city_image; 704 705 BV_IMPRS improvements; 706 STRING name[MAX_LEN_NAME]; 707end 708 709PACKET_CITY_SELL = 33; cs, dsend 710 CITY city_id; 711 UINT8 build_id; 712end 713 714PACKET_CITY_BUY = 34; cs, dsend 715 CITY city_id; 716end 717 718PACKET_CITY_CHANGE = 35; cs, dsend 719 CITY city_id; 720 UINT8 production_kind; 721 UINT8 production_value; 722end 723 724PACKET_CITY_WORKLIST = 36; cs, dsend 725 CITY city_id; 726 WORKLIST worklist; 727end 728 729PACKET_CITY_MAKE_SPECIALIST = 37; cs, dsend 730 CITY city_id; 731 CITY_COORD worker_x, worker_y; 732end 733 734PACKET_CITY_MAKE_WORKER = 38; cs, dsend 735 CITY city_id; 736 CITY_COORD worker_x, worker_y; 737end 738 739PACKET_CITY_CHANGE_SPECIALIST = 39; cs, dsend 740 CITY city_id; 741 SPECIALIST from, to; 742end 743 744PACKET_CITY_RENAME = 40; cs, dsend 745 CITY city_id; 746 STRING name[MAX_LEN_NAME]; 747end 748 749PACKET_CITY_OPTIONS_REQ = 41; cs, dsend 750 CITY city_id; 751 BV_CITY_OPTIONS options; 752end 753 754PACKET_CITY_REFRESH = 42; cs, dsend 755 CITY city_id; 756end 757 758# For city name suggestions, client sends unit id of unit building the 759# city. The server does not use the id, but sends it back to the 760# client so that the client knows what to do with the suggestion when 761# it arrives back. (Currently, for city renaming, default is existing 762# name; if wanted to suggest a new name, could do the same thing 763# sending the city id as id, and only client needs to change.) 764PACKET_CITY_NAME_SUGGESTION_REQ = 43; cs, dsend 765 UNIT unit_id; 766end 767 768PACKET_CITY_NAME_SUGGESTION_INFO = 44; sc, dsend, lsend 769 UNIT unit_id; 770 STRING name[MAX_LEN_NAME]; 771end 772 773PACKET_CITY_SABOTAGE_LIST = 45; sc, lsend 774 UNIT diplomat_id; 775 CITY city_id; 776 BV_IMPRS improvements; 777end 778 779PACKET_WORKER_TASK = 241; cs, sc, lsend, handle-via-packet 780 CITY city_id; 781 TILE tile_id; 782 ACTIVITY activity; 783 EXTRA tgt; 784 UINT16 want; 785end 786 787/************** Player packets **********************/ 788 789PACKET_PLAYER_REMOVE = 50; sc, dsend, cancel(PACKET_PLAYER_INFO) 790 PLAYER playerno; 791end 792 793PACKET_PLAYER_INFO = 51; sc, is-info 794 PLAYER playerno; key 795 STRING name[MAX_LEN_NAME]; 796 STRING username[MAX_LEN_NAME]; 797 BOOL unassigned_user; 798 799 UINT32 score; 800 BOOL is_male; 801 BOOL was_created; 802 GOVERNMENT government; 803 GOVERNMENT target_government; 804 BOOL real_embassy[MAX_NUM_PLAYER_SLOTS]; 805 MOOD mood; 806 UINT8 style; 807 SINT8 music_style; 808 NATION nation; 809 TEAM team; 810 BOOL is_ready; 811 BOOL phase_done; 812 TURN nturns_idle; 813 TURN turns_alive; 814 BOOL is_alive; 815 816 GOLD gold; 817 PERCENT tax, science,luxury; 818 819 UINT16 tech_upkeep; 820 UINT16 science_cost; 821 822 BOOL is_connected; 823 TURN revolution_finishes; 824 BOOL ai; 825 UINT8 ai_skill_level; 826 BARBARIAN_TYPE barbarian_type; 827 BV_PLAYER gives_shared_vision; 828 UINT16 history; 829 SINT16 love[MAX_NUM_PLAYER_SLOTS]; 830 831 BOOL color_valid; 832 BOOL color_changeable; 833 UINT8 color_red; 834 UINT8 color_green; 835 UINT8 color_blue; 836 837 CITYSPE wonders[B_LAST]; diff 838 839 UINT8 multip_count; 840 SINT32 multiplier[MAX_NUM_MULTIPLIERS:multip_count]; 841 SINT32 multiplier_target[MAX_NUM_MULTIPLIERS:multip_count]; 842end 843 844PACKET_PLAYER_PHASE_DONE = 52; cs, dsend 845 TURN turn; 846end 847 848PACKET_PLAYER_RATES = 53; cs, dsend 849 PERCENT tax, luxury, science; 850end 851 852PACKET_PLAYER_CHANGE_GOVERNMENT = 54; cs, dsend 853 GOVERNMENT government; 854end 855 856PACKET_PLAYER_ATTRIBUTE_BLOCK = 57; cs 857end 858 859PACKET_PLAYER_ATTRIBUTE_CHUNK = 58; pre-send, sc, cs, handle-via-packet 860 UINT32 offset; key 861 UINT32 total_length; 862 UINT16 chunk_length; 863 /* to keep memory management simple don't allocate dynamic memory */ 864 MEMORY data[ATTRIBUTE_CHUNK_SIZE:chunk_length]; 865end 866 867PACKET_PLAYER_DIPLSTATE = 59; sc 868 UINT32 diplstate_id; key 869 PLAYER plr1; 870 PLAYER plr2; 871 DIPLSTATE_TYPE type; 872 UINT16 turns_left; 873 UINT8 has_reason_to_cancel; 874 UINT16 contact_turns_left; 875end 876 877PACKET_PLAYER_MULTIPLIER = 242; cs 878 UINT16 count; 879 SINT32 multipliers[MAX_NUM_MULTIPLIERS:count]; 880end 881 882/************** Research packets **********************/ 883 884PACKET_RESEARCH_INFO = 60; sc, lsend, is-game-info 885 RESEARCH id; key 886 UINT32 techs_researched; 887 UINT16 future_tech; 888 TECH researching; 889 UINT32 researching_cost; 890 UINT32 bulbs_researched; 891 TECH tech_goal; 892 SINT32 total_bulbs_prod; 893 STRING inventions[A_LAST + 1]; 894end 895 896PACKET_PLAYER_RESEARCH = 55; cs, dsend 897 TECH tech; 898end 899 900PACKET_PLAYER_TECH_GOAL = 56; cs, dsend 901 TECH tech; 902end 903 904/************** Unit packets **********************/ 905 906PACKET_UNIT_REMOVE = 62; sc, dsend, lsend, cancel(PACKET_UNIT_INFO), cancel(PACKET_UNIT_SHORT_INFO) 907 UNIT unit_id; 908end 909 910PACKET_UNIT_INFO = 63; sc, lsend, is-game-info, cancel(PACKET_UNIT_SHORT_INFO) 911 UNIT id; key 912 PLAYER owner; 913 PLAYER nationality; 914 TILE tile; 915 DIRECTION facing; 916 CITY homecity; 917 918 UINT8 upkeep[O_LAST]; 919 920 UINT8 veteran; 921 BOOL ai, paradropped; 922 BOOL occupied, transported, done_moving; 923 924 UNIT_TYPE type; 925 UNIT transported_by; /* Only valid if transported is set. */ 926 MOVEFRAGS movesleft; 927 UINT8 hp, fuel; 928 /* UINT16 size for activity_count assumed in checks in ruleset.c */ 929 UINT16 activity_count, changed_from_count; 930 TILE goto_tile; 931 ACTIVITY activity; 932 EXTRA activity_tgt; 933 ACTIVITY changed_from; 934 EXTRA changed_from_tgt; 935 936 SINT8 battlegroup; 937 938 BOOL has_orders; 939 UINT16 orders_length, orders_index; 940 BOOL orders_repeat, orders_vigilant; 941 ORDERS orders[MAX_LEN_ROUTE:orders_length]; 942 DIRECTION orders_dirs[MAX_LEN_ROUTE:orders_length]; 943 ACTIVITY orders_activities[MAX_LEN_ROUTE:orders_length]; 944 EXTRA orders_targets[MAX_LEN_ROUTE:orders_length]; 945 946 ACTION_DECISION action_decision_want; 947 TILE action_decision_tile; 948end 949 950PACKET_UNIT_SHORT_INFO = 64; sc, lsend, is-game-info, force, cancel(PACKET_UNIT_INFO) 951 UNIT id; key 952 PLAYER owner; 953 TILE tile; 954 DIRECTION facing; 955 UNIT_TYPE type; 956 957 UINT8 veteran; 958 BOOL occupied, transported; 959 960 UINT8 hp, activity; 961 EXTRA activity_tgt; 962 UNIT transported_by; /* Only valid if transported is set. */ 963 964 /* in packet only, not in unit struct */ 965 UINT8 packet_use; /* see enum unit_info_use */ 966 CITY info_city_id; /* for UNIT_INFO_CITY_SUPPORTED 967 and UNIT_INFO_CITY_PRESENT uses */ 968end 969 970PACKET_UNIT_COMBAT_INFO = 65; sc, lsend 971 UNIT attacker_unit_id; 972 UNIT defender_unit_id; 973 HP attacker_hp; 974 HP defender_hp; 975 BOOL make_winner_veteran; 976end 977 978PACKET_UNIT_BUILD_CITY = 67; cs, dsend 979 UNIT unit_id; 980 STRING name[MAX_LEN_NAME]; 981end 982 983PACKET_UNIT_DISBAND = 68; cs, dsend 984 UNIT unit_id; 985end 986 987PACKET_UNIT_CHANGE_HOMECITY = 69; cs, dsend 988 UNIT unit_id; 989 CITY city_id; 990end 991 992PACKET_UNIT_BATTLEGROUP = 71; cs, dsend 993 UNIT unit_id; 994 SINT8 battlegroup; 995end 996 997# used for client orders: currently client-side goto and patrol 998PACKET_UNIT_ORDERS = 73; cs 999 UNIT unit_id; 1000 TILE src_tile; # Origin tile, included for sanity checking 1001 1002 UINT16 length; 1003 BOOL repeat, vigilant; 1004 ORDERS orders[MAX_LEN_ROUTE:length]; 1005 DIRECTION dir[MAX_LEN_ROUTE:length]; 1006 ACTIVITY activity[MAX_LEN_ROUTE:length]; 1007 EXTRA target[MAX_LEN_ROUTE:length]; 1008 TILE dest_tile; 1009end 1010 1011# Enable autosettlers for a unit. Only works for settler units naturally. 1012PACKET_UNIT_AUTOSETTLERS = 74; cs, dsend 1013 UNIT unit_id; 1014end 1015 1016# Load the given cargo into the transporter. 1017PACKET_UNIT_LOAD = 75; cs, dsend 1018 UNIT cargo_id; 1019 UNIT transporter_id; 1020 TILE transporter_tile; 1021end 1022 1023# Unload the given cargo from the transporter. 1024PACKET_UNIT_UNLOAD = 76; cs, dsend 1025 UNIT cargo_id, transporter_id; 1026end 1027 1028PACKET_UNIT_UPGRADE = 77; cs, dsend 1029 UNIT unit_id; 1030end 1031 1032PACKET_UNIT_NUKE = 79; cs, dsend 1033 UNIT unit_id; 1034end 1035 1036PACKET_UNIT_PARADROP_TO = 80; cs, dsend 1037 UNIT unit_id; 1038 TILE tile; 1039end 1040 1041PACKET_UNIT_AIRLIFT = 81; cs, dsend 1042 UNIT unit_id; 1043 CITY city_id; 1044end 1045 1046PACKET_UNIT_ACTION_QUERY = 82; cs, handle-per-conn, dsend 1047 UNIT diplomat_id; 1048 UNIT target_id; # city_id or unit_id 1049 GEN_ACTION action_type; 1050end 1051 1052PACKET_UNIT_TYPE_UPGRADE = 83; cs, dsend 1053 UNIT_TYPE type; 1054end 1055 1056PACKET_UNIT_DO_ACTION = 84; cs, dsend 1057 UNIT actor_id; 1058 SINT32 target_id; # city_id, unit_id or tile_id 1059 SINT16 value; 1060 GEN_ACTION action_type; 1061end 1062 1063PACKET_UNIT_ACTION_ANSWER = 85; sc, dsend 1064 UNIT diplomat_id; 1065 UNIT target_id; # city_id or unit_id 1066 GOLD cost; 1067 GEN_ACTION action_type; 1068end 1069 1070PACKET_UNIT_GET_ACTIONS = 87; cs, handle-per-conn, dsend 1071 UNIT actor_unit_id; 1072 UNIT target_unit_id; 1073 CITY target_city_id; 1074 TILE target_tile_id; 1075 1076 BOOL disturb_player; 1077end 1078 1079PACKET_UNIT_ACTIONS = 90; sc, dsend 1080 UNIT actor_unit_id; 1081 UNIT target_unit_id; 1082 CITY target_city_id; 1083 TILE target_tile_id; 1084 1085 BOOL disturb_player; 1086 1087 /* How to interpret action probabilities is documented in fc_types.h */ 1088 ACT_PROB action_probabilities[ACTION_COUNT]; 1089end 1090 1091PACKET_UNIT_CHANGE_ACTIVITY = 222; cs, dsend 1092 UNIT unit_id; 1093 ACTIVITY activity; 1094 EXTRA target; 1095end 1096 1097/* 88 & 89 are ping packets (not modifiable). */ 1098 1099/************** Diplomacy packets **********************/ 1100 1101PACKET_DIPLOMACY_INIT_MEETING_REQ = 95; cs, dsend 1102 PLAYER counterpart; 1103end 1104 1105PACKET_DIPLOMACY_INIT_MEETING = 96; sc, dsend, lsend 1106 PLAYER counterpart, initiated_from; 1107end 1108 1109PACKET_DIPLOMACY_CANCEL_MEETING_REQ = 97; cs, dsend 1110 PLAYER counterpart; 1111end 1112 1113PACKET_DIPLOMACY_CANCEL_MEETING = 98; sc, dsend, lsend 1114 PLAYER counterpart, initiated_from; 1115end 1116 1117PACKET_DIPLOMACY_CREATE_CLAUSE_REQ = 99; cs, dsend 1118 PLAYER counterpart, giver; 1119 CLAUSE type; 1120 UINT32 value; 1121end 1122 1123PACKET_DIPLOMACY_CREATE_CLAUSE = 100; sc, dsend, lsend 1124 PLAYER counterpart, giver; 1125 CLAUSE type; 1126 UINT32 value; 1127end 1128 1129PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ = 101; cs, dsend 1130 PLAYER counterpart, giver; 1131 CLAUSE type; 1132 UINT32 value; 1133end 1134 1135PACKET_DIPLOMACY_REMOVE_CLAUSE = 102; sc, dsend, lsend 1136 PLAYER counterpart, giver; 1137 CLAUSE type; 1138 UINT32 value; 1139end 1140 1141PACKET_DIPLOMACY_ACCEPT_TREATY_REQ = 103; cs, dsend 1142 PLAYER counterpart; 1143end 1144 1145PACKET_DIPLOMACY_ACCEPT_TREATY = 104;sc, dsend, lsend 1146 PLAYER counterpart; 1147 BOOL I_accepted, other_accepted; 1148end 1149 1150PACKET_DIPLOMACY_CANCEL_PACT = 105; cs, dsend 1151 PLAYER other_player_id; 1152 CLAUSE clause; 1153end 1154 1155/************** Report packets **********************/ 1156 1157PACKET_PAGE_MSG = 110; sc, lsend 1158 STRING caption[MAX_LEN_MSG]; 1159 STRING headline[MAX_LEN_MSG]; 1160 EVENT event; 1161 UINT32 len; 1162 UINT16 parts; 1163end 1164 1165PACKET_PAGE_MSG_PART = 248; sc, lsend 1166 STRING lines[MAX_LEN_CONTENT]; 1167end 1168 1169PACKET_REPORT_REQ = 111; cs, handle-per-conn, dsend 1170 REPORT_TYPE type; 1171end 1172 1173/************** Connection packets **********************/ 1174 1175# For telling clients information about other connections to server. 1176# Clients may not use all info, but supply now to avoid unnecessary 1177# protocol changes later. 1178PACKET_CONN_INFO = 115; sc, lsend, is-info 1179 CONNECTION id; key 1180 1181 # 0 means client should forget its 1182 # info about this connection 1183 BOOL used; 1184 BOOL established; 1185 BOOL observer; 1186 PLAYER player_num; 1187 CMDLEVEL access_level; 1188 STRING username[MAX_LEN_NAME]; 1189 STRING addr[MAX_LEN_ADDR]; 1190 STRING capability[MAX_LEN_CAPSTR]; 1191end 1192 1193# Information about the ping times of the connections. 1194PACKET_CONN_PING_INFO = 116; sc, lsend 1195 UINT8 connections; 1196 CONNECTION conn_id[MAX_NUM_CONNECTIONS:connections]; 1197 SFLOAT10x7 ping_time[MAX_NUM_CONNECTIONS:connections]; 1198end 1199 1200# For compatibility with older versions, this number cannot be changed. 1201# Freeciv servers version < 2.5.0 still can send this packet in 1202# initial protocol. 1203PACKET_CONN_PING = 88; sc 1204end 1205 1206# For compatibility with older versions, this number cannot be changed. 1207# Can be used in initial protocol, if the client received a PACKET_CONN_PING. 1208PACKET_CONN_PONG = 89; cs, handle-per-conn 1209end 1210 1211PACKET_CLIENT_HEARTBEAT = 251; cs, handle-per-conn 1212end 1213 1214PACKET_CLIENT_INFO = 119; cs, handle-per-conn 1215 GUI_TYPE gui; 1216 STRING distribution[MAX_LEN_NAME]; 1217end 1218 1219/************** New turn packets **********************/ 1220 1221PACKET_END_PHASE = 125; sc, lsend 1222end 1223 1224# sent to everyone, not just the player whose phase it is 1225PACKET_START_PHASE = 126; sc, lsend, dsend 1226 PHASE phase; 1227end 1228 1229# send to each client whenever the turn has ended. 1230PACKET_NEW_YEAR = 127; sc, lsend 1231 YEAR16 year16; remove-cap(year32) 1232 YEAR32 year32; add-cap(year32) 1233 UINT16 fragments; 1234 TURN turn; 1235end 1236 1237# Server has finished processing turn change 1238PACKET_BEGIN_TURN = 128; sc, lsend 1239end 1240 1241# Server starts processing turn change 1242PACKET_END_TURN = 129; sc, lsend 1243end 1244 1245# Freeze reports and agents 1246PACKET_FREEZE_CLIENT = 130; sc, lsend 1247end 1248 1249# Thaw reports and agents 1250PACKET_THAW_CLIENT = 131; sc, lsend 1251end 1252 1253/************** Spaceship packets **********************/ 1254 1255PACKET_SPACESHIP_LAUNCH = 135; cs 1256end 1257 1258PACKET_SPACESHIP_PLACE = 136; cs, dsend 1259 PLACE_TYPE type; 1260 1261 # Meaning of num: 1262 # - if type==SSHIP_ACT_PLACE_STRUCTURAL: 1263 # index to sship->structure[] 1264 # - if type!=SSHIP_ACT_PLACE_STRUCTURAL: 1265 # new value for sship->fuel etc; should be just one more than 1266 # current value of ship->fuel etc Used to avoid possible 1267 # problems if we send duplicate packets when client 1268 # auto-builds? 1269 UINT8 num; 1270end 1271 1272PACKET_SPACESHIP_INFO = 137; sc, lsend, is-game-info 1273 PLAYER player_num; key 1274 UINT8 sship_state; 1275 UINT8 structurals; 1276 UINT8 components; 1277 UINT8 modules; 1278 UINT8 fuel; 1279 UINT8 propulsion; 1280 UINT8 habitation; 1281 UINT8 life_support; 1282 UINT8 solar_panels; 1283 YEAR16 launch_year16; remove-cap(year32) 1284 YEAR32 launch_year32; add-cap(year32) 1285 UINT32 population; 1286 UINT32 mass; 1287 BV_SPACESHIP_STRUCT structure; 1288 UFLOAT support_rate; 1289 UFLOAT energy_rate; 1290 UFLOAT success_rate; 1291 UFLOAT travel_time; 1292end 1293 1294/************** Ruleset packets **********************/ 1295 1296PACKET_RULESET_UNIT = 140; sc, lsend 1297 UNIT_TYPE id; 1298 STRING name[MAX_LEN_NAME]; 1299 STRING rule_name[MAX_LEN_NAME]; 1300 STRING graphic_str[MAX_LEN_NAME]; 1301 STRING graphic_alt[MAX_LEN_NAME]; 1302 STRING sound_move[MAX_LEN_NAME]; 1303 STRING sound_move_alt[MAX_LEN_NAME]; 1304 STRING sound_fight[MAX_LEN_NAME]; 1305 STRING sound_fight_alt[MAX_LEN_NAME]; 1306 UINT8 unit_class_id; 1307 UINT16 build_cost; 1308 UINT8 pop_cost; 1309 UINT8 attack_strength; 1310 UINT8 defense_strength; 1311 MOVEFRAGS move_rate; 1312 TECH tech_requirement; 1313 UINT8 impr_requirement; 1314 GOVERNMENT gov_requirement; 1315 UINT16 vision_radius_sq; 1316 UINT8 transport_capacity; 1317 UINT8 hp; 1318 UINT8 firepower; 1319 UINT8 obsoleted_by; 1320 UINT8 converted_to; 1321 UINT8 convert_time; 1322 UINT8 fuel; 1323 1324 UINT8 happy_cost; # unhappy people in home city 1325 UINT8 upkeep[O_LAST]; # normal upkeep cost (food, gold, shields) 1326 1327 UINT16 paratroopers_range; # max range of paratroopers, UTYF_PARATROOPERS 1328 UINT8 paratroopers_mr_req; # whole move points, not MOVEFRAGS 1329 UINT8 paratroopers_mr_sub; # whole move points, not MOVEFRAGS 1330 1331 UINT8 veteran_levels; 1332 STRING veteran_name[MAX_VET_LEVELS:veteran_levels][MAX_LEN_NAME]; 1333 UINT16 power_fact[MAX_VET_LEVELS:veteran_levels]; 1334 MOVEFRAGS move_bonus[MAX_VET_LEVELS:veteran_levels]; 1335 1336 UINT8 bombard_rate; 1337 UINT8 city_size; 1338 1339 BV_UNIT_CLASSES cargo; 1340 BV_UNIT_CLASSES targets; 1341 BV_UNIT_CLASSES embarks; 1342 BV_UNIT_CLASSES disembarks; 1343 1344 STRVEC helptext[MAX_LEN_PACKET]; 1345 1346 BV_UTYPE_FLAGS flags; 1347 BV_UTYPE_ROLES roles; 1348end 1349 1350PACKET_RULESET_UNIT_BONUS = 228; sc, lsend 1351 UNIT_TYPE unit; 1352 UTYF flag; 1353 CBONUS_TYPE type; 1354 UINT8 value; 1355 BOOL quiet; 1356end 1357 1358PACKET_RULESET_UNIT_FLAG = 229; sc, lsend 1359 UINT8 id; 1360 STRING name[MAX_LEN_NAME]; 1361 STRING helptxt[MAX_LEN_PACKET]; 1362end 1363 1364PACKET_RULESET_GAME = 141; sc, lsend 1365 UINT8 default_specialist; 1366 1367 TECH_LIST global_init_techs[MAX_NUM_TECH_LIST]; 1368 BUILDING_LIST global_init_buildings[MAX_NUM_BUILDING_LIST]; 1369 1370 UINT8 veteran_levels; 1371 STRING veteran_name[MAX_VET_LEVELS:veteran_levels][MAX_LEN_NAME]; 1372 UINT16 power_fact[MAX_VET_LEVELS:veteran_levels]; 1373 MOVEFRAGS move_bonus[MAX_VET_LEVELS:veteran_levels]; 1374 1375 UINT8 background_red; 1376 UINT8 background_green; 1377 UINT8 background_blue; 1378end 1379 1380PACKET_RULESET_SPECIALIST = 142; sc, lsend 1381 SPECIALIST id; 1382 1383 STRING plural_name[MAX_LEN_NAME]; 1384 STRING rule_name[MAX_LEN_NAME]; 1385 STRING short_name[MAX_LEN_NAME]; 1386 1387 STRING graphic_alt[MAX_LEN_NAME]; 1388 1389 UINT8 reqs_count; 1390 REQUIREMENT reqs[MAX_NUM_REQS:reqs_count]; 1391 1392 STRVEC helptext[MAX_LEN_PACKET]; 1393end 1394 1395PACKET_RULESET_GOVERNMENT_RULER_TITLE = 143; sc, lsend 1396 GOVERNMENT gov; 1397 NATION nation; 1398 STRING male_title[MAX_LEN_NAME]; 1399 STRING female_title[MAX_LEN_NAME]; 1400end 1401 1402PACKET_RULESET_TECH = 144; sc, lsend 1403 TECH id; 1404 TECH req[2]; 1405 TECH root_req; 1406 BV_TECH_FLAGS flags; 1407 UFLOAT10x3 cost; 1408 UINT32 num_reqs; 1409 STRING name[MAX_LEN_NAME]; 1410 STRING rule_name[MAX_LEN_NAME]; 1411 STRVEC helptext[MAX_LEN_PACKET]; 1412 STRING graphic_str[MAX_LEN_NAME]; 1413 STRING graphic_alt[MAX_LEN_NAME]; 1414end 1415 1416PACKET_RULESET_TECH_FLAG = 234; sc, lsend 1417 UINT8 id; 1418 STRING name[MAX_LEN_NAME]; 1419 STRING helptxt[MAX_LEN_PACKET]; 1420end 1421 1422PACKET_RULESET_GOVERNMENT = 145; sc, lsend 1423 GOVERNMENT id; 1424 1425 UINT8 reqs_count; 1426 REQUIREMENT reqs[MAX_NUM_REQS:reqs_count]; 1427 1428 STRING name[MAX_LEN_NAME]; 1429 STRING rule_name[MAX_LEN_NAME]; 1430 STRING graphic_str[MAX_LEN_NAME]; 1431 STRING graphic_alt[MAX_LEN_NAME]; 1432 STRVEC helptext[MAX_LEN_PACKET]; 1433end 1434 1435PACKET_RULESET_TERRAIN_CONTROL = 146; sc, lsend 1436 UINT8 ocean_reclaim_requirement_pct; /* # adjacent land tiles for reclaim */ 1437 UINT8 land_channel_requirement_pct; /* # adjacent ocean tiles for channel */ 1438 UINT8 terrain_thaw_requirement_pct; /* # adjacent unfrozen tiles for thaw */ 1439 UINT8 terrain_freeze_requirement_pct; /* # adjacent frozen tiles */ 1440 UINT8 lake_max_size; /* bodies of water up to this size are freshwater */ 1441 UINT8 min_start_native_area; 1442 MOVEFRAGS move_fragments; 1443 MOVEFRAGS igter_cost; 1444 BOOL pythagorean_diagonal; 1445 STRING gui_type_base0[MAX_LEN_NAME]; 1446 STRING gui_type_base1[MAX_LEN_NAME]; 1447end 1448 1449PACKET_RULESETS_READY = 225; sc, lsend 1450end 1451 1452PACKET_RULESET_NATION_SETS = 236; sc, lsend 1453 UINT8 nsets; 1454 STRING names[MAX_NUM_NATION_SETS:nsets][MAX_LEN_NAME]; 1455 STRING rule_names[MAX_NUM_NATION_SETS:nsets][MAX_LEN_NAME]; 1456 /* This relies on MAX_NUM_NATION_SETS not being too big to overflow 1457 * the packet length: */ 1458 STRING descriptions[MAX_NUM_NATION_SETS:nsets][MAX_LEN_MSG]; /*untranslated*/ 1459end 1460 1461PACKET_RULESET_NATION_GROUPS = 147; sc, lsend 1462 UINT8 ngroups; 1463 STRING groups[MAX_NUM_NATION_GROUPS:ngroups][MAX_LEN_NAME]; 1464 BOOL hidden[MAX_NUM_NATION_GROUPS:ngroups]; 1465end 1466 1467PACKET_RULESET_NATION = 148; sc, lsend 1468 NATION id; key 1469 1470 STRING translation_domain[MAX_LEN_NAME]; 1471 /* Strings are untranslated */ 1472 STRING adjective[MAX_LEN_NAME]; 1473 STRING rule_name[MAX_LEN_NAME]; 1474 STRING noun_plural[MAX_LEN_NAME]; 1475 STRING graphic_str[MAX_LEN_NAME]; 1476 STRING graphic_alt[MAX_LEN_NAME]; 1477 STRING legend[MAX_LEN_MSG]; 1478 1479 UINT8 style; 1480 1481 UINT8 leader_count; 1482 STRING leader_name[MAX_NUM_LEADERS:leader_count][MAX_LEN_NAME]; 1483 BOOL leader_is_male[MAX_NUM_LEADERS:leader_count]; 1484 1485 BOOL is_playable; 1486 BARBARIAN_TYPE barbarian_type; 1487 1488 UINT8 nsets; 1489 UINT8 sets[MAX_NUM_NATION_SETS:nsets]; 1490 1491 UINT8 ngroups; 1492 UINT8 groups[MAX_NUM_NATION_GROUPS:ngroups]; 1493 1494 GOVERNMENT init_government_id; 1495 TECH_LIST init_techs[MAX_NUM_TECH_LIST]; 1496 UNIT_LIST init_units[MAX_NUM_UNIT_LIST]; 1497 BUILDING_LIST init_buildings[MAX_NUM_BUILDING_LIST]; 1498end 1499 1500# Separate from PACKET_RULESET_NATION since it can change in pregame 1501# without a ruleset reload 1502PACKET_NATION_AVAILABILITY = 237; sc, lsend 1503 UINT16 ncount; 1504 BOOL is_pickable[MAX_NUM_NATIONS:ncount]; 1505 BOOL nationset_change; 1506end 1507 1508PACKET_RULESET_STYLE = 239; sc, lsend 1509 UINT8 id; 1510 STRING name[MAX_LEN_NAME]; 1511 STRING rule_name[MAX_LEN_NAME]; 1512end 1513 1514PACKET_RULESET_CITY = 149; sc, lsend 1515 UINT8 style_id; 1516 STRING name[MAX_LEN_NAME]; 1517 STRING rule_name[MAX_LEN_NAME]; 1518 STRING citizens_graphic[MAX_LEN_NAME]; 1519 STRING citizens_graphic_alt[MAX_LEN_NAME]; 1520 UINT8 reqs_count; 1521 REQUIREMENT reqs[MAX_NUM_REQS:reqs_count]; 1522 STRING graphic[MAX_LEN_NAME]; 1523 STRING graphic_alt[MAX_LEN_NAME]; 1524end 1525 1526PACKET_RULESET_BUILDING = 150; sc, lsend 1527 IMPROVEMENT id; 1528 IMPR_GENUS genus; 1529 STRING name[MAX_LEN_NAME]; 1530 STRING rule_name[MAX_LEN_NAME]; 1531 STRING graphic_str[MAX_LEN_NAME]; 1532 STRING graphic_alt[MAX_LEN_NAME]; 1533 UINT8 reqs_count; 1534 REQUIREMENT reqs[MAX_NUM_REQS:reqs_count]; 1535 UINT8 obs_count; 1536 REQUIREMENT obs_reqs[MAX_NUM_REQS:obs_count]; 1537 UINT16 build_cost; 1538 UINT8 upkeep, sabotage; 1539 BV_IMPR_FLAGS flags; 1540 STRING soundtag[MAX_LEN_NAME]; 1541 STRING soundtag_alt[MAX_LEN_NAME]; 1542 STRVEC helptext[MAX_LEN_PACKET]; 1543end 1544 1545PACKET_RULESET_TERRAIN = 151; sc, lsend 1546 TERRAIN id; 1547 1548 UINT8 tclass; 1549 BV_TERRAIN_FLAGS flags; 1550 BV_UNIT_CLASSES native_to; 1551 1552 STRING name[MAX_LEN_NAME]; 1553 STRING rule_name[MAX_LEN_NAME]; 1554 STRING graphic_str[MAX_LEN_NAME]; 1555 STRING graphic_alt[MAX_LEN_NAME]; 1556 1557 UINT8 movement_cost; # Whole movement points (not multiplied by SINGLE_MOVE) 1558 SINT16 defense_bonus; 1559 1560 UINT8 output[O_LAST]; 1561 UINT8 num_resources; 1562 RESOURCE resources[MAX_NUM_RESOURCES:num_resources]; 1563 1564 UINT16 road_output_incr_pct[O_LAST]; 1565 UINT8 base_time; 1566 UINT8 road_time; 1567 1568 TERRAIN irrigation_result; 1569 UINT8 irrigation_food_incr; 1570 UINT8 irrigation_time; 1571 1572 TERRAIN mining_result; 1573 UINT8 mining_shield_incr; 1574 UINT8 mining_time; 1575 1576 SINT16 animal; 1577 1578 TERRAIN transform_result; 1579 UINT8 transform_time; 1580 UINT8 clean_pollution_time; 1581 UINT8 clean_fallout_time; 1582 UINT8 pillage_time; 1583 1584 UINT8 color_red; 1585 UINT8 color_green; 1586 UINT8 color_blue; 1587 1588 STRVEC helptext[MAX_LEN_PACKET]; 1589end 1590 1591PACKET_RULESET_TERRAIN_FLAG = 231; sc, lsend 1592 UINT8 id; 1593 STRING name[MAX_LEN_NAME]; 1594 STRING helptxt[MAX_LEN_PACKET]; 1595end 1596 1597PACKET_RULESET_UNIT_CLASS = 152; sc, lsend 1598 UINT8 id; 1599 STRING name[MAX_LEN_NAME]; 1600 STRING rule_name[MAX_LEN_NAME]; 1601 MOVEFRAGS min_speed; 1602 UINT8 hp_loss_pct; 1603 UINT8 hut_behavior; 1604 UINT16 non_native_def_pct; 1605 BV_UCLASS_FLAGS flags; 1606 1607 STRVEC helptext[MAX_LEN_PACKET]; 1608end 1609 1610PACKET_RULESET_EXTRA = 232; sc, lsend 1611 UINT8 id; 1612 STRING name[MAX_LEN_NAME]; 1613 STRING rule_name[MAX_LEN_NAME]; 1614 UINT8 category; 1615 UINT8 causes; 1616 UINT8 rmcauses; 1617 STRING activity_gfx[MAX_LEN_NAME]; 1618 STRING act_gfx_alt[MAX_LEN_NAME]; 1619 STRING act_gfx_alt2[MAX_LEN_NAME]; 1620 STRING rmact_gfx[MAX_LEN_NAME]; 1621 STRING rmact_gfx_alt[MAX_LEN_NAME]; 1622 STRING graphic_str[MAX_LEN_NAME]; 1623 STRING graphic_alt[MAX_LEN_NAME]; 1624 UINT8 reqs_count; 1625 REQUIREMENT reqs[MAX_NUM_REQS:reqs_count]; 1626 UINT8 rmreqs_count; 1627 REQUIREMENT rmreqs[MAX_NUM_REQS:rmreqs_count]; 1628 BOOL buildable; 1629 UINT8 build_time; 1630 UINT8 build_time_factor; 1631 UINT8 removal_time; 1632 UINT8 removal_time_factor; 1633 UINT8 defense_bonus; 1634 BV_UNIT_CLASSES native_to; 1635 BV_EXTRA_FLAGS flags; 1636 BV_EXTRAS hidden_by; 1637 BV_EXTRAS conflicts; 1638 STRVEC helptext[MAX_LEN_PACKET]; 1639end 1640 1641PACKET_RULESET_BASE = 153; sc, lsend 1642 UINT8 id; 1643 BASE_GUI gui_type; 1644 SINT8 border_sq; 1645 SINT8 vision_main_sq; 1646 SINT8 vision_invis_sq; 1647 BV_BASE_FLAGS flags; 1648end 1649 1650PACKET_RULESET_ROAD = 220; sc, lsend 1651 UINT8 id; 1652 UINT8 first_reqs_count; 1653 REQUIREMENT first_reqs[MAX_NUM_REQS:first_reqs_count]; 1654 SINT16 move_cost; # not MOVEFRAGS because -1 is valid 1655 MOVE_MODE move_mode; 1656 UINT16 tile_incr_const[O_LAST]; 1657 UINT16 tile_incr[O_LAST]; 1658 UINT16 tile_bonus[O_LAST]; 1659 ROAD_COMPAT compat; 1660 BV_ROADS integrates; 1661 BV_ROAD_FLAGS flags; 1662end 1663 1664PACKET_RULESET_DISASTER = 224; sc, lsend 1665 UINT8 id; 1666 STRING name[MAX_LEN_NAME]; 1667 STRING rule_name[MAX_LEN_NAME]; 1668 UINT8 reqs_count; 1669 REQUIREMENT reqs[MAX_NUM_REQS:reqs_count]; 1670 UINT8 frequency; 1671 BV_DISASTER_EFFECTS effects; 1672end 1673 1674PACKET_RULESET_ACHIEVEMENT = 233; sc, lsend 1675 UINT8 id; 1676 STRING name[MAX_LEN_NAME]; 1677 STRING rule_name[MAX_LEN_NAME]; 1678 ACHIEVEMENT_TYPE type; 1679 BOOL unique; 1680 UINT16 value; 1681end 1682 1683PACKET_RULESET_TRADE = 227; sc, lsend 1684 UINT8 id; 1685 UINT16 trade_pct; 1686 TRI cancelling; 1687 TR_BONUS_TYPE bonus_type; 1688end 1689 1690PACKET_RULESET_ACTION = 246; sc, lsend 1691 GEN_ACTION id; 1692 1693 STRING ui_name[MAX_LEN_NAME]; 1694 BOOL quiet; 1695end 1696 1697PACKET_RULESET_ACTION_ENABLER = 235; sc, lsend 1698 GEN_ACTION enabled_action; 1699 UINT8 actor_reqs_count; 1700 REQUIREMENT actor_reqs[MAX_NUM_REQS:actor_reqs_count]; 1701 UINT8 target_reqs_count; 1702 REQUIREMENT target_reqs[MAX_NUM_REQS:target_reqs_count]; 1703end 1704 1705PACKET_RULESET_MUSIC = 240; sc, lsend 1706 UINT8 id; 1707 STRING music_peaceful[MAX_LEN_NAME]; 1708 STRING music_combat[MAX_LEN_NAME]; 1709 UINT8 reqs_count; 1710 REQUIREMENT reqs[MAX_NUM_REQS:reqs_count]; 1711end 1712 1713PACKET_RULESET_MULTIPLIER = 243; sc, dsend, lsend 1714 MULTIPLIER id; 1715 SINT32 start; 1716 SINT32 stop; 1717 UINT32 step; 1718 SINT32 def; 1719 SINT32 offset; 1720 SINT32 factor; 1721 STRING name[MAX_LEN_NAME]; 1722 STRING rule_name[MAX_LEN_NAME]; 1723 STRVEC helptext[MAX_LEN_PACKET]; 1724end 1725 1726/************************************************************************** 1727 Ruleset control values: single values, all of which are needed before 1728 sending other ruleset data. After sending this packet, resend every 1729 other part of the rulesets. (Terrain ruleset has enough info for its 1730 own "control" packet, done separately.) 1731**************************************************************************/ 1732PACKET_RULESET_CONTROL = 155; sc, lsend 1733 UINT16 num_unit_classes; 1734 UINT16 num_unit_types; 1735 UINT16 num_impr_types; 1736 UINT16 num_tech_types; 1737 UINT16 num_extra_types; 1738 UINT16 num_base_types; 1739 UINT16 num_road_types; 1740 UINT16 num_disaster_types; 1741 UINT16 num_achievement_types; 1742 UINT16 num_multipliers; 1743 UINT16 num_styles; 1744 UINT16 num_music_styles; 1745 UINT16 government_count; 1746 UINT16 nation_count; 1747 UINT16 styles_count; 1748 UINT16 terrain_count; 1749 UINT16 resource_count; 1750 UINT16 num_specialist_types; 1751 1752 STRING preferred_tileset[MAX_LEN_NAME]; 1753 STRING preferred_soundset[MAX_LEN_NAME]; 1754 STRING preferred_musicset[MAX_LEN_NAME]; 1755 BOOL popup_tech_help; 1756 1757 STRING name[MAX_LEN_NAME]; 1758 STRING version[MAX_LEN_NAME]; 1759 UINT16 desc_length; 1760end 1761 1762PACKET_RULESET_SUMMARY = 249; sc, lsend 1763 STRING text[MAX_LEN_CONTENT]; 1764end 1765 1766PACKET_RULESET_DESCRIPTION_PART = 247; sc, lsend 1767 STRING text[MAX_LEN_CONTENT]; 1768end 1769 1770/********************************************************* 1771 Below are the packets that control single-player mode. 1772*********************************************************/ 1773PACKET_SINGLE_WANT_HACK_REQ = 160; cs, handle-per-conn, handle-via-packet 1774 STRING token[MAX_LEN_NAME]; 1775end 1776 1777PACKET_SINGLE_WANT_HACK_REPLY = 161; sc, dsend 1778 BOOL you_have_hack; 1779end 1780 1781PACKET_RULESET_CHOICES = 162; sc 1782 UINT8 ruleset_count; 1783 STRING rulesets[MAX_NUM_RULESETS:ruleset_count][MAX_RULESET_NAME_LENGTH]; 1784end 1785 1786PACKET_GAME_LOAD = 163; sc, lsend, dsend 1787 BOOL load_successful; 1788 STRING load_filename[MAX_LEN_PACKET]; 1789end 1790 1791PACKET_SERVER_SETTING_CONTROL = 164; sc, handle-via-packet, is-info 1792 UINT16 settings_num; 1793 UINT8 categories_num; 1794 STRING category_names[256:categories_num][MAX_LEN_NAME]; /* untranslated */ 1795end 1796 1797PACKET_SERVER_SETTING_CONST = 165; sc, handle-via-packet, is-info 1798 UINT16 id; key 1799 STRING name[MAX_LEN_NAME]; 1800 STRING short_help[MAX_LEN_PACKET]; /* untranslated */ 1801 STRING extra_help[MAX_LEN_PACKET]; /* untranslated */ 1802 UINT8 category; 1803end 1804 1805PACKET_SERVER_SETTING_BOOL = 166; sc, handle-via-packet, is-info 1806 UINT16 id; key 1807 BOOL is_visible; 1808 BOOL is_changeable; 1809 BOOL initial_setting; 1810 1811 BOOL val; 1812 BOOL default_val; 1813end 1814 1815PACKET_SERVER_SETTING_INT = 167; sc, handle-via-packet, is-info 1816 UINT16 id; key 1817 BOOL is_visible; 1818 BOOL is_changeable; 1819 BOOL initial_setting; 1820 1821 SINT32 val; 1822 SINT32 default_val; 1823 SINT32 min_val; 1824 SINT32 max_val; 1825end 1826 1827PACKET_SERVER_SETTING_STR = 168; sc, handle-via-packet, is-info 1828 UINT16 id; key 1829 BOOL is_visible; 1830 BOOL is_changeable; 1831 BOOL initial_setting; 1832 1833 STRING val[MAX_LEN_PACKET]; 1834 STRING default_val[MAX_LEN_PACKET]; 1835end 1836 1837PACKET_SERVER_SETTING_ENUM = 169; sc, handle-via-packet, is-info 1838 UINT16 id; key 1839 BOOL is_visible; 1840 BOOL is_changeable; 1841 BOOL initial_setting; 1842 1843 SINT8 val; 1844 SINT8 default_val; 1845 SINT8 values_num; 1846 STRING support_names[64:values_num][MAX_LEN_NAME]; 1847 STRING pretty_names[64:values_num][MAX_LEN_ENUM]; /* untranslated */ 1848end 1849 1850PACKET_SERVER_SETTING_BITWISE = 170; sc, handle-via-packet, is-info 1851 UINT16 id; key 1852 BOOL is_visible; 1853 BOOL is_changeable; 1854 BOOL initial_setting; 1855 1856 UINT16 val; 1857 UINT16 default_val; 1858 UINT8 bits_num; 1859 STRING support_names[64:bits_num][MAX_LEN_NAME]; 1860 STRING pretty_names[64:bits_num][MAX_LEN_ENUM]; /* untranslated */ 1861end 1862 1863PACKET_SET_TOPOLOGY = 250; sc 1864 UINT8 topology_id; 1865end 1866 1867/************** Effects hash packets **********************/ 1868 1869PACKET_RULESET_EFFECT = 175; sc, lsend 1870 EFFECT_TYPE effect_type; 1871 SINT32 effect_value; 1872 BOOL has_multiplier; 1873 MULTIPLIER multiplier; 1874 1875 UINT8 reqs_count; 1876 REQUIREMENT reqs[MAX_NUM_REQS:reqs_count]; 1877end 1878 1879PACKET_RULESET_RESOURCE = 177; sc, lsend 1880 RESOURCE id; 1881 1882 STRING name[MAX_LEN_NAME]; 1883 STRING rule_name[MAX_LEN_NAME]; 1884 UINT8 output[O_LAST]; 1885 STRING graphic_str[MAX_LEN_NAME]; 1886 STRING graphic_alt[MAX_LEN_NAME]; 1887end 1888 1889/****************** Scenario Related Packets ******************/ 1890 1891PACKET_SCENARIO_INFO = 180; sc, handle-via-packet, handle-per-conn 1892 BOOL is_scenario; 1893 STRING name[256]; 1894 STRING authors[MAX_LEN_PACKET / 3]; 1895 BOOL players; 1896 BOOL startpos_nations; 1897 BOOL save_random; 1898 BOOL prevent_new_cities; 1899 BOOL lake_flooding; 1900 BOOL handmade; 1901 BOOL allow_ai_type_fallback; 1902 1903 /* Unused at client side. */ 1904 BOOL have_resources; 1905end 1906 1907PACKET_SCENARIO_DESCRIPTION = 252; sc, handle-per-conn 1908 STRING description[MAX_LEN_CONTENT]; 1909end 1910 1911PACKET_SAVE_SCENARIO = 181; cs, handle-per-conn, dsend 1912 STRING name[MAX_LEN_NAME]; 1913end 1914 1915/*************** Vote Packets ***************/ 1916 1917PACKET_VOTE_NEW = 185; sc, handle-via-packet 1918 UINT32 vote_no; 1919 STRING user[MAX_LEN_NAME]; 1920 STRING desc[512]; 1921 UINT8 percent_required; 1922 UINT32 flags; 1923end 1924 1925/* Sent to the client to give the new vote totals. */ 1926PACKET_VOTE_UPDATE = 186; sc, is-info 1927 UINT32 vote_no; key 1928 UINT8 yes; 1929 UINT8 no; 1930 UINT8 abstain; 1931 UINT8 num_voters; 1932end 1933 1934PACKET_VOTE_REMOVE = 187; sc 1935 UINT32 vote_no; 1936end 1937 1938PACKET_VOTE_RESOLVE = 188; sc 1939 UINT32 vote_no; 1940 BOOL passed; 1941end 1942 1943/* Sent to the server by the client when the client 1944 * votes: 1945 * - yes (value = +1) 1946 * - no (value = -1) 1947 * - abstain (value = 0) */ 1948PACKET_VOTE_SUBMIT = 189; cs, handle-per-conn, no-delta 1949 UINT32 vote_no; 1950 SINT8 value; 1951end 1952 1953/************** Client Editor Packets **********************/ 1954 1955/* Always keep this as the first edit type packet sent by 1956 * the client, so that the test in server/srv_main.c in 1957 * the function is_client_edit_packet() is easy to write. */ 1958PACKET_EDIT_MODE = 190; cs, handle-per-conn, dsend 1959 BOOL state; 1960end 1961 1962PACKET_EDIT_RECALCULATE_BORDERS = 197; cs, handle-per-conn 1963end 1964 1965PACKET_EDIT_CHECK_TILES = 198; cs, handle-per-conn 1966end 1967 1968PACKET_EDIT_TOGGLE_FOGOFWAR = 199; cs, handle-per-conn, dsend 1969 PLAYER player; 1970end 1971 1972PACKET_EDIT_TILE_TERRAIN = 200; cs, handle-per-conn, dsend 1973 TILE tile; key 1974 TERRAIN terrain; 1975 UINT8 size; 1976end 1977 1978PACKET_EDIT_TILE_RESOURCE = 201; cs, handle-per-conn, dsend 1979 TILE tile; key 1980 RESOURCE resource; 1981 UINT8 size; 1982end 1983 1984PACKET_EDIT_TILE_EXTRA = 202; cs, handle-per-conn, dsend 1985 TILE tile; key 1986 EXTRA extra_type_id; 1987 BOOL removal; 1988 UINT8 size; 1989end 1990 1991PACKET_EDIT_STARTPOS = 204; cs, sc, dsend, handle-per-conn, handle-via-packet, no-delta 1992 TILE id; 1993 BOOL removal; 1994 SINT32 tag; 1995end 1996 1997PACKET_EDIT_STARTPOS_FULL = 205; cs, sc, handle-per-conn, handle-via-packet, no-delta 1998 TILE id; 1999 BOOL exclude; 2000 BV_STARTPOS_NATIONS nations; 2001end 2002 2003PACKET_EDIT_TILE = 206; cs, handle-per-conn, handle-via-packet 2004 TILE tile; key 2005 BV_EXTRAS extras; 2006 RESOURCE resource; 2007 TERRAIN terrain; 2008 NATION startpos_nation; 2009 STRING label[MAX_LEN_NAME]; 2010end 2011 2012PACKET_EDIT_UNIT_CREATE = 207; cs, handle-per-conn, dsend 2013 PLAYER owner; 2014 TILE tile; 2015 UNIT_TYPE type; 2016 UINT8 count; 2017 SINT32 tag; 2018end 2019 2020PACKET_EDIT_UNIT_REMOVE = 208; cs, handle-per-conn, dsend 2021 PLAYER owner; 2022 TILE tile; 2023 UNIT_TYPE type; 2024 UINT8 count; 2025end 2026 2027PACKET_EDIT_UNIT_REMOVE_BY_ID = 209; cs, handle-per-conn, dsend 2028 UNIT id; 2029end 2030 2031PACKET_EDIT_UNIT = 210; cs, handle-per-conn, handle-via-packet 2032 UNIT id; key 2033 UNIT_TYPE utype; 2034 PLAYER owner; 2035 CITY homecity; 2036 MOVEFRAGS moves_left; 2037 UINT8 hp; 2038 UINT8 veteran; 2039 UINT8 fuel; 2040 ACTIVITY activity; 2041 UINT16 activity_count; 2042 BASE activity_base; 2043 BOOL debug; 2044 BOOL moved; 2045 BOOL paradropped; 2046 BOOL done_moving; 2047 UNIT transported_by; 2048end 2049 2050PACKET_EDIT_CITY_CREATE = 211; cs, handle-per-conn, dsend 2051 PLAYER owner; 2052 TILE tile; 2053 UINT8 size; 2054 SINT32 tag; 2055end 2056 2057PACKET_EDIT_CITY_REMOVE = 212; cs, handle-per-conn, dsend 2058 CITY id; 2059end 2060 2061PACKET_EDIT_CITY = 213; cs, handle-per-conn, handle-via-packet 2062 CITY id; key 2063 STRING name[MAX_LEN_NAME]; 2064 PLAYER owner; 2065 PLAYER original; 2066 UINT8 size; 2067 UINT16 history; 2068 UINT8 ppl_happy[5], ppl_content[5], ppl_unhappy[5], ppl_angry[5]; 2069 UINT8 specialists_size; 2070 UINT8 specialists[SP_MAX:specialists_size]; 2071 UINT16 trade[MAX_TRADE_ROUTES]; 2072 UINT16 food_stock, shield_stock; 2073 BOOL airlift; 2074 BOOL debug; 2075 BOOL did_buy; 2076 BOOL did_sell; 2077 BOOL was_happy; 2078 UINT8 anarchy; 2079 UINT8 rapture; 2080 UINT8 steal; 2081 TURN turn_founded; 2082 TURN turn_last_built; 2083 SINT32 built[B_LAST]; diff 2084 UINT8 production_kind; 2085 UINT8 production_value; 2086 UINT16 last_turns_shield_surplus; 2087 BV_CITY_OPTIONS city_options; 2088end 2089 2090PACKET_EDIT_PLAYER_CREATE = 214; cs, handle-per-conn, dsend 2091 SINT32 tag; 2092end 2093 2094PACKET_EDIT_PLAYER_REMOVE = 215; cs, handle-per-conn, dsend 2095 PLAYER id; 2096end 2097 2098PACKET_EDIT_PLAYER = 216; cs, handle-per-conn, lsend 2099 PLAYER id; key 2100 STRING name[MAX_LEN_NAME]; 2101 STRING username[MAX_LEN_NAME]; 2102 STRING ranked_username[MAX_LEN_NAME]; 2103 TURN user_turns; 2104 2105 BOOL is_male; 2106 GOVERNMENT government; 2107 GOVERNMENT target_government; 2108 NATION nation; 2109 TEAM team; 2110 2111 BOOL phase_done; 2112 TURN nturns_idle; 2113 BOOL is_alive; 2114 TURN revolution_finishes; 2115 2116 BOOL capital; 2117 BV_PLAYER embassy; 2118 GOLD gold; 2119 PERCENT tax, science, luxury; 2120 2121 UINT16 future_tech; 2122 TECH researching; 2123 UINT32 bulbs_researched; 2124 BOOL inventions[A_LAST+1]; diff 2125 2126 BOOL ai; 2127end 2128 2129PACKET_EDIT_PLAYER_VISION = 217; cs, handle-per-conn, dsend 2130 PLAYER player; 2131 TILE tile; 2132 BOOL known; 2133 UINT8 size; 2134end 2135 2136/* Always keep this as the last edit type packet sent by 2137 * the client, so that the test in server/srv_main.c in 2138 * the function is_client_edit_packet() is easy to write. */ 2139PACKET_EDIT_GAME = 218; cs, handle-per-conn, handle-via-packet 2140 YEAR16 year16; remove-cap(year32) 2141 YEAR32 year32; add-cap(year32) 2142 BOOL scenario; 2143 STRING scenario_name[256]; 2144 STRING scenario_authors[MAX_LEN_PACKET / 3]; 2145 BOOL scenario_random; 2146 BOOL scenario_players; 2147 BOOL startpos_nations; 2148 BOOL prevent_new_cities; 2149 BOOL lake_flooding; 2150end 2151 2152PACKET_EDIT_SCENARIO_DESC = 253; cs, handle-per-conn 2153 STRING scenario_desc[MAX_LEN_CONTENT]; 2154end 2155 2156/************** Server Editor Packets **********************/ 2157 2158PACKET_EDIT_OBJECT_CREATED = 219; sc, dsend 2159 SINT32 tag; 2160 SINT32 id; 2161end 2162 2163/************** Client Activity Requests **********************/ 2164 2165PACKET_PLAY_MUSIC = 245; sc, lsend 2166 STRING tag[MAX_LEN_NAME]; 2167end 2168