(svn r13406) [NoAI] -Change [API CHANGE]: renamed CompanyIndex to CompanyID and AICompany::ResolveCompanyIndex() to AICompany::ResolveCompanyID(), to be more consistant with the rest of the API
[NoAI] -Change [API CHANGE]: INVALID_COMPANY now has value -1, to be more consistant with the rest of the API
--- a/bin/ai/regression/regression.txt Sat Jun 07 23:06:36 2008 +0000
+++ b/bin/ai/regression/regression.txt Sat Jun 07 23:08:42 2008 +0000
@@ -5784,7 +5784,7 @@
IsValidSign(): false
GetText(): (null : 0x00000000)
GetLocation(): -1
- GetOwner(): 9
+ GetOwner(): -1
Sign 0
IsValidSign(): true
GetText(): Some Sign
@@ -5794,17 +5794,17 @@
IsValidSign(): false
GetText(): (null : 0x00000000)
GetLocation(): -1
- GetOwner(): 9
+ GetOwner(): -1
Sign 2
IsValidSign(): false
GetText(): (null : 0x00000000)
GetLocation(): -1
- GetOwner(): 9
+ GetOwner(): -1
Sign 3
IsValidSign(): false
GetText(): (null : 0x00000000)
GetLocation(): -1
- GetOwner(): 9
+ GetOwner(): -1
Valid Signs: 1
--Station--
@@ -6053,29 +6053,29 @@
41897 => 16757
41641 => 16666
GetOwner() ListDump:
- 42414 => 9
- 42413 => 9
- 42410 => 9
- 42159 => 9
- 42158 => 9
- 42156 => 9
- 41903 => 9
- 41902 => 9
- 41901 => 9
- 41900 => 9
- 41899 => 9
- 41897 => 9
- 41647 => 9
- 41646 => 9
- 41645 => 9
- 41644 => 9
- 41643 => 9
- 41641 => 9
- 41391 => 9
- 41390 => 9
- 41389 => 9
- 41388 => 9
- 41387 => 9
+ 42414 => -1
+ 42413 => -1
+ 42410 => -1
+ 42159 => -1
+ 42158 => -1
+ 42156 => -1
+ 41903 => -1
+ 41902 => -1
+ 41901 => -1
+ 41900 => -1
+ 41899 => -1
+ 41897 => -1
+ 41647 => -1
+ 41646 => -1
+ 41645 => -1
+ 41644 => -1
+ 41643 => -1
+ 41641 => -1
+ 41391 => -1
+ 41390 => -1
+ 41389 => -1
+ 41388 => -1
+ 41387 => -1
CargoAcceptance(): done
KeepAboveValue(10): done
Count(): 6
@@ -6832,7 +6832,7 @@
--Subsidy (0) --
IsValidSubsidy(): false
IsAwarded(): false
- GetAwardedTo(): 9
+ GetAwardedTo(): -1
GetExpireDate(): -1
SourceIsTown(): false
GetSource(): 65535
@@ -6849,7 +6849,7 @@
--Subsidy (0) --
IsValidSubsidy(): true
IsAwarded(): false
- GetAwardedTo(): 9
+ GetAwardedTo(): -1
GetExpireDate(): 712800
SourceIsTown(): true
GetSource(): 6
--- a/src/ai/api/ai_company.cpp Sat Jun 07 23:06:36 2008 +0000
+++ b/src/ai/api/ai_company.cpp Sat Jun 07 23:08:42 2008 +0000
@@ -16,9 +16,9 @@
#include "../../string_func.h"
#include "table/strings.h"
-/* static */ AICompany::CompanyIndex AICompany::ResolveCompanyIndex(AICompany::CompanyIndex company)
+/* static */ AICompany::CompanyID AICompany::ResolveCompanyID(AICompany::CompanyID company)
{
- if (company == MY_COMPANY) return (CompanyIndex)((byte)_current_player);
+ if (company == MY_COMPANY) return (CompanyID)((byte)_current_player);
return (::IsValidPlayer((PlayerID)company) && ::GetPlayer((PlayerID)company)->is_active) ? company : INVALID_COMPANY;
}
@@ -31,9 +31,9 @@
return AIObject::DoCommand(0, 0, 0, CMD_CHANGE_COMPANY_NAME);
}
-/* static */ char *AICompany::GetCompanyName(AICompany::CompanyIndex company)
+/* static */ char *AICompany::GetCompanyName(AICompany::CompanyID company)
{
- company = ResolveCompanyIndex(company);
+ company = ResolveCompanyID(company);
if (company == INVALID_COMPANY) return NULL;
static const int len = 64;
@@ -52,9 +52,9 @@
return AIObject::DoCommand(0, 0, 0, CMD_CHANGE_PRESIDENT_NAME);
}
-/* static */ char *AICompany::GetPresidentName(AICompany::CompanyIndex company)
+/* static */ char *AICompany::GetPresidentName(AICompany::CompanyID company)
{
- company = ResolveCompanyIndex(company);
+ company = ResolveCompanyID(company);
static const int len = 64;
char *president_name = MallocT<char>(len);
@@ -68,17 +68,17 @@
return president_name;
}
-/* static */ Money AICompany::GetCompanyValue(AICompany::CompanyIndex company)
+/* static */ Money AICompany::GetCompanyValue(AICompany::CompanyID company)
{
- company = ResolveCompanyIndex(company);
+ company = ResolveCompanyID(company);
if (company == INVALID_COMPANY) return -1;
return ::GetPlayer((PlayerID)company)->cur_economy.company_value;
}
-/* static */ Money AICompany::GetBankBalance(AICompany::CompanyIndex company)
+/* static */ Money AICompany::GetBankBalance(AICompany::CompanyID company)
{
- company = ResolveCompanyIndex(company);
+ company = ResolveCompanyID(company);
if (company == INVALID_COMPANY) return -1;
return ::GetPlayer((PlayerID)company)->player_money;
@@ -134,9 +134,9 @@
return AIObject::DoCommand(tile, 0, 0, CMD_BUILD_COMPANY_HQ);
}
-/* static */ TileIndex AICompany::GetCompanyHQ(CompanyIndex company)
+/* static */ TileIndex AICompany::GetCompanyHQ(CompanyID company)
{
- company = ResolveCompanyIndex(company);
+ company = ResolveCompanyID(company);
if (company == INVALID_COMPANY) return INVALID_TILE;
TileIndex loc = ::GetPlayer((PlayerID)company)->location_of_house;
@@ -148,9 +148,9 @@
return AIObject::DoCommand(0, 0, autorenew ? 1 : 0, CMD_SET_AUTOREPLACE);
}
-/* static */ bool AICompany::GetAutoRenewStatus(CompanyIndex company)
+/* static */ bool AICompany::GetAutoRenewStatus(CompanyID company)
{
- company = ResolveCompanyIndex(company);
+ company = ResolveCompanyID(company);
if (company == INVALID_COMPANY) return false;
return ::GetPlayer((PlayerID)company)->engine_renew;
@@ -161,9 +161,9 @@
return AIObject::DoCommand(0, 1, months, CMD_SET_AUTOREPLACE);
}
-/* static */ int16 AICompany::GetAutoRenewMonths(CompanyIndex company)
+/* static */ int16 AICompany::GetAutoRenewMonths(CompanyID company)
{
- company = ResolveCompanyIndex(company);
+ company = ResolveCompanyID(company);
if (company == INVALID_COMPANY) return 0;
return ::GetPlayer((PlayerID)company)->engine_renew_months;
@@ -174,9 +174,9 @@
return AIObject::DoCommand(0, 2, money, CMD_SET_AUTOREPLACE);
}
-/* static */ uint32 AICompany::GetAutoRenewMoney(CompanyIndex company)
+/* static */ uint32 AICompany::GetAutoRenewMoney(CompanyID company)
{
- company = ResolveCompanyIndex(company);
+ company = ResolveCompanyID(company);
if (company == INVALID_COMPANY) return 0;
return ::GetPlayer((PlayerID)company)->engine_renew_money;
--- a/src/ai/api/ai_company.hpp Sat Jun 07 23:06:36 2008 +0000
+++ b/src/ai/api/ai_company.hpp Sat Jun 07 23:08:42 2008 +0000
@@ -14,12 +14,12 @@
public:
static const char *GetClassName() { return "AICompany"; }
- /** Different constants related to CompanyIndex. */
- enum CompanyIndex {
+ /** Different constants related to CompanyID. */
+ enum CompanyID {
+ INVALID_COMPANY = -1, //!< An invalid company.
FIRST_COMPANY = 0, //!< The first available company.
LAST_COMPANY = 7, //!< The last available company.
MY_COMPANY = 8, //!< Constant that gets resolved to the correct company index for your company.
- INVALID_COMPANY = 9, //!< An invalid company.
};
/**
@@ -30,7 +30,7 @@
* @param company The company index to resolve.
* @return The resolved company index.
*/
- static CompanyIndex ResolveCompanyIndex(CompanyIndex company);
+ static CompanyID ResolveCompanyID(CompanyID company);
/**
* Set the name of your company.
@@ -44,10 +44,10 @@
/**
* Get the name of the given company.
* @param company The company to get the name for.
- * @pre ResolveCompanyIndex(company) != INVALID_COMPANY
+ * @pre ResolveCompanyID(company) != INVALID_COMPANY
* @return The name of the given company.
*/
- static char *GetCompanyName(CompanyIndex company);
+ static char *GetCompanyName(CompanyID company);
/**
* Set the name of your president.
@@ -61,10 +61,10 @@
/**
* Get the name of the president of the given company.
* @param company The company to get the president's name for.
- * @pre ResolveCompanyIndex(company) != INVALID_COMPANY
+ * @pre ResolveCompanyID(company) != INVALID_COMPANY
* @return The name of the president of the given company.
*/
- static char *GetPresidentName(CompanyIndex company);
+ static char *GetPresidentName(CompanyID company);
/**
* Sets the amount to loan.
@@ -112,18 +112,18 @@
/**
* Gets the current value of the given company.
* @param company The company to get the company value of.
- * @pre ResolveCompanyIndex(company) != INVALID_COMPANY
+ * @pre ResolveCompanyID(company) != INVALID_COMPANY
* @return The current value of the given company.
*/
- static Money GetCompanyValue(CompanyIndex company);
+ static Money GetCompanyValue(CompanyID company);
/**
* Gets the bank balance. In other words, the amount of money the given company can spent.
* @param company The company to get the bank balance of.
- * @pre ResolveCompanyIndex(company) != INVALID_COMPANY
+ * @pre ResolveCompanyID(company) != INVALID_COMPANY
* @return The actual bank balance.
*/
- static Money GetBankBalance(CompanyIndex company);
+ static Money GetBankBalance(CompanyID company);
/**
* Build your company's HQ on the given tile.
@@ -140,10 +140,10 @@
/**
* Return the location of a company's HQ.
* @param company The company the get the HQ of.
- * @pre ResolveCompanyIndex(company) != INVALID_COMPANY.
+ * @pre ResolveCompanyID(company) != INVALID_COMPANY.
* @return The tile of the company's HQ, this tile is the most nothern tile of that HQ, or INVALID_TILE if there is no HQ yet.
*/
- static TileIndex GetCompanyHQ(CompanyIndex company);
+ static TileIndex GetCompanyHQ(CompanyID company);
/**
* Set whether autorenew is enabled for your company.
@@ -155,10 +155,10 @@
/**
* Return whether autorenew is enabled for a company.
* @param company The company to get the autorenew status of.
- * @pre ResolveCompanyIndex(company) != INVALID_COMPANY.
+ * @pre ResolveCompanyID(company) != INVALID_COMPANY.
* @return True if autorenew is enabled.
*/
- static bool GetAutoRenewStatus(CompanyIndex company);
+ static bool GetAutoRenewStatus(CompanyID company);
/**
* Set the number of months before/after max age to autorenew an engine for your company.
@@ -170,10 +170,10 @@
/**
* Return the number of months before/after max age to autorenew an engine for a company.
* @param company The company to get the autorenew months of.
- * @pre ResolveCompanyIndex(company) != INVALID_COMPANY.
+ * @pre ResolveCompanyID(company) != INVALID_COMPANY.
* @return The months before/after max age of engine.
*/
- static int16 GetAutoRenewMonths(CompanyIndex company);
+ static int16 GetAutoRenewMonths(CompanyID company);
/**
* Set the minimum money needed to autorenew an engine for your company.
@@ -185,12 +185,12 @@
/**
* Return the minimum money needed to autorenew an engine for a company.
* @param company The company to get the autorenew money of.
- * @pre ResolveCompanyIndex(company) != INVALID_COMPANY.
+ * @pre ResolveCompanyID(company) != INVALID_COMPANY.
* @return The minimum required money for autorenew to work.
*/
- static uint32 GetAutoRenewMoney(CompanyIndex company);
+ static uint32 GetAutoRenewMoney(CompanyID company);
};
-DECLARE_POSTFIX_INCREMENT(AICompany::CompanyIndex);
+DECLARE_POSTFIX_INCREMENT(AICompany::CompanyID);
#endif /* AI_COMPANY_HPP */
--- a/src/ai/api/ai_company.hpp.sq Sat Jun 07 23:06:36 2008 +0000
+++ b/src/ai/api/ai_company.hpp.sq Sat Jun 07 23:08:42 2008 +0000
@@ -5,8 +5,8 @@
namespace SQConvert {
/* Allow enums to be used as Squirrel parameters */
- template <> AICompany::CompanyIndex GetParam(ForceType<AICompany::CompanyIndex>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AICompany::CompanyIndex)tmp; }
- template <> int Return<AICompany::CompanyIndex>(HSQUIRRELVM vm, AICompany::CompanyIndex res) { sq_pushinteger(vm, (int32)res); return 1; }
+ template <> AICompany::CompanyID GetParam(ForceType<AICompany::CompanyID>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AICompany::CompanyID)tmp; }
+ template <> int Return<AICompany::CompanyID>(HSQUIRRELVM vm, AICompany::CompanyID res) { sq_pushinteger(vm, (int32)res); return 1; }
/* Allow AICompany to be used as Squirrel parameter */
template <> AICompany *GetParam(ForceType<AICompany *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AICompany *)instance; }
@@ -27,7 +27,7 @@
SQAICompany.DefSQConst(engine, AICompany::INVALID_COMPANY, "INVALID_COMPANY");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetClassName, "GetClassName", 1, "x");
- SQAICompany.DefSQStaticMethod(engine, &AICompany::ResolveCompanyIndex, "ResolveCompanyIndex", 2, "xi");
+ SQAICompany.DefSQStaticMethod(engine, &AICompany::ResolveCompanyID, "ResolveCompanyID", 2, "xi");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetCompanyName, "SetCompanyName", 2, "xs");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetCompanyName, "GetCompanyName", 2, "xi");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetPresidentName, "SetPresidentName", 2, "xs");
--- a/src/ai/api/ai_event_types.hpp Sat Jun 07 23:06:36 2008 +0000
+++ b/src/ai/api/ai_event_types.hpp Sat Jun 07 23:08:42 2008 +0000
@@ -318,7 +318,7 @@
*/
AIEventCompanyNew(PlayerID owner) :
AIEvent(AI_ET_COMPANY_NEW),
- owner((AICompany::CompanyIndex)(byte)owner)
+ owner((AICompany::CompanyID)(byte)owner)
{}
/**
@@ -329,13 +329,13 @@
static AIEventCompanyNew *Convert(AIEvent *instance) { return (AIEventCompanyNew *)instance; }
/**
- * Get the CompanyIndex of the company that has been created.
- * @return The CompanyIndex of the company.
+ * Get the CompanyID of the company that has been created.
+ * @return The CompanyID of the company.
*/
- AICompany::CompanyIndex GetCompanyIndex() { return owner; }
+ AICompany::CompanyID GetCompanyID() { return owner; }
private:
- AICompany::CompanyIndex owner;
+ AICompany::CompanyID owner;
};
/**
@@ -351,7 +351,7 @@
*/
AIEventCompanyInTrouble(PlayerID owner) :
AIEvent(AI_ET_COMPANY_IN_TROUBLE),
- owner((AICompany::CompanyIndex)(byte)owner)
+ owner((AICompany::CompanyID)(byte)owner)
{}
/**
@@ -362,13 +362,13 @@
static AIEventCompanyInTrouble *Convert(AIEvent *instance) { return (AIEventCompanyInTrouble *)instance; }
/**
- * Get the CompanyIndex of the company that is in trouble.
- * @return The CompanyIndex of the company in trouble.
+ * Get the CompanyID of the company that is in trouble.
+ * @return The CompanyID of the company in trouble.
*/
- AICompany::CompanyIndex GetCompanyIndex() { return owner; }
+ AICompany::CompanyID GetCompanyID() { return owner; }
private:
- AICompany::CompanyIndex owner;
+ AICompany::CompanyID owner;
};
/**
@@ -385,8 +385,8 @@
*/
AIEventCompanyMerger(PlayerID old_owner, PlayerID new_owner) :
AIEvent(AI_ET_COMPANY_MERGER),
- old_owner((AICompany::CompanyIndex)(byte)old_owner),
- new_owner((AICompany::CompanyIndex)(byte)new_owner)
+ old_owner((AICompany::CompanyID)(byte)old_owner),
+ new_owner((AICompany::CompanyID)(byte)new_owner)
{}
/**
@@ -397,23 +397,23 @@
static AIEventCompanyMerger *Convert(AIEvent *instance) { return (AIEventCompanyMerger *)instance; }
/**
- * Get the CompanyIndex of the company that has been bought.
- * @return The CompanyIndex of the company that has been bought.
- * @note: The value below is not valid anymore as CompanyIndex, and
- * AICompany::ResolveCompanyIndex will return INVALID_COMPANY. It's
+ * Get the CompanyID of the company that has been bought.
+ * @return The CompanyID of the company that has been bought.
+ * @note: The value below is not valid anymore as CompanyID, and
+ * AICompany::ResolveCompanyID will return INVALID_COMPANY. It's
* only usefull if you're keeping track of company's yourself.
*/
- AICompany::CompanyIndex GetOldCompanyIndex() { return old_owner; }
+ AICompany::CompanyID GetOldCompanyID() { return old_owner; }
/**
- * Get the CompanyIndex of the new owner.
- * @return The CompanyIndex of the new owner.
+ * Get the CompanyID of the new owner.
+ * @return The CompanyID of the new owner.
*/
- AICompany::CompanyIndex GetNewCompanyIndex() { return new_owner; }
+ AICompany::CompanyID GetNewCompanyID() { return new_owner; }
private:
- AICompany::CompanyIndex old_owner;
- AICompany::CompanyIndex new_owner;
+ AICompany::CompanyID old_owner;
+ AICompany::CompanyID new_owner;
};
/**
@@ -428,7 +428,7 @@
*/
AIEventCompanyBankrupt(PlayerID owner) :
AIEvent(AI_ET_COMPANY_BANKRUPT),
- owner((AICompany::CompanyIndex)(byte)owner)
+ owner((AICompany::CompanyID)(byte)owner)
{}
/**
@@ -439,13 +439,13 @@
static AIEventCompanyBankrupt *Convert(AIEvent *instance) { return (AIEventCompanyBankrupt *)instance; }
/**
- * Get the CompanyIndex of the company that has gone bankrupt.
- * @return The CompanyIndex of the company that has gone bankrupt.
+ * Get the CompanyID of the company that has gone bankrupt.
+ * @return The CompanyID of the company that has gone bankrupt.
*/
- AICompany::CompanyIndex GetCompanyIndex() { return owner; }
+ AICompany::CompanyID GetCompanyID() { return owner; }
private:
- AICompany::CompanyIndex owner;
+ AICompany::CompanyID owner;
};
/**
--- a/src/ai/api/ai_event_types.hpp.sq Sat Jun 07 23:06:36 2008 +0000
+++ b/src/ai/api/ai_event_types.hpp.sq Sat Jun 07 23:08:42 2008 +0000
@@ -175,7 +175,7 @@
SQAIEventCompanyNew.DefSQStaticMethod(engine, &AIEventCompanyNew::GetClassName, "GetClassName", 1, "x");
SQAIEventCompanyNew.DefSQStaticMethod(engine, &AIEventCompanyNew::Convert, "Convert", 2, "xx");
- SQAIEventCompanyNew.DefSQMethod(engine, &AIEventCompanyNew::GetCompanyIndex, "GetCompanyIndex", 1, "x");
+ SQAIEventCompanyNew.DefSQMethod(engine, &AIEventCompanyNew::GetCompanyID, "GetCompanyID", 1, "x");
SQAIEventCompanyNew.PostRegister(engine);
}
@@ -196,7 +196,7 @@
SQAIEventCompanyInTrouble.DefSQStaticMethod(engine, &AIEventCompanyInTrouble::GetClassName, "GetClassName", 1, "x");
SQAIEventCompanyInTrouble.DefSQStaticMethod(engine, &AIEventCompanyInTrouble::Convert, "Convert", 2, "xx");
- SQAIEventCompanyInTrouble.DefSQMethod(engine, &AIEventCompanyInTrouble::GetCompanyIndex, "GetCompanyIndex", 1, "x");
+ SQAIEventCompanyInTrouble.DefSQMethod(engine, &AIEventCompanyInTrouble::GetCompanyID, "GetCompanyID", 1, "x");
SQAIEventCompanyInTrouble.PostRegister(engine);
}
@@ -217,8 +217,8 @@
SQAIEventCompanyMerger.DefSQStaticMethod(engine, &AIEventCompanyMerger::GetClassName, "GetClassName", 1, "x");
SQAIEventCompanyMerger.DefSQStaticMethod(engine, &AIEventCompanyMerger::Convert, "Convert", 2, "xx");
- SQAIEventCompanyMerger.DefSQMethod(engine, &AIEventCompanyMerger::GetOldCompanyIndex, "GetOldCompanyIndex", 1, "x");
- SQAIEventCompanyMerger.DefSQMethod(engine, &AIEventCompanyMerger::GetNewCompanyIndex, "GetNewCompanyIndex", 1, "x");
+ SQAIEventCompanyMerger.DefSQMethod(engine, &AIEventCompanyMerger::GetOldCompanyID, "GetOldCompanyID", 1, "x");
+ SQAIEventCompanyMerger.DefSQMethod(engine, &AIEventCompanyMerger::GetNewCompanyID, "GetNewCompanyID", 1, "x");
SQAIEventCompanyMerger.PostRegister(engine);
}
@@ -239,7 +239,7 @@
SQAIEventCompanyBankrupt.DefSQStaticMethod(engine, &AIEventCompanyBankrupt::GetClassName, "GetClassName", 1, "x");
SQAIEventCompanyBankrupt.DefSQStaticMethod(engine, &AIEventCompanyBankrupt::Convert, "Convert", 2, "xx");
- SQAIEventCompanyBankrupt.DefSQMethod(engine, &AIEventCompanyBankrupt::GetCompanyIndex, "GetCompanyIndex", 1, "x");
+ SQAIEventCompanyBankrupt.DefSQMethod(engine, &AIEventCompanyBankrupt::GetCompanyID, "GetCompanyID", 1, "x");
SQAIEventCompanyBankrupt.PostRegister(engine);
}
--- a/src/ai/api/ai_sign.cpp Sat Jun 07 23:06:36 2008 +0000
+++ b/src/ai/api/ai_sign.cpp Sat Jun 07 23:08:42 2008 +0000
@@ -41,11 +41,11 @@
return ::TileVirtXY(sign->x, sign->y);
}
-/* static */ AICompany::CompanyIndex AISign::GetOwner(SignID sign_id)
+/* static */ AICompany::CompanyID AISign::GetOwner(SignID sign_id)
{
if (!IsValidSign(sign_id)) return AICompany::INVALID_COMPANY;
const Sign *sign = ::GetSign(sign_id);
- return (AICompany::CompanyIndex)(byte)sign->owner;
+ return (AICompany::CompanyID)(byte)sign->owner;
}
/* static */ bool AISign::RemoveSign(SignID sign_id)
--- a/src/ai/api/ai_sign.hpp Sat Jun 07 23:06:36 2008 +0000
+++ b/src/ai/api/ai_sign.hpp Sat Jun 07 23:08:42 2008 +0000
@@ -64,7 +64,7 @@
* @pre IsValidSign(sign_id).
* @return The owner of the sign.
*/
- static AICompany::CompanyIndex GetOwner(SignID sign_id);
+ static AICompany::CompanyID GetOwner(SignID sign_id);
/**
* Builds a sign on the map.
--- a/src/ai/api/ai_subsidy.cpp Sat Jun 07 23:06:36 2008 +0000
+++ b/src/ai/api/ai_subsidy.cpp Sat Jun 07 23:08:42 2008 +0000
@@ -23,11 +23,11 @@
return _subsidies[subsidy_id].age >= 12;
}
-/* static */ AICompany::CompanyIndex AISubsidy::GetAwardedTo(SubsidyID subsidy_id)
+/* static */ AICompany::CompanyID AISubsidy::GetAwardedTo(SubsidyID subsidy_id)
{
if (!IsAwarded(subsidy_id)) return AICompany::INVALID_COMPANY;
- return (AICompany::CompanyIndex)((byte)GetStation(_subsidies[subsidy_id].from)->owner);
+ return (AICompany::CompanyID)((byte)GetStation(_subsidies[subsidy_id].from)->owner);
}
/* static */ int32 AISubsidy::GetExpireDate(SubsidyID subsidy_id)
--- a/src/ai/api/ai_subsidy.hpp Sat Jun 07 23:06:36 2008 +0000
+++ b/src/ai/api/ai_subsidy.hpp Sat Jun 07 23:08:42 2008 +0000
@@ -36,7 +36,7 @@
* @pre IsAwarded(subsidy_id).
* @return The companyindex of the company this subsidy is awarded to.
*/
- static AICompany::CompanyIndex GetAwardedTo(SubsidyID subsidy_id);
+ static AICompany::CompanyID GetAwardedTo(SubsidyID subsidy_id);
/**
* Get the date this subsidy expires. In case the subsidy is already
--- a/src/ai/api/ai_tile.cpp Sat Jun 07 23:06:36 2008 +0000
+++ b/src/ai/api/ai_tile.cpp Sat Jun 07 23:08:42 2008 +0000
@@ -92,13 +92,13 @@
return ::TileHeight(tile);
}
-/* static */ AICompany::CompanyIndex AITile::GetOwner(TileIndex tile)
+/* static */ AICompany::CompanyID AITile::GetOwner(TileIndex tile)
{
if (!::IsValidTile(tile)) return AICompany::INVALID_COMPANY;
if (::IsTileType(tile, MP_HOUSE)) return AICompany::INVALID_COMPANY;
if (::IsTileType(tile, MP_INDUSTRY)) return AICompany::INVALID_COMPANY;
- return AICompany::ResolveCompanyIndex((AICompany::CompanyIndex)(byte)::GetTileOwner(tile));
+ return AICompany::ResolveCompanyID((AICompany::CompanyID)(byte)::GetTileOwner(tile));
}
/* static */ int32 AITile::GetCargoAcceptance(TileIndex tile, CargoID cargo_type, uint width, uint height, uint radius)
--- a/src/ai/api/ai_tile.hpp Sat Jun 07 23:06:36 2008 +0000
+++ b/src/ai/api/ai_tile.hpp Sat Jun 07 23:08:42 2008 +0000
@@ -143,10 +143,10 @@
* Get the owner of the tile.
* @param tile The tile to get the owner from.
* @pre AIMap::IsValidTile(tile).
- * @return The CompanyIndex of the owner of the tile, or INVALID_COMPANY if
+ * @return The CompanyID of the owner of the tile, or INVALID_COMPANY if
* there is no owner (grass/industry/water tiles, etc.).
*/
- static AICompany::CompanyIndex GetOwner(TileIndex tile);
+ static AICompany::CompanyID GetOwner(TileIndex tile);
/**
* Check how much cargo this tile accepts.