src/player.h
branchNewGRF_ports
changeset 6719 4cc327ad39d5
parent 6678 6353b8865d42
child 6720 35756db7e577
equal deleted inserted replaced
6718:5a8b295aa345 6719:4cc327ad39d5
   166 
   166 
   167 	byte player_color;
   167 	byte player_color;
   168 	Livery livery[LS_END];
   168 	Livery livery[LS_END];
   169 	byte player_money_fraction;
   169 	byte player_money_fraction;
   170 	byte avail_railtypes;
   170 	byte avail_railtypes;
       
   171 	byte avail_roadtypes;
   171 	byte block_preview;
   172 	byte block_preview;
   172 	PlayerByte index;
   173 	PlayerByte index;
   173 
   174 
   174 	uint16 cargo_types; ///< which cargo types were transported the last year
   175 	uint16 cargo_types; ///< which cargo types were transported the last year
   175 
   176 
   246 {
   247 {
   247 	return IS_INSIDE_1D(pi, PLAYER_FIRST, MAX_PLAYERS);
   248 	return IS_INSIDE_1D(pi, PLAYER_FIRST, MAX_PLAYERS);
   248 }
   249 }
   249 
   250 
   250 byte GetPlayerRailtypes(PlayerID p);
   251 byte GetPlayerRailtypes(PlayerID p);
       
   252 byte GetPlayerRoadtypes(PlayerID p);
   251 
   253 
   252 /** Finds out if a Player has a certain railtype available */
   254 /** Finds out if a Player has a certain railtype available */
   253 static inline bool HasRailtypeAvail(const Player *p, RailType Railtype)
   255 static inline bool HasRailtypeAvail(const Player *p, RailType Railtype)
   254 {
   256 {
   255 	return HASBIT(p->avail_railtypes, Railtype);
   257 	return HASBIT(p->avail_railtypes, Railtype);
   309  * @param p Player.
   311  * @param p Player.
   310  * @param engine Engine type.
   312  * @param engine Engine type.
   311  * @return The engine type to replace with, or INVALID_ENGINE if no
   313  * @return The engine type to replace with, or INVALID_ENGINE if no
   312  * replacement is in the list.
   314  * replacement is in the list.
   313  */
   315  */
   314 static inline EngineID EngineReplacementForPlayer(const Player *p, EngineID engine) { return EngineReplacement(p->engine_renew_list, engine); }
   316 static inline EngineID EngineReplacementForPlayer(const Player *p, EngineID engine, GroupID group) { return EngineReplacement(p->engine_renew_list, engine, group); }
   315 
   317 
   316 /**
   318 /**
   317  * Check if a player has a replacement set up for the given engine.
   319  * Check if a player has a replacement set up for the given engine.
   318  * @param p Player.
   320  * @param p Player.
   319  * @param  engine Engine type to be replaced.
   321  * @param  engine Engine type to be replaced.
   320  * @return true if a replacement was set up, false otherwise.
   322  * @return true if a replacement was set up, false otherwise.
   321  */
   323  */
   322 static inline bool EngineHasReplacementForPlayer(const Player *p, EngineID engine) { return EngineReplacementForPlayer(p, engine) != INVALID_ENGINE; }
   324 static inline bool EngineHasReplacementForPlayer(const Player *p, EngineID engine, GroupID group) { return EngineReplacementForPlayer(p, engine, group) != INVALID_ENGINE; }
   323 
   325 
   324 /**
   326 /**
   325  * Add an engine replacement for the player.
   327  * Add an engine replacement for the player.
   326  * @param p Player.
   328  * @param p Player.
   327  * @param old_engine The original engine type.
   329  * @param old_engine The original engine type.
   328  * @param new_engine The replacement engine type.
   330  * @param new_engine The replacement engine type.
   329  * @param flags The calling command flags.
   331  * @param flags The calling command flags.
   330  * @return 0 on success, CMD_ERROR on failure.
   332  * @return 0 on success, CMD_ERROR on failure.
   331  */
   333  */
   332 static inline int32 AddEngineReplacementForPlayer(Player *p, EngineID old_engine, EngineID new_engine, uint32 flags) { return AddEngineReplacement(&p->engine_renew_list, old_engine, new_engine, flags); }
   334 static inline int32 AddEngineReplacementForPlayer(Player *p, EngineID old_engine, EngineID new_engine, GroupID group, uint32 flags) { return AddEngineReplacement(&p->engine_renew_list, old_engine, new_engine, group, flags); }
   333 
   335 
   334 /**
   336 /**
   335  * Remove an engine replacement for the player.
   337  * Remove an engine replacement for the player.
   336  * @param p Player.
   338  * @param p Player.
   337  * @param engine The original engine type.
   339  * @param engine The original engine type.
   338  * @param flags The calling command flags.
   340  * @param flags The calling command flags.
   339  * @return 0 on success, CMD_ERROR on failure.
   341  * @return 0 on success, CMD_ERROR on failure.
   340  */
   342  */
   341 static inline int32 RemoveEngineReplacementForPlayer(Player *p, EngineID engine, uint32 flags) {return RemoveEngineReplacement(&p->engine_renew_list, engine, flags); }
   343 static inline int32 RemoveEngineReplacementForPlayer(Player *p, EngineID engine, GroupID group, uint32 flags) {return RemoveEngineReplacement(&p->engine_renew_list, engine, group, flags); }
   342 
   344 
   343 /**
   345 /**
   344  * Reset the livery schemes to the player's primary colour.
   346  * Reset the livery schemes to the player's primary colour.
   345  * This is used on loading games without livery information and on new player start up.
   347  * This is used on loading games without livery information and on new player start up.
   346  * @param p Player to reset.
   348  * @param p Player to reset.