tech research refactoring

This commit is contained in:
devZoGok
2024-03-30 09:41:52 +02:00
parent f9889f145d
commit 541cc7ff25
9 changed files with 12 additions and 17 deletions
+10 -12
View File
@@ -38,10 +38,10 @@ gui = {
pos = {x = Pos.x + margin.left, y = Pos.y + margin.top + 2 * heightOffset},
size = techButtonSize,
name = "Research",
imagePath = baseTechPath .. 'fpt.jpg',
imagePath = baseTechPath .. 'cruisers.jpg',
guiType = GuiType.BUTTON,
buttonType = ButtonType.RESEARCH,
techId = TechId.FPT,
techId = TechId.CRUISERS,
trigger = 82,
},
{
@@ -58,20 +58,20 @@ gui = {
pos = {x = Pos.x + .5 * (Size.x - 3 * techButtonSize.x), y = Pos.y + margin.top + 2 * heightOffset},
size = techButtonSize,
name = "Research",
imagePath = baseTechPath .. 'ept.jpg',
imagePath = baseTechPath .. 'stealth.jpg',
guiType = GuiType.BUTTON,
buttonType = ButtonType.RESEARCH,
techId = TechId.EFT,
techId = TechId.ST_SUB,
trigger = 82,
},
{
pos = {x = Pos.x + .5 * (Size.x + 3 * techButtonSize.x), y = Pos.y + margin.top + 2 * heightOffset},
size = techButtonSize,
name = "Research",
imagePath = baseTechPath .. 'ept.jpg',
imagePath = baseTechPath .. 'robo.jpg',
guiType = GuiType.BUTTON,
buttonType = ButtonType.RESEARCH,
techId = TechId.EFT,
techId = TechId.ROBO,
trigger = 82,
},
{
@@ -88,22 +88,20 @@ gui = {
pos = {x = Pos.x + Size.x - (margin.right + 3 * techButtonSize.x), y = Pos.y + margin.top + 2 * heightOffset},
size = techButtonSize,
name = "Research",
imagePath = baseTechPath .. 'pct.jpg',
imagePath = baseTechPath .. 'carriers.jpg',
guiType = GuiType.BUTTON,
buttonType = ButtonType.RESEARCH,
techId = TechId.PCT,
techId = TechId.CARRIERS,
trigger = 82,
},
{
pos = {x = Pos.x + Size.x - (margin.right + techButtonSize.x), y = Pos.y + margin.top + 2 * heightOffset},
size = techButtonSize,
name = "Research",
imagePath = baseTechPath .. 'pct.jpg',
imagePath = baseTechPath .. 'tanks.jpg',
guiType = GuiType.BUTTON,
buttonType = ButtonType.RESEARCH,
techId = TechId.PCT,
techId = TechId.TANKS,
trigger = 82,
},
--[[
]]--
}

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

-2
View File
@@ -244,13 +244,11 @@ namespace battleship{
sol::table techTable = SOL_LUA_VIEW[techKey][i + 1];
Technology t;
t.id = techTable["id"];
t.cost = techTable["cost"];
t.name = techTable["name"];
t.icon = techTable["icon"];
t.description = techTable["description"];
t.parents = parseTechTable(i, techKey, "numParents", "parents");
t.children = parseTechTable(i, techKey, "numChildren", "children");
t.abilities = parseTechTable(i, techKey, "numAbilities", "abilities");
technologies.push_back(t);
+1 -1
View File
@@ -60,7 +60,7 @@ namespace battleship{
bool hasTechParents = true;
for(int tp : techParents)
if(find(technologies.begin(), technologies.end(), techId) == technologies.end()){
if(find(technologies.begin(), technologies.end(), tp) == technologies.end()){
hasTechParents = false;
break;
}
+1 -2
View File
@@ -6,12 +6,11 @@
namespace battleship{
struct Technology{
int id, cost;
int cost;
std::string name;
std::string icon;
std::string description;
std::vector<int> parents;
std::vector<int> children;
std::vector<int> abilities;
};
}