Files
@ r7596:afd285ff90bb
Branch filter:
Location: cpp/openttd-patchpack/source/src/newgrf_cargo.cpp - annotation
r7596:afd285ff90bb
3.3 KiB
text/x-c
(svn r11123) -Update: WebTranslator2 update to 2007-09-17 12:45:29
afrikaans - 47 fixed, 52 changed by TrueTenacity (99)
brazilian_portuguese - 23 changed by fukumori (23)
bulgarian - 14 fixed by thetitan (14)
catalan - 3 changed by arnaullv (3)
croatian - 6 fixed, 12 changed by knovak (15), tperic (3)
danish - 20 fixed by ThomasA (20)
finnish - 20 fixed by habazi (20)
german - 10 fixed by Timwi (10)
hungarian - 1 fixed by miham (1)
italian - 1 fixed by lorenzodv (1)
japanese - 6 fixed by ickoonite (6)
norwegian_nynorsk - 6 fixed by pollux (6)
piglatin - 20 fixed by adammw (20)
russian - 20 fixed by Smoky555 (20)
slovak - 1 fixed by lengyel (1)
slovenian - 7 fixed by Necrolyte (7)
spanish - 1 changed by Cabu (1)
traditional_chinese - 21 fixed by xbddc (21)
afrikaans - 47 fixed, 52 changed by TrueTenacity (99)
brazilian_portuguese - 23 changed by fukumori (23)
bulgarian - 14 fixed by thetitan (14)
catalan - 3 changed by arnaullv (3)
croatian - 6 fixed, 12 changed by knovak (15), tperic (3)
danish - 20 fixed by ThomasA (20)
finnish - 20 fixed by habazi (20)
german - 10 fixed by Timwi (10)
hungarian - 1 fixed by miham (1)
italian - 1 fixed by lorenzodv (1)
japanese - 6 fixed by ickoonite (6)
norwegian_nynorsk - 6 fixed by pollux (6)
piglatin - 20 fixed by adammw (20)
russian - 20 fixed by Smoky555 (20)
slovak - 1 fixed by lengyel (1)
slovenian - 7 fixed by Necrolyte (7)
spanish - 1 changed by Cabu (1)
traditional_chinese - 21 fixed by xbddc (21)
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 127 128 129 | r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6383:09891b2cc6e4 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6383:09891b2cc6e4 r6383:09891b2cc6e4 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6657:0c1322cba91d r6657:0c1322cba91d r6657:0c1322cba91d r6657:0c1322cba91d r6365:410001496130 r6657:0c1322cba91d r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r7327:28855024ff6c r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r7327:28855024ff6c r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6365:410001496130 r6460:74b53af67ae0 r6460:74b53af67ae0 r6460:74b53af67ae0 r6460:74b53af67ae0 r6460:74b53af67ae0 r6460:74b53af67ae0 r6460:74b53af67ae0 r6460:74b53af67ae0 r6460:74b53af67ae0 r6460:74b53af67ae0 r6460:74b53af67ae0 r6460:74b53af67ae0 r6460:74b53af67ae0 r6460:74b53af67ae0 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 r7199:40e27abf8476 | /* $Id$ */
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
#include "cargotype.h"
#include "newgrf.h"
#include "newgrf_callbacks.h"
#include "newgrf_spritegroup.h"
#include "newgrf_cargo.h"
static uint32 CargoGetRandomBits(const ResolverObject *object)
{
return 0;
}
static uint32 CargoGetTriggers(const ResolverObject *object)
{
return 0;
}
static void CargoSetTriggers(const ResolverObject *object, int triggers)
{
return;
}
static uint32 CargoGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
{
DEBUG(grf, 1, "Unhandled cargo property 0x%X", variable);
*available = false;
return 0;
}
static const SpriteGroup *CargoResolveReal(const ResolverObject *object, const SpriteGroup *group)
{
/* Cargo action 2s should always have only 1 "loaded" state, but some
* times things don't follow the spec... */
if (group->g.real.num_loaded > 0) return group->g.real.loaded[0];
if (group->g.real.num_loading > 0) return group->g.real.loading[0];
return NULL;
}
static void NewCargoResolver(ResolverObject *res, const CargoSpec *cs)
{
res->GetRandomBits = &CargoGetRandomBits;
res->GetTriggers = &CargoGetTriggers;
res->SetTriggers = &CargoSetTriggers;
res->GetVariable = &CargoGetVariable;
res->ResolveReal = &CargoResolveReal;
res->u.cargo.cs = cs;
res->callback = CBID_NO_CALLBACK;
res->callback_param1 = 0;
res->callback_param2 = 0;
res->last_value = 0;
res->trigger = 0;
res->reseed = 0;
}
SpriteID GetCustomCargoSprite(const CargoSpec *cs)
{
const SpriteGroup *group;
ResolverObject object;
NewCargoResolver(&object, cs);
group = Resolve(cs->group, &object);
if (group == NULL || group->type != SGT_RESULT) return 0;
return group->g.result.sprite;
}
uint16 GetCargoCallback(CallbackID callback, uint32 param1, uint32 param2, const CargoSpec *cs)
{
ResolverObject object;
const SpriteGroup *group;
NewCargoResolver(&object, cs);
object.callback = callback;
object.callback_param1 = param1;
object.callback_param2 = param2;
group = Resolve(cs->group, &object);
if (group == NULL || group->type != SGT_CALLBACK) return CALLBACK_FAILED;
return group->g.callback.result;
}
CargoID GetCargoTranslation(uint8 cargo, const GRFFile *grffile)
{
/* Pre-version 7 uses the 'climate dependent' ID, i.e. cargo is the cargo ID */
if (grffile->grf_version < 7) return HASBIT(_cargo_mask, cargo) ? cargo : (CargoID) CT_INVALID;
/* If the GRF contains a translation table (and the cargo is in bounds)
* then get the cargo ID for the label */
if (cargo < grffile->cargo_max) return GetCargoIDByLabel(grffile->cargo_list[cargo]);
/* Else the cargo value is a 'climate independent' 'bitnum' */
return GetCargoIDByBitnum(cargo);
}
uint8 GetReverseCargoTranslation(CargoID cargo, const GRFFile *grffile)
{
/* Pre-version 7 uses the 'climate dependent' ID, i.e. cargo is the cargo ID */
if (grffile->grf_version < 7) return cargo;
const CargoSpec *cs = GetCargo(cargo);
/* If the GRF contains a translation table (and the cargo is in the table)
* then get the cargo ID for the label */
for (uint i = 0; i < grffile->cargo_max; i++) {
if (cs->label == grffile->cargo_list[i]) return i;
}
/* No matching label was found, so we return the 'climate independent' 'bitnum' */
return cs->bitnum;;
}
|