1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
/***************************************************************************
destination.cpp - description
-------------------
begin : may 16th, 2004
copyright : (C) 2004-2007 by Duong Khang NGUYEN
email : neoneurone @ gmail com
$Id: destination.cpp 375 2008-10-28 14:47:15Z neoneurone $
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* any later version. *
* *
***************************************************************************/
// Useful enumerations
#include "opencity_direction.h"
// OpenCity header
#include "destination.h"
/*=====================================================================*/
Destination::Destination():
_eDir( OC_DIR_O_S ),
_uiW( 0 ), _uiL( 0 ),
_iHMin( 0 ), _iHMax( 0 ),
_uiTime( 0 ),
_ubTraffic( 0 )
{
// OPENCITY_DEBUG( "ctor" );
}
/*=====================================================================*/
Destination::~Destination()
{
// OPENCITY_DEBUG( "dtor" );
}
/*=====================================================================*/
OPENCITY_DIRECTION
Destination::GetDir(
const Destination & rcA,
const Destination & rcB)
{
// W tests
if ((rcA._uiW == rcB._uiW) and (rcA._uiL == rcB._uiL)) {
return rcA._eDir;
}
if (rcA._uiW < rcB._uiW) {
return OC_DIR_O_E;
}
if (rcA._uiW > rcB._uiW) {
return OC_DIR_O_W;
}
// L tests
if (rcA._uiL < rcB._uiL) {
return OC_DIR_O_S;
}
if (rcA._uiL > rcB._uiL) {
return OC_DIR_O_N;
}
OPENCITY_DEBUG( "Game design error" );
assert( 0 );
return OC_DIR_O_S;
}
|