Skip to content

Commit

Permalink
OK, here's some good stuff: 1) Added file including ALL effect types …
Browse files Browse the repository at this point in the history
…so we dont hard code numbers, 2) Finally finished reworking ModuleEffects and MEffect classes with a way to access the 'default' effect, if there is one, 3) finally fixed broken accessor uses of effect classes in ActiveModules.h and Modules.h files. NOW, I'm ready to start using this stuff in PassiveModules class to make changes to ship attributes when Passive modules are put Online and Offline :D and \o/
  • Loading branch information
aknorjaden committed Mar 15, 2012
1 parent 8d12a1d commit c572595
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 8 deletions.
1 change: 1 addition & 0 deletions include/eve-server/EVEServerPCH.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@
// item stuff
#include "inventory/AttributeEnum.h"
#include "inventory/AttributeMgr.h"
#include "inventory/EffectsEnum.h"
#include "inventory/EVEAttributeMgr.h"
#include "inventory/InvBrokerService.h"
#include "inventory/Inventory.h"
Expand Down
25 changes: 25 additions & 0 deletions include/eve-server/inventory/AttributeEnum.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*
------------------------------------------------------------------------------------
LICENSE:
------------------------------------------------------------------------------------
This file is part of EVEmu: EVE Online Server Emulator
Copyright 2006 - 2011 The EVEmu Team
For the latest information visit http://evemu.org
------------------------------------------------------------------------------------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------------
Author: Captnoord
*/

#ifndef AttributeEnum_h__
#define AttributeEnum_h__

Expand Down
8 changes: 7 additions & 1 deletion include/eve-server/ship/Modules/ActiveModules.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ class ActiveModule : public GenericModule
bool isLowPower() { return m_Effects->isLowSlot(); }
bool isRig() { return false; }
bool isSubSystem() { return false; }
bool requiresTarget() { return false; }//m_Effects->GetIsAssistance() || m_Effects->GetIsOffensive(); }
bool requiresTarget()
{
if( m_Effects->HasDefaultEffect() )
return m_Effects->GetDefaultEffect()->GetIsAssistance() || m_Effects->GetDefaultEffect()->GetIsOffensive();
else
return false;
}

protected:
ModifyShipAttributesComponent * m_ShipAttrComp;
Expand Down
3 changes: 3 additions & 0 deletions include/eve-server/ship/Modules/ModuleEffects.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ class ModuleEffects
bool isMediumSlot();
bool isLowSlot();
bool HasEffect(uint32 effectID);
bool HasDefaultEffect() { return ( (m_defaultEffect != NULL) ? true : false ); }
MEffect * GetDefaultEffect() { return m_defaultEffect; }
MEffect * GetEffect(uint32 effectID);

std::map<uint32, MEffect *>::const_iterator GetOnlineEffectsConstIterator() { return m_OnlineEffects.begin(); }
Expand All @@ -151,6 +153,7 @@ class ModuleEffects
std::map<uint32, MEffect *> m_OnlineEffects;
std::map<uint32, MEffect *> m_ActiveEffects;
std::map<uint32, MEffect *> m_OverloadEffects;
MEffect * m_defaultEffect;

uint32 m_typeID;

Expand Down
15 changes: 8 additions & 7 deletions include/eve-server/ship/Modules/Modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include "ship/Modules/ModuleDefs.h"
#include "ship/Modules/ModuleEffects.h"
#include "inventory/EffectsEnum.h"


//generic module base class - possibly should inherit from RefPtr...
Expand Down Expand Up @@ -82,24 +83,24 @@ class GenericModule
virtual bool isTurretFitted()
{
// Try to make the effect called 'turretFitted' active, if it exists, to test for module being a turret:
//if( m_Effects->SetActiveEffect(42) )
// return true;
//else
if( m_Effects->HasEffect(EveEffectEnum::Effect_turretFitted) )
return true;
else
return false;
}

virtual bool isLauncherFitted()
{
// Try to make the effect called 'launcherFitted' active, if it exists, to test for module being a launcher:
//if( m_Effects->SetActiveEffect(40) )
// return true;
//else
if( m_Effects->HasEffect(EveEffectEnum::Effect_launcherFitted) )
return true;
else
return false;
}

virtual bool isMaxGroupFitLimited()
{
if( m_Item->HasAttribute(AttrMaxGroupFitted) )
if( m_Item->HasAttribute(EveAttrEnum::AttrMaxGroupFitted) )
return true;
else
return false;
Expand Down
25 changes: 25 additions & 0 deletions include/eve-server/ship/dgmtypeattributeinfo.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*
------------------------------------------------------------------------------------
LICENSE:
------------------------------------------------------------------------------------
This file is part of EVEmu: EVE Online Server Emulator
Copyright 2006 - 2011 The EVEmu Team
For the latest information visit http://evemu.org
------------------------------------------------------------------------------------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
http://www.gnu.org/copyleft/lesser.txt.
------------------------------------------------------------------------------------
Author: Captnoord
*/

#ifndef dgmtypeattributeinfo_h__
#define dgmtypeattributeinfo_h__

Expand Down
1 change: 1 addition & 0 deletions src/eve-server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ SET( fleet_SOURCE
SET( inventory_INCLUDE
"${TARGET_INCLUDE_DIR}/inventory/AttributeEnum.h"
"${TARGET_INCLUDE_DIR}/inventory/AttributeMgr.h"
"${TARGET_INCLUDE_DIR}/inventory/EffectsEnum.h"
"${TARGET_INCLUDE_DIR}/inventory/EVEAttributeMgr.h"
"${TARGET_INCLUDE_DIR}/inventory/EVEAttributes.h"
"${TARGET_INCLUDE_DIR}/inventory/InvBrokerService.h"
Expand Down
6 changes: 6 additions & 0 deletions src/eve-server/ship/Modules/ModuleEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,16 @@ void ModuleEffects::_populate(uint32 typeID)
//counter
MEffect * mEffectPtr;
mEffectPtr = NULL;
m_defaultEffect = NULL; // Set this to NULL until the default effect is found, if there is any
uint32 effectID;
uint32 isDefault;

//go through and populate each effect
DBResultRow row;
while( res->GetRow(row) )
{
effectID = row.GetInt(0);
isDefault = row.GetInt(1);
switch( effectID )
{
case 11: // loPower
Expand All @@ -286,6 +289,9 @@ void ModuleEffects::_populate(uint32 typeID)
break;
}

if( isDefault > 0 )
m_defaultEffect = mEffectPtr;

// This switch is assuming that all entries in 'dgmEffectsInfo' for this effectID are applied during the same module state,
// which should really be the case anyway, for every effectID, so we just check index 0 of the effectIDs list of attributes
// that are modified by this effect for which module state during which the effect is active:
Expand Down

0 comments on commit c572595

Please sign in to comment.