• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Adding a getConditionParamValue(), rlly close

DemShion

New Member
Joined
Apr 8, 2013
Messages
82
Reaction score
1
Location
Mexico
Hi, so i wanna add a function that returns the value of a condition param[getConditionParamValue()], so i can use it to define a variable on the file game.cpp, for example.
int wathever2 = player->getConditionParamValue(CONDITIONPARAM_SKILL_FISHINGPERCENT);

so yeah... so far ive managed to create the funcion and dont get compiling errors, but something is wrong because when i run the server i get this error:
ErrorDialog.jpg

on the source so far ive modified and added the following:

--------On creature.cpp
Code:
//below
bool Creature::isSuppress(ConditionType_t type) const
{
	return ((getConditionSuppressions() & (uint32_t)type) == (uint32_t)type);
}

//added

Condition* Creature::getConditionParam(ConditionParam_t param, int32_t value/* = 0*/ ) const
{
	for(ConditionParamList::const_iterator it = conditionParams.begin(); it != conditionParams.end(); ++it)
	{
		if((*it)->getParam() == param)
			return *it;
	}

	return NULL;
}

int32_t Creature::getConditionParamValue(ConditionParam_t param, int32_t value/* = 0*/)
{
	for(ConditionParamList::iterator it = conditionParams.begin(); it != conditionParams.end(); ++it)
	{
		if((*it)->getParam() != param)
			continue;

		if((*it)->getParam() == param)
			paramValue = value;
			return paramValue;
	}
	
	return NULL;
}

--------On creature.h
Code:
//below
		virtual bool isSuppress(ConditionType_t type) const;

//added
		Condition* getConditionParam(ConditionParam_t param, int32_t value = 0) const;
		int32_t getConditionParamValue(ConditionParam_t param, int32_t value = 0);

//below
		ConditionList conditions;

//added
		int32_t paramValue;
		conditionParams;

--------On condition.h
Code:
//below
		ConditionType_t getType() const {return conditionType;}

//added
		ConditionParam_t getParam() const {return conditionParam;}

//below
		ConditionType_t conditionType;

//added
		ConditionParam_t conditionParam;

Thats everything ive modified so far, please help me :( i dont know what to do D:
 
Last edited:
Back
Top