00001 /*************************************************************************** 00002 destination.cpp - description 00003 ------------------- 00004 begin : dim mai 16 2004 00005 copyright : (C) 2004-2006 by Duong-Khang NGUYEN 00006 email : neoneurone @ users sourceforge net 00007 00008 $Id: destination.cpp 6 2006-06-19 21:43:20Z neoneurone $ 00009 ***************************************************************************/ 00010 00011 /*************************************************************************** 00012 * * 00013 * This program is free software; you can redistribute it and/or modify * 00014 * it under the terms of the GNU General Public License as published by * 00015 * the Free Software Foundation; either version 2 of the License, or * 00016 * any later version. * 00017 * * 00018 ***************************************************************************/ 00019 00020 00021 #include "destination.h" 00022 00023 00024 /*=====================================================================*/ 00025 Destination::Destination(): 00026 _eDir( OC_DIR_S ), 00027 _uiW( 0 ), _uiL( 0 ), 00028 _iHMin( 0 ), _iHMax( 0 ), 00029 _uiTime( 0 ), 00030 _ubTraffic( 0 ) 00031 { 00032 // OPENCITY_DEBUG( "ctor" ); 00033 } 00034 00035 00036 /*=====================================================================*/ 00037 Destination::~Destination() 00038 { 00039 // OPENCITY_DEBUG( "dtor" ); 00040 } 00041 00042 00043 /*=====================================================================*/ 00044 OPENCITY_DIRECTION 00045 Destination::GetDir( 00046 const Destination & rcA, 00047 const Destination & rcB) 00048 { 00049 // W tests 00050 if ((rcA._uiW == rcB._uiW) and (rcA._uiL == rcB._uiL)) { 00051 return rcA._eDir; 00052 } 00053 00054 if (rcA._uiW < rcB._uiW) { 00055 return OC_DIR_E; 00056 } 00057 00058 if (rcA._uiW > rcB._uiW) { 00059 return OC_DIR_W; 00060 } 00061 00062 // L tests 00063 if (rcA._uiL < rcB._uiL) { 00064 return OC_DIR_S; 00065 } 00066 00067 if (rcA._uiL > rcB._uiL) { 00068 return OC_DIR_N; 00069 } 00070 00071 OPENCITY_DEBUG( "Game design error" ); 00072 assert( 0 ); 00073 return OC_DIR_S; 00074 } 00075 00076 00077