Skip to content

Commit 302a326

Browse files
committed
Added configurable age labels
1 parent 4752c5b commit 302a326

5 files changed

Lines changed: 26 additions & 6 deletions

File tree

‎AoKHBlacksmith.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ This software is published under the MIT/X11 license. Please read the LICENSE fo
4545

4646
[b]Updates[/b]
4747

48+
[u]1.2.5[/u]
49+
- The DLL-IDs of the labels below the age emblems are no longer hardcoded (useful for mods that change age names to something that doesn't end with "Age", like "Renaissance")
50+
Note: This update breaks compatibility with files that were created with a version prior to 1.2.2; use one of the versions 1.2.2-1.2.4 to convert those files first!
51+
4852
[u]1.2.4[/u]
4953
View:
5054
- Fixed crash when opening the tech tree during a game (thanks to danielpereira for reporting it and providing test data)

‎LICENSE‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015-2017 Jan Wichelmann
3+
Copyright (c) 2015-2018 Jan Wichelmann
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

‎TechTree/TechTreeDesign.cpp‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extern int(__cdecl *ReadDataFromCompressedFile)(int fileHandle, char *dataBuffer
1919
TechTreeDesign::TechTreeDesign(int datFileHandle)
2020
{
2121
// Read and check version marker
22-
const unsigned char TECH_TREE_DESIGN_VERSION = 1;
22+
const unsigned char TECH_TREE_DESIGN_VERSION = 2;
2323
unsigned char techTreeDesignVersion;
2424
ReadDataFromCompressedFile(datFileHandle, reinterpret_cast<char *>(&techTreeDesignVersion), 1);
2525
if(techTreeDesignVersion != TECH_TREE_DESIGN_VERSION)
@@ -108,6 +108,13 @@ TechTreeDesign::TechTreeDesign(int datFileHandle)
108108
ReadDataFromCompressedFile(datFileHandle, reinterpret_cast<char *>(&nodeBackgroundCount), 4);
109109
for(int i = 0; i < nodeBackgroundCount; i++)
110110
_nodeTypes.push_back(new NodeType(datFileHandle));
111+
112+
// Read age label data
113+
ReadDataFromCompressedFile(datFileHandle, reinterpret_cast<char *>(&_firstLineBaseDllId), 4);
114+
ReadDataFromCompressedFile(datFileHandle, reinterpret_cast<char *>(&_secondLineDllId), 4);
115+
char tmp;
116+
ReadDataFromCompressedFile(datFileHandle, &tmp, 1);
117+
_incrementSecondLineDllId = tmp > 0;
111118
}
112119

113120
TechTreeDesign::~TechTreeDesign()

‎TechTree/TechTreeDesign.h‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@ class TechTreeDesign
168168
// The first three indices match the TechTreeElement::ItemType members, so each node type has a default background design.
169169
std::vector<NodeType *> _nodeTypes;
170170

171+
// The base DLL ID of the first line of the age labels.
172+
int _firstLineBaseDllId;
173+
174+
// The DLL ID of the second line of the age labels.
175+
int _secondLineDllId;
176+
177+
// Determines whether the DLL ID of the second line of the age labels should be incremented for each age (like the first line ID)
178+
bool _incrementSecondLineDllId;
179+
171180
public:
172181
// Constructor. Reads the tech tree element data from the given DAT file handle.
173182
// Parameters:

‎TechTree/TechTreeWindow.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,10 @@ TechTreeWindow *TechTreeWindow::Constructor(Window *underlyingWindow, int unknow
257257
}
258258

259259
// Set label texts
260-
static_cast<LabelControlVTable *>(_ageLabels[i][0][0]->_VTable)->AssignTextFromLanguageDlls(_ageLabels[i][0][0], 20110 + i);
261-
static_cast<LabelControlVTable *>(_ageLabels[i][0][1]->_VTable)->AssignTextFromLanguageDlls(_ageLabels[i][0][1], 20114);
262-
static_cast<LabelControlVTable *>(_ageLabels[i][1][0]->_VTable)->AssignTextFromLanguageDlls(_ageLabels[i][1][0], 20110 + i);
263-
static_cast<LabelControlVTable *>(_ageLabels[i][1][1]->_VTable)->AssignTextFromLanguageDlls(_ageLabels[i][1][1], 20114);
260+
static_cast<LabelControlVTable *>(_ageLabels[i][0][0]->_VTable)->AssignTextFromLanguageDlls(_ageLabels[i][0][0], _designData->_firstLineBaseDllId + i);
261+
static_cast<LabelControlVTable *>(_ageLabels[i][0][1]->_VTable)->AssignTextFromLanguageDlls(_ageLabels[i][0][1], _designData->_secondLineDllId + (_designData->_incrementSecondLineDllId ? i : 0));
262+
static_cast<LabelControlVTable *>(_ageLabels[i][1][0]->_VTable)->AssignTextFromLanguageDlls(_ageLabels[i][1][0], _designData->_firstLineBaseDllId + i);
263+
static_cast<LabelControlVTable *>(_ageLabels[i][1][1]->_VTable)->AssignTextFromLanguageDlls(_ageLabels[i][1][1], _designData->_secondLineDllId + (_designData->_incrementSecondLineDllId ? i : 0));
264264
}
265265

266266
// Create popup label

0 commit comments

Comments
 (0)