misc_cmd.cpp File Reference

#include "stdafx.h"
#include "openttd.h"
#include "command_func.h"
#include "economy_func.h"
#include "gui.h"
#include "window_func.h"
#include "textbuf_gui.h"
#include "network/network.h"
#include "variables.h"
#include "livery.h"
#include "player_face.h"
#include "strings_func.h"
#include "gfx_func.h"
#include "functions.h"
#include "vehicle_func.h"
#include "string_func.h"
#include "player_func.h"
#include "player_base.h"
#include "player_gui.h"
#include "settings_type.h"
#include "table/strings.h"

Go to the source code of this file.

Functions

CommandCost CmdSetPlayerFace (TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 Change the player's face.
CommandCost CmdSetPlayerColor (TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 Change the player's company-colour.
CommandCost CmdIncreaseLoan (TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 Increase the loan of your company.
CommandCost CmdDecreaseLoan (TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 Decrease the loan of your company.
static bool IsUniqueCompanyName (const char *name)
CommandCost CmdChangeCompanyName (TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 Change the name of the company.
static bool IsUniquePresidentName (const char *name)
CommandCost CmdChangePresidentName (TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 Change the name of the president.
static void AskUnsafeUnpauseCallback (Window *w, bool confirmed)
 In case of an unsafe unpause, we want the user to confirm that it might crash.
CommandCost CmdPause (TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 Pause/Unpause the game (server-only).
CommandCost CmdMoneyCheat (TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 Change the financial flow of your company.
CommandCost CmdGiveMoney (TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 Transfer funds (money) from one player to another.
CommandCost CmdChangeDifficultyLevel (TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 Change difficulty level/settings (server-only).


Detailed Description

Definition in file misc_cmd.cpp.


Function Documentation

static void AskUnsafeUnpauseCallback ( Window *  w,
bool  confirmed 
) [static]

In case of an unsafe unpause, we want the user to confirm that it might crash.

Parameters:
w unused
confirmed whether the user confirms his/her action

Definition at line 293 of file misc_cmd.cpp.

References CMD_PAUSE, and DoCommandP().

Referenced by CmdPause().

CommandCost CmdChangeCompanyName ( TileIndex  tile,
uint32  flags,
uint32  p1,
uint32  p2 
)

Change the name of the company.

Parameters:
tile unused
flags operation to perform
p1 unused
p2 unused

Definition at line 226 of file misc_cmd.cpp.

References _cmd_text, CMD_ERROR, DC_EXEC, MarkWholeScreenDirty(), MAX_LENGTH_COMPANY_NAME, and return_cmd_error.

CommandCost CmdChangeDifficultyLevel ( TileIndex  tile,
uint32  flags,
uint32  p1,
uint32  p2 
)

Change difficulty level/settings (server-only).

We cannot really check for valid values of p2 (too much work mostly); stored in file 'settings_gui.c' _game_setting_info[]; we'll just trust the server it knows what to do and does this correctly

Parameters:
tile unused
flags operation to perform
p1 the difficulty setting being changed. If it is -1, the difficulty level itself is changed. The new value is inside p2
p2 new value for a difficulty setting or difficulty level

Definition at line 393 of file misc_cmd.cpp.

References _networking, CMD_ERROR, and DC_EXEC.

CommandCost CmdChangePresidentName ( TileIndex  tile,
uint32  flags,
uint32  p1,
uint32  p2 
)

Change the name of the president.

Parameters:
tile unused
flags operation to perform
p1 unused
p2 unused

Definition at line 263 of file misc_cmd.cpp.

References _cmd_text, CMD_CHANGE_COMPANY_NAME, CMD_ERROR, DC_EXEC, DoCommand(), MarkWholeScreenDirty(), MAX_LENGTH_PRESIDENT_NAME, and return_cmd_error.

CommandCost CmdDecreaseLoan ( TileIndex  tile,
uint32  flags,
uint32  p1,
uint32  p2 
)

Decrease the loan of your company.

Parameters:
tile unused
flags operation to perform
p1 unused
p2 when 0: pays back LOAN_INTERVAL when 1: pays back the maximum loan permitting money (press CTRL),

Definition at line 174 of file misc_cmd.cpp.

References CMD_ERROR, DC_EXEC, max(), min(), and return_cmd_error.

CommandCost CmdGiveMoney ( TileIndex  tile,
uint32  flags,
uint32  p1,
uint32  p2 
)

Transfer funds (money) from one player to another.

To prevent abuse in multiplayer games you can only send money to other players if you have paid off your loan (either explicitely, or implicitely given the fact that you have more money than loan).

Parameters:
tile unused
flags operation to perform
p1 the amount of money to transfer; max 20.000.000
p2 the player to transfer the money to

Definition at line 360 of file misc_cmd.cpp.

References _networking, CMD_ERROR, DC_EXEC, CommandCost::GetCost(), and min().

CommandCost CmdIncreaseLoan ( TileIndex  tile,
uint32  flags,
uint32  p1,
uint32  p2 
)

Increase the loan of your company.

Parameters:
tile unused
flags operation to perform
p1 unused
p2 when 0: loans LOAN_INTERVAL when 1: loans the maximum loan permitting money (press CTRL),

Definition at line 135 of file misc_cmd.cpp.

References CMD_ERROR, DC_EXEC, and return_cmd_error.

CommandCost CmdMoneyCheat ( TileIndex  tile,
uint32  flags,
uint32  p1,
uint32  p2 
)

Change the financial flow of your company.

This is normally only enabled in offline mode, but if there is a debug build, you can cheat (to test).

Parameters:
tile unused
flags operation to perform
p1 the amount of money to receive (if negative), or spend (if positive)
p2 unused

Definition at line 343 of file misc_cmd.cpp.

References _networking, and CMD_ERROR.

CommandCost CmdPause ( TileIndex  tile,
uint32  flags,
uint32  p1,
uint32  p2 
)

Pause/Unpause the game (server-only).

Increase or decrease the pause counter. If the counter is zero, the game is unpaused. A counter is used instead of a boolean value to have more control over the game when saving/loading, etc.

Parameters:
tile unused
flags operation to perform
p1 0 = decrease pause counter; 1 = increase pause counter
p2 unused

Definition at line 307 of file misc_cmd.cpp.

References AskUnsafeUnpauseCallback(), DC_EXEC, and ShowQuery().

CommandCost CmdSetPlayerColor ( TileIndex  tile,
uint32  flags,
uint32  p1,
uint32  p2 
)

Change the player's company-colour.

Parameters:
tile unused
flags operation to perform
p1 bitstuffed: p1 bits 0-7 scheme to set p1 bits 8-9 set in use state or first/second colour
p2 new colour for vehicles, property, etc.

Definition at line 55 of file misc_cmd.cpp.

References CMD_ERROR, DC_EXEC, GB(), and MarkWholeScreenDirty().

CommandCost CmdSetPlayerFace ( TileIndex  tile,
uint32  flags,
uint32  p1,
uint32  p2 
)

Change the player's face.

Parameters:
tile unused
flags operation to perform
p1 unused
p2 face bitmasked

Definition at line 34 of file misc_cmd.cpp.

References CMD_ERROR, DC_EXEC, IsValidPlayerFace(), and MarkWholeScreenDirty().


Generated on Mon Sep 22 20:34:22 2008 for openttd by  doxygen 1.5.6