1 | |
|
|
2 | /* |
|
|
3 | * static char *rcsid_button_c = |
|
|
4 | * "$Id: button.C,v 1.9 2006/09/13 23:42:23 root Exp $"; |
|
|
5 | */ |
|
|
6 | |
|
|
7 | /* |
1 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
9 | |
3 | |
10 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
11 | Copyright (C) 1992 Frank Tore Johansen |
5 | Copyright (C) 1992 Frank Tore Johansen |
… | |
… | |
22 | |
16 | |
23 | You should have received a copy of the GNU General Public License |
17 | You should have received a copy of the GNU General Public License |
24 | along with this program; if not, write to the Free Software |
18 | along with this program; if not, write to the Free Software |
25 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | |
20 | |
27 | The authors can be reached via e-mail at crossfire-devel@real-time.com |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
28 | */ |
22 | */ |
29 | |
23 | |
30 | #include <global.h> |
24 | #include <global.h> |
31 | #include <funcpoint.h> |
25 | #include <funcpoint.h> |
32 | |
26 | |
… | |
… | |
193 | * the connection was 'state' or 'released'. So that you can activate objects |
187 | * the connection was 'state' or 'released'. So that you can activate objects |
194 | * who have FLAG_ACTIVATE_ON_PUSH/RELEASE set properly. |
188 | * who have FLAG_ACTIVATE_ON_PUSH/RELEASE set properly. |
195 | * |
189 | * |
196 | */ |
190 | */ |
197 | void |
191 | void |
198 | activate_connection (mapstruct *map, long connection, bool state) |
192 | activate_connection (maptile *map, long connection, bool state) |
199 | { |
193 | { |
200 | if (INVOKE_MAP (TRIGGER, map, ARG_INT64 (connection), ARG_INT (state))) |
194 | if (INVOKE_MAP (TRIGGER, map, ARG_INT64 (connection), ARG_INT (state))) |
201 | return; |
195 | return; |
202 | |
196 | |
203 | oblinkpt *obp = get_connection_links (map, connection); |
197 | oblinkpt *obp = get_connection_links (map, connection); |
… | |
… | |
287 | /* |
281 | /* |
288 | * Updates every button on the map (by calling update_button() for them). |
282 | * Updates every button on the map (by calling update_button() for them). |
289 | */ |
283 | */ |
290 | |
284 | |
291 | void |
285 | void |
292 | update_buttons (mapstruct *m) |
286 | update_buttons (maptile *m) |
293 | { |
287 | { |
294 | objectlink *ol; |
288 | objectlink *ol; |
295 | oblinkpt *obp; |
289 | oblinkpt *obp; |
296 | |
290 | |
297 | for (obp = m->buttons; obp; obp = obp->next) |
291 | for (obp = m->buttons; obp; obp = obp->next) |
… | |
… | |
601 | return 0; |
595 | return 0; |
602 | } |
596 | } |
603 | } |
597 | } |
604 | |
598 | |
605 | void |
599 | void |
606 | add_button_link (object *button, mapstruct *map, int connected) |
600 | add_button_link (object *button, maptile *map, int connected) |
607 | { |
601 | { |
608 | oblinkpt *obp; |
602 | oblinkpt *obp; |
609 | objectlink *ol = get_objectlink (); |
603 | objectlink *ol = get_objectlink (); |
610 | |
604 | |
611 | if (!map) |
605 | if (!map) |
… | |
… | |
681 | |
675 | |
682 | /* |
676 | /* |
683 | * Gets the objectlink for this connection from the map. |
677 | * Gets the objectlink for this connection from the map. |
684 | */ |
678 | */ |
685 | oblinkpt * |
679 | oblinkpt * |
686 | get_connection_links (mapstruct *map, long connection) |
680 | get_connection_links (maptile *map, long connection) |
687 | { |
681 | { |
688 | for (oblinkpt * obp = map->buttons; obp; obp = obp->next) |
682 | for (oblinkpt * obp = map->buttons; obp; obp = obp->next) |
689 | if (obp->value == connection) |
683 | if (obp->value == connection) |
690 | return obp; |
684 | return obp; |
691 | return 0; |
685 | return 0; |
… | |
… | |
877 | /* This does a minimal check of the button link consistency for object |
871 | /* This does a minimal check of the button link consistency for object |
878 | * map. All it really does it much sure the object id link that is set |
872 | * map. All it really does it much sure the object id link that is set |
879 | * matches what the object has. |
873 | * matches what the object has. |
880 | */ |
874 | */ |
881 | void |
875 | void |
882 | verify_button_links (const mapstruct *map) |
876 | verify_button_links (const maptile *map) |
883 | { |
877 | { |
884 | oblinkpt *obp; |
878 | oblinkpt *obp; |
885 | objectlink *ol; |
879 | objectlink *ol; |
886 | |
880 | |
887 | if (!map) |
881 | if (!map) |