Yeah, that's what the 'if(Link->MP > Link->MaxMP) Link->MP = Link->MaxMP;' line is for.