summaryrefslogtreecommitdiff
path: root/src/signs.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-23 20:56:08 +0000
committerrubidium <rubidium@openttd.org>2008-04-23 20:56:08 +0000
commit6939569362a8c3e2c1b5174962309d0d73152845 (patch)
treea6906b106143841dcbc6aea392d11baa75492e05 /src/signs.cpp
parent1ba6e3deebf4c26896491842df51dc26f29a1c5d (diff)
downloadopenttd-6939569362a8c3e2c1b5174962309d0d73152845.tar.xz
(svn r12855) -Codechange: do not use autoptr's for testing whether certain objects can be build, but check it directly in the pool so we do not have to call destructors in the testing phase. Stations still use the autoptr though.
Diffstat (limited to 'src/signs.cpp')
-rw-r--r--src/signs.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/signs.cpp b/src/signs.cpp
index a1dce3304..93ab460f0 100644
--- a/src/signs.cpp
+++ b/src/signs.cpp
@@ -11,7 +11,6 @@
#include "saveload.h"
#include "command_func.h"
#include "variables.h"
-#include "misc/autoptr.hpp"
#include "strings_func.h"
#include "viewport_func.h"
#include "zoom_func.h"
@@ -99,12 +98,11 @@ static void MarkSignDirty(Sign *si)
CommandCost CmdPlaceSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
/* Try to locate a new sign */
- Sign *si = new Sign(_current_player);
- if (si == NULL) return_cmd_error(STR_2808_TOO_MANY_SIGNS);
- AutoPtrT<Sign> s_auto_delete = si;
+ if (!Sign::CanAllocateItem()) return_cmd_error(STR_2808_TOO_MANY_SIGNS);
/* When we execute, really make the sign */
if (flags & DC_EXEC) {
+ Sign *si = new Sign(_current_player);
int x = TileX(tile) * TILE_SIZE;
int y = TileY(tile) * TILE_SIZE;
@@ -117,7 +115,6 @@ CommandCost CmdPlaceSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
_sign_sort_dirty = true;
_new_sign_id = si->index;
_total_signs++;
- s_auto_delete.Detach();
}
return CommandCost();