src/ai/api/company/name.cpp
branchnoai
changeset 9430 9e0a193b2bec
parent 9429 25b7d020a3a9
child 9431 346932a30fc9
equal deleted inserted replaced
9429:25b7d020a3a9 9430:9e0a193b2bec
     1 /* $Id$ */
       
     2 
       
     3 /** @file name.cpp handles the company name-related functions of the AICompany class */
       
     4 
       
     5 #include "../ai_company.hpp"
       
     6 #include "../../../player.h"
       
     7 #include "../../../strings.h"
       
     8 
       
     9 bool AICompany::SetCompanyName(const char *name)
       
    10 {
       
    11 	if (name == NULL) return false;
       
    12 
       
    13 	_cmd_text = name;
       
    14 	return !CmdFailed(this->DoCommand(0, 0, 0, DC_EXEC, CMD_CHANGE_PRESIDENT_NAME));
       
    15 }
       
    16 
       
    17 char *AICompany::GetCompanyName()
       
    18 {
       
    19 	static const int len = 64;
       
    20 	char *company_name = MallocT<char>(len);
       
    21 	GetString(company_name, GetPlayer(_current_player)->name_1, &company_name[len - 1]);
       
    22 
       
    23 	return company_name;
       
    24 }