(svn r19654) -Codechange: Use Extract<> in more places.

This commit is contained in:
frosch
2010-04-17 13:31:41 +00:00
parent 184fa43df2
commit 75d4bc947d
24 changed files with 87 additions and 63 deletions

View File

@@ -15,6 +15,7 @@
#include "company_gui.h"
#include "town.h"
#include "news_func.h"
#include "cmd_helper.h"
#include "command_func.h"
#include "network/network.h"
#include "network/network_func.h"
@@ -898,14 +899,11 @@ CommandCost CmdSetCompanyManagerFace(TileIndex tile, DoCommandFlag flags, uint32
*/
CommandCost CmdSetCompanyColour(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (p2 >= 16) return CMD_ERROR; // max 16 colours
Colours colour = (Colours)p2;
LiveryScheme scheme = (LiveryScheme)GB(p1, 0, 8);
Colours colour = Extract<Colours, 0, 4>(p2);
LiveryScheme scheme = Extract<LiveryScheme, 0, 8>(p1);
byte state = GB(p1, 8, 2);
if (scheme >= LS_END || state >= 3) return CMD_ERROR;
if (scheme >= LS_END || state >= 3 || colour == INVALID_COLOUR) return CMD_ERROR;
Company *c = Company::Get(_current_company);