ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/c_range.C
(Generate patch)

Comparing deliantra/server/server/c_range.C (file contents):
Revision 1.52 by root, Wed Nov 21 12:12:03 2012 UTC vs.
Revision 1.55 by root, Sat Nov 17 23:40:03 2018 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 5 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 6 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 7 * Copyright (©) 1992 Frank Tore Johansen
7 * 8 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 9 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 10 * the terms of the Affero GNU General Public License as published by the
112static int 113static int
113command_cast_spell (object *op, char *params, char command) 114command_cast_spell (object *op, char *params, char command)
114{ 115{
115 int castnow = 0; 116 int castnow = 0;
116 char *cp; 117 char *cp;
117 object *spob;
118 118
119 if (command == 'i') 119 if (command == 'i')
120 castnow = 1; 120 castnow = 1;
121 121
122 /* Remove control of the golem */ 122 /* Remove control of the golem */
123 if (object *golem = op->contr->golem) 123 if (object *golem = op->contr->golem)
124 golem->drop_and_destroy (); 124 golem->drop_and_destroy ();
125 125
126 if (params) 126 if (params)
127 { 127 {
128 int spellnumber = 0; 128 object *spob = op->find_spell (params);
129 129
130 if ((spellnumber = atoi (params))) 130 if (spob)
131 for (spob = op->inv; spob && spob->count != spellnumber; spob = spob->below)
132 /* nop */;
133 else
134 spob = op->find_spell (params);
135
136 if (spob && spob->type == SPELL)
137 { 131 {
138 /* Now grab any extra data, if there is any. Forward pass
139 * any 'of' delimiter
140 */
141 if (spellnumber)
142 {
143 /* if we passed a number, the options start at the second word */
144 cp = strchr (params, ' ');
145 if (cp)
146 {
147 cp++;
148 if (!strncmp (cp, "of ", 3))
149 cp += 3;
150 }
151 }
152 else if (strlen (params) > strlen (spob->name)) 132 if (strlen (params) > strlen (spob->name))
153 { 133 {
154 cp = params + strlen (spob->name); 134 cp = params + strlen (spob->name);
155 *cp = 0; 135 *cp = 0;
156 cp++; 136 cp++;
157 if (!strncmp (cp, "of ", 3)) 137 if (!strncmp (cp, "of ", 3))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines