Freeciv21
Develop your civilization from humble roots to a global empire
rscompat.h
Go to the documentation of this file.
1 /*__ ___ ***************************************
2 / \ / \ Copyright (c) 1996-2020 Freeciv21 and Freeciv
3 \_ \ / __/ contributors. This file is part of Freeciv21.
4  _\ \ / /__ Freeciv21 is free software: you can redistribute it
5  \___ \____/ __/ and/or modify it under the terms of the GNU General
6  \_ _/ Public License as published by the Free Software
7  | @ @ \_ Foundation, either version 3 of the License,
8  | or (at your option) any later version.
9  _/ /\ You should have received a copy of the GNU
10  /o) (o/\ \_ General Public License along with Freeciv21.
11  \_____/ / If not, see https://www.gnu.org/licenses/.
12  \____/ ********************************************************/
13 #pragma once
14 
15 // utility
16 #include "support.h"
17 
18 // server
19 #include "ruleset.h"
20 
21 #define RULESET_COMPAT_CAP "+Freeciv-3.0-ruleset"
22 
23 struct rscompat_info {
24  bool compat_mode = false;
26  int ver_buildings = 0;
27  int ver_cities = 0;
28  int ver_effects = 0;
29  int ver_game = 0;
30  int ver_governments = 0;
31  int ver_nations = 0;
32  int ver_styles = 0;
33  int ver_techs = 0;
34  int ver_terrain = 0;
35  int ver_units = 0;
36  QByteArray cap_effects;
37 };
38 
40  const char *filename,
41  struct rscompat_info *info);
42 
43 bool rscompat_names(struct rscompat_info *info);
44 
45 void rscompat_postprocess(struct rscompat_info *info);
46 
47 /* General upgrade functions that should be kept to avoid regressions in
48  * corner case handling. */
50 
51 // Functions from ruleset.c made visible to rscompat.c
52 struct requirement_vector *lookup_req_list(struct section_file *file,
53  struct rscompat_info *compat,
54  const char *sec, const char *sub,
55  const char *rfor);
56 
57 // Functions specific to 3.0 -> 3.1 transition
59  struct action_auto_perf *auto_perf,
60  size_t psize,
61  enum unit_type_flag_id *protecor_flag);
62 const char *rscompat_req_name_3_1(const char *type, const char *old_name);
63 const char *rscompat_utype_flag_name_3_1(struct rscompat_info *info,
64  const char *old_type);
65 bool rscompat_old_effect_3_1(const char *type, struct section_file *file,
66  const char *sec_name,
67  struct rscompat_info *compat);
69  struct extra_type *pextra);
71  bool slow_invasions);
void rscompat_enablers_add_obligatory_hard_reqs()
Update existing action enablers for new hard obligatory requirements.
Definition: rscompat.cpp:227
struct requirement_vector * lookup_req_list(struct section_file *file, struct rscompat_info *compat, const char *sec, const char *sub, const char *rfor)
Load a requirement list.
Definition: ruleset.cpp:338
int rscompat_check_capabilities(struct section_file *file, const char *filename, struct rscompat_info *info)
Ruleset files should have a capabilities string datafile.options This checks the string and that the ...
Definition: rscompat.cpp:50
const char * rscompat_req_name_3_1(const char *type, const char *old_name)
Replace deprecated requirement type names with currently valid ones.
Definition: rscompat.cpp:1502
void rscompat_extra_adjust_3_1(struct rscompat_info *compat, struct extra_type *pextra)
Adjust freeciv-3.0 ruleset extra definitions to freeciv-3.1.
Definition: rscompat.cpp:1524
bool rscompat_auto_attack_3_1(struct rscompat_info *compat, struct action_auto_perf *auto_perf, size_t psize, enum unit_type_flag_id *protecor_flag)
Replace deprecated auto_attack configuration.
Definition: rscompat.cpp:1239
bool rscompat_old_effect_3_1(const char *type, struct section_file *file, const char *sec_name, struct rscompat_info *compat)
Check if effect name refers to one of the removed effects, and handle it if it does.
Definition: rscompat.cpp:606
bool rscompat_names(struct rscompat_info *info)
Do compatibility things with names before they are referred to.
Definition: rscompat.cpp:325
bool rscompat_old_slow_invasions_3_1(struct rscompat_info *compat, bool slow_invasions)
Replace slow_invasions and friends.
Definition: rscompat.cpp:1277
void rscompat_postprocess(struct rscompat_info *info)
Do compatibility things after regular ruleset loading.
Definition: rscompat.cpp:640
const char * rscompat_utype_flag_name_3_1(struct rscompat_info *info, const char *old_type)
Replace deprecated unit type flag names with currently valid ones.
Definition: rscompat.cpp:1515
void(* rs_conversion_logger)(const char *msg)
Definition: ruleset.h:43
static struct compatibility compat[]
Definition: savecompat.cpp:109
bool compat_mode
Definition: rscompat.h:24
int ver_techs
Definition: rscompat.h:33
int ver_cities
Definition: rscompat.h:27
int ver_styles
Definition: rscompat.h:32
int ver_terrain
Definition: rscompat.h:34
int ver_nations
Definition: rscompat.h:31
int ver_buildings
Definition: rscompat.h:26
int ver_effects
Definition: rscompat.h:28
rs_conversion_logger log_cb
Definition: rscompat.h:25
QByteArray cap_effects
Definition: rscompat.h:36
int ver_game
Definition: rscompat.h:29
int ver_units
Definition: rscompat.h:35
int ver_governments
Definition: rscompat.h:30