diff options
author | peter1138 <peter1138@openttd.org> | 2007-06-25 13:30:38 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2007-06-25 13:30:38 +0000 |
commit | eb6594caa840da0b4d8a16154cc2c0353d3eb238 (patch) | |
tree | 2aea1c963774b012ba0a63a2d9573f247003e6a9 /src/strings.cpp | |
parent | 0e59b4dc57b52f6c13df258f9d9c6263f53d68dd (diff) | |
download | openttd-eb6594caa840da0b4d8a16154cc2c0353d3eb238.tar.xz |
(svn r10323) -Codechange: reference company name, number and player (president) name
by index
Diffstat (limited to 'src/strings.cpp')
-rw-r--r-- | src/strings.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/strings.cpp b/src/strings.cpp index 24056b8c3..52401b9bd 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -880,6 +880,34 @@ static char* FormatString(char* buff, const char* str, const int64* argv, uint c break; } + case SCC_COMPANY_NAME: { // {COMPANY} + const Player *p = GetPlayer((PlayerID)GetInt32(&argv)); + int64 args[1]; + args[0] = p->name_2; + buff = GetStringWithArgs(buff, p->name_1, args, last); + break; + } + + case SCC_COMPANY_NUM: { // {COMPANYNUM} + PlayerID player = (PlayerID)GetInt32(&argv); + + /* Nothing is added for AI or inactive players */ + if (IsHumanPlayer(player) && IsValidPlayer(player)) { + int64 args[1]; + args[0] = player + 1; + buff = GetStringWithArgs(buff, STR_7002_PLAYER, args, last); + } + break; + } + + case SCC_PLAYER_NAME: { // {PLAYERNAME} + const Player *p = GetPlayer((PlayerID)GetInt32(&argv)); + int64 args[1]; + args[0] = p->president_name_2; + buff = GetStringWithArgs(buff, p->president_name_1, args, last); + break; + } + case SCC_SETCASE: { // {SETCASE} /* This is a pseudo command, it's outputted when someone does {STRING.ack} * The modifier is added to all subsequent GetStringWithArgs that accept the modifier. */ |