minor fixes and improvements

This commit is contained in:
devZoGok
2024-03-03 14:42:16 +02:00
parent b9f01da844
commit 7194db47ff
8 changed files with 16 additions and 9 deletions
+4 -2
View File
@@ -11,9 +11,11 @@ AbilityType = {
LOAD_SPEED = 8, LOAD_SPEED = 8,
DRAW_RATE = 9, DRAW_RATE = 9,
DRAW_SPEED = 10, DRAW_SPEED = 10,
HACK_RANGE = 11 HACK_RANGE = 11,
UNIT_UNLOCK = 12
} }
abilities = { 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}},
} }
@@ -1,4 +1,4 @@
TechnologyId = { TechId = {
APT = 0, APT = 0,
EFT = 1, EFT = 1,
PCT = 2, PCT = 2,
@@ -7,7 +7,7 @@ TechnologyId = {
technologies = { technologies = {
{ {
id = TechnologyId.APT, id = TechId.APT,
name = 'Advanced power technology', name = 'Advanced power technology',
cost = 1000, cost = 1000,
icon = '', icon = '',
@@ -17,7 +17,7 @@ technologies = {
abilities = {0}, abilities = {0},
}, },
{ {
id = TechnologyId.EFT, id = TechId.EFT,
name = 'Energy field technology', name = 'Energy field technology',
cost = 1000, cost = 1000,
icon = '', icon = '',
@@ -27,7 +27,7 @@ technologies = {
abilities = {}, abilities = {},
}, },
{ {
id = TechnologyId.PCT, id = TechId.PCT,
name = 'Plasma casting technology', name = 'Plasma casting technology',
cost = 1000, cost = 1000,
icon = '', icon = '',
@@ -37,7 +37,7 @@ technologies = {
abilities = {}, abilities = {},
}, },
{ {
id = TechnologyId.FPT, id = TechId.FPT,
name = 'Fusion power technology', name = 'Fusion power technology',
cost = 1000, cost = 1000,
icon = '', icon = '',
+2 -1
View File
@@ -231,6 +231,7 @@ namespace battleship{
return varVec; return varVec;
} }
//TODO clean this method up
void Game::initTechnologies(){ void Game::initTechnologies(){
technologies.clear(); technologies.clear();
@@ -264,7 +265,7 @@ namespace battleship{
Ability ability; Ability ability;
ability.type = techTable["type"]; ability.type = techTable["type"];
ability.ammount = techTable["ammount"]; ability.ammount = techTable["ammount"].get_or(0);
ability.gameObjType = techTable["gameObjType"]; ability.gameObjType = techTable["gameObjType"];
ability.gameObjIds = parseTechTable(i, techKey, "numGameObjIds", "gameObjIds"); ability.gameObjIds = parseTechTable(i, techKey, "numGameObjIds", "gameObjIds");
abilities.push_back(ability); abilities.push_back(ability);
+1
View File
@@ -32,6 +32,7 @@ namespace battleship{
inline std::vector<Player*>& getPlayers(){return players;} inline std::vector<Player*>& getPlayers(){return players;}
inline Player* getPlayer(int id){return players[id];} inline Player* getPlayer(int id){return players[id];}
inline int getNumPlayers(){return players.size();} inline int getNumPlayers(){return players.size();}
inline Technology getTechnology(int id){return technologies[id];}
private: private:
Game(){} Game(){}
void resetLuaGameObjects(); void resetLuaGameObjects();
+1
View File
@@ -2,6 +2,7 @@
#include "player.h" #include "player.h"
#include "structure.h" #include "structure.h"
#include "projectile.h"
#include "stateManager.h" #include "stateManager.h"
#include "activeGameState.h" #include "activeGameState.h"
#include "resourceDeposit.h" #include "resourceDeposit.h"
+1
View File
@@ -9,6 +9,7 @@
namespace battleship{ namespace battleship{
class ResourceDeposit; class ResourceDeposit;
class Projectile; class Projectile;
class Unit;
class Player { class Player {
public: public:
+1
View File
@@ -1,5 +1,6 @@
#include "researchStruct.h" #include "researchStruct.h"
#include "player.h" #include "player.h"
#include "game.h"
namespace battleship{ namespace battleship{
using namespace std; using namespace std;
+1 -1
View File
@@ -14,7 +14,7 @@ namespace battleship{
int researchCost, generationRate, generationSpeed, researchStatus = 0; int researchCost, generationRate, generationSpeed, researchStatus = 0;
std::vector<int> researchQueue; std::vector<int> researchQueue;
bool canUpdateResearch(){return vb01::getTime() - lastGenTime > generationRate;} bool canUpdateResearch(){return vb01::getTime() - lastUpdateTime > generationRate;}
void generateResearch(); void generateResearch();
}; };
} }