--- deliantra/server/common/button.C 2009/10/15 21:40:42 1.58
+++ deliantra/server/common/button.C 2016/11/16 23:41:59 1.72
@@ -1,24 +1,24 @@
/*
* This file is part of Deliantra, the Roguelike Realtime MMORPG.
- *
- * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
- * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
- * Copyright (©) 1992,2007 Frank Tore Johansen
- *
+ *
+ * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
+ * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
+ * Copyright (©) 1992 Frank Tore Johansen
+ *
* Deliantra is free software: you can redistribute it and/or modify it under
* the terms of the Affero GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the Affero GNU General Public License
* and the GNU General Public License along with this program. If not, see
* .
- *
+ *
* The authors can be reached via e-mail to
*/
@@ -54,16 +54,16 @@
* re-loaded. As such, just exit this function if that is the case.
*/
- if (QUERY_FLAG (ol->ob, FLAG_FREED))
+ if (ol->ob->flag [FLAG_FREED])
return;
object *tmp = ol->ob;
/* if the criteria isn't appropriate, don't do anything */
- if (state && !QUERY_FLAG (tmp, FLAG_ACTIVATE_ON_PUSH))
+ if (state && !tmp->flag [FLAG_ACTIVATE_ON_PUSH])
continue;
- if (!state && !QUERY_FLAG (tmp, FLAG_ACTIVATE_ON_RELEASE))
+ if (!state && !tmp->flag [FLAG_ACTIVATE_ON_RELEASE])
continue;
switch (tmp->type)
@@ -86,8 +86,13 @@
case SIGN:
if (!tmp->stats.food || tmp->last_eat < tmp->stats.food)
{
- tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_sign"));
- new_info_map (NDI_UNIQUE | NDI_NAVY, tmp->map, tmp->msg);
+ tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("msg_voice"));
+
+ if (originator && originator->contr)
+ originator->contr->infobox (MSG_CHANNEL ("examine"), format ("T<%s>\n\n%s", &tmp->name, &tmp->msg));
+
+ new_info_map_except (NDI_UNIQUE | NDI_NAVY, tmp->map, originator, tmp->msg);
+
if (tmp->stats.food)
tmp->last_eat++;
}
@@ -134,7 +139,7 @@
case DIRECTOR:
case FIREWALL:
- if (!QUERY_FLAG (tmp, FLAG_ANIMATE) && tmp->type == FIREWALL)
+ if (!tmp->flag [FLAG_ANIMATE] && tmp->type == FIREWALL)
move_firewall (tmp);
else
{
@@ -233,7 +238,7 @@
if (tmp->type == BUTTON)
{
- sint32 total = 0;
+ weight_t total = 0;
for (object *ab = tmp->above; ab; ab = ab->above)
/* Basically, if the move_type matches that on what the
@@ -273,6 +278,25 @@
any_down = any_down || tmp->value;
}
+ else if (tmp->type == T_MATCH)
+ {
+ tmp->value = 0;
+
+ for (object *ab = tmp->above; ab; ab = ab->above)
+ {
+ object *head = ab->head_ ();
+
+ /* Same note regarding move_type for buttons above apply here. */
+ if (((ab->move_type & tmp->move_on) || ab->move_type == 0))
+ if (match (tmp->slaying, head, tmp, originator))
+ {
+ tmp->value = 1;
+ break;
+ }
+ }
+
+ any_down = any_down || tmp->value;
+ }
}
if (any_down) /* If any other buttons were down, force this to remain down */
@@ -324,19 +348,18 @@
* sacrificed. This fixes a bug of trying to put multiple altars/related
* objects on the same space that take the same sacrifice.
*/
-
int
check_altar_sacrifice (object *altar, object *sacrifice, object *originator)
{
- if (sacrifice->flag [FLAG_UNPAID])
+ if (sacrifice->flag [FLAG_UNPAID]
+ || sacrifice->flag [FLAG_IS_LINKED]
+ || sacrifice->is_player ())
return 0;
if (is_match_expr (ARCH_SACRIFICE (altar)))
- return match (ARCH_SACRIFICE (altar), altar, originator);
+ return match (ARCH_SACRIFICE (altar), sacrifice, altar, originator);
- if (!QUERY_FLAG (sacrifice, FLAG_ALIVE)
- && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED)
- && sacrifice->type != PLAYER)
+ if (!sacrifice->flag [FLAG_ALIVE])
{
if (ARCH_SACRIFICE (altar) == shstr_money
&& sacrifice->type == MONEY
@@ -402,7 +425,7 @@
return 1;
}
-void
+static void
trigger_move (object *op, int state, object *originator) /* 1 down and 0 up */
{
op->stats.wc = state;
@@ -438,7 +461,7 @@
{
object *tmp;
int push = 0, tot = 0;
- int in_movement = op->stats.wc || op->speed;
+ int in_movement = op->stats.wc || op->has_active_speed ();
switch (op->type)
{
@@ -739,7 +762,7 @@
object *tmp;
for (tmp = ms.top; tmp; tmp = tmp->below)
- if (QUERY_FLAG (tmp, FLAG_MONSTER))
+ if (tmp->flag [FLAG_MONSTER])
break;
/* doesn't effect players, and if there is a player on this space, won't also
@@ -752,10 +775,10 @@
switch (op->last_sp)
{
case 0: /* furious--make all monsters mad */
- if (QUERY_FLAG (tmp, FLAG_UNAGGRESSIVE))
- CLEAR_FLAG (tmp, FLAG_UNAGGRESSIVE);
+ if (tmp->flag [FLAG_UNAGGRESSIVE])
+ tmp->clr_flag (FLAG_UNAGGRESSIVE);
- if (QUERY_FLAG (tmp, FLAG_FRIENDLY))
+ if (tmp->flag [FLAG_FRIENDLY])
{
tmp->attack_movement = 0;
/* lots of checks here, but want to make sure we don't
@@ -774,16 +797,16 @@
break;
case 1: /* angry -- get neutral monsters mad */
- if (QUERY_FLAG (tmp, FLAG_UNAGGRESSIVE) && !QUERY_FLAG (tmp, FLAG_FRIENDLY))
- CLEAR_FLAG (tmp, FLAG_UNAGGRESSIVE);
+ if (tmp->flag [FLAG_UNAGGRESSIVE] && !tmp->flag [FLAG_FRIENDLY])
+ tmp->clr_flag (FLAG_UNAGGRESSIVE);
break;
case 2: /* calm -- pacify unfriendly monsters */
- SET_FLAG (tmp, FLAG_UNAGGRESSIVE);
+ tmp->set_flag (FLAG_UNAGGRESSIVE);
break;
case 3: /* make all monsters fall asleep */
- SET_FLAG (tmp, FLAG_SLEEP);
+ tmp->set_flag (FLAG_SLEEP);
break;
case 4: /* charm all monsters */
@@ -793,7 +816,7 @@
if (object *pl = source->ms ().player ())
{
tmp->set_owner (pl);
- SET_FLAG (tmp, FLAG_MONSTER);
+ tmp->set_flag (FLAG_MONSTER);
tmp->stats.exp = 0;
@@ -803,7 +826,7 @@
break;
case 6: // kill monsters
- if (!QUERY_FLAG (tmp, FLAG_FRIENDLY))
+ if (!tmp->flag [FLAG_FRIENDLY])
break;
// FALL THROUGH