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
];
243 EventHandlerMap mOnEvents
;
247 class item
: public object
250 friend class databasecreator
<item
>;
251 typedef itemprototype prototype
;
252 typedef itemdatabase database
;
260 inline truth
IsSteppedOn () const { return mIsStepedOn
; }
261 inline void SetSteppedOn (truth v
) { mIsStepedOn
= v
; }
263 virtual double GetWeaponStrength() const;
264 virtual truth
Open(character
*);
265 truth
Consume(character
*, sLong
);
266 virtual truth
CanBeRead(character
*) const { return false; }
267 virtual truth
Read(character
*);
268 virtual void FinishReading(character
*) { }
269 virtual truth
HitEffect(character
*, character
*, v2
, int, int, truth
) { return false; }
270 virtual void DipInto(liquid
*, character
*) { }
271 virtual truth
DumpTo (character
*dumper
, v2 dest
) { return false; }
272 virtual liquid
* CreateDipLiquid() { return 0; }
273 virtual item
* BetterVersion() const { return 0; }
274 virtual int GetOfferValue(int) const;
275 virtual void Fly(character
*, int, int);
276 int HitCharacter(character
*, character
*, int, double, int);
277 virtual truth
DogWillCatchAndConsume(ccharacter
*) const { return false; }
278 virtual truth
Apply(character
*);
279 virtual truth
Zap(character
*, v2
, int) { return false; }
280 virtual truth
Burn(character
*, v2
, int);
281 virtual truth
Polymorph(character
*, stack
*);
282 virtual truth
CheckPickUpEffect(character
*) { return true; }
283 virtual void StepOnEffect(character
*) { }
284 virtual void SignalSquarePositionChange(int);
285 virtual truth
CanBeEatenByAI(ccharacter
*) const;
286 virtual void Save(outputfile
&) const;
287 virtual void Load(inputfile
&);
288 virtual void ChargeFully(character
*) { }
289 void SetSize(int Value
) { Size
= Value
; }
290 virtual int GetSize() const { return Size
; }
291 feuLong
GetID() const { return ID
; }
292 virtual void TeleportRandomly();
293 virtual int GetStrengthValue() const;
294 slot
* GetSlot(int I
= 0) const { return Slot
[I
]; }
295 void SetMainSlot(slot
* What
) { Slot
[0] = What
; }
296 void PlaceToSlot(slot
* Slot
) { Slot
->PutInItem(this); }
297 virtual void RemoveFromSlot();
298 void MoveTo(stack
*Stack
, truth setPickupTime
=false);
299 truth
IsMainSlot(const slot
* What
) const { return Slot
[0] == What
; }
300 static cchar
* GetItemCategoryName(sLong
);
301 truth
IsEatable(ccharacter
*) const;
302 truth
IsDrinkable(ccharacter
*) const;
303 virtual truth
IsOpenable(ccharacter
*) const { return false; }
304 virtual truth
IsReadable(ccharacter
*) const { return false; }
305 virtual truth
IsDippable(ccharacter
*) const { return false; }
306 virtual truth
IsDipDestination(ccharacter
*) const { return false; }
307 virtual truth
IsDumpable(ccharacter
*) const { return false; }
308 virtual truth
IsAppliable(ccharacter
*) const { return false; }
309 virtual truth
IsZappable(ccharacter
*) const { return false; }
310 virtual truth
IsChargeable(ccharacter
*) const { return false; }
311 virtual truth
IsHelmet(ccharacter
*) const { return false; }
312 virtual truth
IsAmulet(ccharacter
*) const { return false; }
313 virtual truth
IsCloak(ccharacter
*) const { return false; }
314 virtual truth
IsBodyArmor(ccharacter
*) const { return false; }
315 virtual truth
IsRing(ccharacter
*) const { return false; }
316 virtual truth
IsGauntlet(ccharacter
*) const { return false; }
317 virtual truth
IsBelt(ccharacter
*) const { return false; }
318 virtual truth
IsBoot(ccharacter
*) const { return false; }
319 virtual truth
IsShield(ccharacter
*) const { return false; }
320 virtual truth
IsWeapon(ccharacter
*) const { return false; }
321 virtual truth
IsArmor(ccharacter
*) const { return false; }
322 virtual truth
IsEnchantable(ccharacter
*) const { return CanBeEnchanted(); }
323 virtual truth
IsRepairable(ccharacter
*) const { return IsBroken() || IsRusted(); }
324 virtual truth
IsDecosAdShirt(ccharacter
*) const { return false; }
325 virtual truth
IsLuxuryItem(ccharacter
*) const { return false; }
326 virtual truth
MaterialIsChangeable(ccharacter
*) const { return true; }
327 virtual truth
IsBeverage(ccharacter
*) const;
328 virtual truth
CanBeHardened(ccharacter
*) const;
329 virtual truth
HasLock(ccharacter
*) const { return false; }
330 virtual truth
IsOnGround() const;
331 virtual truth
IsFlaming (ccharacter
*) const { return CanFlame(); }
332 virtual truth
IsLockableContainer () const { return false; }
333 int GetResistance(int) const;
335 int GetType() const { return GetProtoType()->GetIndex(); }
336 virtual truth
ReceiveDamage(character
*, int, int, int = YOURSELF
);
337 virtual truth
RaiseTheDead(character
*) { return false; }
338 virtual int GetBodyPartIndex() const { return 0xFF; }
339 const database
* GetDataBase() const { return DataBase
; }
340 virtual truth
CanOpenLockType(int) const { return false; }
341 DATA_BASE_VALUE(const prototype
*, ProtoType
);
342 DATA_BASE_VALUE(int, Config
);
343 virtual DATA_BASE_TRUTH_WITH_PARAMETER(IsDestroyable
, ccharacter
*);
344 DATA_BASE_TRUTH(IsMaterialChangeable
);
345 DATA_BASE_VALUE(int, WeaponCategory
);
346 DATA_BASE_TRUTH(IsAutoInitializable
);
347 DATA_BASE_VALUE(sLong
, Category
);
348 DATA_BASE_VALUE(int, EnergyResistance
);
349 DATA_BASE_VALUE(int, FireResistance
);
350 DATA_BASE_VALUE(int, PoisonResistance
);
351 DATA_BASE_VALUE(int, ElectricityResistance
);
352 DATA_BASE_VALUE(int, AcidResistance
);
353 DATA_BASE_VALUE(int, SoundResistance
);
354 DATA_BASE_VALUE(int, StrengthModifier
);
355 virtual DATA_BASE_VALUE(int, FormModifier
);
356 DATA_BASE_VALUE(int, DefaultSize
);
357 DATA_BASE_VALUE(sLong
, DefaultMainVolume
);
358 DATA_BASE_VALUE(sLong
, DefaultSecondaryVolume
);
359 virtual DATA_BASE_VALUE_WITH_PARAMETER(v2
, BitmapPos
, int);
360 virtual DATA_BASE_VALUE(sLong
, Price
);
361 virtual DATA_BASE_VALUE(col24
, BaseEmitation
);
362 virtual DATA_BASE_TRUTH(UsesLongArticle
);
363 virtual DATA_BASE_VALUE(cfestring
&, Adjective
);
364 virtual DATA_BASE_TRUTH(UsesLongAdjectiveArticle
);
365 virtual DATA_BASE_VALUE(cfestring
&, NameSingular
);
366 virtual DATA_BASE_VALUE(cfestring
&, NamePlural
);
367 virtual DATA_BASE_VALUE(cfestring
&, PostFix
);
368 virtual DATA_BASE_VALUE(int, ArticleMode
);
369 DATA_BASE_VALUE(const fearray
<sLong
>&, MainMaterialConfig
);
370 DATA_BASE_VALUE(const fearray
<sLong
>&, SecondaryMaterialConfig
);
371 virtual DATA_BASE_VALUE(const fearray
<sLong
>&, MaterialConfigChances
);
372 virtual DATA_BASE_VALUE(sLong
, MaterialConfigChanceSum
);
373 DATA_BASE_TRUTH(IsPolymorphable
);
374 virtual DATA_BASE_VALUE(int, OKVisualEffects
);
375 DATA_BASE_TRUTH(CanBeGeneratedInContainer
);
376 virtual DATA_BASE_VALUE(int, ForcedVisualEffects
);
377 DATA_BASE_VALUE(int, Roundness
);
378 DATA_BASE_VALUE(sLong
, GearStates
);
379 DATA_BASE_TRUTH(IsTwoHanded
);
380 DATA_BASE_TRUTH(CanBeBroken
);
381 DATA_BASE_VALUE_WITH_PARAMETER(v2
, WallBitmapPos
, int);
382 DATA_BASE_VALUE(cfestring
&, FlexibleNameSingular
);
383 DATA_BASE_TRUTH(CanBePiled
);
384 DATA_BASE_TRUTH(AffectsArmStrength
);
385 DATA_BASE_TRUTH(AffectsLegStrength
);
386 DATA_BASE_TRUTH(AffectsDexterity
);
387 DATA_BASE_TRUTH(AffectsAgility
);
388 DATA_BASE_TRUTH(AffectsEndurance
);
389 DATA_BASE_TRUTH(AffectsPerception
);
390 DATA_BASE_TRUTH(AffectsIntelligence
);
391 DATA_BASE_TRUTH(AffectsWisdom
);
392 DATA_BASE_TRUTH(AffectsWillPower
);
393 DATA_BASE_TRUTH(AffectsCharisma
);
394 DATA_BASE_TRUTH(AffectsMana
);
395 DATA_BASE_TRUTH(AffectsCarryingCapacity
);
396 DATA_BASE_VALUE(int, BaseEnchantment
);
397 DATA_BASE_TRUTH(PriceIsProportionalToEnchantment
);
398 DATA_BASE_VALUE(int, MaxCharges
);
399 DATA_BASE_VALUE(int, MinCharges
);
400 DATA_BASE_VALUE(int, InElasticityPenaltyModifier
);
401 DATA_BASE_VALUE(sLong
, StorageVolume
);
402 DATA_BASE_VALUE(int, MaxGeneratedContainedItems
);
403 virtual DATA_BASE_TRUTH(CanBeCloned
);
404 virtual DATA_BASE_TRUTH(CanBeMirrored
);
405 DATA_BASE_VALUE(int, BeamRange
);
406 DATA_BASE_TRUTH(CanBeUsedBySmith
);
407 DATA_BASE_VALUE(int, DamageDivider
);
408 DATA_BASE_TRUTH(HandleInPairs
);
409 DATA_BASE_TRUTH(CanBeEnchanted
);
410 DATA_BASE_VALUE(sLong
, BeamColor
);
411 DATA_BASE_VALUE(int, BeamEffect
);
412 DATA_BASE_VALUE(int, BeamStyle
);
413 DATA_BASE_VALUE(int, WearWisdomLimit
);
414 DATA_BASE_VALUE(int, BreakEffectRangeSquare
);
415 virtual DATA_BASE_VALUE_WITH_PARAMETER(v2
, WieldedBitmapPos
, int);
416 DATA_BASE_TRUTH(IsQuestItem
);
417 DATA_BASE_TRUTH(IsGoodWithPlants
);
418 DATA_BASE_TRUTH(CanBePickedUp
);
419 DATA_BASE_VALUE(int, CoverPercentile
);
420 DATA_BASE_VALUE_WITH_PARAMETER(v2
, TorsoArmorBitmapPos
, int);
421 DATA_BASE_VALUE_WITH_PARAMETER(v2
, ArmArmorBitmapPos
, int);
422 DATA_BASE_VALUE_WITH_PARAMETER(v2
, AthleteArmArmorBitmapPos
, int);
423 DATA_BASE_VALUE_WITH_PARAMETER(v2
, LegArmorBitmapPos
, int);
424 DATA_BASE_VALUE_WITH_PARAMETER(v2
, HelmetBitmapPos
, int);
425 DATA_BASE_VALUE_WITH_PARAMETER(v2
, CloakBitmapPos
, int);
426 DATA_BASE_VALUE_WITH_PARAMETER(v2
, BeltBitmapPos
, int);
427 DATA_BASE_VALUE_WITH_PARAMETER(v2
, GauntletBitmapPos
, int);
428 DATA_BASE_VALUE_WITH_PARAMETER(v2
, BootBitmapPos
, int);
429 DATA_BASE_TRUTH(AllowEquip
);
430 DATA_BASE_VALUE(int, ReadDifficulty
);
431 DATA_BASE_VALUE(int, EnchantmentMinusChance
);
432 DATA_BASE_VALUE(int, EnchantmentPlusChance
);
433 virtual DATA_BASE_VALUE(int, TeleportPriority
);
434 DATA_BASE_TRUTH(HasNormalPictureDirection
);
435 DATA_BASE_VALUE(int, DamageFlags
);
436 DATA_BASE_TRUTH(FlexibilityIsEssential
);
437 DATA_BASE_VALUE(cfestring
&, BreakMsg
);
438 DATA_BASE_TRUTH(IsSadistWeapon
);
439 DATA_BASE_TRUTH(IsThrowingWeapon
);
440 DATA_BASE_VALUE(sLong
, ThrowItemTypes
);
441 DATA_BASE_TRUTH(CanFlame
);
442 DATA_BASE_VALUE(const fearray
<int> &, AllowedDungeons
);
443 DATA_BASE_VALUE(const fearray
<festring
> &, LevelTags
);
444 truth
CanBeSoldInLibrary(character
* Librarian
) const { return CanBeRead(Librarian
); }
445 virtual truth
TryKey(item
*, character
*) { return false; }
446 sLong
GetBlockModifier() const;
447 truth
IsSimiliarTo(item
*) const;
448 virtual truth
IsPickable(character
*) const { return true; }
449 truth
CanBeSeenByPlayer() const;
450 virtual truth
CanBeSeenBy(ccharacter
*) const;
451 festring
GetDescription(int) const;
452 virtual square
* GetSquareUnderEntity(int = 0) const;
453 virtual square
* GetSquareUnder(int = 0) const;
454 virtual lsquare
* GetLSquareUnder(int = 0) const;
455 level
* GetLevel() const { return static_cast<level
*>(Slot
[0]->GetSquareUnder()->GetArea()); }
456 area
* GetArea() const { return Slot
[0]->GetSquareUnder()->GetArea(); }
457 v2
GetPos(int I
= 0) const { return Slot
[I
]->GetSquareUnder()->GetPos(); }
458 square
* GetNearSquare(v2 Pos
) const { return Slot
[0]->GetSquareUnder()->GetArea()->GetSquare(Pos
); }
459 square
* GetNearSquare(int x
, int y
) const { return Slot
[0]->GetSquareUnder()->GetArea()->GetSquare(x
, y
); }
460 lsquare
* GetNearLSquare(v2 Pos
) const { return static_cast<lsquare
*>(Slot
[0]->GetSquareUnder()->GetArea()->GetSquare(Pos
)); }
461 lsquare
* GetNearLSquare(int x
, int y
) const { return static_cast<lsquare
*>(Slot
[0]->GetSquareUnder()->GetArea()->GetSquare(x
, y
)); }
462 virtual void SignalVolumeAndWeightChange();
463 virtual void CalculateVolumeAndWeight();
464 sLong
GetVolume() const { return Volume
; }
465 sLong
GetWeight() const { return Weight
; }
466 virtual void SignalEmitationIncrease(col24
);
467 virtual void SignalEmitationDecrease(col24
);
469 virtual void DropEquipment(stack
* = 0) { }
470 virtual truth
IsDangerous(ccharacter
*) const { return false; }
471 virtual truth
NeedDangerSymbol() const { return false; }
472 void WeaponSkillHit(int);
473 virtual void SetTeam(int) { }
474 void SpecialGenerationHandler();
475 item
* Duplicate(feuLong
= 0);
476 virtual void SetIsActive(truth
) { }
477 double GetBaseDamage() const;
478 int GetBaseMinDamage() const;
479 int GetBaseMaxDamage() const;
480 int GetBaseToHitValue() const;
481 int GetBaseBlockValue() const;
482 virtual void AddInventoryEntry(ccharacter
*, festring
&, int, truth
) const;
483 sLong
GetNutritionValue() const;
484 virtual void SignalSpoil(material
*);
485 virtual truth
AllowSpoil() const;
486 item
* DuplicateToStack(stack
*, feuLong
= 0);
487 virtual truth
CanBePiledWith(citem
*, ccharacter
*) const;
488 virtual sLong
GetTotalExplosivePower() const { return 0; }
489 virtual void Break(character
*, int = YOURSELF
);
490 virtual void SetEnchantment(int) { }
491 virtual void EditEnchantment(int) { }
492 virtual void SignalEnchantmentChange();
493 virtual double GetTHVBonus() const { return 0.; }
494 virtual double GetDamageBonus() const { return 0.; }
495 virtual void DrawContents(ccharacter
*) { }
496 virtual int GetEnchantment() const { return 0; }
497 sLong
GetEnchantedPrice(int) const;
499 int GetStrengthRequirement() const;
500 virtual int GetInElasticityPenalty(int) const { return 0; }
501 virtual truth
IsFixableBySmith(ccharacter
*) const { return false; }
502 virtual truth
IsFixableByTailor(ccharacter
*) const { return false; }
503 virtual sLong
GetFixPrice() const;
504 virtual void DonateSlotTo(item
*);
505 virtual int GetSpoilLevel() const;
506 virtual void SignalSpoilLevelChange(material
*);
507 void ResetSpoiling();
508 virtual void SetItemsInside(const fearray
<contentscript
<item
> >&, int) { }
509 virtual int GetCarryingBonus() const { return 0; }
510 cchar
* GetStrengthValueDescription() const;
511 cchar
* GetBaseToHitValueDescription() const;
512 cchar
* GetBaseBlockValueDescription() const;
513 virtual truth
IsInCorrectSlot(int) const;
514 truth
IsInCorrectSlot() const;
515 int GetEquipmentIndex() const;
516 room
* GetRoom(int I
= 0) const { return GetLSquareUnder(I
)->GetRoom(); }
517 virtual truth
HasBetterVersion() const { return false; }
518 virtual void SortAllItems(const sortdata
&) const;
519 virtual truth
AllowAlphaEverywhere() const { return false; }
520 virtual int GetAttachedGod() const;
521 virtual sLong
GetTruePrice() const;
522 virtual void Search(ccharacter
*, int) { }
523 virtual head
* Behead() { return 0; }
524 virtual truth
EffectIsGood() const { return false; }
526 virtual void AddAttackInfo(felist
&) const;
527 void AddMiscellaneousInfo(felist
&) const;
529 virtual void PreProcessForBone();
530 virtual void PostProcessForBone();
531 virtual void FinalProcessForBone() { }
532 virtual truth
SuckSoul(character
*, character
* = 0) { return false; }
533 void SetConfig(int, int = 0);
534 god
* GetMasterGod() const;
535 idholder
* GetCloneMotherID() const { return CloneMotherID
; }
536 virtual void SignalStackAdd(stackslot
*, void (stack::*)(item
*, truth
));
537 virtual int GetSquareIndex(v2
) const { return 0; }
538 virtual void Draw(blitdata
&) const;
539 v2
GetLargeBitmapPos(v2
, int) const;
540 void LargeDraw(blitdata
&) const;
541 virtual truth
BunnyWillCatchAndConsume(ccharacter
*) const { return false; }
542 void DonateIDTo(item
*);
543 virtual void SignalRustLevelChange();
544 virtual void SendNewDrawAndMemorizedUpdateRequest() const;
545 virtual void CalculateSquaresUnder() { SquaresUnder
= 1; }
546 int GetSquaresUnder() const { return SquaresUnder
; }
547 virtual void CalculateEmitation();
548 void FillFluidVector(fluidvector
&, int = 0) const;
549 virtual void SpillFluid(character
*, liquid
*, int = 0);
550 virtual void TryToRust(sLong
);
551 void RemoveFluid(fluid
*);
552 void RemoveAllFluids ();
553 void AddFluid(liquid
*, festring
, int, truth
);
554 virtual truth
IsAnimated() const;
555 const rawbitmap
* GetRawPicture() const;
556 void DrawFluidGearPictures(blitdata
&, int = 0) const;
557 void DrawFluidBodyArmorPictures(blitdata
&, int) const;
558 void CheckFluidGearPictures(v2
, int, truth
);
559 void DrawFluids(blitdata
&) const;
560 virtual void ReceiveAcid(material
*, cfestring
&, sLong
);
561 virtual truth
ShowFluids() const { return true; }
562 void DonateFluidsTo(item
*);
563 void Destroy(character
*, int);
564 virtual truth
AllowFluidBe() const { return true; }
565 virtual truth
IsRusted() const;
566 virtual void RemoveRust();
567 void SetSpoilPercentage(int);
568 virtual pixelpredicate
GetFluidPixelAllowedPredicate() const;
569 void RedistributeFluids();
570 virtual material
* GetConsumeMaterial(ccharacter
*, materialpredicate
= TrueMaterialPredicate
) const;
571 virtual material
* RemoveMaterial(material
*);
572 virtual void Cannibalize();
573 void InitMaterials(material
*, truth
= true);
574 void SetMainMaterial(material
*, int = 0);
575 void ChangeMainMaterial(material
*, int = 0);
576 virtual void GenerateMaterials();
577 virtual void InitMaterials(const materialscript
*, const materialscript
*, truth
);
578 int GetSquarePosition() const { return (Flags
& SQUARE_POSITION_BITS
) >> SQUARE_POSITION_SHIFT
; }
579 virtual void DestroyBodyPart(stack
*) { SendToHell(); }
580 int GetLifeExpectancy() const { return LifeExpectancy
; }
581 virtual void SetLifeExpectancy(int, int);
582 int NeedsBe() const { return LifeExpectancy
; }
583 truth
IsVeryCloseToDisappearance() const { return LifeExpectancy
&& LifeExpectancy
< 10; }
584 truth
IsVeryCloseToSpoiling() const;
585 virtual truth
IsValuable() const;
586 virtual truth
Necromancy(character
*) { return false; }
587 virtual void CalculateEnchantment() { }
588 virtual character
* GetBodyPartMaster() const { return 0; }
589 virtual truth
AllowFluids() const { return false; }
590 int GetHinderVisibilityBonus(ccharacter
*) const;
591 virtual DATA_BASE_TRUTH_WITH_PARAMETER(IsKamikazeWeapon
, ccharacter
*);
592 virtual void AddTrapName(festring
&, int) const;
593 int GetMainMaterialRustLevel() const;
594 truth
HasID(feuLong What
) const { return ID
== What
; }
595 virtual truth
Spoils() const;
596 int GetMaxSpoilPercentage() const;
597 truth
HasPrice() const;
598 virtual void Disappear();
599 festring
GetLocationDescription() const;
600 truth
IsEquipped() const;
601 festring
GetExtendedDescription() const;
602 virtual ccharacter
* FindCarrier() const;
603 virtual void BlockEffect(character
*, character
*, item
*, int type
) { }
604 virtual bool WillExplodeSoon() const { return false; }
605 virtual const character
* GetWearer() const;
606 virtual bool SpecialOfferEffect(int) { return false; }
609 void SendMemorizedUpdateRequest() const;
611 virtual truth
IsHeadOfElpuri() const { return false; }
612 virtual truth
IsPetrussNut() const { return false; }
613 virtual truth
IsGoldenEagleShirt() const { return false; }
614 virtual truth
IsMoneyBag () const { return false; }
615 virtual truth
IsKleinBottle () const { return false; }
616 virtual truth
IsTheAvatar() const { return false; }
617 virtual truth
IsExplosive() const { return false; }
618 virtual truth
IsConsumable() const { return true; }
619 virtual truth
IsWhip() const { return false; }
620 virtual truth
IsBroken() const;
621 virtual truth
IsFood() const;
622 virtual truth
IsBanana() const { return false; }
623 virtual truth
IsEncryptedScroll() const { return false; }
624 virtual truth
IsShadowVeil () const { return false; }
625 virtual truth
IsLostRubyFlamingSword () const { return false; }
626 virtual truth
IsMangoSeedling() const { return false; }
627 virtual truth
IsMondedrPass () const { return false; }
628 virtual truth
IsRingOfThieves () const { return false; }
629 virtual truth
IsGorovitsFamilyRelic() const { return false; }
630 virtual truth
IsBananaPeel() const { return false; }
631 virtual truth
IsLanternOnWall() const { return false; }
632 virtual truth
IsABone () const { return false; }
633 virtual truth
IsASkull () const { return false; }
635 //FIXME:k8: are there such functions already? can we use RTTI?
636 virtual truth
IsCorpse () const { return false; }
637 virtual truth
IsBodyPart () const { return false; }
638 virtual truth
IsBottle () const { return false; }
639 virtual truth
IsCan () const { return false; }
640 virtual truth
IsScroll () const { return false; }
641 virtual truth
IsMango () const { return false; }
643 virtual truth
AllowDetailedDescription () const { return false; }
645 virtual truth
IsBoneNameSingular () const override
{ return (GetNameSingular() == "bone"); }
647 inline cchar
*GetClassID () const { return (FindProtoType() ? FindProtoType()->GetClassID() : ""); }
648 virtual const prototype
* FindProtoType () const { return &ProtoType
; }
651 virtual cchar
* GetBreakVerb() const;
652 virtual sLong
GetMaterialPrice() const;
653 void LoadDataBaseStats();
654 virtual void PostConstruct() { }
655 void Initialize(int, int);
656 virtual int GetGraphicsContainerIndex() const;
657 virtual truth
ShowMaterial() const;
658 virtual truth
AllowSparkling() const { return !Fluid
; }
659 virtual truth
WeightIsIrrelevant() const { return false; }
660 virtual truth
AddStateDescription(festring
&, truth
) const;
661 static const prototype ProtoType
;
665 const database
* DataBase
;
668 idholder
* CloneMotherID
;
670 int FluidCount
; // same as 'SquaresUnder'?
680 #ifdef __FILE_OF_STATIC_ITEM_PROTOTYPE_DEFINITIONS__
681 #define ITEM_PROTO(name, base)\
682 template<> const itemprototype\
683 name##sysbase::ProtoType(&base::ProtoType,\
684 (itemspawner)(&name##sysbase::Spawn),\
685 (itemcloner)(&name##sysbase::Clone), #name);
687 #define ITEM_PROTO(name, base)
690 #define ITEM(name, base)\
692 typedef sysbase<name, base, itemprototype> name##sysbase;\
693 ITEM_PROTO(name, base)\
694 class name : public name##sysbase