src/tron/gSensor.cpp

Go to the documentation of this file.
00001 /*
00002 
00003 *************************************************************************
00004 
00005 ArmageTron -- Just another Tron Lightcycle Game in 3D.
00006 Copyright (C) 2000  Manuel Moos (manuel@moosnet.de)
00007 
00008 **************************************************************************
00009 
00010 This program is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 This program is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00023   
00024 ***************************************************************************
00025 
00026 */
00027 
00028 #include "gCycle.h"
00029 #include "gSensor.h"
00030 #include "gWall.h"
00031 #include "eDebugLine.h"
00032 
00033 extern REAL sg_delayCycle;
00034 
00035 void gSensor::PassEdge(const eWall *ww,REAL time,REAL a,int r){
00036     if (!ww)
00037         return;
00038 
00039     try{
00040         eSensor::PassEdge(ww,time,a,r);
00041     }
00042     catch( eSensorFinished & e )
00043     {
00044         const gPlayerWall *w=dynamic_cast<const gPlayerWall*>(ww);
00045         if (w)
00046         {
00047             gCycle *owner=w->Cycle();
00048             if (owner && owner->IsMe( owned ) )
00049             {
00050                 type=gSENSOR_SELF;
00051             }
00052             else if ( owner && owned && owner->Team() == owned->Team() )
00053             {
00054                 type=gSENSOR_TEAMMATE;
00055             }
00056             else
00057             {
00058                 type=gSENSOR_ENEMY;
00059             }
00060 
00061             if (w->EndTime() < w->BegTime())
00062                 lr=-lr;
00063         }
00064         else if (dynamic_cast<const gWallRim*>(ww))
00065             type=gSENSOR_RIM;
00066 
00067         throw;
00068     }
00069 }
00070 

Generated on Sat Mar 15 22:56:09 2008 for Armagetron Advanced by  doxygen 1.5.4