disinclined.org
/
git
/
mudd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
0ce89d3
)
universe->error cleanup
author
Dylan Lloyd
<dylan@dylansserver.com>
Fri, 4 Oct 2013 11:38:58 +0000
(11:38 +0000)
committer
Dylan Lloyd
<dylan@dylansserver.com>
Fri, 4 Oct 2013 11:38:58 +0000
(11:38 +0000)
mud.php
patch
|
blob
|
history
diff --git
a/mud.php
b/mud.php
index
ed063dc
..
629f48e
100644
(file)
--- a/
mud.php
+++ b/
mud.php
@@
-147,35
+147,24
@@
class mud extends model {
}
private function yell($msg) {
}
private function yell($msg) {
- if (!$msg) {
- $this->error('400', 'expected `msg` field');
- return;
- }
+ if (!$msg) $this->error('400', 'expected `msg` field');
$this->insert(
'INSERT INTO messages (message,type,room,source) VALUES(?,?,?,?)',
'ssii', $msg, 'yell', $this->player->room, $this->player->id);
}
private function say($msg) {
$this->insert(
'INSERT INTO messages (message,type,room,source) VALUES(?,?,?,?)',
'ssii', $msg, 'yell', $this->player->room, $this->player->id);
}
private function say($msg) {
- if (!$msg) {
- $this->error('400', 'expected `dest` field');
- return;
- }
+ if (!$msg) $this->error('400', 'expected `dest` field');
$this->insert(
'INSERT INTO messages (message,type,room,source) VALUES(?,?,?,?)',
'ssii', $msg, 'say', $this->player->room, $this->player->id);
}
private function tell($dest, $msg) {
$this->insert(
'INSERT INTO messages (message,type,room,source) VALUES(?,?,?,?)',
'ssii', $msg, 'say', $this->player->room, $this->player->id);
}
private function tell($dest, $msg) {
- if (!$dest || !$msg) {
- $this->error('400', 'expected `dest` and `msg` fields');
- return;
- }
+ if (!$dest || !$msg) $this->error('400', 'expected `dest` and `msg` fields');
$player = $this->query('SELECT id FROM players where name = ?', 's', $dest);
$player = $this->query('SELECT id FROM players where name = ?', 's', $dest);
- if (!($player && $player['id']))
{
+ if (!($player && $player['id']))
$this->error('400', "could not find a player with `name` == $dest");
$this->error('400', "could not find a player with `name` == $dest");
- return;
- }
$this->insert(
'INSERT INTO messages (message,type,destination,source) VALUES(?,?,?,?)',
'ssii', $msg, 'say', $player['id'], $this->player->id);
$this->insert(
'INSERT INTO messages (message,type,destination,source) VALUES(?,?,?,?)',
'ssii', $msg, 'say', $player['id'], $this->player->id);
@@
-267,6
+256,7
@@
class mud extends model {
private function error($status, $msg) {
header("HTTP/1.0 $status");
echo $msg;
private function error($status, $msg) {
header("HTTP/1.0 $status");
echo $msg;
+ exit;
}
}
}
}