Skip to content

Commit 857db09

Browse files
committed
Add mod to multiply civilization bonuses. Refactor patches into multiple source files. Refactor genieutils patching method to use a patchfile instead of sed
1 parent e47a6b7 commit 857db09

26 files changed

+1196
-796
lines changed

.clang_complete

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-I./genieutils/include

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ build
3636
*.exe
3737
*.out
3838
*.app
39+
40+
# vs code
41+
.vscode

CMakeLists.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++")
44
add_subdirectory(genieutils EXCLUDE_FROM_ALL)
55
include_directories(
66
"genieutils/include"
7+
"."
78
)
8-
add_executable(create-data-mod create-data-mod.cpp patches.cpp ids.h)
9+
add_executable(
10+
create-data-mod
11+
create-data-mod.cpp
12+
patches/community_games.cpp
13+
patches/exploding_villagers.cpp
14+
patches/flying_dutchman.cpp
15+
patches/kidnap.cpp
16+
patches/no_wall.cpp
17+
patches/random_costs.cpp
18+
patches/duplicate_techs.cpp
19+
patches/duplicate_civ_bonuses.cpp
20+
ids.h
21+
)
22+
set_property(TARGET create-data-mod PROPERTY CXX_STANDARD 17)
923
target_link_libraries(create-data-mod genieutils)

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Just install stuff until it stops complaining I guess, sorry.
2828
```sh
2929
git clone --recurse-submodules https://github.com/SiegeEngineers/auto-mods.git
3030
cd auto-mods
31-
./patchGenieutils.sh
31+
patch -d genieutils <genieutils.patch
3232
mkdir build
3333
cd build
3434
cmake ..
@@ -56,6 +56,8 @@ Where <mod-identifier> is one of the following, or multiple of the following joi
5656
x3
5757
x9
5858
x256
59+
x3-civ-bonus
60+
x9-civ-bonus
5961
```
6062

6163
For example, in order to patch the current dat file with the Flying Dutchman modifications, one might execute

create-data-mod.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
#include "genie/dat/DatFile.h"
2-
#include "patches.h"
2+
3+
#include "patches/community_games.h"
4+
#include "patches/duplicate_civ_bonuses.h"
5+
#include "patches/duplicate_techs.h"
6+
#include "patches/exploding_villagers.h"
7+
#include "patches/flying_dutchman.h"
8+
#include "patches/kidnap.h"
9+
#include "patches/no_wall.h"
10+
#include "patches/random_costs.h"
11+
312
#include <string>
413

14+
515
using namespace std;
616
const char *const COMMUNITY_GAMES = "community-games";
717
const char *const EXPLODING_VILLAGERS = "exploding-villagers";
@@ -14,6 +24,8 @@ const char *const RANDOM_UNIT_COSTS = "random-unit-costs";
1424
const char *const X_256_TECH = "x256";
1525
const char *const X_3_TECH = "x3";
1626
const char *const X_9_TECH = "x9";
27+
const char *const X_3_CIV_BONUS = "x3-civ-bonus";
28+
const char *const X_9_CIV_BONUS = "x9-civ-bonus";
1729

1830
vector<string> getModIdentifiers(char *const *argv);
1931

@@ -38,6 +50,8 @@ int main(int argc, char **argv) {
3850
cout << " " << X_3_TECH << endl;
3951
cout << " " << X_9_TECH << endl;
4052
cout << " " << X_256_TECH << endl;
53+
cout << " " << X_3_CIV_BONUS << endl;
54+
cout << " " << X_9_CIV_BONUS << endl;
4155
return 1;
4256
}
4357

@@ -86,6 +100,10 @@ void applyModifications(genie::DatFile *df, const string &modIdentifier) {
86100
duplicateTechs(df, 9);
87101
} else if (X_256_TECH == modIdentifier) {
88102
duplicateTechs(df, 256);
103+
} else if (X_3_CIV_BONUS == modIdentifier) {
104+
multiplyCivilizationBonuses(df, 3);
105+
} else if (X_9_CIV_BONUS == modIdentifier) {
106+
multiplyCivilizationBonuses(df, 9);
89107
} else {
90108
cout << "Unknown mod identifier: '" << modIdentifier << "'" << endl;
91109
}

genieutils.patch

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index b4b3abb..760a912 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -12,11 +12,11 @@ project(genieutils)
6+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/)
7+
#set(CMAKE_CXX_FLAGS "-std=gnu++0x")
8+
9+
-#set(Boost_USE_STATIC_LIBS ON)
10+
+set(Boost_USE_STATIC_LIBS ON)
11+
#set(Boost_USE_STATIC_RUNTIME ON)
12+
set(Boost_USE_MULTITHREADED ON)
13+
14+
-find_library(iconv REQUIRED)
15+
+find_library(iconv iconv REQUIRED)
16+
17+
# dependencies:
18+
19+
@@ -158,9 +158,9 @@ set(BINCOMP_SRC src/tools/bincompare/bincomp.cpp
20+
# Executeable:
21+
#------------------------------------------------------------------------------#
22+
23+
-add_library(${Genieutils_LIBRARY} SHARED ${FILE_SRC} ${LANG_SRC} ${DAT_SRC}
24+
+add_library(${Genieutils_LIBRARY} STATIC ${FILE_SRC} ${LANG_SRC} ${DAT_SRC}
25+
${RESOURCE_SRC} ${UTIL_SRC} ${SCRIPT_SRC} )
26+
-target_link_libraries(${Genieutils_LIBRARY} ${ZLIB_LIBRARIES} ${Boost_LIBRARIES} ${ICONV_LIBRARIES})
27+
+target_link_libraries(${Genieutils_LIBRARY} ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${ICONV_LIBRARIES})
28+
29+
#add_executable(main main.cpp)
30+
#target_link_libraries(main ${Genieutils_LIBRARY})

ids.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,45 @@ static const int TYPE_FOOD = 0;
203203
static const int TYPE_WOOD = 1;
204204
static const int TYPE_STONE = 2;
205205
static const int TYPE_GOLD = 3;
206+
static const int TYPE_RESEARCH_COST_MODIFIER = 85;
207+
static const int TYPE_RESEARCH_TIME_MODIFIER = 86;
208+
static const int TYPE_GOLD_MINING_PRODUCTIVITY = 47;
209+
static const int TYPE_STONE_MINING_PRODUCTIVITY = 79;
210+
static const int TYPE_WOOD_CHOPPING_PRODUCTIVITY = 189;
211+
static const int TYPE_FOOD_GATHERING_PRODUCTIVITY = 190;
212+
static const int TYPE_FOOD_HERDING_PRODUCTIVITY = 216;
206213

207214
static const int ID_SCOUT = 448;
208215
static const int ID_EAGLE_SCOUT = 751;
216+
static const int ID_MADARASH_MONK = 412;
209217
static const int ACTION_KIDNAP_UNIT = 135;
210218
static const int ACTION_LOOT = 122;
211219
static const int CLASS_CIVILIAN = 4;
212220
static const int CLASS_BUILDING = 3;
213221

222+
static const int ID_EMPTY_TC_ANNEX = 890;
223+
224+
static const int EFFECT_ID_HUNS_100_WOOD = 214;
225+
static const int EFFECT_ID_PERSIANS_TC_HITPOINTS = 340;
226+
static const int EFFECT_ID_PERSIANS_DOCK_HITPOINTS = 347;
227+
static const int EFFECT_ID_PERSIANS_KAMANDARAN = 547;
228+
static const int EFFECT_ID_BYZANTINE_BUILDING_BONUS_HP_DARK = 283;
229+
static const int EFFECT_ID_BYZANTINE_BUILDING_BONUS_HP_FEUDAL = 429;
230+
static const int EFFECT_ID_BYZANTINE_BUILDING_BONUS_HP_CASTLE = 430;
231+
static const int EFFECT_ID_BYZANTINE_BUILDING_BONUS_HP_IMPERIAL = 431;
232+
static const int EFFECT_ID_MAYAN_TECH_TREE = 449;
233+
static const int EFFECT_ID_SARACEN_MARKET_BONUS = 354;
234+
static const int EFFECT_ID_SARACEN_MADARASH = 545;
235+
236+
237+
static const int COMMAND_RESOURCE_MODIFIER = 1;
238+
static const int COMMAND_UPGRADE_UNIT = 3;
239+
static const int COMMAND_ATTRIBUTE_MODIFIER = 4;
240+
static const int COMMAND_ATTRIBUTE_MULTIPLIER = 5;
241+
static const int COMMAND_TEAM_ATTRIBUTE_MODIFIER = 10;
242+
static const int COMMAND_TECH_COST_MODIFIER = 101;
243+
static const int COMMAND_DISABLE_TECH = 102;
244+
static const int COMMAND_TECH_TIME_MODIFIER = 103;
245+
246+
214247
#endif //CREATE_DATA_MOD_IDS_H

patchGenieutils.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)