ai flags seem to work (both menus)

This commit is contained in:
Bill Currie 2006-12-20 10:51:16 +00:00
parent 07969da2a0
commit 9bbdc67fbf
4 changed files with 27 additions and 6 deletions

View file

@ -376,6 +376,7 @@ very good all things considered.
if (current_way) if (current_way)
[current_way deselect]; [current_way deselect];
[t select]; [t select];
[self.editor refresh];
} }
} }
current_way = t; current_way = t;

View file

@ -67,6 +67,7 @@
+(void)impulse; +(void)impulse;
-(id)initWithOwner:(Target)owner; -(id)initWithOwner:(Target)owner;
-(void)refresh;
@end @end
#endif//__editor_h #endif//__editor_h

View file

@ -135,6 +135,7 @@
{ {
self = [super init]; self = [super init];
mask = msk; mask = msk;
return self;
} }
-(integer) getState -(integer) getState
@ -380,9 +381,9 @@
initWithMask:AI_TRACE_TEST]]]; initWithMask:AI_TRACE_TEST]]];
[ai_flag2_menu addItem:[[MenuItem alloc] initWithText:""]]; [ai_flag2_menu addItem:[[MenuItem alloc] initWithText:""]];
[ai_flag2_menu addItem:[[CommandMenuItem alloc] [ai_flag2_menu addItem:[[CommandMenuItem alloc]
initWithText:">>AI Flags page 2" initWithText:">>AI Flag Management"
object:[EditorState class] object:[EditorState class]
selector:@selector(ai_flag2_menu)]]; selector:@selector(ai_flags_menu)]];
[ai_flag2_menu addItem:[[CommandMenuItem alloc] [ai_flag2_menu addItem:[[CommandMenuItem alloc]
initWithText:">>Main Menu" initWithText:">>Main Menu"
object:[EditorState class] object:[EditorState class]
@ -485,11 +486,13 @@
+ai_flags_menu +ai_flags_menu
{ {
dprint ("ai_flags_menu\n");
[EditorState set_menu: ai_flags_menu]; [EditorState set_menu: ai_flags_menu];
} }
+ai_flag2_menu +ai_flag2_menu
{ {
dprint ("ai_flag2_menu\n");
[EditorState set_menu: ai_flag2_menu]; [EditorState set_menu: ai_flag2_menu];
} }
@ -587,7 +590,7 @@
sprint (@self, PRINT_HIGH, sprint (@self, PRINT_HIGH,
sprintf ("\nwaypoint info for waypoint #%i", [way id])); sprintf ("\nwaypoint info for waypoint #%i", [way id]));
sprint (@self, PRINT_HIGH, sprint (@self, PRINT_HIGH,
sprintf ("\nAI Flag value: %#x", [way id])); sprintf ("\nAI Flag value: %#x", way.flags));
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (!way.links[i]) if (!way.links[i])
continue; continue;
@ -879,4 +882,8 @@
return self; return self;
} }
-(void)refresh
{
menu_time = time;
}
@end @end

View file

@ -115,12 +115,24 @@
local string str = text; local string str = text;
local string s; local string s;
local integer i; local integer i;
local string [10] is;
local integer max_len = 0, len;
for (i = 0; i < 10; i++) { if (!items[i]) for (i = 0; i < 10; i++) {
if (!items[i])
break; break;
s = [items[i] text]; is[i] = [items[i] text];
len = strlen(is[i]);
if (len > max_len)
max_len = len;
}
for (i = 0; i < 10; i++) {
if (!items[i])
break;
s = is[i];
if (s) if (s)
str = sprintf ("%s\n[%i] %s", str, (i + 1) % 10, s); str = sprintf (sprintf ("%%s\n[%%i] %%-%ds", max_len),
str, (i + 1) % 10, s);
else else
str = sprintf ("%s\n", str); str = sprintf ("%s\n", str);
} }