src/ai/api/ai_company.hpp
author rubidium
Sun, 25 Mar 2007 12:02:13 +0000
branchnoai
changeset 9520 f7cf8bea10db
parent 9448 2a4c4340233d
child 9524 283d23931bb4
permissions -rw-r--r--
(svn r9440) [NoAI] -Codechange: use the identifier used for the #ifdef in the #endif not something that looks like the identifier.
9374
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
     1
/* $Id$ */
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
     2
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
     3
/** @file ai_company.hpp Everything to query a company's financials and statistics */
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
     4
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
     5
#ifndef AI_COMPANY_HPP
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
     6
#define AI_COMPANY_HPP
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
     7
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
     8
#include "ai_object.hpp"
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
     9
9447
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    10
/**
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    11
 * Class that handles all company related functions.
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    12
 */
9374
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    13
class AICompany : public AIObject {
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    14
public:
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    15
	/**
9447
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    16
	 * Set the name of your company.
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    17
	 * @param name the new name of the company.
9374
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    18
	 * @pre name != NULL
9447
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    19
	 * @return true if the command was send without problem.
9374
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    20
	 */
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    21
	bool SetCompanyName(const char *name);
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    22
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    23
	/**
9447
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    24
	 * Get the name of your company.
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    25
	 * @return the name of your company.
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    26
	 * @note the returned company name must be free'd (C++ only).
9374
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    27
	 */
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    28
	char *GetCompanyName();
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    29
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    30
	/**
9447
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    31
	 * Gets the current value of your company.
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    32
	 * @return the current value of your company.
9374
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    33
	 */
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    34
	int32 GetCompanyValue();
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    35
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    36
	/**
9447
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    37
	 * Gets the bank balance. In other words, the amount of money you can spent.
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    38
	 * @return the bank balance of your company.
9374
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    39
	 */
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    40
	int32 GetBankBalance();
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    41
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    42
	/**
9447
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    43
	 * Gets the amount your company have loaned.
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    44
	 * @return the amount loaned money.
9448
2a4c4340233d (svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents: 9447
diff changeset
    45
	 * @post the return value is always non-negative.
9447
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    46
	 * @post GetLoanInterval() is always a multiplier of the return value.
9374
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    47
	 */
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    48
	int32 GetLoanAmount();
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    49
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    50
	/**
9447
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    51
	 * Gets the maximum amount your company can loan.
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    52
	 * @return the maximum amount your company can loan.
9448
2a4c4340233d (svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents: 9447
diff changeset
    53
	 * @post the return value is always non-negative.
9447
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    54
	 * @post GetLoanInterval() is always a multiplier of the return value.
9374
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    55
	 */
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    56
	int32 GetMaxLoanAmount();
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    57
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    58
	/**
9447
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    59
	 * Gets the interval/loan step.
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    60
	 * @return the loan step.
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    61
	 * @post return value is always positive.
9376
7c12a15c945a (svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents: 9374
diff changeset
    62
	 */
7c12a15c945a (svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents: 9374
diff changeset
    63
	int32 GetLoanInterval();
7c12a15c945a (svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents: 9374
diff changeset
    64
7c12a15c945a (svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents: 9374
diff changeset
    65
	/**
9447
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    66
	 * Sets the amount to loan.
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    67
	 * @param loan the amount to loan (multiplier of GetLoanInterval()).
9448
2a4c4340233d (svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents: 9447
diff changeset
    68
	 * @pre loan must be non-negative.
9447
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    69
	 * @pre GetLoanInterval must be a multiplier of loan.
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    70
	 * @pre loan must be below GetMaxLoan().
9448
2a4c4340233d (svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents: 9447
diff changeset
    71
	 * @pre loan - GetLoanAmount() + GetBankBalance() must be non-negative.
9447
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    72
	 * @return true if the loan could be set to your requested amount.
9374
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    73
	 */
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    74
	bool SetLoanAmount(int32 loan);
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    75
};
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    76
9425
8eec6d10844a (svn r9227) [NoAI] -Change: renamed SQUIRREL_CLASS to DEFINE_SQUIRREL_CLASS
truelight
parents: 9422
diff changeset
    77
#ifdef DEFINE_SQUIRREL_CLASS
9422
33efcc5f1b09 (svn r9223) [NoAI] -Change: moved squirrel/engine.cpp to squirrel.cpp in root
truelight
parents: 9404
diff changeset
    78
void SQAICompanyRegister(Squirrel *engine) {
9387
4255a0a2d272 (svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents: 9376
diff changeset
    79
	DefSQClass <AICompany> SQAICompany("AICompany");
9397
d8f8db9c1a2e (svn r9189) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine
truelight
parents: 9387
diff changeset
    80
	SQAICompany.PreRegister(engine);
9404
ef9e171617a3 (svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents: 9397
diff changeset
    81
	SQAICompany.AddConstructor(engine);
9397
d8f8db9c1a2e (svn r9189) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine
truelight
parents: 9387
diff changeset
    82
	SQAICompany.DefSQFunction(engine, &AICompany::SetCompanyName,   "SetCompanyName");
d8f8db9c1a2e (svn r9189) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine
truelight
parents: 9387
diff changeset
    83
	SQAICompany.DefSQFunction(engine, &AICompany::GetCompanyName,   "GetCompanyName");
d8f8db9c1a2e (svn r9189) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine
truelight
parents: 9387
diff changeset
    84
	SQAICompany.DefSQFunction(engine, &AICompany::GetCompanyValue,  "GetCompanyValue");
d8f8db9c1a2e (svn r9189) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine
truelight
parents: 9387
diff changeset
    85
	SQAICompany.DefSQFunction(engine, &AICompany::GetBankBalance,   "GetBankBalance");
d8f8db9c1a2e (svn r9189) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine
truelight
parents: 9387
diff changeset
    86
	SQAICompany.DefSQFunction(engine, &AICompany::GetLoanAmount,    "GetLoanAmount");
d8f8db9c1a2e (svn r9189) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine
truelight
parents: 9387
diff changeset
    87
	SQAICompany.DefSQFunction(engine, &AICompany::GetMaxLoanAmount, "GetMaxLoanAmount");
d8f8db9c1a2e (svn r9189) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine
truelight
parents: 9387
diff changeset
    88
	SQAICompany.DefSQFunction(engine, &AICompany::GetLoanInterval,  "GetLoanInterval");
d8f8db9c1a2e (svn r9189) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine
truelight
parents: 9387
diff changeset
    89
	SQAICompany.DefSQFunction(engine, &AICompany::SetLoanAmount,    "SetLoanAmount");
d8f8db9c1a2e (svn r9189) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine
truelight
parents: 9387
diff changeset
    90
	SQAICompany.PostRegister(engine);
9387
4255a0a2d272 (svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents: 9376
diff changeset
    91
}
9520
f7cf8bea10db (svn r9440) [NoAI] -Codechange: use the identifier used for the #ifdef in the #endif not something that looks like the identifier.
rubidium
parents: 9448
diff changeset
    92
#endif /* DEFINE_SQUIRREL_CLASS */
9387
4255a0a2d272 (svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents: 9376
diff changeset
    93
9374
61379e9b2393 (svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff changeset
    94
#endif /* AI_COMPANY_HPP */