1 /*
2  * Copyright (c) 1997 - 2002 Hansj�rg Malthaner
3  *
4  * This file is part of the Simutrans project under the artistic licence.
5  * (see licence.txt)
6  */
7 
8 #ifndef vehicle_builder_t_h
9 #define vehicle_builder_t_h
10 
11 
12 #include "../dataobj/koord3d.h"
13 #include "../simtypes.h"
14 #include "../gui/depot_frame.h"
15 #include <string>
16 
17 class vehicle_t;
18 class player_t;
19 class convoi_t;
20 class vehicle_desc_t;
21 class goods_desc_t;
22 template <class T> class slist_tpl;
23 
24 
25 /**
26  * Baut Fahrzeuge. Fahrzeuge sollten nicht direct instanziiert werden
27  * sondern immer von einem vehicle_builder_t erzeugt werden.
28  *
29  * @author Hj. Malthaner
30  */
31 class vehicle_builder_t
32 {
33 public:
34 	static bool speedbonus_init(const std::string &objfilename);
35 	static sint32 get_speedbonus( sint32 monthyear, waytype_t wt );
36 	static void rdwr_speedbonus(loadsave_t *file);
37 
38 	static bool register_desc(const vehicle_desc_t *desc);
39 	static bool successfully_loaded();
40 
41 	static vehicle_t* build(koord3d k, player_t* player, convoi_t* cnv, const vehicle_desc_t* vb );
42 
43 	static const vehicle_desc_t * get_info(const char *name);
44 	static slist_tpl<vehicle_desc_t const*> const& get_info(waytype_t, uint8 sortkey = depot_frame_t::sb_name);
45 
46 	/* extended search for vehicles for KI
47 	* @author prissi
48 	*/
49 	static const vehicle_desc_t *vehikel_search(waytype_t typ,const uint16 month_now,const uint32 target_power,const sint32 target_speed, const goods_desc_t * target_freight, bool include_electric, bool not_obsolete );
50 
51 	/* for replacement during load time
52 	 * prev_veh==NULL equals leading of convoi
53 	 */
54 	static const vehicle_desc_t *get_best_matching( waytype_t wt, const uint16 month_now, const uint32 target_weight, const uint32 target_power, const sint32 target_speed, const goods_desc_t * target_freight, bool not_obsolete, const vehicle_desc_t *prev_veh, bool is_last );
55 
56 	/* Resolves the fastest achieveable speed in km/h for the specified way type.
57 	 * This is the speed of the fastest powered vehicle for the way type that is available within the time constraints.
58 	 * This does not factor in limits applied by logically dependant vehicles or buildable ways.
59 	 */
60 	static sint32 get_fastest_vehicle_speed(waytype_t wt, uint16 const month_now, bool const use_timeline, bool const allow_obsolete);
61 };
62 
63 #endif
64