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