Want to work on TURN ORDER

It is my first attempt in VCMI so I thought I should announce it first. Is anyone else working on that?

I will build it according to Strategy Manual

It’s already done exactly that way. I doubt there are any bugs.

Maybe you would like to implement missing adventure map spells instead?

I took a rapid look at that code and I found some TODO’s

bool CMP_stack::operator()( const CStack* a, const CStack* b )
{
	switch(phase)
	{
	case 0: //catapult moves after turrets
		return a->getCreature()->idNumber > b->getCreature()->idNumber; //catapult is 145 and turrets are 149
	case 1: //fastest first, upper slot first
		{
			int as = a->Speed(turn), bs = b->Speed(turn);
			if(as != bs)
				return as > bs;
			else
				return a->slot < b->slot;
		}
	case 2: //fastest last, upper slot first
		//TODO: should be replaced with order of receiving morale!
	case 3: //fastest last, upper slot first
		{
			int as = a->Speed(turn), bs = b->Speed(turn);
			if(as != bs)
				return as < bs;
			else
				return a->slot < b->slot;
		}
	default:
		assert(0);
		return false;
	}

}

Then looking where it was used found a mistake? like

if(out.size() && out.front() == active)
				lastMoved = active->attackerOwned;
			else
				lastMoved = active->attackerOwned;

And thought it is only an intermediate version :(. I was happy because it was an already started and relatively contained code (no implications in the whole project).

I think I am not able to head-on adventure map spells just yet. I guess I will look around a little more. (I take my time because half a year ago I wanted to fix a simple glitch in cavaliers movement and I just got entangled in that part of code. I did not like the experience at all :slight_smile: ).

I remember that piece of logic giving me quite a hard time. Difficult to get right behaviour and difficult to debug. The TODO seems to be actually a missing piece of original logic.
It’d be non-trival to implement, because we don’t store information about when morale effect happens. This can be done (some counter for morale effects plus field on the stack “last morale effect nr”), I just never thought it is effortworthy.

Good find! Frankly speaking ATM I have no idea how this should look. Either “if” is redundant or the assignments should differ. I guess the latter but before making change I’d like to see a case which would be affected by change. Oh, I just hate that code and the complexity of the rules. That’s a piece that should have tests.

Disguise is probably the only relatively easy one. Others are difficult, especially view * spells. (GUI + special terrain rendering + devising how the informations are showed to the player interface)

But generally… all easy stuff is probably already done. :stuck_out_tongue:

How about Hall of Fame? Its development can be easily split: first the GUI and screen itself, then storing the high scores and their format, then calculating points at the game end and transition to the screen? (I can help with the last one)

Morale could be implemented with a separate FIFO queue. Stack gets morale put it on the queue. In morale phase just take them out from the other end. (I’m sure it is not that trivial :slight_smile: ).

I guess until I am a little more comfortable with the project I will stick with already implemented features that need some touching. That would be the easiest for me.

I like the Turn Order part. Will do some work there send the 2-3 files to you and you decide if it worth committing. If not… well I had my exercise :).