Hi all,
I have a very weird problem.
I develop a game on Nintendo DS using DevKitPro.
I have a method that get a value in an XML file :
sscanf(xEffect.getChildNode("mpmodif").getAttribute("value"), "%d", &mpModif);
With the values I have get, I instanciate a new Effect :
Effect *test = new Effect(durationTime, probabilities, delay, target0, hpModif, mpModif, intModif, agiModif, strModif, defModif, mdefModif, aspdModif, msModif, msModifPer, atkModif, status);
But this instanciation seems not to be effective.
Indeed, I print values :
iprintf("\x1b[2;0H test : %d, %d\n", test->GetMpModif(), mpModif);
The, the result is 0,-50.
Here is the Effect constructor :
Effect::Effect(u16 durationTime, u8 probabilities, u8 delay, u8 target, int hpModif, int mpModif, int intModif, int agiModif, int strModif, int defModif, int mdefModif, int aspdModif, int msModif, int msModifPer, int atkModif, Status status) :
Start_(0), Stop_(0), Run_(0), durationTime_(durationTime), probabilities_(probabilities), delay_(delay), target_(target), hpModif_(hpModif), mpModif_(mpModif), intModif_(intModif), agiModif_(agiModif), strModif_(strModif), defModif_(defModif), mdefModif_(mdefModif), aspdModif_(aspdModif), msModif_(msModif), msModifPer_(msModifPer), atkModif_(atkModif), status_(status), lastTick_(0), started_(false)
{
[...] // No relationship with the subject
}
With this, no way it works.
I tried to initialize fields in the ctor body and to iprintf the mpModif_ value. When I do that BETWEEN the "//**********" (see below), it works fine, and I got the good values (-50, -50). Otherwise, it doesnt work. I show you :
Effect::Effect(u16 durationTime, u8 probabilities, u8 delay, u8 target, int hpModif, int mpModif, int intModif, int agiModif, int strModif, int defModif, int mdefModif, int aspdModif, int msModif, int msModifPer, int atkModif, Status status)
{
//****************
Start_ = 0;
Stop_ = 0;
Run_ = 0;
durationTime_ = durationTime;
probabilities_ = probabilities;
delay_ = delay;
target_ = target;
hpModif_ = hpModif;
mpModif_ = mpModif;
intModif_ = intModif;
agiModif_ = agiModif;
strModif_ = strModif;
defModif_ = defModif;
mdefModif_ = mdefModif;
aspdModif_ = aspdModif;
msModif_ = msModif;
msModifPer_ = msModifPer;
atkModif_ = atkModif;
//****************
status_ = status;
lastTick_ = 0;
started_ = false;
[...] // No relationship with the subject
}
Could that be a DS reference issue ? A comrade talked me about something like that but I do not lose hope to find the problem...
Thank you very much for your help I have to finish this game very soon !
I will keep looking here for the next days, please ask me details if you have any idea.
++