561 Commits

Author SHA1 Message Date
yvt
1a4594d9bd
Tracer: Replace Client * with Client & 2019-08-08 01:09:22 +09:00
yvt
066eda82df
Add bounds check 2019-08-08 01:08:12 +09:00
yvt
ef2d844a97
clang-format all source files under Sources/Client 2019-08-07 23:51:05 +09:00
yvt
b49028d822 Add const to GameMapLoader::IsComplete 2019-07-24 19:11:36 +09:00
yvt
3b15a205ff Replace Deque with std::deque
Profiling indicated that a little time (< 10% of `ApplyBlockActions`'s
total execution time) is spent on `Deque` when a large chunk of block
is being removed. Thus even *if* this commit slows down things, the
performance impact would be insignificant.
2019-07-24 19:11:36 +09:00
yvt
d1ba2a729b
Fix to build with GCC 4.9
> error: invalid use of incomplete type ‘class spades::Bitmap’
2019-07-23 22:55:02 +09:00
yvt
f841c94db7
Change the return type of CreatePipeStream to use unique_ptr 2019-07-23 22:28:56 +09:00
yvt
da7e61b25c
Change std::regex static local variables to global
Removes the runtime cost caused by lazy initialization.
2019-07-23 22:25:12 +09:00
yvt
701105f916
Change the return type of file opening functions to std::unique_ptr<_>
This also fixes a memory leak in `MainScreenHelper::SaveFavorites`.
2019-07-23 22:14:10 +09:00
yvt
d248ac2460 Change the return type of GameMapLoader::TakeGameMap to Handle<_> 2019-07-23 21:57:40 +09:00
yvt
5fe8b0fe18 Remove StreamHandle
It was functionally identical to `std::shared_ptr<IStream>`.
2019-07-23 21:57:40 +09:00
yvt
770f11a0d1 FTFont: Get rid of raw pointer 2019-07-20 17:16:09 +09:00
yvt
4c69adb972
Reformat 2019-07-20 17:13:16 +09:00
yvt
a0c9a661eb
Remove unused variables 2019-07-20 17:12:45 +09:00
yvt
0754d4e3dc
clang-format 2019-07-20 17:12:18 +09:00
yvt
e54a3ff470
FTFontSet is no longer RefCountedObject 2019-07-20 17:10:27 +09:00
yvt
516156e39e
FTFontSet: Construct unique_ptr earlier
This is a subtle change, but fixes memory leak caused by `std::list`'s
memory allocation failure.
2019-07-20 17:06:34 +09:00
yvt
b9a5d80f7b
Use Handle::New to construct T <: RefCountedObject
Unless `T::T(Args...)` is inaccessible from `Handle::New`, in which case
`Handle::Handle{new T(args...), false}` should be used.
2019-07-20 17:01:04 +09:00
yvt
830db57c01
Require rvalue for Handle::Unmanage 2019-07-20 16:38:21 +09:00
yvt
b4dcec2e1c
Use make_unique to construct unique_ptr 2019-07-20 16:34:35 +09:00
yvt
725ee9f706
Merge remote-tracking branch 'origin/master' into patch-modernize 2019-07-20 16:18:10 +09:00
yvt
6e262ea6ec
Add stmp::make_unique
This template function is a polyfill of `std::make_unique`, which is
unavailable in GCC 4.9 (should we even be supporting this old thing?).
2019-07-20 16:17:10 +09:00
yvt
1b67c4eff0
Turn BlockHitAction into enum class 2019-07-20 16:03:33 +09:00
yvt
0470ca3187
ParticleSpriteEntity: Receive images via Handle<IImage> 2019-07-20 16:00:07 +09:00
yvt
6513bd0075
ParticleSpriteEntity: Use Handle for reference counting 2019-07-20 15:57:56 +09:00
yvt
60fd3191c5
Remove Handle::operator T*(), discouraging conversion to raw pointers
It was replaced by `Handle::GetPointerOrNull()`. Every use of
`GetPointerOrNull` should be reviewed. Some of them were already removed.
2019-07-20 15:47:42 +09:00
yvt
e6227b3361
Update IRenderer for null safety and safe memory management 2019-07-20 13:48:49 +09:00
yvt
fae85af23d
Make stmp::optional::operator= behave more like std::optional
This means the inner type's `operator=` is used whenever possible,
instead of using `T::T(const T&)` or `T::T(T&&)` all the time.
2019-07-18 16:12:44 +09:00
yvt
7b3d6bf28d
Change the return type of HotTrackedPlayer 2019-07-17 11:11:52 +09:00
yvt
9735d5855e
Change the return type of GetLocalClientPlayer 2019-07-17 11:05:21 +09:00
yvt
980b484c32
Instantly wrap Corpse with std::unique_ptr after construction
Note: IIRC `make_unique` isn't supported by some of the targeted
compilers.
2019-07-17 10:49:33 +09:00
yvt
f742420187
Replace raw pointers in CorpseUpdateDispatch with references 2019-07-17 10:46:32 +09:00
yvt
3916a39713
Replace raw pointers in Corpse::Corpse with references 2019-07-17 10:43:25 +09:00
YVT
989fc1e211
Remove out-dated comment 2019-07-17 10:30:36 +09:00
yvt
5db97f7f10
clang-format 2019-07-17 00:31:22 +09:00
yvt
7c3a39e639
Modernize
- Replaced raw pointers with references or smart pointers. Nullable
  references are represented by `stmp::optional<const T&>`. (There are
  many raw pointers still remaining. They should be replaced at some
  point.)
- Added class template specializations `stmp::optional<T &>` and
  `stmp::optional<const T&>`.
- Fixed `stmp::optional`'s various behaviors
- `World::{players, playerPersistents}` are now `std::array`.
- More uses of `stmp::optional` to clarify the semantics
- Renamed `PlayerThrownGrenade` to `PlayerThrewGrenade`
- Replaced old-style `for` loops with range based ones
- Deleted `Player`'s default constructors and `operator =`
- Deleted `TCGameMode`'s default constructor and `operator =`
- Deleted `CTFGameMode`'s default constructor and `operator =`
- Replaced `static_cast` with `dynamic_cast` for down-casting
- `RefCountedObject::operator*()` no longer requires non-constness to
  return `T &`.
- Replaced the uses of `std::vector::operator[]` with `std::vector::at`
  for bounds checking.
- Made some methods of `GameMap` `const`.
- Added some null checks.
2019-07-17 00:31:00 +09:00
yvt
8aa52a40fb
Add const to GameMap's methods 2019-07-16 01:17:47 +09:00
yvt
abcf65d536
Add clearsfxcache console command 2019-07-15 00:08:02 +09:00
yvt
ed508fadd5
Add IRenderer::ClearCache 2019-07-14 23:53:10 +09:00
yvt
a9561991c3
Add savemap console command 2019-07-14 22:29:15 +09:00
yvt
d6f5370581
Add the console window (WIP) 2019-07-14 01:38:28 +09:00
yvt
b02ad53109 Add View::RunFrameLate
`IRenderer::{FrameDone, Flip}` are now called in `RunFrameLate` instead.
This makes it possible to create a `View` wrapping another `View` to
insert a new 2D drawing pass, which is necessary to render the system
console.
2019-07-14 00:29:36 +09:00
yvt
cb89824f32
clang-format 2019-06-09 13:44:05 +09:00
YVT
c2677c0465
Merge pull request #832 from otzade/fix-minimap
Fix minimap
2019-06-09 13:43:05 +09:00
otzade
fabb3bd0ba Draw cursor inside block differently 2019-05-25 20:12:16 +03:00
otzade
aeeca9331e Some more changes..
Cursor made emissive, unshaded
Yellow cursor is back, but less opaque
2019-05-25 17:11:55 +03:00
otzade
a1def7e762 Merge branch 'master' into block 2019-05-25 13:19:59 +03:00
yvt
31a153e711 Add "ghost" rendering
This commit adds new model rendering options
`ModelRenderParam::{ghost, opacity}`.

> Specifies that the model is not an actual object in the virtual world, 
> thus does not affect the shading of other objects and does not appear
> in a mirror.
> ...
> In exchange, it allows the use of an opacity value other than `1`.
2019-05-25 18:56:41 +09:00
yvt
f75f55f33d
FallingBlock: Use the default material ID for generated VoxelModels 2019-05-25 15:42:51 +09:00
yvt
c910bd4846
Remove Mutex, replacing their uses with std::{mutex, recursive_mutex} 2019-05-25 15:00:32 +09:00