From 7194db47ffd7199569156a068dda4973c3324f57 Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sun, 3 Mar 2024 14:42:16 +0200 Subject: [PATCH] minor fixes and improvements --- Assets/Scripts/Abilities/abilityData.lua | 6 ++++-- Assets/Scripts/Technologies/technologyData.lua | 10 +++++----- game.cpp | 3 ++- game.h | 1 + player.cpp | 1 + player.h | 1 + researchStruct.cpp | 1 + researchStruct.h | 2 +- 8 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Assets/Scripts/Abilities/abilityData.lua b/Assets/Scripts/Abilities/abilityData.lua index c2dd186..d3d3ab5 100644 --- a/Assets/Scripts/Abilities/abilityData.lua +++ b/Assets/Scripts/Abilities/abilityData.lua @@ -11,9 +11,11 @@ AbilityType = { LOAD_SPEED = 8, DRAW_RATE = 9, DRAW_SPEED = 10, - HACK_RANGE = 11 + HACK_RANGE = 11, + UNIT_UNLOCK = 12 } abilities = { - {type = AbilityType.SPEED, gameObjType = 0, ammount = .4, gameObjIds = {UnitId.WAR_MECH}} + {type = AbilityType.SPEED, gameObjType = 0, ammount = .4, gameObjIds = {UnitId.WAR_MECH}}, + {type = AbilityType.UNIT_UNLOCK, gameObjType = 0, gameObjIds = {UnitId.WAR_MECH}}, } diff --git a/Assets/Scripts/Technologies/technologyData.lua b/Assets/Scripts/Technologies/technologyData.lua index 0c7324f..74b412f 100644 --- a/Assets/Scripts/Technologies/technologyData.lua +++ b/Assets/Scripts/Technologies/technologyData.lua @@ -1,4 +1,4 @@ -TechnologyId = { +TechId = { APT = 0, EFT = 1, PCT = 2, @@ -7,7 +7,7 @@ TechnologyId = { technologies = { { - id = TechnologyId.APT, + id = TechId.APT, name = 'Advanced power technology', cost = 1000, icon = '', @@ -17,7 +17,7 @@ technologies = { abilities = {0}, }, { - id = TechnologyId.EFT, + id = TechId.EFT, name = 'Energy field technology', cost = 1000, icon = '', @@ -27,7 +27,7 @@ technologies = { abilities = {}, }, { - id = TechnologyId.PCT, + id = TechId.PCT, name = 'Plasma casting technology', cost = 1000, icon = '', @@ -37,7 +37,7 @@ technologies = { abilities = {}, }, { - id = TechnologyId.FPT, + id = TechId.FPT, name = 'Fusion power technology', cost = 1000, icon = '', diff --git a/game.cpp b/game.cpp index 9d65e11..fe17b11 100644 --- a/game.cpp +++ b/game.cpp @@ -231,6 +231,7 @@ namespace battleship{ return varVec; } + //TODO clean this method up void Game::initTechnologies(){ technologies.clear(); @@ -264,7 +265,7 @@ namespace battleship{ Ability ability; ability.type = techTable["type"]; - ability.ammount = techTable["ammount"]; + ability.ammount = techTable["ammount"].get_or(0); ability.gameObjType = techTable["gameObjType"]; ability.gameObjIds = parseTechTable(i, techKey, "numGameObjIds", "gameObjIds"); abilities.push_back(ability); diff --git a/game.h b/game.h index 294f3ee..af76b46 100644 --- a/game.h +++ b/game.h @@ -32,6 +32,7 @@ namespace battleship{ inline std::vector& getPlayers(){return players;} inline Player* getPlayer(int id){return players[id];} inline int getNumPlayers(){return players.size();} + inline Technology getTechnology(int id){return technologies[id];} private: Game(){} void resetLuaGameObjects(); diff --git a/player.cpp b/player.cpp index 26faa92..2195442 100755 --- a/player.cpp +++ b/player.cpp @@ -2,6 +2,7 @@ #include "player.h" #include "structure.h" +#include "projectile.h" #include "stateManager.h" #include "activeGameState.h" #include "resourceDeposit.h" diff --git a/player.h b/player.h index d8d5666..a6a8a2e 100755 --- a/player.h +++ b/player.h @@ -9,6 +9,7 @@ namespace battleship{ class ResourceDeposit; class Projectile; + class Unit; class Player { public: diff --git a/researchStruct.cpp b/researchStruct.cpp index 8a725f4..c6848c3 100644 --- a/researchStruct.cpp +++ b/researchStruct.cpp @@ -1,5 +1,6 @@ #include "researchStruct.h" #include "player.h" +#include "game.h" namespace battleship{ using namespace std; diff --git a/researchStruct.h b/researchStruct.h index 21e085f..49ebc45 100644 --- a/researchStruct.h +++ b/researchStruct.h @@ -14,7 +14,7 @@ namespace battleship{ int researchCost, generationRate, generationSpeed, researchStatus = 0; std::vector researchQueue; - bool canUpdateResearch(){return vb01::getTime() - lastGenTime > generationRate;} + bool canUpdateResearch(){return vb01::getTime() - lastUpdateTime > generationRate;} void generateResearch(); }; }