Commit graph

191 commits

Author SHA1 Message Date
Anders Jenbo
6d346c7e18
Use std::string in PrintItemPower 2021-12-13 01:02:07 +01:00
Gleb Mazovetskiy
c57644970f Move UiFlags and UiPanels into their own files
The first breaks circular dependency between `DiabloUI` and `text_render`.
The latter one moves `UiPanels` to a more appropriate place.
2021-11-25 12:22:27 +01:00
Gleb Mazovetskiy
7e1fea6f76 clang-format all files in {Source,test}/
Also includes a few manual tweaks to comments and newlines for better results.

Co-authored-by: Anders Jenbo <anders@jenbo.dk>
2021-11-24 23:44:12 +01:00
ephphatha
b8b220311a Remove AvailableItems, no longer required 2021-11-23 19:08:41 +01:00
ephphatha
18658f6a42 Remove duplicate argument to DeleteItem 2021-11-23 19:08:41 +01:00
ephphatha
baa1cd65c5 Make FindGetItem return an index into ActiveItems
This allows the calling code in DeltaLoadLevel to behave the same as every other use of DeleteItem, making it possible to remove the duplicate argument and ensure that the ActiveItems/AvailableItems arrays are treated appropriately.
2021-11-23 19:08:41 +01:00
ephphatha
55a52b82c2 Use unsigned types for Items array indexes consistently
Actual type used varied based on context, this addresses some type conversion warnings.
2021-11-23 19:08:41 +01:00
ephphatha
87651aa2f5 Check the item at the target position before searching all items 2021-11-14 18:32:29 +01:00
qndel
6dbe9109b2
make durability int again (#3467) 2021-11-10 15:04:51 +01:00
staphen
ab13fba13f Use Rune Bomb or Cathedral Map to open Hive or Crypt 2021-10-12 15:21:37 +02:00
qndel
c44ae7b0d4
Faster and better debug unique drop
Drop unique debug command tweak
2021-09-24 16:03:19 +02:00
Gleb Mazovetskiy
ec13c333a9 Refactor: Use item iterators for scroll checks
Refs #2586
2021-09-24 01:56:44 +01:00
Anders Jenbo
7771a08d03 Translatable mainpanel 2021-09-19 07:21:52 +02:00
Juliano Leal Goncalves
379a27b64a ♻️ Convert 'ItemType' enum to enum class
🎨 Rename 'ItemType' elements to enum class standards
2021-09-13 00:25:49 +02:00
Juliano Leal Goncalves
5a69380074 ♻️ Leverage 'ItemType' enum 2021-09-13 00:25:49 +02:00
Juliano Leal Goncalves
6323539fcc 🚚 Rename 'item_type' enum to 'ItemType' 2021-09-13 00:25:49 +02:00
Juliano Leal Goncalves
20db8d1a11 🚚 Rename 'MonsterStruct' to 'Monster' 2021-09-01 22:26:37 +02:00
BC Ko
589abe65d1 documentation cleanup: items 2021-08-30 13:56:11 +02:00
Juliano Leal Goncalves
bb2dfdfb73 🚚 Rename 'ItemStruct' to 'Item' 2021-08-30 13:40:08 +02:00
Juliano Leal Goncalves
bbf529c65a 🚚 Rename 'PlayerStruct' to 'Player' 2021-08-30 06:44:18 +02:00
Anders Jenbo
4044fadeb5 Clean up some players references 2021-08-30 03:26:17 +02:00
BC Ko
4df798808e
2435 refactor global variable Items part 2 (#2673) 2021-08-26 08:06:48 +02:00
Robin
f7f9786658
items: add BUGFIX, reset item get records when resetting items (#2691)
* items: add BUGFIX, reset item get records when resetting items

The item get record array tracks items being recently looted in an
effort to prevent the same item from being looted more than once.
Prior to this commit, the item get record array (and corresponding
item get record array length) variables were not cleared when
creating a new game. Therefore, the item get record array of a
previous game could remain in between games and prevent an item
from being looted (if it was looted in a previous), even if it was
never looted in the current game. In practice this almost never
shows up, since each item get record is valid for a total of 6
seconds before being cleared. So, you would either have to save
a game, quickly loot an item, when load the game and try to loot
the same item before 6 seconds pass. OR, you could use the demo
replay functionality to run test cases, and speed up execution to
run e.g. 10'000'000 logic ticks per second. Both would exhibit the
bug and prevent the item from being looted.

This commit fixes such issues by explicitly clearing the item get
record array and item get record array length variables whenever
items are initialized.
2021-08-24 11:08:24 +00:00
qndel
6fca66ad8a debug commands: dropitem/dropunique 2021-08-21 20:42:07 +02:00
ephphatha
0575716eac Rename UiFlags members to group related options 2021-07-31 20:22:40 +02:00
ephphatha
4ad53232a0 Convert the UiFlags enum to a scoped enum type
Replace operator&& with named function
2021-07-31 20:22:40 +02:00
Anders Jenbo
77b72da276 ♻️Use monster by reference when possible 2021-07-14 20:22:35 -07:00
Anders Jenbo
74b57558c9 🚚 Move local code to anonymous namespace 2021-07-10 17:30:15 -07:00
matheusgomes28
42e2c174ac
Refactored parameters of "StartItemPower(...)" and code around calls to it. (#2345)
Co-authored-by: Matheus Gomes <mgomes1@jaguarlandrover.com>
2021-07-10 18:04:42 +02:00
Anders Jenbo
c8870dbd1f Rename item globals 2021-07-08 02:01:14 -07:00
Gleb Mazovetskiy
cb0dae8590 🚚 Rename CelOutputBuf to Surface and extract 2021-07-03 05:33:32 -07:00
Anders Jenbo
7e737cfa96 Merge remote-tracking branch 'refs/remotes/devilution/master' 2021-07-03 01:44:45 +02:00
Andrew James
20190ee687
Update random number functions to avoid IB (#2226)
* Update random number functions to avoid IB

Most calls to set seed were using uint32_t already, there were a few variables which were better served by having their type changed from signed to unsigned. The one exception is ItemStruct::_iSeed. This is an identifier that also happens to be used as a seed occasionally so a comment was added documenting this exception.

Includes suggested style changes for Source/towners.h; Source/towners.cpp; Source/msg.h; Source/multi.h
2021-06-27 10:37:09 +02:00
Anders Jenbo
790f42d078 Clang-tidy: readability-inconsistent-declaration-parameter-name 2021-06-27 01:06:00 +02:00
Anders Jenbo
2bdb6caa07
Cleanup majority of remaning implicit bool conversions (#2234) 2021-06-26 21:05:45 +02:00
Anders Jenbo
22b632f04a ♻️Clean up implicit bool conversions 2021-06-26 08:57:59 -07:00
Anders Jenbo
ee7b32d8f6 Player by reference part 3 2021-06-24 00:53:09 +02:00
Gleb Mazovetskiy
f9f301b054 🚚 engine.h: Extract Point, Direction, clamp
`engine.h` is getting quite bloated. Moves this code to their own files.
2021-06-21 01:36:20 -07:00
Juliano Leal Goncalves
d47fc924f3 ♻️ Use '_item_indexes' instead of 'int' for 'ItemStruct.IDidx' field 2021-06-14 02:07:06 +02:00
obligaron
ab3f3f3ee7 Introduce ItemStruct.SetNewAnimation(bool) to start Animations only at one location 2021-06-08 10:12:09 +02:00
obligaron
ccc1ccf9c3 Introduce ItemStruct.AnimInfo 2021-06-08 10:12:09 +02:00
Juliano Leal Goncalves
b04047ba4d ♻️ Leverage 'Point' struct on 'SpawnUnique' 2021-05-31 06:05:35 +02:00
Juliano Leal Goncalves
9c85e61025 ♻️ Leverage 'Point' struct on 'ItemSpaceOk' 2021-05-31 06:05:35 +02:00
Gleb Mazovetskiy
dd3ea66fa2 ♻️ Split getTextColor(bool) into 2 functions
This is a bit more readable than using a bool argument.
2021-05-28 13:38:36 +02:00
qndel
2f3cf65b27 cleanup getTextColor 2021-05-26 15:58:14 +02:00
qndel
b1d74d2791
alt highlighting (#2060) 2021-05-25 23:47:29 +02:00
Gleb Mazovetskiy
8ceb36a4cb ♻️ GetItemTextColor(item) -> item.getTextColor()
This will help with the Alt highlight feature.
2021-05-23 18:45:01 +02:00
Vladimir Olteanu
0c7c71d579
Cleanup of items.cpp (#1967)
- Apply Point where applicable
- Deduplicate vendor logic
- Add comment about unhanded edge case in GetSuperItemLoc
- Initialize some variables at deceleration
2021-05-17 00:12:53 +02:00
Anders Jenbo
0c2042fa52 ♻️ Player by reference
Update Source/items.cpp
Update Source/lighting.cpp
Update Source/pack.cpp
asd


ads


as
2021-05-13 01:47:46 +02:00
Anders Jenbo
6321bf04d5 ♻️Pass player to towner by reference instead of index 2021-05-07 00:29:46 +02:00