27 Commits

Author SHA1 Message Date
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
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
6517338dab
Delete RefCountedObject's copy constructor 2019-07-20 14:18:48 +09:00
yvt
9e770cc040
Update the rules for RefCountedObject 2019-07-20 13:25:35 +09:00
yvt
a44a900c62
Fix Handle::Handle(T&) 2019-07-20 12:36:11 +09:00
yvt
8cdb086bb1
Add implicit casts between Handle<T> and stmp::optional<T &> 2019-07-20 12:26:44 +09:00
yvt
9038c7e135
Update the rules for RefCountedObject 2019-07-20 12:25:58 +09:00
yvt
5f7dde6a96
Update and clarify the rules for RefCountedObject 2019-07-18 15:54:40 +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
3c90eedfb8 Add Handle::operator== 2019-07-16 01:18:26 +09:00
yvt
c910bd4846
Remove Mutex, replacing their uses with std::{mutex, recursive_mutex} 2019-05-25 15:00:32 +09:00
yvt
6426247f09 Use C++11 atomics in place of AngelScript's implementation
AngelScript's implementation uses now-deprecated `OSAtomicIncrement32`
and generates compiler warnings.
2018-12-31 21:57:11 +09:00
yvt
3cd581260a Fix a bug causing the program not to start
This bug was introduced in ac4799abafbeb1d44d1b7166913406cd3a46b560.

This bug apparently only affected MSVC since the evaluation order of function
call parameters respect to other parameters is unspecified by the C++
specification.

Fixes #785.
2018-10-31 16:16:51 +09:00
yvt
c50906d16b Fix to build with GCC 4.9 2018-10-27 18:19:38 +09:00
yvt
6a6e771478 Add utilities and static checks to Handle 2018-10-13 16:07:24 +09:00
yvt
2554eaad57 Refactor, add more checks 2017-01-05 04:11:42 +09:00
Tomoaki Kawada
2eb9e35c65 Apply clang-format to all non-external source files 2016-12-03 18:23:47 +09:00
yvt
b9e79a3fe6 Improved stability of cg_smp 2014-03-16 22:52:24 +09:00
yvt
b568d7485b Fixed a bug that Handle<T> cannot return nullptr 2014-03-09 02:20:59 +09:00
yvt
db88ee4703 Fixed some little bugs (thanks to Clang static analyzer) 2014-02-25 19:35:37 +09:00
yvt
4788b751fb Fixed a bug that assignment of NULL to Handle<T> caused a crash 2013-11-24 00:17:28 +09:00
yvt
8552c30366 Small fixes 2013-11-23 02:50:02 +09:00
yvt
e4b83484db Fixed #93. 2013-11-17 00:26:05 +09:00
yvt
13692657e1 Merge and some refactor (ref-counting some objects) 2013-09-14 13:28:19 +09:00
yvt
881c868b39 Merge branch 'master' of https://github.com/yvt/openspades
Conflicts:
	Sources/AngelScript/addons/scriptbuilder.h
	Sources/Core/Math.cpp
	Sources/ScriptBindings/ScriptManager.cpp
	Sources/ScriptBindings/ScriptManager.h
2013-09-14 13:28:12 +09:00