Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: Add mod to multiply civilization bonuses. #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang_complete
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-I./genieutils/include
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ build
*.exe
*.out
*.app

# vs code
.vscode
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++")
add_subdirectory(genieutils EXCLUDE_FROM_ALL)
include_directories(
"genieutils/include"
"."
)
add_executable(create-data-mod create-data-mod.cpp patches.cpp ids.h)
add_executable(
create-data-mod
create-data-mod.cpp
patches/community_games.cpp
patches/exploding_villagers.cpp
patches/flying_dutchman.cpp
patches/kidnap.cpp
patches/no_wall.cpp
patches/random_costs.cpp
patches/duplicate_techs.cpp
patches/duplicate_civ_bonuses.cpp
ids.h
)
set_property(TARGET create-data-mod PROPERTY CXX_STANDARD 17)
target_link_libraries(create-data-mod genieutils)
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Just install stuff until it stops complaining I guess, sorry.
```sh
git clone --recurse-submodules https://github.com/SiegeEngineers/auto-mods.git
cd auto-mods
./patchGenieutils.sh
patch -d genieutils <genieutils.patch
mkdir build
cd build
cmake ..
Expand Down Expand Up @@ -56,6 +56,8 @@ Where <mod-identifier> is one of the following, or multiple of the following joi
x3
x9
x256
x3-civ-bonus
x9-civ-bonus
```

For example, in order to patch the current dat file with the Flying Dutchman modifications, one might execute
Expand Down
20 changes: 19 additions & 1 deletion create-data-mod.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
#include "genie/dat/DatFile.h"
#include "patches.h"

#include "patches/community_games.h"
#include "patches/duplicate_civ_bonuses.h"
#include "patches/duplicate_techs.h"
#include "patches/exploding_villagers.h"
#include "patches/flying_dutchman.h"
#include "patches/kidnap.h"
#include "patches/no_wall.h"
#include "patches/random_costs.h"

#include <string>


using namespace std;
const char *const COMMUNITY_GAMES = "community-games";
const char *const EXPLODING_VILLAGERS = "exploding-villagers";
Expand All @@ -14,6 +24,8 @@ const char *const RANDOM_UNIT_COSTS = "random-unit-costs";
const char *const X_256_TECH = "x256";
const char *const X_3_TECH = "x3";
const char *const X_9_TECH = "x9";
const char *const X_3_CIV_BONUS = "x3-civ-bonus";
const char *const X_9_CIV_BONUS = "x9-civ-bonus";

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

Expand All @@ -38,6 +50,8 @@ int main(int argc, char **argv) {
cout << " " << X_3_TECH << endl;
cout << " " << X_9_TECH << endl;
cout << " " << X_256_TECH << endl;
cout << " " << X_3_CIV_BONUS << endl;
cout << " " << X_9_CIV_BONUS << endl;
return 1;
}

Expand Down Expand Up @@ -86,6 +100,10 @@ void applyModifications(genie::DatFile *df, const string &modIdentifier) {
duplicateTechs(df, 9);
} else if (X_256_TECH == modIdentifier) {
duplicateTechs(df, 256);
} else if (X_3_CIV_BONUS == modIdentifier) {
multiplyCivilizationBonuses(df, 3);
} else if (X_9_CIV_BONUS == modIdentifier) {
multiplyCivilizationBonuses(df, 9);
} else {
cout << "Unknown mod identifier: '" << modIdentifier << "'" << endl;
}
Expand Down
2 changes: 1 addition & 1 deletion genieutils
30 changes: 30 additions & 0 deletions genieutils.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b4b3abb..760a912 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,11 +12,11 @@ project(genieutils)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/)
#set(CMAKE_CXX_FLAGS "-std=gnu++0x")

-#set(Boost_USE_STATIC_LIBS ON)
+set(Boost_USE_STATIC_LIBS ON)
#set(Boost_USE_STATIC_RUNTIME ON)
set(Boost_USE_MULTITHREADED ON)

-find_library(iconv REQUIRED)
+find_library(iconv iconv REQUIRED)

# dependencies:

@@ -158,9 +158,9 @@ set(BINCOMP_SRC src/tools/bincompare/bincomp.cpp
# Executeable:
#------------------------------------------------------------------------------#

-add_library(${Genieutils_LIBRARY} SHARED ${FILE_SRC} ${LANG_SRC} ${DAT_SRC}
+add_library(${Genieutils_LIBRARY} STATIC ${FILE_SRC} ${LANG_SRC} ${DAT_SRC}
${RESOURCE_SRC} ${UTIL_SRC} ${SCRIPT_SRC} )
-target_link_libraries(${Genieutils_LIBRARY} ${ZLIB_LIBRARIES} ${Boost_LIBRARIES} ${ICONV_LIBRARIES})
+target_link_libraries(${Genieutils_LIBRARY} ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${ICONV_LIBRARIES})

#add_executable(main main.cpp)
#target_link_libraries(main ${Genieutils_LIBRARY})
49 changes: 48 additions & 1 deletion ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,59 @@ static const int TYPE_FOOD = 0;
static const int TYPE_WOOD = 1;
static const int TYPE_STONE = 2;
static const int TYPE_GOLD = 3;
static const int TYPE_RESEARCH_COST_MODIFIER = 85;
static const int TYPE_RESEARCH_TIME_MODIFIER = 86;
static const int TYPE_GOLD_MINING_PRODUCTIVITY = 47;
static const int TYPE_STONE_MINING_PRODUCTIVITY = 79;
static const int TYPE_WOOD_CHOPPING_PRODUCTIVITY = 189;
static const int TYPE_FOOD_GATHERING_PRODUCTIVITY = 190;
static const int TYPE_FOOD_HERDING_PRODUCTIVITY = 216;

enum class AttributeType : uint16_t {
HITPOINTS = 0,
ARMOR = 8,
ATTACK = 9,
BONUS_DAMAGE_RESISTANCE = 24,
};

static const int ID_SCOUT = 448;
static const int ID_EAGLE_SCOUT = 751;
static const int ID_MADRASAH_MONK = 412;
static const int ACTION_KIDNAP_UNIT = 135;
static const int ACTION_LOOT = 122;
static const int CLASS_CIVILIAN = 4;
static const int CLASS_BUILDING = 3;

#endif //CREATE_DATA_MOD_IDS_H
static const int ID_EMPTY_TC_ANNEX = 890;

enum class EffectId : uint16_t {
HUNS_100_WOOD = 214,
PERSIANS_TC_HITPOINTS = 340,
PERSIANS_DOCK_HITPOINTS = 347,
PERSIANS_KAMANDARAN = 547,
BYZANTINE_BUILDING_HP_DARK = 282,
BYZANTINE_BUILDING_HP_FEUDAL = 429,
BYZANTINE_BUILDING_HP_CASTLE = 430,
BYZANTINE_BUILDING_HP_IMPERIAL = 431,
MAYAN_TECH_TREE = 449,
SARACEN_MARKET_BONUS = 354,
SARACEN_MADRASAH = 545,
};

enum class CommandType : int8_t {
SET_ATTRIBUTE_MODIFIER = 0,
RESOURCE_MODIFIER = 1,
ENABLE_DISABLE_UNIT = 2,
UPGRADE_UNIT = 3,
ATTRIBUTE_MODIFIER = 4,
ATTRIBUTE_MULTIPLIER = 5,
RESOURCE_MULTIPLIER = 6,
SPAWN_UNIT = 7,
SET_TEAM_ATTRIBUTE_MODIFIER = 10,
TEAM_ATTRIBUTE_MODIFIER = 11,
TECH_COST_MODIFIER = 101,
DISABLE_TECH = 102,
TECH_TIME_MODIFIER = 103,
};

#endif // CREATE_DATA_MOD_IDS_H
5 changes: 0 additions & 5 deletions patchGenieutils.sh

This file was deleted.

Loading