Skip to content

Commit

Permalink
Separate patches into dedicated source files
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscoDA authored Jan 29, 2021
1 parent 36ecd96 commit bcb4d32
Show file tree
Hide file tree
Showing 19 changed files with 861 additions and 793 deletions.
25 changes: 25 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
Language: Cpp
IndentWidth: 4
UseTab: Never
DerivePointerAlignment: false
PointerAlignment: Right
IncludeBlocks: Merge
IncludeCategories:
- Regex: '<[^>]+>'
Priority: 1
- Regex: '"[^"]+"'
Priority: 2
SpacesInCStyleCastParentheses: false
SpacesInAngles: false
SpacesInParentheses: false
SpaceInEmptyParentheses: false
Standard: c++17
ColumnLimit: 120
IndentCaseBlocks: true
InsertTrailingCommas: Wrapped
BinPackArguments: false
SpacesBeforeTrailingComments: 2
AlignTrailingComments: true
MaxEmptyLinesToKeep: 2
---
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ 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
ids.h
)
set_property(TARGET create-data-mod PROPERTY CXX_STANDARD 17)
target_link_libraries(create-data-mod genieutils)
16 changes: 12 additions & 4 deletions create-data-mod.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#include "genie/dat/DatFile.h"
#include "patches.h"
#include <string>
#include "genie/dat/DatFile.h"
#include "patches/community_games.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"


using namespace std;
const char *const COMMUNITY_GAMES = "community-games";
Expand Down Expand Up @@ -63,6 +70,7 @@ int main(int argc, char **argv) {
return 0;
}


void applyModifications(genie::DatFile *df, const string &modIdentifier) {
if (COMMUNITY_GAMES == modIdentifier) {
configureCommunityGamesMod(df);
Expand Down Expand Up @@ -91,13 +99,15 @@ void applyModifications(genie::DatFile *df, const string &modIdentifier) {
}
}


void printModIdentifiers(const vector<string> &modIdentifiers) {
cout << "Applying the following modifications in order:" << endl;
for (const string &modIdentifier : modIdentifiers) {
cout << "\t" << modIdentifier << endl;
}
}


vector<string> getModIdentifiers(char *const *argv) {
string s = argv[1];
string delimiter = "+";
Expand All @@ -113,5 +123,3 @@ vector<string> getModIdentifiers(char *const *argv) {
modIdentifiers.push_back(s.substr(start, end));
return modIdentifiers;
}


Loading

0 comments on commit bcb4d32

Please sign in to comment.