src/ai/api/ai_transactionmode.hpp
branchnoai
changeset 9829 80fbe02a4184
parent 9629 66dde6412125
child 9839 ea94d60d13e7
equal deleted inserted replaced
9828:38be66875b45 9829:80fbe02a4184
     1 /* $Id$ */
     1 /* $Id$ */
     2 
     2 
     3 /** @file ai_transactionmode.hpp class to switch the AI to Transaction mode */
     3 /** @file ai_transactionmode.hpp Switch the AI to Transaction Mode. */
     4 
     4 
     5 #ifndef AI_TRANSACTIONMODE_HPP
     5 #ifndef AI_TRANSACTIONMODE_HPP
     6 #define AI_TRANSACTIONMODE_HPP
     6 #define AI_TRANSACTIONMODE_HPP
     7 
     7 
     8 #include "ai_object.hpp"
     8 #include "ai_object.hpp"
    19  * On execute the transaction can return false, because maps change over time.
    19  * On execute the transaction can return false, because maps change over time.
    20  *   If this happens you can use the rollback feature to remove all already
    20  *   If this happens you can use the rollback feature to remove all already
    21  *   built things.
    21  *   built things.
    22  */
    22  */
    23 class AITransactionMode : public AIObject {
    23 class AITransactionMode : public AIObject {
       
    24 public:
       
    25 	static const char *GetClassName() { return "AITransactionMode"; }
       
    26 
    24 private:
    27 private:
    25 	struct AITransactionModeCommand {
    28 	struct AITransactionModeCommand {
    26 		TileIndex tile;
    29 		TileIndex tile;
    27 		uint32 p1;
    30 		uint32 p1;
    28 		uint32 p2;
    31 		uint32 p2;
    42 	 * The callback proc for Transaction mode.
    45 	 * The callback proc for Transaction mode.
    43 	 */
    46 	 */
    44 	static bool ModeProc(TileIndex tile, uint32 p1, uint32 p2, uint procc, CommandCost costs);
    47 	static bool ModeProc(TileIndex tile, uint32 p1, uint32 p2, uint procc, CommandCost costs);
    45 
    48 
    46 public:
    49 public:
    47 	/**
       
    48 	 * The name of the class, needed by several sub-processes.
       
    49 	 */
       
    50 	static const char *GetClassName() { return "AITransactionMode"; }
       
    51 
       
    52 	/**
    50 	/**
    53 	 * Creating instance of this class switches the build mode to Transaction.
    51 	 * Creating instance of this class switches the build mode to Transaction.
    54 	 * @note when the instance is destroyed, he restores the mode that was
    52 	 * @note when the instance is destroyed, he restores the mode that was
    55 	 *   current when the instance was created!
    53 	 *   current when the instance was created!
    56 	 */
    54 	 */