3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
8 * See LICENSING which should be included
9 * along with this file for more details
16 #include "ivancommon.h"
30 template <class type
> class databasecreator
;
32 typedef std::vector
<item
*> itemvector
;
33 typedef std::vector
<fluid
*> fluidvector
;
34 typedef truth (rawbitmap::*pixelpredicate
)(v2
) const;
35 typedef truth (material::*materialpredicate
)() const;
36 typedef truth (item::*sorter
)(ccharacter
*) const;
37 typedef item
* (*itemspawner
)(int, int);
38 typedef item
* (*itemcloner
)(citem
*);
40 extern materialpredicate TrueMaterialPredicate
;
44 sortdata(itemvector
& AllItems
, ccharacter
* Character
, truth Recurse
, sorter Sorter
)
50 ccharacter
* Character
;
57 idholder(feuLong ID
) : ID(ID
) { }
62 outputfile
& operator<<(outputfile
&, const idholder
*);
63 inputfile
& operator>>(inputfile
&, idholder
*&);
68 typedef itemprototype prototype
;
71 itemlock() : Locked(false) { }
72 virtual ~itemlock () { }
75 void Save(outputfile
&) const;
76 void Load(inputfile
&);
77 virtual truth
TryKey(item
*, character
*);
78 virtual int GetVirtualConfig() const = 0;
79 virtual void SetVirtualConfig(int, int = 0) = 0;
80 virtual const prototype
* GetVirtualProtoType() const = 0;
81 virtual festring
GetVirtualDescription(int) const = 0;
83 virtual void PostConstruct();
87 typedef lockable
<item
, itemlock
> lockableitem
;
89 struct itemdatabase
: public databasebase
91 typedef itemprototype prototype
;
92 void InitDefaults (const itemprototype
*NewProtoType
, int NewConfig
, cfestring
&acfgstrname
);
93 truth
AllowRandomInstantiation() const;
94 void PostProcess() { }
96 const prototype
* ProtoType
;
97 /* Maintained by configcontainer */
98 sLong PartialPossibilitySum
;
99 sLong PartialCategoryPossibilitySum
;
104 truth IsMaterialChangeable
;
105 truth IsPolymorphSpawnable
;
106 truth IsAutoInitializable
;
108 truth IsPolymorphable
;
109 truth CanBeGeneratedInContainer
;
111 truth CreateDivineConfigurations
;
114 truth AffectsArmStrength
;
115 truth AffectsLegStrength
;
116 truth AffectsDexterity
;
117 truth AffectsAgility
;
118 truth AffectsEndurance
;
119 truth AffectsPerception
;
120 truth AffectsIntelligence
;
122 truth AffectsWillPower
;
123 truth AffectsCharisma
;
125 truth PriceIsProportionalToEnchantment
;
126 truth CanBeUsedBySmith
;
127 truth AffectsCarryingCapacity
;
129 truth CanBeEnchanted
;
131 truth IsGoodWithPlants
;
132 truth CreateLockConfigurations
;
134 truth HasSecondaryMaterial
;
137 truth HasNormalPictureDirection
;
138 truth IsKamikazeWeapon
;
139 truth FlexibilityIsEssential
;
143 int EnergyResistance
;
145 int PoisonResistance
;
146 int ElectricityResistance
;
149 int StrengthModifier
;
152 sLong DefaultMainVolume
;
153 sLong DefaultSecondaryVolume
;
157 truth UsesLongArticle
;
159 truth UsesLongAdjectiveArticle
;
160 festring NameSingular
;
164 fearray
<sLong
> MainMaterialConfig
;
165 fearray
<sLong
> SecondaryMaterialConfig
;
166 fearray
<sLong
> MaterialConfigChances
;
167 sLong MaterialConfigChanceSum
;
168 fearray
<festring
> Alias
;
170 int ForcedVisualEffects
;
175 festring FlexibleNameSingular
;
179 int MaxGeneratedContainedItems
;
181 int InElasticityPenaltyModifier
;
188 int BreakEffectRangeSquare
;
191 v2 TorsoArmorBitmapPos
;
192 v2 ArmArmorBitmapPos
;
193 v2 AthleteArmArmorBitmapPos
;
194 v2 LegArmorBitmapPos
;
198 v2 GauntletBitmapPos
;
201 int EnchantmentMinusChance
;
202 int EnchantmentPlusChance
;
203 int TeleportPriority
;
206 truth IsSadistWeapon
;
207 truth IsThrowingWeapon
;
208 sLong ThrowItemTypes
;
210 fearray
<int> AllowedDungeons
;
211 fearray
<festring
> LevelTags
;
217 friend class databasecreator
<item
>;
219 itemprototype(const itemprototype
*, itemspawner
, itemcloner
, cchar
*);
220 virtual ~itemprototype () {}
222 item
* Spawn(int Config
= 0, int SpecialFlags
= 0) const { return Spawner(Config
, SpecialFlags
); }
223 item
* SpawnAndLoad(inputfile
&) const;
224 item
* Clone(citem
* Item
) const { return Cloner(Item
); }
225 cchar
* GetClassID() const { return ClassID
; }
226 int GetIndex() const { return Index
; }
227 const itemprototype
* GetBase() const { return Base
; }
228 int CreateSpecialConfigurations(itemdatabase
**, int, int);
229 const itemdatabase
* ChooseBaseForConfig(itemdatabase
**, int, int);
230 const itemdatabase
*const* GetConfigData() const { return ConfigData
; }
231 int GetConfigSize() const { return ConfigSize
; }
234 const itemprototype
* Base
;
235 itemdatabase
** ConfigData
;
236 itemdatabase
** ConfigTable
[CONFIG_TABLE_SIZE
];
246 class item
: public object
249 friend class databasecreator
<item
>;
250 typedef itemprototype prototype
;
251 typedef itemdatabase database
;
259 inline truth
IsSteppedOn () const { return mIsStepedOn
; }
260 inline void SetSteppedOn (truth v
) { mIsStepedOn
= v
; }
262 virtual double GetWeaponStrength() const;
263 virtual truth
Open(character
*);
264 truth
Consume(character
*, sLong
);
265 virtual truth
CanBeRead(character
*) const { return false; }
266 virtual truth
Read(character
*);
267 virtual void FinishReading(character
*) { }
268 virtual truth
HitEffect(character
*, character
*, v2
, int, int, truth
) { return false; }
269 virtual void DipInto(liquid
*, character
*) { }
270 virtual truth
DumpTo (character
*dumper
, v2 dest
) { return false; }
271 virtual liquid
* CreateDipLiquid() { return 0; }
272 virtual item
* BetterVersion() const { return 0; }
273 virtual int GetOfferValue(int) const;
274 virtual void Fly(character
*, int, int);
275 int HitCharacter(character
*, character
*, int, double, int);
276 virtual truth
DogWillCatchAndConsume(ccharacter
*) const { return false; }
277 virtual truth
Apply(character
*);
278 virtual truth
Zap(character
*, v2
, int) { return false; }
279 virtual truth
Burn(character
*, v2
, int);
280 virtual truth
Polymorph(character
*, stack
*);
281 virtual truth
CheckPickUpEffect(character
*) { return true; }
282 virtual void StepOnEffect(character
*) { }
283 virtual void SignalSquarePositionChange(int);
284 virtual truth
CanBeEatenByAI(ccharacter
*) const;
285 virtual void Save(outputfile
&) const;
286 virtual void Load(inputfile
&);
287 virtual void ChargeFully(character
*) { }
288 void SetSize(int Value
) { Size
= Value
; }
289 virtual int GetSize() const { return Size
; }
290 feuLong
GetID() const { return ID
; }
291 virtual void TeleportRandomly();
292 virtual int GetStrengthValue() const;
293 slot
* GetSlot(int I
= 0) const { return Slot
[I
]; }
294 void SetMainSlot(slot
* What
) { Slot
[0] = What
; }
295 void PlaceToSlot(slot
* Slot
) { Slot
->PutInItem(this); }
296 virtual void RemoveFromSlot();
297 void MoveTo(stack
*Stack
, truth setPickupTime
=false);
298 truth
IsMainSlot(const slot
* What
) const { return Slot
[0] == What
; }
299 static cchar
* GetItemCategoryName(sLong
);
300 truth
IsEatable(ccharacter
*) const;
301 truth
IsDrinkable(ccharacter
*) const;
302 virtual truth
IsOpenable(ccharacter
*) const { return false; }
303 virtual truth
IsReadable(ccharacter
*) const { return false; }
304 virtual truth
IsDippable(ccharacter
*) const { return false; }
305 virtual truth
IsDipDestination(ccharacter
*) const { return false; }
306 virtual truth
IsDumpable(ccharacter
*) const { return false; }
307 virtual truth
IsAppliable(ccharacter
*) const { return false; }
308 virtual truth
IsZappable(ccharacter
*) const { return false; }
309 virtual truth
IsChargeable(ccharacter
*) const { return false; }
310 virtual truth
IsHelmet(ccharacter
*) const { return false; }
311 virtual truth
IsAmulet(ccharacter
*) const { return false; }
312 virtual truth
IsCloak(ccharacter
*) const { return false; }
313 virtual truth
IsBodyArmor(ccharacter
*) const { return false; }
314 virtual truth
IsRing(ccharacter
*) const { return false; }
315 virtual truth
IsGauntlet(ccharacter
*) const { return false; }
316 virtual truth
IsBelt(ccharacter
*) const { return false; }
317 virtual truth
IsBoot(ccharacter
*) const { return false; }
318 virtual truth
IsShield(ccharacter
*) const { return false; }
319 virtual truth
IsWeapon(ccharacter
*) const { return false; }
320 virtual truth
IsArmor(ccharacter
*) const { return false; }
321 virtual truth
IsEnchantable(ccharacter
*) const { return CanBeEnchanted(); }
322 virtual truth
IsRepairable(ccharacter
*) const { return IsBroken() || IsRusted(); }
323 virtual truth
IsDecosAdShirt(ccharacter
*) const { return false; }
324 virtual truth
IsLuxuryItem(ccharacter
*) const { return false; }
325 virtual truth
MaterialIsChangeable(ccharacter
*) const { return true; }
326 virtual truth
IsBeverage(ccharacter
*) const;
327 virtual truth
CanBeHardened(ccharacter
*) const;
328 virtual truth
HasLock(ccharacter
*) const { return false; }
329 virtual truth
IsOnGround() const;
330 virtual truth
IsFlaming (ccharacter
*) const { return CanFlame(); }
331 virtual truth
IsLockableContainer () const { return false; }
332 int GetResistance(int) const;
334 int GetType() const { return GetProtoType()->GetIndex(); }
335 virtual truth
ReceiveDamage(character
*, int, int, int = YOURSELF
);
336 virtual truth
RaiseTheDead(character
*) { return false; }
337 virtual int GetBodyPartIndex() const { return 0xFF; }
338 const database
* GetDataBase() const { return DataBase
; }
339 virtual truth
CanOpenLockType(int) const { return false; }
340 DATA_BASE_VALUE(const prototype
*, ProtoType
);
341 DATA_BASE_VALUE(int, Config
);
342 virtual DATA_BASE_TRUTH_WITH_PARAMETER(IsDestroyable
, ccharacter
*);
343 DATA_BASE_TRUTH(IsMaterialChangeable
);
344 DATA_BASE_VALUE(int, WeaponCategory
);
345 DATA_BASE_TRUTH(IsAutoInitializable
);
346 DATA_BASE_VALUE(sLong
, Category
);
347 DATA_BASE_VALUE(int, EnergyResistance
);
348 DATA_BASE_VALUE(int, FireResistance
);
349 DATA_BASE_VALUE(int, PoisonResistance
);
350 DATA_BASE_VALUE(int, ElectricityResistance
);
351 DATA_BASE_VALUE(int, AcidResistance
);
352 DATA_BASE_VALUE(int, SoundResistance
);
353 DATA_BASE_VALUE(int, StrengthModifier
);
354 virtual DATA_BASE_VALUE(int, FormModifier
);
355 DATA_BASE_VALUE(int, DefaultSize
);
356 DATA_BASE_VALUE(sLong
, DefaultMainVolume
);
357 DATA_BASE_VALUE(sLong
, DefaultSecondaryVolume
);
358 virtual DATA_BASE_VALUE_WITH_PARAMETER(v2
, BitmapPos
, int);
359 virtual DATA_BASE_VALUE(sLong
, Price
);
360 virtual DATA_BASE_VALUE(col24
, BaseEmitation
);
361 virtual DATA_BASE_TRUTH(UsesLongArticle
);
362 virtual DATA_BASE_VALUE(cfestring
&, Adjective
);
363 virtual DATA_BASE_TRUTH(UsesLongAdjectiveArticle
);
364 virtual DATA_BASE_VALUE(cfestring
&, NameSingular
);
365 virtual DATA_BASE_VALUE(cfestring
&, NamePlural
);
366 virtual DATA_BASE_VALUE(cfestring
&, PostFix
);
367 virtual DATA_BASE_VALUE(int, ArticleMode
);
368 DATA_BASE_VALUE(const fearray
<sLong
>&, MainMaterialConfig
);
369 DATA_BASE_VALUE(const fearray
<sLong
>&, SecondaryMaterialConfig
);
370 virtual DATA_BASE_VALUE(const fearray
<sLong
>&, MaterialConfigChances
);
371 virtual DATA_BASE_VALUE(sLong
, MaterialConfigChanceSum
);
372 DATA_BASE_TRUTH(IsPolymorphable
);
373 virtual DATA_BASE_VALUE(int, OKVisualEffects
);
374 DATA_BASE_TRUTH(CanBeGeneratedInContainer
);
375 virtual DATA_BASE_VALUE(int, ForcedVisualEffects
);
376 DATA_BASE_VALUE(int, Roundness
);
377 DATA_BASE_VALUE(sLong
, GearStates
);
378 DATA_BASE_TRUTH(IsTwoHanded
);
379 DATA_BASE_TRUTH(CanBeBroken
);
380 DATA_BASE_VALUE_WITH_PARAMETER(v2
, WallBitmapPos
, int);
381 DATA_BASE_VALUE(cfestring
&, FlexibleNameSingular
);
382 DATA_BASE_TRUTH(CanBePiled
);
383 DATA_BASE_TRUTH(AffectsArmStrength
);
384 DATA_BASE_TRUTH(AffectsLegStrength
);
385 DATA_BASE_TRUTH(AffectsDexterity
);
386 DATA_BASE_TRUTH(AffectsAgility
);
387 DATA_BASE_TRUTH(AffectsEndurance
);
388 DATA_BASE_TRUTH(AffectsPerception
);
389 DATA_BASE_TRUTH(AffectsIntelligence
);
390 DATA_BASE_TRUTH(AffectsWisdom
);
391 DATA_BASE_TRUTH(AffectsWillPower
);
392 DATA_BASE_TRUTH(AffectsCharisma
);
393 DATA_BASE_TRUTH(AffectsMana
);
394 DATA_BASE_TRUTH(AffectsCarryingCapacity
);
395 DATA_BASE_VALUE(int, BaseEnchantment
);
396 DATA_BASE_TRUTH(PriceIsProportionalToEnchantment
);
397 DATA_BASE_VALUE(int, MaxCharges
);
398 DATA_BASE_VALUE(int, MinCharges
);
399 DATA_BASE_VALUE(int, InElasticityPenaltyModifier
);
400 DATA_BASE_VALUE(sLong
, StorageVolume
);
401 DATA_BASE_VALUE(int, MaxGeneratedContainedItems
);
402 virtual DATA_BASE_TRUTH(CanBeCloned
);
403 virtual DATA_BASE_TRUTH(CanBeMirrored
);
404 DATA_BASE_VALUE(int, BeamRange
);
405 DATA_BASE_TRUTH(CanBeUsedBySmith
);
406 DATA_BASE_VALUE(int, DamageDivider
);
407 DATA_BASE_TRUTH(HandleInPairs
);
408 DATA_BASE_TRUTH(CanBeEnchanted
);
409 DATA_BASE_VALUE(sLong
, BeamColor
);
410 DATA_BASE_VALUE(int, BeamEffect
);
411 DATA_BASE_VALUE(int, BeamStyle
);
412 DATA_BASE_VALUE(int, WearWisdomLimit
);
413 DATA_BASE_VALUE(int, BreakEffectRangeSquare
);
414 virtual DATA_BASE_VALUE_WITH_PARAMETER(v2
, WieldedBitmapPos
, int);
415 DATA_BASE_TRUTH(IsQuestItem
);
416 DATA_BASE_TRUTH(IsGoodWithPlants
);
417 DATA_BASE_TRUTH(CanBePickedUp
);
418 DATA_BASE_VALUE(int, CoverPercentile
);
419 DATA_BASE_VALUE_WITH_PARAMETER(v2
, TorsoArmorBitmapPos
, int);
420 DATA_BASE_VALUE_WITH_PARAMETER(v2
, ArmArmorBitmapPos
, int);
421 DATA_BASE_VALUE_WITH_PARAMETER(v2
, AthleteArmArmorBitmapPos
, int);
422 DATA_BASE_VALUE_WITH_PARAMETER(v2
, LegArmorBitmapPos
, int);
423 DATA_BASE_VALUE_WITH_PARAMETER(v2
, HelmetBitmapPos
, int);
424 DATA_BASE_VALUE_WITH_PARAMETER(v2
, CloakBitmapPos
, int);
425 DATA_BASE_VALUE_WITH_PARAMETER(v2
, BeltBitmapPos
, int);
426 DATA_BASE_VALUE_WITH_PARAMETER(v2
, GauntletBitmapPos
, int);
427 DATA_BASE_VALUE_WITH_PARAMETER(v2
, BootBitmapPos
, int);
428 DATA_BASE_TRUTH(AllowEquip
);
429 DATA_BASE_VALUE(int, ReadDifficulty
);
430 DATA_BASE_VALUE(int, EnchantmentMinusChance
);
431 DATA_BASE_VALUE(int, EnchantmentPlusChance
);
432 virtual DATA_BASE_VALUE(int, TeleportPriority
);
433 DATA_BASE_TRUTH(HasNormalPictureDirection
);
434 DATA_BASE_VALUE(int, DamageFlags
);
435 DATA_BASE_TRUTH(FlexibilityIsEssential
);
436 DATA_BASE_VALUE(cfestring
&, BreakMsg
);
437 DATA_BASE_TRUTH(IsSadistWeapon
);
438 DATA_BASE_TRUTH(IsThrowingWeapon
);
439 DATA_BASE_VALUE(sLong
, ThrowItemTypes
);
440 DATA_BASE_TRUTH(CanFlame
);
441 DATA_BASE_VALUE(const fearray
<int> &, AllowedDungeons
);
442 DATA_BASE_VALUE(const fearray
<festring
> &, LevelTags
);
443 truth
CanBeSoldInLibrary(character
* Librarian
) const { return CanBeRead(Librarian
); }
444 virtual truth
TryKey(item
*, character
*) { return false; }
445 sLong
GetBlockModifier() const;
446 truth
IsSimiliarTo(item
*) const;
447 virtual truth
IsPickable(character
*) const { return true; }
448 truth
CanBeSeenByPlayer() const;
449 virtual truth
CanBeSeenBy(ccharacter
*) const;
450 festring
GetDescription(int) const;
451 virtual square
* GetSquareUnderEntity(int = 0) const;
452 virtual square
* GetSquareUnder(int = 0) const;
453 virtual lsquare
* GetLSquareUnder(int = 0) const;
454 level
* GetLevel() const { return static_cast<level
*>(Slot
[0]->GetSquareUnder()->GetArea()); }
455 area
* GetArea() const { return Slot
[0]->GetSquareUnder()->GetArea(); }
456 v2
GetPos(int I
= 0) const { return Slot
[I
]->GetSquareUnder()->GetPos(); }
457 square
* GetNearSquare(v2 Pos
) const { return Slot
[0]->GetSquareUnder()->GetArea()->GetSquare(Pos
); }
458 square
* GetNearSquare(int x
, int y
) const { return Slot
[0]->GetSquareUnder()->GetArea()->GetSquare(x
, y
); }
459 lsquare
* GetNearLSquare(v2 Pos
) const { return static_cast<lsquare
*>(Slot
[0]->GetSquareUnder()->GetArea()->GetSquare(Pos
)); }
460 lsquare
* GetNearLSquare(int x
, int y
) const { return static_cast<lsquare
*>(Slot
[0]->GetSquareUnder()->GetArea()->GetSquare(x
, y
)); }
461 virtual void SignalVolumeAndWeightChange();
462 virtual void CalculateVolumeAndWeight();
463 sLong
GetVolume() const { return Volume
; }
464 sLong
GetWeight() const { return Weight
; }
465 virtual void SignalEmitationIncrease(col24
);
466 virtual void SignalEmitationDecrease(col24
);
468 virtual void DropEquipment(stack
* = 0) { }
469 virtual truth
IsDangerous(ccharacter
*) const { return false; }
470 virtual truth
NeedDangerSymbol() const { return false; }
471 void WeaponSkillHit(int);
472 virtual void SetTeam(int) { }
473 void SpecialGenerationHandler();
474 item
* Duplicate(feuLong
= 0);
475 virtual void SetIsActive(truth
) { }
476 double GetBaseDamage() const;
477 int GetBaseMinDamage() const;
478 int GetBaseMaxDamage() const;
479 int GetBaseToHitValue() const;
480 int GetBaseBlockValue() const;
481 virtual void AddInventoryEntry(ccharacter
*, festring
&, int, truth
) const;
482 sLong
GetNutritionValue() const;
483 virtual void SignalSpoil(material
*);
484 virtual truth
AllowSpoil() const;
485 item
* DuplicateToStack(stack
*, feuLong
= 0);
486 virtual truth
CanBePiledWith(citem
*, ccharacter
*) const;
487 virtual sLong
GetTotalExplosivePower() const { return 0; }
488 virtual void Break(character
*, int = YOURSELF
);
489 virtual void SetEnchantment(int) { }
490 virtual void EditEnchantment(int) { }
491 virtual void SignalEnchantmentChange();
492 virtual double GetTHVBonus() const { return 0.; }
493 virtual double GetDamageBonus() const { return 0.; }
494 virtual void DrawContents(ccharacter
*) { }
495 virtual int GetEnchantment() const { return 0; }
496 sLong
GetEnchantedPrice(int) const;
498 int GetStrengthRequirement() const;
499 virtual int GetInElasticityPenalty(int) const { return 0; }
500 virtual truth
IsFixableBySmith(ccharacter
*) const { return false; }
501 virtual truth
IsFixableByTailor(ccharacter
*) const { return false; }
502 virtual sLong
GetFixPrice() const;
503 virtual void DonateSlotTo(item
*);
504 virtual int GetSpoilLevel() const;
505 virtual void SignalSpoilLevelChange(material
*);
506 void ResetSpoiling();
507 virtual void SetItemsInside(const fearray
<contentscript
<item
> >&, int) { }
508 virtual int GetCarryingBonus() const { return 0; }
509 cchar
* GetStrengthValueDescription() const;
510 cchar
* GetBaseToHitValueDescription() const;
511 cchar
* GetBaseBlockValueDescription() const;
512 virtual truth
IsInCorrectSlot(int) const;
513 truth
IsInCorrectSlot() const;
514 int GetEquipmentIndex() const;
515 room
* GetRoom(int I
= 0) const { return GetLSquareUnder(I
)->GetRoom(); }
516 virtual truth
HasBetterVersion() const { return false; }
517 virtual void SortAllItems(const sortdata
&) const;
518 virtual truth
AllowAlphaEverywhere() const { return false; }
519 virtual int GetAttachedGod() const;
520 virtual sLong
GetTruePrice() const;
521 virtual void Search(ccharacter
*, int) { }
522 virtual head
* Behead() { return 0; }
523 virtual truth
EffectIsGood() const { return false; }
525 virtual void AddAttackInfo(felist
&) const;
526 void AddMiscellaneousInfo(felist
&) const;
528 virtual void PreProcessForBone();
529 virtual void PostProcessForBone();
530 virtual void FinalProcessForBone() { }
531 virtual truth
SuckSoul(character
*, character
* = 0) { return false; }
532 void SetConfig(int, int = 0);
533 god
* GetMasterGod() const;
534 idholder
* GetCloneMotherID() const { return CloneMotherID
; }
535 virtual void SignalStackAdd(stackslot
*, void (stack::*)(item
*, truth
));
536 virtual int GetSquareIndex(v2
) const { return 0; }
537 virtual void Draw(blitdata
&) const;
538 v2
GetLargeBitmapPos(v2
, int) const;
539 void LargeDraw(blitdata
&) const;
540 virtual truth
BunnyWillCatchAndConsume(ccharacter
*) const { return false; }
541 void DonateIDTo(item
*);
542 virtual void SignalRustLevelChange();
543 virtual void SendNewDrawAndMemorizedUpdateRequest() const;
544 virtual void CalculateSquaresUnder() { SquaresUnder
= 1; }
545 int GetSquaresUnder() const { return SquaresUnder
; }
546 virtual void CalculateEmitation();
547 void FillFluidVector(fluidvector
&, int = 0) const;
548 virtual void SpillFluid(character
*, liquid
*, int = 0);
549 virtual void TryToRust(sLong
);
550 void RemoveFluid(fluid
*);
551 void RemoveAllFluids ();
552 void AddFluid(liquid
*, festring
, int, truth
);
553 virtual truth
IsAnimated() const;
554 const rawbitmap
* GetRawPicture() const;
555 void DrawFluidGearPictures(blitdata
&, int = 0) const;
556 void DrawFluidBodyArmorPictures(blitdata
&, int) const;
557 void CheckFluidGearPictures(v2
, int, truth
);
558 void DrawFluids(blitdata
&) const;
559 virtual void ReceiveAcid(material
*, cfestring
&, sLong
);
560 virtual truth
ShowFluids() const { return true; }
561 void DonateFluidsTo(item
*);
562 void Destroy(character
*, int);
563 virtual truth
AllowFluidBe() const { return true; }
564 virtual truth
IsRusted() const;
565 virtual void RemoveRust();
566 void SetSpoilPercentage(int);
567 virtual pixelpredicate
GetFluidPixelAllowedPredicate() const;
568 void RedistributeFluids();
569 virtual material
* GetConsumeMaterial(ccharacter
*, materialpredicate
= TrueMaterialPredicate
) const;
570 virtual material
* RemoveMaterial(material
*);
571 virtual void Cannibalize();
572 void InitMaterials(material
*, truth
= true);
573 void SetMainMaterial(material
*, int = 0);
574 void ChangeMainMaterial(material
*, int = 0);
575 virtual void GenerateMaterials();
576 virtual void InitMaterials(const materialscript
*, const materialscript
*, truth
);
577 int GetSquarePosition() const { return (Flags
& SQUARE_POSITION_BITS
) >> SQUARE_POSITION_SHIFT
; }
578 virtual void DestroyBodyPart(stack
*) { SendToHell(); }
579 int GetLifeExpectancy() const { return LifeExpectancy
; }
580 virtual void SetLifeExpectancy(int, int);
581 int NeedsBe() const { return LifeExpectancy
; }
582 truth
IsVeryCloseToDisappearance() const { return LifeExpectancy
&& LifeExpectancy
< 10; }
583 truth
IsVeryCloseToSpoiling() const;
584 virtual truth
IsValuable() const;
585 virtual truth
Necromancy(character
*) { return false; }
586 virtual void CalculateEnchantment() { }
587 virtual character
* GetBodyPartMaster() const { return 0; }
588 virtual truth
AllowFluids() const { return false; }
589 int GetHinderVisibilityBonus(ccharacter
*) const;
590 virtual DATA_BASE_TRUTH_WITH_PARAMETER(IsKamikazeWeapon
, ccharacter
*);
591 virtual void AddTrapName(festring
&, int) const;
592 int GetMainMaterialRustLevel() const;
593 truth
HasID(feuLong What
) const { return ID
== What
; }
594 virtual truth
Spoils() const;
595 int GetMaxSpoilPercentage() const;
596 truth
HasPrice() const;
597 virtual void Disappear();
598 festring
GetLocationDescription() const;
599 truth
IsEquipped() const;
600 festring
GetExtendedDescription() const;
601 virtual ccharacter
* FindCarrier() const;
602 virtual void BlockEffect(character
*, character
*, item
*, int type
) { }
603 virtual bool WillExplodeSoon() const { return false; }
604 virtual const character
* GetWearer() const;
605 virtual bool SpecialOfferEffect(int) { return false; }
608 void SendMemorizedUpdateRequest() const;
610 virtual truth
IsHeadOfElpuri() const { return false; }
611 virtual truth
IsPetrussNut() const { return false; }
612 virtual truth
IsGoldenEagleShirt() const { return false; }
613 virtual truth
IsMoneyBag () const { return false; }
614 virtual truth
IsKleinBottle () const { return false; }
615 virtual truth
IsTheAvatar() const { return false; }
616 virtual truth
IsExplosive() const { return false; }
617 virtual truth
IsConsumable() const { return true; }
618 virtual truth
IsWhip() const { return false; }
619 virtual truth
IsBroken() const;
620 virtual truth
IsFood() const;
621 virtual truth
IsBanana() const { return false; }
622 virtual truth
IsEncryptedScroll() const { return false; }
623 virtual truth
IsShadowVeil () const { return false; }
624 virtual truth
IsLostRubyFlamingSword () const { return false; }
625 virtual truth
IsMangoSeedling() const { return false; }
626 virtual truth
IsMondedrPass () const { return false; }
627 virtual truth
IsRingOfThieves () const { return false; }
628 virtual truth
IsGorovitsFamilyRelic() const { return false; }
629 virtual truth
IsBananaPeel() const { return false; }
630 virtual truth
IsLanternOnWall() const { return false; }
631 virtual truth
IsABone () const { return false; }
632 virtual truth
IsASkull () const { return false; }
634 //FIXME:k8: are there such functions already? can we use RTTI?
635 virtual truth
IsCorpse () const { return false; }
636 virtual truth
IsBodyPart () const { return false; }
637 virtual truth
IsBottle () const { return false; }
638 virtual truth
IsCan () const { return false; }
639 virtual truth
IsScroll () const { return false; }
640 virtual truth
IsMango () const { return false; }
642 virtual truth
AllowDetailedDescription () const { return false; }
644 virtual truth
IsBoneNameSingular () const override
{ return (GetNameSingular() == "bone"); }
647 virtual cchar
* GetBreakVerb() const;
648 virtual sLong
GetMaterialPrice() const;
649 void LoadDataBaseStats();
650 virtual void PostConstruct() { }
651 void Initialize(int, int);
652 virtual int GetGraphicsContainerIndex() const;
653 virtual truth
ShowMaterial() const;
654 virtual truth
AllowSparkling() const { return !Fluid
; }
655 virtual truth
WeightIsIrrelevant() const { return false; }
656 virtual const prototype
* FindProtoType() const { return &ProtoType
; }
657 virtual truth
AddStateDescription(festring
&, truth
) const;
658 static const prototype ProtoType
;
662 const database
* DataBase
;
665 idholder
* CloneMotherID
;
667 int FluidCount
; // same as 'SquaresUnder'?
677 #ifdef __FILE_OF_STATIC_ITEM_PROTOTYPE_DEFINITIONS__
678 #define ITEM_PROTO(name, base)\
679 template<> const itemprototype\
680 name##sysbase::ProtoType(&base::ProtoType,\
681 (itemspawner)(&name##sysbase::Spawn),\
682 (itemcloner)(&name##sysbase::Clone), #name);
684 #define ITEM_PROTO(name, base)
687 #define ITEM(name, base)\
689 typedef sysbase<name, base, itemprototype> name##sysbase;\
690 ITEM_PROTO(name, base)\
691 class name : public name##sysbase