~flamefire/s25rttr/s25rttr

« back to all changes in this revision

Viewing changes to src/GameClientPlayer.h

  • Committer: Alex
  • Date: 2013-08-27 22:44:20 UTC
  • mfrom: (8873.1.48 trunk)
  • Revision ID: alex@flamefire-20130827224420-29ckzxhc59p3yc3f
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// $Id: GameClientPlayer.h 8737 2013-05-16 15:42:35Z marcus $
 
1
// $Id: GameClientPlayer.h 8918 2013-08-27 19:15:17Z marcus $
2
2
//
3
3
// Copyright (c) 2005 - 2011 Settlers Freaks (sf-team at siedler25.org)
4
4
//
207
207
        /*/// liefert das aktuelle (komplette) inventar.
208
208
        void GetInventory(unsigned int *wares, unsigned int *figures);*/
209
209
 
210
 
        template <class ParamType>
211
 
        struct IsWarehouseGood
212
 
        {
213
 
                typedef bool (*Check)(nobBaseWarehouse*,typename const ParamType*);
214
 
        };
215
 
 
216
210
        /// Sucht ein nächstgelegenes Warenhaus für den Punkt 'start', das die Bedingung der Ãœbergebenen Funktion
217
211
        /// IsWarehouseGood erfüllt, als letzen Parameter erhält jene Funktion param
218
212
        /// - forbidden ist ein optionales Straßenstück, das nicht betreten werden darf,
219
213
        /// - to_wh muss auf true gesetzt werden, wenn es zum Lagerhaus geht, ansonsten auf false, in length wird die Wegeslänge zurückgegeben
220
 
        template< typename ParamType, typename Check >
221
 
        nobBaseWarehouse * FindWarehouse(const noRoadNode * const start,Check isWarehouseGood,const RoadSegment * const forbidden,const bool to_wh,const ParamType &param,const bool use_boat_roads,unsigned * const length = NULL)
222
 
        {
223
 
                nobBaseWarehouse * best = 0;
224
 
 
225
 
                //      unsigned char path = 0xFF, tpath = 0xFF;
226
 
                unsigned tlength = 0xFFFFFFFF,best_length = 0xFFFFFFFF;
227
 
 
228
 
                for(std::list<nobBaseWarehouse*>::iterator w = warehouses.begin(); w!=warehouses.end(); ++w)
229
 
                {
230
 
                        // Lagerhaus geeignet?
231
 
                        if(isWarehouseGood(*w,param))
232
 
                        {
233
 
                                // Bei der erlaubten Benutzung von Bootsstraßen Waren-Pathfinding benutzen
234
 
                                if(gwg->FindPathOnRoads(to_wh ? start : *w, to_wh ? *w : start,use_boat_roads,&tlength,NULL, NULL,forbidden))
235
 
                                {
236
 
                                        if(tlength < best_length || !best)
237
 
                                        {
238
 
                                                //                                      path = tpath;
239
 
                                                best_length = tlength;
240
 
                                                best = (*w);
241
 
                                        }
242
 
                                }
243
 
                        }
244
 
                }
245
 
 
246
 
                if(length)
247
 
                        *length = best_length;
248
 
 
249
 
                return best;
250
 
        }
 
214
        nobBaseWarehouse * FindWarehouse(const noRoadNode * const start,bool (*IsWarehouseGood)(nobBaseWarehouse*,const void*),const RoadSegment * const forbidden,const bool to_wh,const void * param,const bool use_boat_roads,unsigned * const length = 0);
251
215
        /// Gibt dem Spieler bekannt, das eine neue Straße gebaut wurde
252
216
        void NewRoad(RoadSegment * const rs);
253
217
        /// Neue Straße hinzufügen