(svn r23257) [1.1] -Backport from trunk:

- Fix: [NoAI] Hide AIObject from the documentation as it cannot be used (r23204, r23201)
- Fix: [Network] Unstable sorting in the network list when two servers had the exact same name [FS#4829] (r23202)
- Fix: Oil rigs that "expired" did not get removed from the station list [FS#4822] (r23199)
This commit is contained in:
rubidium 2011-11-18 21:15:09 +00:00
parent 83062be4e0
commit 47e7a98207
14 changed files with 48 additions and 23 deletions

View File

@ -206,7 +206,7 @@ EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = DOXYGEN_SKIP
PREDEFINED = DOXYGEN_AI_DOCS
EXPAND_AS_DEFINED = DEF_COMMAND
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------

View File

@ -109,7 +109,7 @@ public:
*/
static int32 GetMinLength(BridgeID bridge_id);
#ifndef DOXYGEN_SKIP
#ifndef DOXYGEN_AI_DOCS
/**
* Internal function to help BuildBridge in case of road.
*/

View File

@ -278,7 +278,7 @@ public:
*/
Money GetRunningCost();
#ifdef DOXYGEN_SKIP
#ifdef DOXYGEN_AI_DOCS
/**
* Get the type of the offered engine.
* @return The type the engine has.

View File

@ -10,7 +10,7 @@
/** @file ai_info_docs.hpp Description of the functions an AI can/must provide in AIInfo. */
/* This file exists purely for doxygen purposes. */
#ifdef DOXYGEN_SKIP
#ifdef DOXYGEN_AI_DOCS
/**
* 'Abstract' class of the class AIs/AI libraries use to register themselves.
*

View File

@ -239,7 +239,7 @@ public:
*/
void KeepList(AIList *list);
#ifndef DOXYGEN_SKIP
#ifndef DOXYGEN_AI_DOCS
/**
* Used for 'foreach()' and [] get from Squirrel.
*/
@ -280,7 +280,7 @@ public:
* list.Valuate(MyVal, 12);
*/
void Valuate(void *valuator_function, int params, ...);
#endif /* DOXYGEN_SKIP */
#endif /* DOXYGEN_AI_DOCS */
};
#endif /* AI_LIST_HPP */

View File

@ -38,6 +38,7 @@ 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
protected:
/**
* Executes a raw DoCommand for the AI.
@ -180,51 +181,45 @@ protected:
public:
/**
* Store the latest result of a DoCommand per company.
* @note NEVER use this yourself in your AI!
* @param res The result of the last command.
*/
static void SetLastCommandRes(bool res);
/**
* Store a new_vehicle_id per company.
* @note NEVER use this yourself in your AI!
* @param vehicle_id The new VehicleID.
*/
static void SetNewVehicleID(VehicleID vehicle_id);
/**
* Store a new_sign_id per company.
* @note NEVER use this yourself in your AI!
* @param sign_id The new SignID.
*/
static void SetNewSignID(SignID sign_id);
/**
* Store a new_tunnel_endtile per company.
* @note NEVER use this yourself in your AI!
* @param tile The new TileIndex.
*/
static void SetNewTunnelEndtile(TileIndex tile);
/**
* Store a new_group_id per company.
* @note NEVER use this yourself in your AI!
* @param group_id The new GroupID.
*/
static void SetNewGroupID(GroupID group_id);
/**
* Store a allow_do_command per company.
* @note NEVER use this yourself in your AI!
* @param allow The new allow.
*/
static void SetAllowDoCommand(bool allow);
/**
* Get the pointer to store log message in.
* @note NEVER use this yourself in your AI!
*/
static void *&GetLogPointer();
#endif /* DOXYGEN_AI_DOCS */
};
#endif /* AI_OBJECT_HPP */

View File

@ -443,12 +443,12 @@ public:
*/
static bool RemoveOrder(VehicleID vehicle_id, OrderPosition order_position);
#ifndef DOXYGEN_SKIP
#ifndef DOXYGEN_AI_DOCS
/**
* Internal function to help SetOrderFlags.
*/
static bool _SetOrderFlags();
#endif /* DOXYGEN_SKIP */
#endif /* DOXYGEN_AI_DOCS */
/**
* Changes the order flags of the given order.

View File

@ -65,7 +65,7 @@ public:
*/
static TileIndex GetOtherTunnelEnd(TileIndex tile);
#ifndef DOXYGEN_SKIP
#ifndef DOXYGEN_AI_DOCS
/**
* Internal function to help BuildTunnel in case of road.
*/
@ -75,7 +75,7 @@ public:
* Internal function to help BuildTunnel in case of road.
*/
static bool _BuildTunnelRoad2();
#endif /* DOXYGEN_SKIP */
#endif /* DOXYGEN_AI_DOCS */
/**
* Builds a tunnel starting at start. The direction of the tunnel depends

View File

@ -102,9 +102,9 @@ BEGIN {
/^( *)private/ { if (cls_level == 1) public = "false"; next; }
# Ignore special doxygen blocks
/^#ifndef DOXYGEN_SKIP/ { doxygen_skip = "next"; next; }
/^#ifdef DOXYGEN_SKIP/ { doxygen_skip = "true"; next; }
/^#endif \/\* DOXYGEN_SKIP \*\// { doxygen_skip = "false"; next; }
/^#ifndef DOXYGEN_AI_DOCS/ { doxygen_skip = "next"; next; }
/^#ifdef DOXYGEN_AI_DOCS/ { doxygen_skip = "true"; next; }
/^#endif \/\* DOXYGEN_AI_DOCS \*\// { doxygen_skip = "false"; next; }
/^#else/ {
if (doxygen_skip == "next") {
doxygen_skip = "true";

View File

@ -280,7 +280,8 @@ protected:
/** Sort servers by name. */
static int CDECL NGameNameSorter(NetworkGameList * const *a, NetworkGameList * const *b)
{
return strnatcmp((*a)->info.server_name, (*b)->info.server_name); // Sort by name (natural sorting).
int r = strnatcmp((*a)->info.server_name, (*b)->info.server_name); // Sort by name (natural sorting).
return r == 0 ? (*a)->address.CompareTo((*b)->address) : r;
}
/**

View File

@ -16,6 +16,7 @@
#include "network/network_func.h"
#include "order_backup.h"
#include "vehicle_base.h"
#include "window_func.h"
OrderBackupPool _order_backup_pool("BackupOrder");
INSTANTIATE_POOL_METHODS(OrderBackup)
@ -84,6 +85,8 @@ void OrderBackup::DoRestore(Vehicle *v)
} else if (this->orders != NULL && OrderList::CanAllocateItem()) {
v->orders.list = new OrderList(this->orders, v);
this->orders = NULL;
/* Make sure buoys/oil rigs are updated in the station list. */
InvalidateWindowClassesData(WC_STATION_LIST, 0);
}
uint num_orders = v->GetNumOrders();

View File

@ -51,7 +51,7 @@ public:
uint16 travel_time; ///< How long in ticks the journey to this destination should take.
Order() : refit_cargo(CT_NO_REFIT) {}
~Order() {}
~Order();
Order(uint32 packed);

View File

@ -41,6 +41,19 @@ INSTANTIATE_POOL_METHODS(Order)
OrderListPool _orderlist_pool("OrderList");
INSTANTIATE_POOL_METHODS(OrderList)
/** Clean everything up. */
Order::~Order()
{
if (CleaningPool()) return;
/* We can visit oil rigs and buoys that are not our own. They will be shown in
* the list of stations. So, we need to invalidate that window if needed. */
if (this->IsType(OT_GOTO_STATION) || this->IsType(OT_GOTO_WAYPOINT)) {
BaseStation *bs = BaseStation::GetIfValid(this->GetDestination());
if (bs != NULL && bs->owner == OWNER_NONE) InvalidateWindowClassesData(WC_STATION_LIST, 0);
}
}
/**
* 'Free' the order
* @note ONLY use on "current_order" vehicle orders!
@ -367,6 +380,14 @@ void OrderList::InsertOrderAt(Order *new_order, int index)
++this->num_orders;
if (!new_order->IsType(OT_IMPLICIT)) ++this->num_manual_orders;
this->timetable_duration += new_order->wait_time + new_order->travel_time;
/* We can visit oil rigs and buoys that are not our own. They will be shown in
* the list of stations. So, we need to invalidate that window if needed. */
if (new_order->IsType(OT_GOTO_STATION) || new_order->IsType(OT_GOTO_WAYPOINT)) {
BaseStation *bs = BaseStation::Get(new_order->GetDestination());
if (bs->owner == OWNER_NONE) InvalidateWindowClassesData(WC_STATION_LIST, 0);
}
}

View File

@ -90,7 +90,12 @@ Station::~Station()
}
}
InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
if (this->owner == OWNER_NONE) {
/* Invalidate all in case of oil rigs. */
InvalidateWindowClassesData(WC_STATION_LIST, 0);
} else {
InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
}
DeleteWindowById(WC_STATION_VIEW, index);