Files
@ r23882:d683a0787bc9
Branch filter:
Location: cpp/openttd-patchpack/source/src/command_func.h - annotation
r23882:d683a0787bc9
4.0 KiB
text/x-c
Codechange: Don't use SDL_CreateRGBSurfaceWithFormat()
This function requires libSDL 2.0.5 or higher. It looks like we don't
need to use it, and can just use the original SDL_CreateRGBSurface(),
with the masks set to 0, to trigger the default 8-bit format, which is
SDL_PIXELFORMAT_INDEX8.
Closes #7785
Note: this code path is activated by using an 8-bit blitter, like:
./bin/openttd -b 8bpp-simple
This function requires libSDL 2.0.5 or higher. It looks like we don't
need to use it, and can just use the original SDL_CreateRGBSurface(),
with the masks set to 0, to trigger the default 8-bit format, which is
SDL_PIXELFORMAT_INDEX8.
Closes #7785
Note: this code path is activated by using an 8-bit blitter, like:
./bin/openttd -b 8bpp-simple
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | r8116:df67d3c5e4fd r8116:df67d3c5e4fd r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r14223:fd89464d3da0 r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r8116:df67d3c5e4fd r23607:36c15679007d r11090:9276cea703d4 r8116:df67d3c5e4fd r23607:36c15679007d r10624:44138dbb3250 r8116:df67d3c5e4fd r14224:4cf91ac6c669 r14224:4cf91ac6c669 r16618:d89f0c3f42e7 r8116:df67d3c5e4fd r8119:8fdb3a371896 r8116:df67d3c5e4fd r8116:df67d3c5e4fd r18369:bc3de8f003de r14981:edf3934972c6 r8116:df67d3c5e4fd r16685:e529cb769028 r16685:e529cb769028 r10692:ff32a4e34c54 r10692:ff32a4e34c54 r10692:ff32a4e34c54 r10692:ff32a4e34c54 r10692:ff32a4e34c54 r18369:bc3de8f003de r10692:ff32a4e34c54 r11090:9276cea703d4 r10692:ff32a4e34c54 r10692:ff32a4e34c54 r10855:5a3c2f38f98e r10692:ff32a4e34c54 r10692:ff32a4e34c54 r10692:ff32a4e34c54 r14220:2b66d13ca715 r14220:2b66d13ca715 r18507:a734d5918322 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r22376:332c148bca52 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r18746:ffe36c655ceb r18746:ffe36c655ceb r18746:ffe36c655ceb r14220:2b66d13ca715 r14220:2b66d13ca715 r19236:ce39f6a41576 r14220:2b66d13ca715 r14822:bdb7fc47ed89 r14822:bdb7fc47ed89 r14822:bdb7fc47ed89 r14220:2b66d13ca715 r22376:332c148bca52 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r22376:332c148bca52 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r22376:332c148bca52 r14220:2b66d13ca715 r14220:2b66d13ca715 r14638:c17bbb7e1736 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14220:2b66d13ca715 r14218:a6f34e5b981d r15078:76a51dd49982 r14218:a6f34e5b981d r8116:df67d3c5e4fd | /* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file command_func.h Functions related to commands. */
#ifndef COMMAND_FUNC_H
#define COMMAND_FUNC_H
#include "command_type.h"
#include "company_type.h"
/**
* Define a default return value for a failed command.
*
* This variable contains a CommandCost object with is declared as "failed".
* Other functions just need to return this error if there is an error,
* which doesn't need to specific by a StringID.
*/
static const CommandCost CMD_ERROR = CommandCost(INVALID_STRING_ID);
/**
* Returns from a function with a specific StringID as error.
*
* This macro is used to return from a function. The parameter contains the
* StringID which will be returned.
*
* @param errcode The StringID to return
*/
#define return_cmd_error(errcode) return CommandCost(errcode);
CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, DoCommandFlag flags, uint32 cmd, const char *text = nullptr);
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags);
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback = nullptr, const char *text = nullptr, bool my_cmd = true);
bool DoCommandP(const CommandContainer *container, bool my_cmd = true);
CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd, bool estimate_only);
void NetworkSendCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, CompanyID company);
extern Money _additional_cash_required;
bool IsValidCommand(uint32 cmd);
CommandFlags GetCommandFlags(uint32 cmd);
const char *GetCommandName(uint32 cmd);
Money GetAvailableMoneyForCommand();
bool IsCommandAllowedWhilePaused(uint32 cmd);
/**
* Extracts the DC flags needed for DoCommand from the flags returned by GetCommandFlags
* @param cmd_flags Flags from GetCommandFlags
* @return flags for DoCommand
*/
static inline DoCommandFlag CommandFlagsToDCFlags(CommandFlags cmd_flags)
{
DoCommandFlag flags = DC_NONE;
if (cmd_flags & CMD_NO_WATER) flags |= DC_NO_WATER;
if (cmd_flags & CMD_AUTO) flags |= DC_AUTO;
if (cmd_flags & CMD_ALL_TILES) flags |= DC_ALL_TILES;
return flags;
}
/*** All command callbacks that exist ***/
/* ai/ai_instance.cpp */
CommandCallback CcAI;
/* airport_gui.cpp */
CommandCallback CcBuildAirport;
/* bridge_gui.cpp */
CommandCallback CcBuildBridge;
/* dock_gui.cpp */
CommandCallback CcBuildDocks;
CommandCallback CcPlaySound_SPLAT_WATER;
/* depot_gui.cpp */
CommandCallback CcCloneVehicle;
/* game/game_instance.cpp */
CommandCallback CcGame;
/* group_gui.cpp */
CommandCallback CcCreateGroup;
CommandCallback CcAddVehicleNewGroup;
/* industry_gui.cpp */
CommandCallback CcBuildIndustry;
/* main_gui.cpp */
CommandCallback CcPlaySound_EXPLOSION;
CommandCallback CcPlaceSign;
CommandCallback CcTerraform;
CommandCallback CcGiveMoney;
/* rail_gui.cpp */
CommandCallback CcPlaySound_SPLAT_RAIL;
CommandCallback CcRailDepot;
CommandCallback CcStation;
CommandCallback CcBuildRailTunnel;
/* road_gui.cpp */
CommandCallback CcPlaySound_SPLAT_OTHER;
CommandCallback CcBuildRoadTunnel;
CommandCallback CcRoadDepot;
CommandCallback CcRoadStop;
/* train_gui.cpp */
CommandCallback CcBuildWagon;
/* town_gui.cpp */
CommandCallback CcFoundTown;
CommandCallback CcFoundRandomTown;
/* vehicle_gui.cpp */
CommandCallback CcBuildPrimaryVehicle;
CommandCallback CcStartStopVehicle;
#endif /* COMMAND_FUNC_H */
|