Cube  Diff

Differences From Artifact [86266db4fd]:

To Artifact [2969d1193c]:


1
2
3
4
5
6
7
8
9
10
11
12
13
// console.cpp: the console buffer, its display, and command line control

#include "cube.h"

#include <ctype.h>
#include <memory>

#import "KeyMapping.h"

struct cline {
	char *cref;
	int outtime;
};





<







1
2
3
4
5

6
7
8
9
10
11
12
// console.cpp: the console buffer, its display, and command line control

#include "cube.h"

#include <ctype.h>


#import "KeyMapping.h"

struct cline {
	char *cref;
	int outtime;
};
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
void
history(int n)
{
	static bool rec = false;

	if (!rec && n >= 0 && n < vhistory.count) {
		rec = true;
		OFString *cmd = vhistory[vhistory.count - n - 1];
		std::unique_ptr<char> copy(strdup(cmd.UTF8String));
		execute(copy.get());
		rec = false;
	}
}
COMMAND(history, ARG_1INT)

void
keypress(int code, bool isdown, int cooked)







|
<
<







168
169
170
171
172
173
174
175


176
177
178
179
180
181
182
void
history(int n)
{
	static bool rec = false;

	if (!rec && n >= 0 && n < vhistory.count) {
		rec = true;
		execute(vhistory[vhistory.count - n - 1]);


		rec = false;
	}
}
COMMAND(history, ARG_1INT)

void
keypress(int code, bool isdown, int cooked)
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
							[vhistory
							    addObject:
							        [commandbuf
							            copy]];
						}
					}
					histpos = vhistory.count;
					if ([commandbuf hasPrefix:@"/"]) {
						std::unique_ptr<char> copy(
						    strdup(
						        commandbuf.UTF8String));
						execute(copy.get(), true);
					} else
						toserver(commandbuf);
				}
				saycommand(NULL);
			} else if (code == SDLK_ESCAPE) {
				saycommand(NULL);
			}
		}
	} else if (!menukey(code, isdown)) {
		// keystrokes go to menu

		for (KeyMapping *mapping in keyMappings) {
			if (mapping.code == code) {
				// keystrokes go to game, lookup in keymap and
				// execute
				string temp;
				strcpy_s(temp, mapping.action.UTF8String);
				execute(temp, isdown);
				return;
			}
		}
	}
}

OFString *







|
<
<
|
<
|














<
|
<







242
243
244
245
246
247
248
249


250

251
252
253
254
255
256
257
258
259
260
261
262
263
264
265

266

267
268
269
270
271
272
273
							[vhistory
							    addObject:
							        [commandbuf
							            copy]];
						}
					}
					histpos = vhistory.count;
					if ([commandbuf hasPrefix:@"/"])


						execute(commandbuf, true);

					else
						toserver(commandbuf);
				}
				saycommand(NULL);
			} else if (code == SDLK_ESCAPE) {
				saycommand(NULL);
			}
		}
	} else if (!menukey(code, isdown)) {
		// keystrokes go to menu

		for (KeyMapping *mapping in keyMappings) {
			if (mapping.code == code) {
				// keystrokes go to game, lookup in keymap and
				// execute

				execute(mapping.action, isdown);

				return;
			}
		}
	}
}

OFString *