236 |
236 |
237 /* Validate functions for rail building */ |
237 /* Validate functions for rail building */ |
238 static inline bool ValParamRailtype(uint32 rail) { return HASBIT(GetPlayer(_current_player)->avail_railtypes, rail);} |
238 static inline bool ValParamRailtype(uint32 rail) { return HASBIT(GetPlayer(_current_player)->avail_railtypes, rail);} |
239 |
239 |
240 /** Returns the "best" railtype a player can build. |
240 /** Returns the "best" railtype a player can build. |
241 * As the AI doesn't know what the BEST one is, we |
241 * As the AI doesn't know what the BEST one is, we have our own priority list |
242 * have our own priority list here. When adding |
242 * here. When adding new railtypes, modify this function |
243 * new railtypes, modify this function |
243 * @param p the player "in action" |
244 * @param p the player "in action" |
244 * @return The "best" railtype a player has available |
245 * @return The "best" railtype a player has available |
245 */ |
246 */ |
|
247 static inline RailType GetBestRailtype(const Player* p) |
246 static inline RailType GetBestRailtype(const Player* p) |
248 { |
247 { |
249 if (HasRailtypeAvail(p, RAILTYPE_MAGLEV)) return RAILTYPE_MAGLEV; |
248 if (HasRailtypeAvail(p, RAILTYPE_MAGLEV)) return RAILTYPE_MAGLEV; |
250 if (HasRailtypeAvail(p, RAILTYPE_MONO)) return RAILTYPE_MONO; |
249 if (HasRailtypeAvail(p, RAILTYPE_MONO)) return RAILTYPE_MONO; |
251 if (HasRailtypeAvail(p, RAILTYPE_ELECTRIC)) return RAILTYPE_ELECTRIC; |
250 if (HasRailtypeAvail(p, RAILTYPE_ELECTRIC)) return RAILTYPE_ELECTRIC; |