MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / OnObjectPlaceWaypointAtViewer

Method OnObjectPlaceWaypointAtViewer

editor/MainFrm.cpp:3517–3554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3515
3516#include "player.h"
3517
3518void CMainFrame::OnObjectPlaceWaypointAtViewer() {
3519 int objnum;
3520 int count = 0;
3521
3522 // Count the number of waypoints
3523 for (int i = 0; i <= Highest_object_index; i++)
3524 if (Objects[i].type == OBJ_WAYPOINT)
3525 count++;
3526
3527 if (count >= MAX_WAYPOINTS) {
3528 EditorMessageBox("Cannot add waypoint: Already at maximum number of waypoints.");
3529 return;
3530 }
3531
3532 // Check for waypoint already in this room
3533 if (OBJECT_OUTSIDE(Viewer_object))
3534 objnum = Terrain_seg[CELLNUM(Viewer_object->roomnum)].objects;
3535 else
3536 objnum = Rooms[Viewer_object->roomnum].objects;
3537
3538 for (objnum = Rooms[Viewer_object->roomnum].objects; objnum != -1; objnum = Objects[objnum].next) {
3539 if (Objects[objnum].type == OBJ_WAYPOINT) {
3540 EditorMessageBox("Cannot add waypoint: There's alerady a waypoint in this room (object %d)", objnum);
3541 return;
3542 }
3543 }
3544
3545 objnum = ObjCreate(OBJ_WAYPOINT, 0, Viewer_object->roomnum, &Viewer_object->pos, &Viewer_object->orient);
3546
3547 if (objnum == -1) {
3548 Int3();
3549 return;
3550 }
3551
3552 EditorStatus("Waypoint created as object %d\n", objnum);
3553
3554 World_changed = 1;
3555}
3556
3557#include "levelgoal.h"

Callers

nothing calls this directly

Calls 2

ObjCreateFunction · 0.85
EditorStatusFunction · 0.85

Tested by

no test coverage detected