~ubuntu-branches/ubuntu/natty/spring/natty

« back to all changes in this revision

Viewing changes to rts/Sim/MoveTypes/MoveMath/HoverMoveMath.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Ritchie
  • Date: 2010-09-23 18:56:03 UTC
  • mfrom: (3.1.9 experimental)
  • Revision ID: james.westby@ubuntu.com-20100923185603-st97s5chplo42y7w
Tags: 0.82.5.1+dfsg1-1ubuntu1
* Latest upstream version for online play
* debian/control: Replace (rather than conflict) spring-engine
  - spring-engine will be a dummy package (LP: #612905)
  - also set maintainer to MOTU

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
 
2
 
1
3
#include "StdAfx.h"
2
4
#include "HoverMoveMath.h"
3
5
#include "Map/ReadMap.h"
13
15
/*
14
16
Calculate speed-multiplier for given height and slope data.
15
17
*/
16
 
float CHoverMoveMath::SpeedMod(const MoveData& moveData, float height, float slope)
 
18
float CHoverMoveMath::SpeedMod(const MoveData& moveData, float height, float slope) const
17
19
{
18
20
        //On water?
19
21
        if(height < 0){
28
30
        return 1 / (1 + slope * moveData.slopeMod);
29
31
}
30
32
 
31
 
float CHoverMoveMath::SpeedMod(const MoveData& moveData, float height, float slope,float moveSlope)
 
33
float CHoverMoveMath::SpeedMod(const MoveData& moveData, float height, float slope,float moveSlope) const
32
34
{
33
35
        //On water?
34
36
        if(height < 0)
43
45
/*
44
46
Gives a position slightly over ground and water level.
45
47
*/
46
 
float CHoverMoveMath::yLevel(int xSquare, int zSquare)
 
48
float CHoverMoveMath::yLevel(int xSquare, int zSquare) const
47
49
{
48
50
        return ground->GetHeight(xSquare*SQUARE_SIZE, zSquare*SQUARE_SIZE) + 10;
49
51
}
50
52
 
51
53
 
52
 
float CHoverMoveMath::yLevel(const float3& pos)
 
54
float CHoverMoveMath::yLevel(const float3& pos) const
53
55
{
54
56
        return ground->GetHeight(pos.x, pos.z) + 10;
55
57
}