Changeset - r18361:0751703dbaf1
[Not reviewed]
master
0 2 0
truebrain - 13 years ago 2011-11-13 20:41:17
truebrain@openttd.org
(svn r23207) -Codechange: make functions private/protected/public depending on their current usage (and reorder functions a bit)
2 files changed with 29 insertions and 28 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_instance.hpp
Show inline comments
 
@@ -152,18 +152,12 @@ public:
 
	 * @param version The version of the AI when saving, or -1 if this was
 
	 *  not the original AI saving the game.
 
	 */
 
	void Load(int version);
 

	
 
	/**
 
	 * Call the AI Load function if it exists and data was loaded
 
	 *  from a savegame.
 
	 */
 
	bool CallLoad();
 

	
 
	/**
 
	 * Load and discard data from a savegame.
 
	 */
 
	static void LoadEmpty();
 

	
 
	/**
 
	 * Reduces the number of opcodes the AI have left to zero. Unless
 
@@ -204,12 +198,18 @@ private:
 
	/**
 
	 * Tell the AI it died.
 
	 */
 
	void Died();
 

	
 
	/**
 
	 * Call the AI Load function if it exists and data was loaded
 
	 *  from a savegame.
 
	 */
 
	bool CallLoad();
 

	
 
	/**
 
	 * Save one object (int / string / array / table) to the savegame.
 
	 * @param vm The virtual machine to get all the data from.
 
	 * @param index The index on the squirrel stack of the element to save.
 
	 * @param max_depth The maximum depth recursive arrays / tables will be stored
 
	 *   with before an error is returned.
 
	 * @param test If true, don't really store the data but only check if it is
src/ai/api/ai_object.hpp
Show inline comments
 
@@ -36,12 +36,24 @@ typedef bool (AIModeProc)();
 
 */
 
class AIObject : public SimpleCountedObject {
 
friend void CcAI(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2);
 
friend class AIInstance;
 
friend class AIController;
 
#ifndef DOXYGEN_AI_DOCS
 
public:
 
	/**
 
	 * Store the latest result of a DoCommand per company.
 
	 * @param res The result of the last command.
 
	 */
 
	static void SetLastCommandRes(bool res);
 

	
 
	/**
 
	 * Get the pointer to store log message in.
 
	 */
 
	static void *&GetLogPointer();
 

	
 
protected:
 
	/**
 
	 * Executes a raw DoCommand for the AI.
 
	 */
 
	static bool DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text = NULL, AISuspendCallbackProc *callback = NULL);
 

	
 
@@ -138,31 +150,27 @@ protected:
 
	/**
 
	 * Get the latest stored new_group_id.
 
	 */
 
	static GroupID GetNewGroupID();
 

	
 
	/**
 
	 * Can we suspend the AI at this moment?
 
	 * Store a allow_do_command per company.
 
	 * @param allow The new allow.
 
	 */
 
	static bool CanSuspend();
 
	static void SetAllowDoCommand(bool allow);
 

	
 
	/**
 
	 * Get the internal value of allow_do_command. This can differ
 
	 * from CanSuspend() if the reason we are not allowed
 
	 * to execute a DoCommand is in squirrel and not the API.
 
	 * In that case use this function to restore the previous value.
 
	 * @return True iff DoCommands are allowed in the current scope.
 
	 */
 
	static bool GetAllowDoCommand();
 

	
 
	/**
 
	 * Get the pointer to store event data in.
 
	 */
 
	static void *&GetEventPointer();
 

	
 
	/**
 
	 * Set the cost of the last command.
 
	 */
 
	static void SetLastCost(Money last_cost);
 

	
 
	/**
 
	 * Get the cost of the last command.
 
@@ -176,19 +184,23 @@ protected:
 

	
 
	/**
 
	 * Get the variable that is used by callback functions to pass information.
 
	 */
 
	static int GetCallbackVariable(int index);
 

	
 
public:
 
	/**
 
	 * Can we suspend the AI at this moment?
 
	 */
 
	static bool CanSuspend();
 

	
 
	/**
 
	 * Store the latest result of a DoCommand per company.
 
	 * @param res The result of the last command.
 
	 * Get the pointer to store event data in.
 
	 */
 
	static void SetLastCommandRes(bool res);
 
	static void *&GetEventPointer();
 

	
 
private:
 
	/**
 
	 * Store a new_vehicle_id per company.
 
	 * @param vehicle_id The new VehicleID.
 
	 */
 
	static void SetNewVehicleID(VehicleID vehicle_id);
 

	
 
@@ -206,21 +218,10 @@ public:
 

	
 
	/**
 
	 * Store a new_group_id per company.
 
	 * @param group_id The new GroupID.
 
	 */
 
	static void SetNewGroupID(GroupID group_id);
 

	
 
	/**
 
	 * Store a allow_do_command per company.
 
	 * @param allow The new allow.
 
	 */
 
	static void SetAllowDoCommand(bool allow);
 

	
 
	/**
 
	 * Get the pointer to store log message in.
 
	 */
 
	static void *&GetLogPointer();
 
#endif /* DOXYGEN_AI_DOCS */
 
};
 

	
 
#endif /* AI_OBJECT_HPP */
0 comments (0 inline, 0 general)