Further fixes
This commit is contained in:
parent
2bc741b7b2
commit
51d150e0ec
3 changed files with 17 additions and 5 deletions
|
@ -40,11 +40,20 @@
|
|||
class CFile;
|
||||
class CPlayer;
|
||||
class CUpgrade;
|
||||
class CUnit;
|
||||
class CUpgradeModifier;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Variables
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/// How many upgrades modifiers supported
|
||||
#define UPGRADE_MODIFIERS_MAX (UpgradeMax * 4)
|
||||
|
||||
extern CUpgradeModifier *UpgradeModifiers[UPGRADE_MODIFIERS_MAX];
|
||||
|
||||
extern int NumUpgradeModifiers;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Functions
|
||||
----------------------------------------------------------------------------*/
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "unit_manager.h"
|
||||
#include "unitsound.h"
|
||||
#include "unittype.h"
|
||||
#include "upgrade.h"
|
||||
#include "video.h"
|
||||
|
||||
#include <math.h>
|
||||
|
|
|
@ -67,12 +67,10 @@ static void AllowUnitId(CPlayer &player, int id, int units);
|
|||
|
||||
std::vector<CUpgrade *> AllUpgrades; /// The main user useable upgrades
|
||||
|
||||
/// How many upgrades modifiers supported
|
||||
#define UPGRADE_MODIFIERS_MAX (UpgradeMax * 4)
|
||||
/// Upgrades modifiers
|
||||
static CUpgradeModifier *UpgradeModifiers[UPGRADE_MODIFIERS_MAX];
|
||||
CUpgradeModifier *UpgradeModifiers[UPGRADE_MODIFIERS_MAX];
|
||||
/// Number of upgrades modifiers used
|
||||
static int NumUpgradeModifiers;
|
||||
int NumUpgradeModifiers;
|
||||
|
||||
std::map<std::string, CUpgrade *> Upgrades;
|
||||
|
||||
|
@ -255,7 +253,11 @@ static int CclDefineModifier(lua_State *l)
|
|||
um->ModifyPercent = new int[UnitTypeVar.GetNumberVariable()];
|
||||
memset(um->ModifyPercent, 0, UnitTypeVar.GetNumberVariable() * sizeof(int));
|
||||
|
||||
um->UpgradeId = UpgradeIdByIdent(LuaToString(l, 1));
|
||||
std::string upgrade_ident = LuaToString(l, 1);
|
||||
um->UpgradeId = UpgradeIdByIdent(upgrade_ident);
|
||||
if (um->UpgradeId == -1) {
|
||||
LuaError(l, "Error when defining upgrade modifier: upgrade \"%s\" doesn't exist." _C_ upgrade_ident.c_str());
|
||||
}
|
||||
|
||||
for (int j = 1; j < args; ++j) {
|
||||
if (!lua_istable(l, j + 1)) {
|
||||
|
|
Loading…
Reference in a new issue