1 /*********************************************************************** 2 Freeciv - Copyright (C) 2004 - The Freeciv Project 3 This program is free software; you can redistribute it and/or modify 4 it under the terms of the GNU General Public License as published by 5 the Free Software Foundation; either version 2, or (at your option) 6 any later version. 7 8 This program is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 GNU General Public License for more details. 12 ***********************************************************************/ 13 14 #ifndef FC__FC_TYPES_H 15 #define FC__FC_TYPES_H 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif /* __cplusplus */ 20 21 #include "bitvector.h" 22 #include "shared.h" 23 24 /* This file serves to reduce the cross-inclusion of header files which 25 * occurs when a type which is defined in one file is needed for a function 26 * definition in another file. 27 * 28 * Nothing in this file should require anything else from the common/ 29 * directory! */ 30 31 #define MAX_NUM_PLAYER_SLOTS 160 /* Used in the network protocol. */ 32 /* Must be divisable by 32 or iterations 33 * in savegame2.c needs to be changed */ 34 #define MAX_NUM_BARBARIANS 10 /* 3, but slots reserved for future use. */ 35 #define MAX_NUM_PLAYERS MAX_NUM_PLAYER_SLOTS - MAX_NUM_BARBARIANS 36 /* Used in the network protocol. */ 37 #define MAX_NUM_CONNECTIONS (2 * (MAX_NUM_PLAYER_SLOTS)) 38 /* e.g. unit_types. Used in the network protocol. */ 39 #define MAX_NUM_ITEMS 200 40 #define MAX_NUM_TECH_LIST 10 /* Used in the network protocol. */ 41 #define MAX_NUM_UNIT_LIST 10 /* Used in the network protocol. */ 42 #define MAX_NUM_BUILDING_LIST 10 /* Used in the network protocol. */ 43 #define MAX_LEN_VET_SHORT_NAME 8 44 /* Used in the network protocol. See diplomat_success_vs_defender() */ 45 #define MAX_VET_LEVELS 20 46 /* Limited by what values num2char() can store in unit orders in 47 * savegames. */ 48 #define MAX_EXTRA_TYPES 64 /* Used in the network protocol. */ 49 #define MAX_BASE_TYPES MAX_EXTRA_TYPES /* Used in the network protocol. */ 50 #define MAX_ROAD_TYPES MAX_EXTRA_TYPES /* Used in the network protocol. */ 51 #define MAX_DISASTER_TYPES 10 52 #define MAX_ACHIEVEMENT_TYPES 10 53 #define MAX_NUM_MULTIPLIERS 15 54 #define MAX_NUM_LEADERS MAX_NUM_ITEMS /* Used in the network protocol. */ 55 #define MAX_NUM_NATION_SETS 32 /* Used in the network protocol. 56 * RULESET_NATION_SETS packet may become too big 57 * if increased */ 58 #define MAX_NUM_NATION_GROUPS 128 /* Used in the network protocol. */ 59 /* Used in the network protocol -- nation count is a UINT16 */ 60 #define MAX_NUM_NATIONS MAX_UINT16 61 #define MAX_NUM_STARTPOS_NATIONS 1024 /* Used in the network protocol. */ 62 #define MAX_CALENDAR_FRAGMENTS 52 /* Used in the network protocol. */ 63 64 /* Changing these will probably break network compatibility. */ 65 #define MAX_LEN_NAME 48 66 #define MAX_LEN_DEMOGRAPHY 16 67 #define MAX_LEN_ALLOW_TAKE 16 68 #define MAX_LEN_GAME_IDENTIFIER 33 69 #define MAX_GRANARY_INIS 24 70 #define MAX_LEN_STARTUNIT (20+1) 71 #define MAX_LEN_ENUM 64 72 73 /* Line breaks after this number of characters; be carefull and use only 70 */ 74 #define LINE_BREAK 70 75 76 /* symbol to flag missing numbers for better debugging */ 77 #define IDENTITY_NUMBER_ZERO (0) 78 79 enum override_bool { OVERRIDE_TRUE, OVERRIDE_FALSE, NO_OVERRIDE }; 80 81 /* A bitvector for all player slots. Used in the network protocol. */ 82 BV_DEFINE(bv_player, MAX_NUM_PLAYER_SLOTS); 83 84 /* Changing this breaks network compatibility. */ 85 enum output_type_id { 86 O_FOOD, O_SHIELD, O_TRADE, O_GOLD, O_LUXURY, O_SCIENCE, O_LAST 87 }; 88 89 /* Changing this enum will break savegame and network compatibility. */ 90 #define SPECENUM_NAME unit_activity 91 #define SPECENUM_VALUE0 ACTIVITY_IDLE 92 #define SPECENUM_VALUE0NAME "Idle" 93 #define SPECENUM_VALUE1 ACTIVITY_POLLUTION 94 #define SPECENUM_VALUE1NAME "Pollution" 95 #define SPECENUM_VALUE2 ACTIVITY_OLD_ROAD 96 #define SPECENUM_VALUE2NAME "Unused Road" 97 #define SPECENUM_VALUE3 ACTIVITY_MINE 98 #define SPECENUM_VALUE3NAME "Mine" 99 #define SPECENUM_VALUE4 ACTIVITY_IRRIGATE 100 #define SPECENUM_VALUE4NAME "Irrigate" 101 #define SPECENUM_VALUE5 ACTIVITY_FORTIFIED 102 #define SPECENUM_VALUE5NAME "Fortified" 103 #define SPECENUM_VALUE6 ACTIVITY_FORTRESS 104 #define SPECENUM_VALUE6NAME "Fortress" 105 #define SPECENUM_VALUE7 ACTIVITY_SENTRY 106 #define SPECENUM_VALUE7NAME "Sentry" 107 #define SPECENUM_VALUE8 ACTIVITY_OLD_RAILROAD 108 #define SPECENUM_VALUE8NAME "Unused Railroad" 109 #define SPECENUM_VALUE9 ACTIVITY_PILLAGE 110 #define SPECENUM_VALUE9NAME "Pillage" 111 #define SPECENUM_VALUE10 ACTIVITY_GOTO 112 #define SPECENUM_VALUE10NAME "Goto" 113 #define SPECENUM_VALUE11 ACTIVITY_EXPLORE 114 #define SPECENUM_VALUE11NAME "Explore" 115 #define SPECENUM_VALUE12 ACTIVITY_TRANSFORM 116 #define SPECENUM_VALUE12NAME "Transform" 117 #define SPECENUM_VALUE13 ACTIVITY_UNKNOWN 118 #define SPECENUM_VALUE13NAME "Unused" 119 #define SPECENUM_VALUE14 ACTIVITY_AIRBASE 120 #define SPECENUM_VALUE14NAME "Unused Airbase" 121 #define SPECENUM_VALUE15 ACTIVITY_FORTIFYING 122 #define SPECENUM_VALUE15NAME "Fortifying" 123 #define SPECENUM_VALUE16 ACTIVITY_FALLOUT 124 #define SPECENUM_VALUE16NAME "Fallout" 125 #define SPECENUM_VALUE17 ACTIVITY_PATROL_UNUSED 126 #define SPECENUM_VALUE17NAME "Unused Patrol" 127 #define SPECENUM_VALUE18 ACTIVITY_BASE 128 #define SPECENUM_VALUE18NAME "Base" 129 #define SPECENUM_VALUE19 ACTIVITY_GEN_ROAD 130 #define SPECENUM_VALUE19NAME "Road" 131 #define SPECENUM_VALUE20 ACTIVITY_CONVERT 132 #define SPECENUM_VALUE20NAME "Convert" 133 #define SPECENUM_COUNT ACTIVITY_LAST 134 #include "specenum_gen.h" 135 136 enum adv_unit_task { AUT_NONE, AUT_AUTO_SETTLER, AUT_BUILD_CITY }; 137 138 typedef signed short Continent_id; 139 typedef int Terrain_type_id; 140 typedef int Resource_type_id; 141 typedef int Specialist_type_id; 142 typedef int Impr_type_id; 143 typedef int Tech_type_id; 144 typedef enum output_type_id Output_type_id; 145 typedef enum unit_activity Activity_type_id; 146 typedef int Nation_type_id; 147 typedef int Government_type_id; 148 typedef int Unit_type_id; 149 typedef int Base_type_id; 150 typedef int Road_type_id; 151 typedef int Disaster_type_id; 152 typedef int Multiplier_type_id; 153 typedef unsigned char citizens; 154 typedef int action_id; 155 156 struct advance; 157 struct city; 158 struct connection; 159 struct government; 160 struct impr_type; 161 struct nation_type; 162 struct output_type; 163 struct player; 164 struct specialist; 165 struct terrain; 166 struct tile; 167 struct unit; 168 struct achievement; 169 170 171 /* Changing these will break network compatibility. */ 172 #define SP_MAX 20 173 #define MAX_NUM_REQS 20 174 175 #define MAX_NUM_RULESETS 16 /* Used in the network protocol. */ 176 #define MAX_RULESET_NAME_LENGTH 64 /* Used in the network protocol. */ 177 #define RULESET_SUFFIX ".serv" 178 179 /* Unit Class List, also 32-bit vector? */ 180 #define UCL_LAST 32 /* Used in the network protocol. */ 181 typedef int Unit_Class_id; 182 183 /* The direction8 gives the 8 possible directions. These may be used in 184 * a number of ways, for instance as an index into the DIR_DX/DIR_DY 185 * arrays. Not all directions may be valid; see is_valid_dir and 186 * is_cardinal_dir. */ 187 188 /* The DIR8/direction8 naming system is used to avoid conflict with 189 * DIR4/direction4 in client/tilespec.h 190 * 191 * Changing the order of the directions will break network compatibility. 192 * 193 * Some code assumes that the first 4 directions are the reverses of the 194 * last 4 (in no particular order). See client/goto.c and 195 * map.c:opposite_direction(). */ 196 197 /* Used in the network protocol. */ 198 #define SPECENUM_NAME direction8 199 #define SPECENUM_VALUE0 DIR8_NORTHWEST 200 #define SPECENUM_VALUE0NAME "Northwest" 201 #define SPECENUM_VALUE1 DIR8_NORTH 202 #define SPECENUM_VALUE1NAME "North" 203 #define SPECENUM_VALUE2 DIR8_NORTHEAST 204 #define SPECENUM_VALUE2NAME "Northeast" 205 #define SPECENUM_VALUE3 DIR8_WEST 206 #define SPECENUM_VALUE3NAME "West" 207 #define SPECENUM_VALUE4 DIR8_EAST 208 #define SPECENUM_VALUE4NAME "East" 209 #define SPECENUM_VALUE5 DIR8_SOUTHWEST 210 #define SPECENUM_VALUE5NAME "Southwest" 211 #define SPECENUM_VALUE6 DIR8_SOUTH 212 #define SPECENUM_VALUE6NAME "South" 213 #define SPECENUM_VALUE7 DIR8_SOUTHEAST 214 #define SPECENUM_VALUE7NAME "Southeast" 215 #define SPECENUM_INVALID ((enum direction8) (DIR8_SOUTHEAST + 1)) 216 #include "specenum_gen.h" 217 218 /* No direction. Understood as the origin tile that a direction would have 219 * been relative to. */ 220 #define DIR8_ORIGIN direction8_invalid() 221 222 /* Used in the network protocol. */ 223 #define SPECENUM_NAME free_tech_method 224 #define SPECENUM_VALUE0 FTM_GOAL 225 #define SPECENUM_VALUE0NAME "Goal" 226 #define SPECENUM_VALUE1 FTM_RANDOM 227 #define SPECENUM_VALUE1NAME "Random" 228 #define SPECENUM_VALUE2 FTM_CHEAPEST 229 #define SPECENUM_VALUE2NAME "Cheapest" 230 #include "specenum_gen.h" 231 232 /* Some code requires compile time value for number of directions, and 233 * cannot use specenum function call direction8_max(). */ 234 #define DIR8_MAGIC_MAX 8 235 236 /* Used in the network protocol. */ 237 /* server/commands.c must match these */ 238 #define SPECENUM_NAME ai_level 239 #define SPECENUM_VALUE0 AI_LEVEL_AWAY 240 #define SPECENUM_VALUE0NAME N_("Away") 241 #define SPECENUM_VALUE1 AI_LEVEL_HANDICAPPED 242 #define SPECENUM_VALUE1NAME N_("Handicapped") 243 #define SPECENUM_VALUE2 AI_LEVEL_NOVICE 244 #define SPECENUM_VALUE2NAME N_("Novice") 245 #define SPECENUM_VALUE3 AI_LEVEL_EASY 246 #define SPECENUM_VALUE3NAME N_("Easy") 247 #define SPECENUM_VALUE4 AI_LEVEL_NORMAL 248 #define SPECENUM_VALUE4NAME N_("Normal") 249 #define SPECENUM_VALUE5 AI_LEVEL_HARD 250 #define SPECENUM_VALUE5NAME N_("Hard") 251 #define SPECENUM_VALUE6 AI_LEVEL_CHEATING 252 #define SPECENUM_VALUE6NAME N_("Cheating") 253 254 #ifdef FREECIV_DEBUG 255 #define SPECENUM_VALUE7 AI_LEVEL_EXPERIMENTAL 256 #define SPECENUM_VALUE7NAME N_("Experimental") 257 #endif /* FREECIV_DEBUG */ 258 259 #define SPECENUM_COUNT AI_LEVEL_COUNT 260 #include "specenum_gen.h" 261 262 /* pplayer->ai.barbarian_type and nations use this enum. */ 263 #define SPECENUM_NAME barbarian_type 264 #define SPECENUM_VALUE0 NOT_A_BARBARIAN 265 #define SPECENUM_VALUE0NAME "None" 266 #define SPECENUM_VALUE1 LAND_BARBARIAN 267 #define SPECENUM_VALUE1NAME "Land" 268 #define SPECENUM_VALUE2 SEA_BARBARIAN 269 #define SPECENUM_VALUE2NAME "Sea" 270 #define SPECENUM_VALUE3 ANIMAL_BARBARIAN 271 #define SPECENUM_VALUE3NAME "Animal" 272 #include "specenum_gen.h" 273 274 /* 275 * Citytile requirement types. 276 * 277 * Used in the network protocol 278 */ 279 #define SPECENUM_NAME citytile_type 280 #define SPECENUM_VALUE0 CITYT_CENTER 281 #define SPECENUM_VALUE0NAME "Center" 282 #define SPECENUM_VALUE1 CITYT_CLAIMED 283 #define SPECENUM_VALUE1NAME "Claimed" 284 #define SPECENUM_COUNT CITYT_LAST 285 #include "specenum_gen.h" 286 287 /* 288 * UnitState requirement property types. 289 * 290 * Used in the network protocol. 291 */ 292 #define SPECENUM_NAME ustate_prop 293 #define SPECENUM_VALUE0 USP_TRANSPORTED 294 #define SPECENUM_VALUE0NAME "Transported" 295 #define SPECENUM_VALUE1 USP_LIVABLE_TILE 296 #define SPECENUM_VALUE1NAME "OnLivableTile" 297 #define SPECENUM_COUNT USP_COUNT 298 #include "specenum_gen.h" 299 300 /* Changing these values will break map_init_topology. 301 * Changing the names will break file format compatibility. */ 302 #define SPECENUM_NAME topo_flag 303 #define SPECENUM_BITWISE 304 #define SPECENUM_VALUE0 TF_WRAPX 305 #define SPECENUM_VALUE0NAME N_("WrapX") 306 #define SPECENUM_VALUE1 TF_WRAPY 307 #define SPECENUM_VALUE1NAME N_("WrapY") 308 #define SPECENUM_VALUE2 TF_ISO 309 #define SPECENUM_VALUE2NAME N_("ISO") 310 #define SPECENUM_VALUE3 TF_HEX 311 #define SPECENUM_VALUE3NAME N_("Hex") 312 #include "specenum_gen.h" 313 314 /* Sometimes we don't know (or don't care) if some requirements for effect 315 * are currently fulfilled or not. This enum tells lower level functions 316 * how to handle uncertain requirements. 317 */ 318 enum req_problem_type { 319 RPT_POSSIBLE, /* We want to know if it is possible that effect is active */ 320 RPT_CERTAIN /* We want to know if it is certain that effect is active */ 321 }; 322 323 #define REVERSED_RPT(x) \ 324 (x == RPT_CERTAIN ? RPT_POSSIBLE : RPT_CERTAIN) 325 326 /* Originally in requirements.h, bumped up and revised to unify with 327 * city_production and worklists. Functions remain in requirements.c 328 * Used in the network protocol. */ 329 typedef union { 330 struct advance *advance; 331 struct government *govern; 332 struct impr_type *building; 333 struct nation_type *nation; 334 struct nation_type *nationality; 335 struct specialist *specialist; 336 struct terrain *terrain; 337 struct unit_class *uclass; 338 struct unit_type *utype; 339 struct extra_type *extra; 340 struct resource *resource; 341 struct achievement *achievement; 342 struct nation_group *nationgroup; 343 struct nation_style *style; 344 345 enum ai_level ai_level; 346 enum citytile_type citytile; 347 int minsize; 348 int minculture; 349 int minyear; 350 Output_type_id outputtype; 351 int terrainclass; /* enum terrain_class */ 352 int terrainalter; /* enum terrain_alteration */ 353 int unitclassflag; /* enum unit_class_flag_id */ 354 int unitflag; /* enum unit_flag_id */ 355 int terrainflag; /* enum terrain_flag_id */ 356 int techflag; /* enum tech_flag_id */ 357 int baseflag; /* enum base_flag_id */ 358 int roadflag; /* enum road_flag_id */ 359 int extraflag; 360 int diplrel; /* enum diplstate_type or 361 enum diplrel_other */ 362 enum ustate_prop unit_state; 363 int minmoves; 364 int max_tile_units; 365 int minveteran; 366 int min_hit_points; 367 int age; 368 369 enum topo_flag topo_property; 370 } universals_u; 371 372 /* The kind of universals_u (value_union_type was req_source_type). 373 * Used in the network protocol. */ 374 #define SPECENUM_NAME universals_n 375 #define SPECENUM_VALUE0 VUT_NONE 376 #define SPECENUM_VALUE0NAME "None" 377 #define SPECENUM_VALUE1 VUT_ADVANCE 378 #define SPECENUM_VALUE1NAME "Tech" 379 #define SPECENUM_VALUE2 VUT_GOVERNMENT 380 #define SPECENUM_VALUE2NAME "Gov" 381 #define SPECENUM_VALUE3 VUT_IMPROVEMENT 382 #define SPECENUM_VALUE3NAME "Building" 383 #define SPECENUM_VALUE4 VUT_TERRAIN 384 #define SPECENUM_VALUE4NAME "Terrain" 385 #define SPECENUM_VALUE5 VUT_NATION 386 #define SPECENUM_VALUE5NAME "Nation" 387 #define SPECENUM_VALUE6 VUT_UTYPE 388 #define SPECENUM_VALUE6NAME "UnitType" 389 #define SPECENUM_VALUE7 VUT_UTFLAG 390 #define SPECENUM_VALUE7NAME "UnitFlag" 391 #define SPECENUM_VALUE8 VUT_UCLASS 392 #define SPECENUM_VALUE8NAME "UnitClass" 393 #define SPECENUM_VALUE9 VUT_UCFLAG 394 #define SPECENUM_VALUE9NAME "UnitClassFlag" 395 #define SPECENUM_VALUE10 VUT_OTYPE 396 #define SPECENUM_VALUE10NAME "OutputType" 397 #define SPECENUM_VALUE11 VUT_SPECIALIST 398 #define SPECENUM_VALUE11NAME "Specialist" 399 /* Minimum size: at city range means city size */ 400 #define SPECENUM_VALUE12 VUT_MINSIZE 401 #define SPECENUM_VALUE12NAME "MinSize" 402 /* AI level of the player */ 403 #define SPECENUM_VALUE13 VUT_AI_LEVEL 404 #define SPECENUM_VALUE13NAME "AI" 405 /* More generic terrain type currently "Land" or "Ocean" */ 406 #define SPECENUM_VALUE14 VUT_TERRAINCLASS 407 #define SPECENUM_VALUE14NAME "TerrainClass" 408 #define SPECENUM_VALUE15 VUT_MINYEAR 409 #define SPECENUM_VALUE15NAME "MinYear" 410 /* Terrain alterations that are possible */ 411 #define SPECENUM_VALUE16 VUT_TERRAINALTER 412 #define SPECENUM_VALUE16NAME "TerrainAlter" 413 /* Target tile is used by city. */ 414 #define SPECENUM_VALUE17 VUT_CITYTILE 415 #define SPECENUM_VALUE17NAME "CityTile" 416 #define SPECENUM_VALUE18 VUT_RESOURCE 417 #define SPECENUM_VALUE18NAME "Resource" 418 #define SPECENUM_VALUE19 VUT_TERRFLAG 419 #define SPECENUM_VALUE19NAME "TerrainFlag" 420 #define SPECENUM_VALUE20 VUT_NATIONALITY 421 #define SPECENUM_VALUE20NAME "Nationality" 422 #define SPECENUM_VALUE21 VUT_BASEFLAG 423 #define SPECENUM_VALUE21NAME "BaseFlag" 424 #define SPECENUM_VALUE22 VUT_ROADFLAG 425 #define SPECENUM_VALUE22NAME "RoadFlag" 426 #define SPECENUM_VALUE23 VUT_EXTRA 427 #define SPECENUM_VALUE23NAME "Extra" 428 #define SPECENUM_VALUE24 VUT_TECHFLAG 429 #define SPECENUM_VALUE24NAME "TechFlag" 430 #define SPECENUM_VALUE25 VUT_ACHIEVEMENT 431 #define SPECENUM_VALUE25NAME "Achievement" 432 #define SPECENUM_VALUE26 VUT_DIPLREL 433 #define SPECENUM_VALUE26NAME "DiplRel" 434 #define SPECENUM_VALUE27 VUT_MAXTILEUNITS 435 #define SPECENUM_VALUE27NAME "MaxUnitsOnTile" 436 #define SPECENUM_VALUE28 VUT_STYLE 437 #define SPECENUM_VALUE28NAME "Style" 438 #define SPECENUM_VALUE29 VUT_MINCULTURE 439 #define SPECENUM_VALUE29NAME "MinCulture" 440 #define SPECENUM_VALUE30 VUT_UNITSTATE 441 #define SPECENUM_VALUE30NAME "UnitState" 442 #define SPECENUM_VALUE31 VUT_MINMOVES 443 #define SPECENUM_VALUE31NAME "MinMoveFrags" 444 #define SPECENUM_VALUE32 VUT_MINVETERAN 445 #define SPECENUM_VALUE32NAME "MinVeteran" 446 #define SPECENUM_VALUE33 VUT_MINHP 447 #define SPECENUM_VALUE33NAME "MinHitPoints" 448 #define SPECENUM_VALUE34 VUT_AGE 449 #define SPECENUM_VALUE34NAME "Age" 450 #define SPECENUM_VALUE35 VUT_NATIONGROUP 451 #define SPECENUM_VALUE35NAME "NationGroup" 452 #define SPECENUM_VALUE36 VUT_TOPO 453 #define SPECENUM_VALUE36NAME "Topology" 454 #define SPECENUM_VALUE37 VUT_EXTRAFLAG 455 #define SPECENUM_VALUE37NAME "ExtraFlag" 456 /* Keep this last. */ 457 #define SPECENUM_COUNT VUT_COUNT 458 #include "specenum_gen.h" 459 460 /* Used in the network protocol. */ 461 struct universal { 462 universals_u value; 463 enum universals_n kind; /* formerly .type and .is_unit */ 464 }; 465 466 /* Used in the network protocol. */ 467 BV_DEFINE(bv_extras, MAX_EXTRA_TYPES); 468 BV_DEFINE(bv_special, MAX_EXTRA_TYPES); 469 BV_DEFINE(bv_bases, MAX_BASE_TYPES); 470 BV_DEFINE(bv_roads, MAX_ROAD_TYPES); 471 BV_DEFINE(bv_startpos_nations, MAX_NUM_STARTPOS_NATIONS); 472 473 /* Used in the network protocol. */ 474 #define SPECENUM_NAME gui_type 475 /* Used for options which do not belong to any gui. */ 476 #define SPECENUM_VALUE0 GUI_STUB 477 #define SPECENUM_VALUE0NAME "stub" 478 #define SPECENUM_VALUE1 GUI_GTK2 479 #define SPECENUM_VALUE1NAME "gtk2" 480 #define SPECENUM_VALUE2 GUI_GTK3 481 #define SPECENUM_VALUE2NAME "gtk3" 482 #define SPECENUM_VALUE3 GUI_SDL 483 #define SPECENUM_VALUE3NAME "sdl" 484 #define SPECENUM_VALUE4 GUI_XAW 485 #define SPECENUM_VALUE4NAME "xaw" 486 #define SPECENUM_VALUE5 GUI_QT 487 #define SPECENUM_VALUE5NAME "qt" 488 #define SPECENUM_VALUE6 GUI_SDL2 489 #define SPECENUM_VALUE6NAME "sdl2" 490 #define SPECENUM_VALUE7 GUI_WEB 491 #define SPECENUM_VALUE7NAME "web" 492 #define SPECENUM_VALUE8 GUI_GTK3_22 493 #define SPECENUM_VALUE8NAME "gtk3.22" 494 #include "specenum_gen.h" 495 496 /* Used in the network protocol. */ 497 #define SPECENUM_NAME airlifting_style 498 #define SPECENUM_BITWISE 499 /* Like classical Freeciv. One unit per turn. */ 500 #define SPECENUM_ZERO AIRLIFTING_CLASSICAL 501 /* Allow airlifting from allied cities. */ 502 #define SPECENUM_VALUE0 AIRLIFTING_ALLIED_SRC 503 /* Allow airlifting to allied cities. */ 504 #define SPECENUM_VALUE1 AIRLIFTING_ALLIED_DEST 505 /* Unlimited units to airlift from the source (but always needs an Airport 506 * or equivalent). */ 507 #define SPECENUM_VALUE2 AIRLIFTING_UNLIMITED_SRC 508 /* Unlimited units to airlift to the destination (doesn't require any 509 * Airport or equivalent). */ 510 #define SPECENUM_VALUE3 AIRLIFTING_UNLIMITED_DEST 511 #include "specenum_gen.h" 512 513 /* Used in the network protocol. */ 514 #define SPECENUM_NAME persistent_ready 515 #define SPECENUM_VALUE0 PERSISTENTR_DISABLED 516 #define SPECENUM_VALUE0NAME "Disabled" 517 #define SPECENUM_VALUE1 PERSISTENTR_CONNECTED 518 #define SPECENUM_VALUE1NAME "Connected" 519 #include "specenum_gen.h" 520 521 #define SPECENUM_NAME reveal_map 522 #define SPECENUM_BITWISE 523 /* Reveal only the area around the first units at the beginning. */ 524 #define SPECENUM_ZERO REVEAL_MAP_NONE 525 /* Reveal the (fogged) map at the beginning of the game. */ 526 #define SPECENUM_VALUE0 REVEAL_MAP_START 527 /* Reveal (and unfog) the map for dead players. */ 528 #define SPECENUM_VALUE1 REVEAL_MAP_DEAD 529 #include "specenum_gen.h" 530 531 /* Used in the network protocol. */ 532 #define SPECENUM_NAME gameloss_style 533 #define SPECENUM_BITWISE 534 /* Like classical Freeciv. No special effects. */ 535 #define SPECENUM_ZERO GAMELOSS_STYLE_CLASSICAL 536 /* Remaining cities are taken by barbarians. */ 537 #define SPECENUM_VALUE0 GAMELOSS_STYLE_BARB 538 #define SPECENUM_VALUE0NAME "Barbarians" 539 /* Try civil war. */ 540 #define SPECENUM_VALUE1 GAMELOSS_STYLE_CWAR 541 #define SPECENUM_VALUE1NAME "CivilWar" 542 /* Do some looting */ 543 #define SPECENUM_VALUE2 GAMELOSS_STYLE_LOOT 544 #define SPECENUM_VALUE2NAME "Loot" 545 #include "specenum_gen.h" 546 547 /* Used in the network protocol. */ 548 #define SPECENUM_NAME tech_upkeep_style 549 /* No upkeep */ 550 #define SPECENUM_VALUE0 TECH_UPKEEP_NONE 551 #define SPECENUM_VALUE0NAME "None" 552 /* Normal tech upkeep */ 553 #define SPECENUM_VALUE1 TECH_UPKEEP_BASIC 554 #define SPECENUM_VALUE1NAME "Basic" 555 /* Tech upkeep multiplied by number of cities */ 556 #define SPECENUM_VALUE2 TECH_UPKEEP_PER_CITY 557 #define SPECENUM_VALUE2NAME "Cities" 558 #include "specenum_gen.h" 559 560 /* Used in the network protocol. */ 561 enum phase_mode_types { 562 PMT_CONCURRENT = 0, 563 PMT_PLAYERS_ALTERNATE, 564 PMT_TEAMS_ALTERNATE 565 }; 566 567 /* Phase mode change has changed meaning of the phase numbers */ 568 #define PHASE_INVALIDATED -1 569 /* Phase was never known */ 570 #define PHASE_UNKNOWN -2 571 572 /* Used in the network protocol. */ 573 enum borders_mode { 574 BORDERS_DISABLED = 0, 575 BORDERS_ENABLED, 576 BORDERS_SEE_INSIDE, 577 BORDERS_EXPAND 578 }; 579 580 enum trait_dist_mode { 581 TDM_FIXED = 0, 582 TDM_EVEN 583 }; 584 585 /* Used in the network protocol. */ 586 enum diplomacy_mode { 587 DIPLO_FOR_ALL, 588 DIPLO_FOR_HUMANS, 589 DIPLO_FOR_AIS, 590 DIPLO_NO_AIS, 591 DIPLO_NO_MIXED, 592 DIPLO_FOR_TEAMS, 593 DIPLO_DISABLED, 594 }; 595 596 /* Used in the network protocol. */ 597 #define SPECENUM_NAME extra_category 598 #define SPECENUM_VALUE0 ECAT_INFRA 599 #define SPECENUM_VALUE0NAME "Infra" 600 #define SPECENUM_VALUE1 ECAT_NATURAL 601 #define SPECENUM_VALUE1NAME "Natural" 602 #define SPECENUM_VALUE2 ECAT_NUISANCE 603 #define SPECENUM_VALUE2NAME "Nuisance" 604 #define SPECENUM_VALUE3 ECAT_BONUS 605 #define SPECENUM_VALUE3NAME "Bonus" 606 #define SPECENUM_COUNT ECAT_COUNT 607 #include "specenum_gen.h" 608 #define ECAT_NONE ECAT_COUNT 609 610 /* Used in the network protocol. */ 611 #define SPECENUM_NAME extra_cause 612 #define SPECENUM_VALUE0 EC_IRRIGATION 613 #define SPECENUM_VALUE0NAME "Irrigation" 614 #define SPECENUM_VALUE1 EC_MINE 615 #define SPECENUM_VALUE1NAME "Mine" 616 #define SPECENUM_VALUE2 EC_ROAD 617 #define SPECENUM_VALUE2NAME "Road" 618 #define SPECENUM_VALUE3 EC_BASE 619 #define SPECENUM_VALUE3NAME "Base" 620 #define SPECENUM_VALUE4 EC_POLLUTION 621 #define SPECENUM_VALUE4NAME "Pollution" 622 #define SPECENUM_VALUE5 EC_FALLOUT 623 #define SPECENUM_VALUE5NAME "Fallout" 624 #define SPECENUM_VALUE6 EC_HUT 625 #define SPECENUM_VALUE6NAME "Hut" 626 #define SPECENUM_COUNT EC_COUNT 627 #include "specenum_gen.h" 628 #define EC_NONE EC_COUNT 629 #define EC_SPECIAL (EC_NONE + 1) 630 #define EC_DEFENSIVE (EC_NONE + 2) 631 #define EC_NATURAL_DEFENSIVE (EC_NONE + 3) 632 #define EC_LAST (EC_NONE + 4) 633 634 /* packets.def and struct extra_type reserve 8 bits (0-7) for these. */ 635 FC_STATIC_ASSERT(EC_COUNT < 8, extra_causes_over_limit); 636 637 /* Used in the network protocol. */ 638 #define SPECENUM_NAME extra_rmcause 639 #define SPECENUM_VALUE0 ERM_PILLAGE 640 #define SPECENUM_VALUE0NAME "Pillage" 641 #define SPECENUM_VALUE1 ERM_CLEANPOLLUTION 642 #define SPECENUM_VALUE1NAME "CleanPollution" 643 #define SPECENUM_VALUE2 ERM_CLEANFALLOUT 644 #define SPECENUM_VALUE2NAME "CleanFallout" 645 #define SPECENUM_COUNT ERM_COUNT 646 #include "specenum_gen.h" 647 #define ERM_NONE ERM_COUNT 648 649 /* packets.def and struct extra_type reserve 8 bits (0-7) for these. */ 650 FC_STATIC_ASSERT(ERM_COUNT < 8, extra_rmcauses_over_limit); 651 652 /* Used in the network protocol. */ 653 #define SPECENUM_NAME achievement_type 654 #define SPECENUM_VALUE0 ACHIEVEMENT_SPACESHIP 655 #define SPECENUM_VALUE0NAME "Spaceship" 656 #define SPECENUM_VALUE1 ACHIEVEMENT_MAP 657 #define SPECENUM_VALUE1NAME "Map_Known" 658 #define SPECENUM_VALUE2 ACHIEVEMENT_MULTICULTURAL 659 #define SPECENUM_VALUE2NAME "Multicultural" 660 #define SPECENUM_VALUE3 ACHIEVEMENT_CULTURED_CITY 661 #define SPECENUM_VALUE3NAME "Cultured_City" 662 #define SPECENUM_VALUE4 ACHIEVEMENT_CULTURED_NATION 663 #define SPECENUM_VALUE4NAME "Cultured_Nation" 664 #define SPECENUM_VALUE5 ACHIEVEMENT_LUCKY 665 #define SPECENUM_VALUE5NAME "Lucky" 666 #define SPECENUM_VALUE6 ACHIEVEMENT_HUTS 667 #define SPECENUM_VALUE6NAME "Huts" 668 #define SPECENUM_VALUE7 ACHIEVEMENT_METROPOLIS 669 #define SPECENUM_VALUE7NAME "Metropolis" 670 #define SPECENUM_VALUE8 ACHIEVEMENT_LITERATE 671 #define SPECENUM_VALUE8NAME "Literate" 672 #define SPECENUM_VALUE9 ACHIEVEMENT_LAND_AHOY 673 #define SPECENUM_VALUE9NAME "Land_Ahoy" 674 #define SPECENUM_COUNT ACHIEVEMENT_COUNT 675 #include "specenum_gen.h" 676 677 /* Used in the network protocol. */ 678 #define SPECENUM_NAME mood_type 679 #define SPECENUM_VALUE0 MOOD_PEACEFUL 680 #define SPECENUM_VALUE0NAME "Peaceful" 681 #define SPECENUM_VALUE1 MOOD_COMBAT 682 #define SPECENUM_VALUE1NAME "Combat" 683 #define SPECENUM_COUNT MOOD_COUNT 684 #include "specenum_gen.h" 685 686 /* Used in the network protocol. */ 687 #define SPECENUM_NAME action_decision 688 /* Doesn't need the player to decide what action to take. */ 689 #define SPECENUM_VALUE0 ACT_DEC_NOTHING 690 #define SPECENUM_VALUE0NAME N_("nothing") 691 /* Wants a decision because of something done to the actor. */ 692 #define SPECENUM_VALUE1 ACT_DEC_PASSIVE 693 #define SPECENUM_VALUE1NAME N_("passive") 694 /* Wants a decision because of something the actor did. */ 695 #define SPECENUM_VALUE2 ACT_DEC_ACTIVE 696 #define SPECENUM_VALUE2NAME N_("active") 697 #include "specenum_gen.h" 698 699 /* 700 * Action probability 701 * 702 * An action probability is the probability that an action will be 703 * successful under the given circumstances. It is an interval that 704 * includes the end points. An end point goes from 0% to 100%. 705 * Alternatively it can signal a special case. 706 * 707 * End point values from 0 up to and including 200 should be understood as 708 * the chance of success measured in half percentage points. In other words: 709 * The value 3 indicates that the chance is 1.5%. The value 10 indicates 710 * that the chance is 5%. The probability of a minimum may be rounded down 711 * to the nearest half percentage point. The probability of a maximum may 712 * be rounded up to the nearest half percentage point. 713 * 714 * Values with a higher minimum than maximum are special case values. All 715 * special cases should be declared and documented below. An undocumented 716 * value in this range should be considered a bug. If a special value for 717 * internal use is needed please avoid the range from and including 0 up 718 * to and including 255. 719 * 720 * [0, 0] ACTPROB_IMPOSSIBLE is another way of saying that the 721 * probability is 0%. It isn't really a special value since it 722 * is in range. 723 * 724 * [200, 200] ACTPROB_CERTAIN is another way of saying that the probability 725 * is 100%. It isn't really a special value since it is in range. 726 * 727 * [253, 0] ACTPROB_NA indicates that no probability should exist. 728 * 729 * [254, 0] ACTPROB_NOT_IMPLEMENTED indicates that support for finding 730 * this probability currently is missing. 731 * 732 * [0, 200] ACTPROB_NOT_KNOWN indicates that the player don't know enough 733 * to find out. It is caused by the probability depending on a 734 * rule that depends on game state the player don't have access 735 * to. It may be possible for the player to later gain access to 736 * this game state. It isn't really a special value since it is 737 * in range. 738 */ 739 struct act_prob { 740 int min; 741 int max; 742 }; 743 744 enum test_result { 745 TR_SUCCESS, 746 TR_OTHER_FAILURE, 747 TR_ALREADY_SOLD 748 }; 749 750 /* Road type compatibility with old specials based roads. 751 * Used in the network protocol. */ 752 enum road_compat { ROCO_ROAD, ROCO_RAILROAD, ROCO_RIVER, ROCO_NONE }; 753 754 /* 755 * Maximum number of trade routes a city can have in any situation. 756 * Changing this changes network protocol. 757 */ 758 #define MAX_TRADE_ROUTES 5 759 760 enum victory_condition_type 761 { 762 VC_SPACERACE = 0, 763 VC_ALLIED, 764 VC_CULTURE 765 }; 766 767 enum environment_upset_type 768 { 769 EUT_GLOBAL_WARMING = 0, 770 EUT_NUCLEAR_WINTER 771 }; 772 773 enum revolen_type { 774 REVOLEN_FIXED = 0, 775 REVOLEN_RANDOM, 776 REVOLEN_QUICKENING, 777 REVOLEN_RANDQUICK 778 }; 779 780 enum happyborders_type { 781 HB_DISABLED = 0, 782 HB_NATIONAL, 783 HB_ALLIANCE 784 }; 785 786 /* Used in network protocol. */ 787 enum spaceship_place_type { 788 SSHIP_PLACE_STRUCTURAL, 789 SSHIP_PLACE_FUEL, 790 SSHIP_PLACE_PROPULSION, 791 SSHIP_PLACE_HABITATION, 792 SSHIP_PLACE_LIFE_SUPPORT, 793 SSHIP_PLACE_SOLAR_PANELS 794 }; 795 796 /* Used in the network protocol. */ 797 #define SPECENUM_NAME tech_cost_style 798 #define SPECENUM_VALUE0 TECH_COST_CIV1CIV2 799 #define SPECENUM_VALUE0NAME "Civ I|II" 800 #define SPECENUM_VALUE1 TECH_COST_CLASSIC 801 #define SPECENUM_VALUE1NAME "Classic" 802 #define SPECENUM_VALUE2 TECH_COST_CLASSIC_PRESET 803 #define SPECENUM_VALUE2NAME "Classic+" 804 #define SPECENUM_VALUE3 TECH_COST_EXPERIMENTAL 805 #define SPECENUM_VALUE3NAME "Experimental" 806 #define SPECENUM_VALUE4 TECH_COST_EXPERIMENTAL_PRESET 807 #define SPECENUM_VALUE4NAME "Experimental+" 808 #include "specenum_gen.h" 809 810 /* Used in the network protocol. */ 811 #define SPECENUM_NAME tech_leakage_style 812 #define SPECENUM_VALUE0 TECH_LEAKAGE_NONE 813 #define SPECENUM_VALUE0NAME "None" 814 #define SPECENUM_VALUE1 TECH_LEAKAGE_EMBASSIES 815 #define SPECENUM_VALUE1NAME "Embassies" 816 #define SPECENUM_VALUE2 TECH_LEAKAGE_PLAYERS 817 #define SPECENUM_VALUE2NAME "All Players" 818 #define SPECENUM_VALUE3 TECH_LEAKAGE_NO_BARBS 819 #define SPECENUM_VALUE3NAME "Normal Players" 820 #include "specenum_gen.h" 821 822 /* Used in the network protocol. */ 823 #define SPECENUM_NAME gold_upkeep_style 824 #define SPECENUM_VALUE0 GOLD_UPKEEP_CITY 825 #define SPECENUM_VALUE0NAME "City" 826 #define SPECENUM_VALUE1 GOLD_UPKEEP_MIXED 827 #define SPECENUM_VALUE1NAME "Mixed" 828 #define SPECENUM_VALUE2 GOLD_UPKEEP_NATION 829 #define SPECENUM_VALUE2NAME "Nation" 830 #include "specenum_gen.h" 831 832 typedef int adv_want; 833 #define ADV_WANT_PRINTF "%d" 834 835 #ifdef __cplusplus 836 } 837 #endif /* __cplusplus */ 838 839 #endif /* FC__FC_TYPES_H */ 840