src/ai/api/ai_company.cpp
author truelight
Sun, 19 Aug 2007 13:16:06 +0000
branchnoai
changeset 9696 4384ed3de1f0
parent 9668 6fe3d2cb9655
child 9701 d1ac22c62f64
permissions -rw-r--r--
(svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
[NoAI] -Fix: AICompant::GetCompanyName returned \0 for invalid company instead of NULL
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"
9441
03da911c8d5f (svn r9255) [NoAI] -Add: each AI now runs in a seperate thread. The main thread is suspended if any AI thread is running, only one AI thread runs at the time.
truelight
parents: 9436
diff changeset
     6
#include "../../command.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"
9e0a193b2bec (svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents: 9427
diff changeset
     8
#include "../../economy.h"
9e0a193b2bec (svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents: 9427
diff changeset
     9
#include "../../strings.h"
9629
66dde6412125 (svn r10350) [NoAI] -Sync with trunk r10194:10349
glx
parents: 9575
diff changeset
    10
#include "../../variables.h"
66dde6412125 (svn r10350) [NoAI] -Sync with trunk r10194:10349
glx
parents: 9575
diff changeset
    11
#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
    12
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
    13
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
    14
{
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
	if (company == MY_COMPANY) return (CompanyIndex)_current_player;
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
    16
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
	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
    18
}
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
9430
9e0a193b2bec (svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents: 9427
diff changeset
    20
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
    21
{
9e0a193b2bec (svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents: 9427
diff changeset
    22
	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
    23
9e0a193b2bec (svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents: 9427
diff changeset
    24
	_cmd_text = name;
9575
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9486
diff changeset
    25
	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
    26
}
9e0a193b2bec (svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents: 9427
diff changeset
    27
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
    28
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
    29
{
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
    30
	company = this->ResolveCompanyIndex(company);
9696
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9668
diff changeset
    31
	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
    32
9430
9e0a193b2bec (svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents: 9427
diff changeset
    33
	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
    34
	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
    35
9696
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9668
diff changeset
    36
	SetDParam(0, GetPlayer((PlayerID)company)->index);
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9668
diff changeset
    37
	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
    38
	return company_name;
9e0a193b2bec (svn r9234) [NoAI] -Codechange: move away from the 'much' subdirectory approach for the API implementation.
rubidium
parents: 9427
diff changeset
    39
}
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
    40
9575
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9486
diff changeset
    41
bool AICompany::SetPresidentName(const char *name)
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9486
diff changeset
    42
{
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9486
diff changeset
    43
	if (name == NULL) return false;
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9486
diff changeset
    44
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9486
diff changeset
    45
	_cmd_text = name;
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9486
diff changeset
    46
	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
    47
}
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9486
diff changeset
    48
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
    49
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
    50
{
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
    51
	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
    52
9575
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9486
diff changeset
    53
	static const int len = 64;
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9486
diff changeset
    54
	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
    55
	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
    56
		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
    57
		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
    58
	} 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
    59
		*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
    60
	}
9575
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9486
diff changeset
    61
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9486
diff changeset
    62
	return president_name;
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9486
diff changeset
    63
}
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9486
diff changeset
    64
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
    65
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
    66
{
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
    67
	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
    68
	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
    69
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
	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
    71
}
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
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
    73
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
    74
{
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
    75
	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
    76
	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
    77
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
	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
    79
}
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
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
    82
{
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
	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
    84
}
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
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
    87
{
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
	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
    89
}
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
9376
7c12a15c945a (svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents: 9374
diff changeset
    91
int32 AICompany::GetLoanInterval()
7c12a15c945a (svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents: 9374
diff changeset
    92
{
7c12a15c945a (svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents: 9374
diff changeset
    93
	return LOAN_INTERVAL;
7c12a15c945a (svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents: 9374
diff changeset
    94
}
7c12a15c945a (svn r9164) [NoAI] -Add: function to get the value of LOAN_INTERVAL in the AIs.
rubidium
parents: 9374
diff changeset
    95
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
    96
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
    97
{
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
	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
    99
			(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
   100
			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
   101
			(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
   102
		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
   103
	}
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
9462
a4f49aab1367 (svn r9294) [NoAI] -Codechange: make changing the loan to 'any' amount a single command.
rubidium
parents: 9456
diff changeset
   105
	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
   106
9462
a4f49aab1367 (svn r9294) [NoAI] -Codechange: make changing the loan to 'any' amount a single command.
rubidium
parents: 9456
diff changeset
   107
	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
   108
			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
   109
			(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
   110
}
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
   111
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
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
   113
{
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
	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
   115
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
	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
   117
	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
   118
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
	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
   120
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
	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
   122
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
	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
   124
}