author | rubidium |
Wed, 09 Jan 2008 18:11:12 +0000 | |
branch | noai |
changeset 9723 | eee46cb39750 |
parent 9701 | d1ac22c62f64 |
child 9724 | b39bc69bb2f2 |
permissions | -rw-r--r-- |
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 |
|
9436
e28503f827a5
(svn r9247) [NoAI] -Fix: some small coding-style/double inclusion issues.
rubidium
parents:
9430
diff
changeset
|
3 |
/** @file ai_company.cpp handles the functions of the AICompany class */ |
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
|
4 |
|
9430
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
5 |
#include "ai_company.hpp" |
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9701
diff
changeset
|
6 |
#include "../../command_func.h" |
9430
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
7 |
#include "../../player.h" |
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9701
diff
changeset
|
8 |
#include "../../economy_func.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9701
diff
changeset
|
9 |
#include "../../strings_func.h" |
9629 | 10 |
#include "../../variables.h" |
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9701
diff
changeset
|
11 |
#include "../../core/alloc_func.hpp" |
9629 | 12 |
#include "table/strings.h" |
9430
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
13 |
|
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
14 |
AICompany::CompanyIndex AICompany::ResolveCompanyIndex(AICompany::CompanyIndex company) |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
15 |
{ |
9701
d1ac22c62f64
(svn r11036) [NoAI] -Sync: with trunk r10774:11035.
rubidium
parents:
9696
diff
changeset
|
16 |
if (company == MY_COMPANY) return (CompanyIndex)((byte)_current_player); |
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
17 |
|
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
18 |
return (IsValidPlayer((PlayerID)company) && GetPlayer((PlayerID)company)->is_active) ? company : INVALID_COMPANY; |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
19 |
} |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
20 |
|
9430
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
21 |
bool AICompany::SetCompanyName(const char *name) |
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
22 |
{ |
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
23 |
if (name == NULL) return false; |
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
24 |
|
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
25 |
_cmd_text = name; |
9575
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
26 |
return this->DoCommand(0, 0, 0, CMD_CHANGE_COMPANY_NAME); |
9430
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
27 |
} |
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
28 |
|
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
29 |
char *AICompany::GetCompanyName(AICompany::CompanyIndex company) |
9430
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
30 |
{ |
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
31 |
company = this->ResolveCompanyIndex(company); |
9696
4384ed3de1f0
(svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents:
9668
diff
changeset
|
32 |
if (company == INVALID_COMPANY) return NULL; |
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
33 |
|
9430
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
34 |
static const int len = 64; |
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
35 |
char *company_name = MallocT<char>(len); |
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
36 |
|
9696
4384ed3de1f0
(svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents:
9668
diff
changeset
|
37 |
SetDParam(0, GetPlayer((PlayerID)company)->index); |
4384ed3de1f0
(svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents:
9668
diff
changeset
|
38 |
GetString(company_name, STR_COMPANY_NAME, &company_name[len - 1]); |
9430
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
39 |
return company_name; |
9e0a193b2bec
(svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents:
9427
diff
changeset
|
40 |
} |
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
|
41 |
|
9575
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
42 |
bool AICompany::SetPresidentName(const char *name) |
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
43 |
{ |
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
44 |
if (name == NULL) return false; |
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
45 |
|
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
46 |
_cmd_text = name; |
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
47 |
return this->DoCommand(0, 0, 0, CMD_CHANGE_PRESIDENT_NAME); |
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
48 |
} |
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
49 |
|
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
50 |
char *AICompany::GetPresidentName(AICompany::CompanyIndex company) |
9575
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
51 |
{ |
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
52 |
company = this->ResolveCompanyIndex(company); |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
53 |
|
9575
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
54 |
static const int len = 64; |
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
55 |
char *president_name = MallocT<char>(len); |
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
56 |
if (company != INVALID_COMPANY) { |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
57 |
SetDParam(0, GetPlayer((PlayerID)company)->index); |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
58 |
GetString(president_name, STR_PLAYER_NAME, &president_name[len - 1]); |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
59 |
} else { |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
60 |
*president_name = '\0'; |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
61 |
} |
9575
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
62 |
|
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
63 |
return president_name; |
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
64 |
} |
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9486
diff
changeset
|
65 |
|
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
66 |
int32 AICompany::GetCompanyValue(AICompany::CompanyIndex 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
|
67 |
{ |
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
68 |
company = this->ResolveCompanyIndex(company); |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
69 |
if (company == INVALID_COMPANY) return 0; |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
70 |
|
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
71 |
return GetPlayer((PlayerID)company)->cur_economy.company_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
|
72 |
} |
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 |
|
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
74 |
int32 AICompany::GetBankBalance(AICompany::CompanyIndex 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
|
75 |
{ |
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
76 |
company = this->ResolveCompanyIndex(company); |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
77 |
if (company == INVALID_COMPANY) return 0; |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
78 |
|
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
79 |
return GetPlayer((PlayerID)company)->player_money; |
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
|
80 |
} |
61379e9b2393
(svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff
changeset
|
81 |
|
61379e9b2393
(svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff
changeset
|
82 |
int32 AICompany::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
|
83 |
{ |
61379e9b2393
(svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff
changeset
|
84 |
return GetPlayer(_current_player)->current_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
|
85 |
} |
61379e9b2393
(svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff
changeset
|
86 |
|
61379e9b2393
(svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff
changeset
|
87 |
int32 AICompany::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
|
88 |
{ |
61379e9b2393
(svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff
changeset
|
89 |
return _economy.max_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
|
90 |
} |
61379e9b2393
(svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff
changeset
|
91 |
|
9376
7c12a15c945a
(svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents:
9374
diff
changeset
|
92 |
int32 AICompany::GetLoanInterval() |
7c12a15c945a
(svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents:
9374
diff
changeset
|
93 |
{ |
7c12a15c945a
(svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents:
9374
diff
changeset
|
94 |
return LOAN_INTERVAL; |
7c12a15c945a
(svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents:
9374
diff
changeset
|
95 |
} |
7c12a15c945a
(svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents:
9374
diff
changeset
|
96 |
|
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
|
97 |
bool AICompany::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
|
98 |
{ |
61379e9b2393
(svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff
changeset
|
99 |
if (loan < 0 || |
9376
7c12a15c945a
(svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents:
9374
diff
changeset
|
100 |
(loan % this->GetLoanInterval()) != 0 || |
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
|
101 |
loan > this->GetMaxLoanAmount() || |
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
102 |
(loan - this->GetLoanAmount() + this->GetBankBalance(MY_COMPANY)) < 0) { |
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
|
103 |
return false; |
61379e9b2393
(svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff
changeset
|
104 |
} |
61379e9b2393
(svn r9161) [NoAI] -Add: functions to get/set company related information: loan, bank balance, company value and company name.
rubidium
parents:
diff
changeset
|
105 |
|
9462
a4f49aab1367
(svn r9294) [NoAI] -Codechange: make changing the loan to 'any' amount a single command.
rubidium
parents:
9456
diff
changeset
|
106 |
if (loan == this->GetLoanAmount()) return true; |
9414
a7f7bbec08da
(svn r9212) [NoAI] -Add: added CmdFailed and CmdSucceeded in AIObject() and used it
truelight
parents:
9376
diff
changeset
|
107 |
|
9462
a4f49aab1367
(svn r9294) [NoAI] -Codechange: make changing the loan to 'any' amount a single command.
rubidium
parents:
9456
diff
changeset
|
108 |
return this->DoCommand(0, |
9486
a9b5f6b8667c
(svn r9336) [NoAI] -Fix: remove 'flags' for AI DoCommand and detect its value automaticly
truelight
parents:
9462
diff
changeset
|
109 |
abs(loan - this->GetLoanAmount()), 2, |
9462
a4f49aab1367
(svn r9294) [NoAI] -Codechange: make changing the loan to 'any' amount a single command.
rubidium
parents:
9456
diff
changeset
|
110 |
(loan > this->GetLoanAmount()) ? CMD_INCREASE_LOAN : CMD_DECREASE_LOAN); |
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
|
111 |
} |
9668
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
112 |
|
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
113 |
bool AICompany::SetMinimumLoanAmount(int32 loan) |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
114 |
{ |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
115 |
if (loan < 0) return false; |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
116 |
|
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
117 |
int32 over_interval = loan % this->GetLoanInterval(); |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
118 |
if (over_interval != 0) loan += this->GetLoanInterval() - over_interval; |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
119 |
|
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
120 |
if (loan > this->GetMaxLoanAmount()) return false; |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
121 |
|
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
122 |
this->SetLoanAmount(loan); |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
123 |
|
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
124 |
return this->GetLoanAmount() == loan; |
6fe3d2cb9655
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents:
9629
diff
changeset
|
125 |
} |