| 1 | /*************************************************************************** |
| 2 | trafficsim.h - description |
| 3 | ------------------- |
| 4 | begin : may 1st, 2004 |
| 5 | copyright : (C) 2003-2010 by Duong Khang NGUYEN |
| 6 | email : neoneurone @ gmail com |
| 7 | |
| 8 | $Id: trafficsim.h 450 2010-11-21 19:11:43Z 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 | #ifndef _OPENCITY_TRAFFICSIM_H_ |
| 21 | #define _OPENCITY_TRAFFICSIM_H_ 1 |
| 22 | |
| 23 | #include "main.h" |
| 24 | #include "simulator.h" |
| 25 | |
| 26 | |
| 27 | // 10% of time, we create a new vehicle |
| 28 | #define OC_TSIM_VEHICLE_CHANCE 10 |
| 29 | |
| 30 | // Minimum of traffic in order to generate a vehicle starting from a point of the map |
| 31 | #define OC_TSIM_TRAFFIC_MIN 50 |
| 32 | |
| 33 | |
| 34 | class PathFinder; |
| 35 | class MovementManager; |
| 36 | |
| 37 | |
| 38 | //======================================================================== |
| 39 | /** This class generates an artificial traffic in the game. The traffic level |
| 40 | of each unit (square) depends on the structures' level around it |
| 41 | */ |
| 42 | class TrafficSim : public Simulator |
| 43 | { |
| 44 | public: |
| 45 | TrafficSim( |
| 46 | SDL_mutex* mutex, |
| 47 | BuildingLayer* pblayer, |
| 48 | Map* pmap, |
| 49 | PathFinder* pf, |
| 50 | MovementManager* mm ); |
| 51 | |
| 52 | virtual ~TrafficSim(); |
| 53 | |
| 54 | int Main(); |
| 55 | |
| 56 | |
| 57 | private: |
| 58 | PathFinder* _pPathFinder; |
| 59 | MovementManager* _pMovementManager; |
| 60 | |
| 61 | /*=====================================================================*/ |
| 62 | /* PRIVATE METHODS */ |
| 63 | /*=====================================================================*/ |
| 64 | void CreateNewVehicle( |
| 65 | const uint& w, |
| 66 | const uint& h ); |
| 67 | }; |
| 68 | |
| 69 | #endif |