Keelan Lightfoot il y a 8 ans
Parent
révision
5e1829fbe0
5 fichiers modifiés avec 131 ajouts et 125 suppressions
  1. 4
    5
      client.go
  2. 5
    7
      cmd/funmow/main.go
  3. 16
    11
      db.go
  4. 64
    75
      execution_context.go
  5. 42
    27
      object.go

+ 4
- 5
client.go Voir le fichier

@@ -109,7 +109,6 @@ func (c *Client) handleLoginPhase(message string) {
109 109
 				c.write("Bad username or password.\n")
110 110
 				break
111 111
 			}
112
-			
113 112
 
114 113
 			c.playerID = player.ID
115 114
 			c.authenticated = true
@@ -134,17 +133,17 @@ func (c *Client) handleLoginPhase(message string) {
134 133
 				c.write("That name is already taken.\n")
135 134
 				break
136 135
 			}
137
-			
136
+
138 137
 			playerID, _ := c.db.CreatePlayer(strings.TrimSpace(fields[1]), strings.TrimSpace(fields[2]), nil)
139
-			
138
+
140 139
 			_, found = c.db.Fetch(playerID)
141 140
 			if !found {
142 141
 				c.write("I can't even.\n")
143 142
 				break
144 143
 			}
145
-			
144
+
146 145
 			c.write("You have been created. Now you can connect!\n")
147
-			
146
+
148 147
 		} else {
149 148
 			c.write("What?\n")
150 149
 		}

+ 5
- 7
cmd/funmow/main.go Voir le fichier

@@ -1,16 +1,16 @@
1 1
 package main
2 2
 
3 3
 import (
4
+	"flag"
4 5
 	"github.com/naleek/funmow"
5 6
 	"log"
6 7
 	"net"
7
-	"flag"
8 8
 )
9 9
 
10 10
 const (
11
-	FunMOWVersion   = "0.2"
12
-	FunMOWDefaultDB = "funmow.db"
13
-	FunMOWDefaultListen    = ":4201"
11
+	FunMOWVersion       = "0.2"
12
+	FunMOWDefaultDB     = "funmow.db"
13
+	FunMOWDefaultListen = ":4201"
14 14
 )
15 15
 
16 16
 func main() {
@@ -32,8 +32,6 @@ func main() {
32 32
 		return
33 33
 	}
34 34
 
35
-
36
-
37 35
 	log.Print("Starting FunMOW Version ", FunMOWVersion)
38 36
 
39 37
 	log.Print("Using database ", FunMOWDefaultDB)
@@ -73,7 +71,7 @@ func seedDB(db *funmow.DB) {
73 71
 
74 72
 	f := funmow.NewObjectFactory(db)
75 73
 
76
-	keelan, _ := db.CreatePlayer("keelan", "123", map[string]bool{"wizard":true})
74
+	keelan, _ := db.CreatePlayer("keelan", "123", map[string]bool{"wizard": true})
77 75
 	dan, _ := db.CreatePlayer("dan", "123", nil)
78 76
 
79 77
 	outside := f.NewObject()

+ 16
- 11
db.go Voir le fichier

@@ -4,11 +4,11 @@ import (
4 4
 	"bytes"
5 5
 	"encoding/binary"
6 6
 	"encoding/json"
7
+	"errors"
7 8
 	"fmt"
8 9
 	"github.com/boltdb/bolt"
9
-	"strconv"
10
-	"errors"
11 10
 	"regexp"
11
+	"strconv"
12 12
 )
13 13
 
14 14
 const (
@@ -19,7 +19,7 @@ type DBRef int
19 19
 
20 20
 func NewDBRefFromHashRef(v string) (DBRef, bool) {
21 21
 	var destInt int
22
-	
22
+
23 23
 	if matched, _ := regexp.MatchString(`^\pZ*#[0-9]+\pZ*?`, v); !matched {
24 24
 		return 0, false
25 25
 	}
@@ -242,13 +242,15 @@ func (s *DB) Delete(objectID DBRef) error {
242 242
 func (s *DB) SetPlayer(name string, player PlayerMeta) error {
243 243
 
244 244
 	err := s.db.Update(func(tx *bolt.Tx) error {
245
-		
245
+
246 246
 		buf, err := json.Marshal(player)
247 247
 
248
-		if err != nil { return err }
249
-	
248
+		if err != nil {
249
+			return err
250
+		}
251
+
250 252
 		b := tx.Bucket([]byte("player"))
251
-		
253
+
252 254
 		return b.Put([]byte(name), buf)
253 255
 	})
254 256
 
@@ -259,11 +261,13 @@ func (s *DB) SetPlayer(name string, player PlayerMeta) error {
259 261
 func (s *DB) GetPlayer(name string) (PlayerMeta, bool) {
260 262
 	var player PlayerMeta
261 263
 	found := false
262
-	
264
+
263 265
 	s.db.View(func(tx *bolt.Tx) error {
264 266
 		b := tx.Bucket([]byte("player"))
265 267
 		v := b.Get([]byte(name))
266
-		if v == nil { return nil }
268
+		if v == nil {
269
+			return nil
270
+		}
267 271
 		err := json.Unmarshal(v, &player)
268 272
 		if err == nil {
269 273
 			found = true
@@ -292,12 +296,13 @@ func (s *DB) RenamePlayer(oldName string, newName string) error {
292 296
 			return errors.New("Can't find player")
293 297
 		}
294 298
 		err := playerBucket.Delete([]byte(oldName))
295
-		if err != nil { return err }
299
+		if err != nil {
300
+			return err
301
+		}
296 302
 		return playerBucket.Put([]byte(newName), buf)
297 303
 	})
298 304
 }
299 305
 
300
-
301 306
 func (s *DB) CreatePlayer(name string, password string, flags map[string]bool) (DBRef, error) {
302 307
 
303 308
 	var playerID DBRef

+ 64
- 75
execution_context.go Voir le fichier

@@ -38,8 +38,6 @@ func NewExecutionContext(actorID DBRef, e *EventDistributor, w *DB, outbound cha
38 38
 	if !found {
39 39
 		return nil
40 40
 	}
41
-	
42
-	
43 41
 
44 42
 	c.actor = actor
45 43
 	c.outbound = outbound
@@ -121,8 +119,7 @@ func (c *ExecutionContext) HandleEvent(m PlayerEvent) {
121 119
 	if found {
122 120
 		c.context, _ = c.db.Fetch(contextID)
123 121
 	}
124
-	
125
-	
122
+
126 123
 	switch m.messageType {
127 124
 	case EventTypeLogin:
128 125
 		if c.actor.Type == "player" {
@@ -250,8 +247,7 @@ func (c *ExecutionContext) evaluateCommand(m PlayerEvent) {
250 247
 		c.destroyCmd(strings.TrimPrefix(message, "@destroy "))
251 248
 	case strings.HasPrefix(message, "@force "):
252 249
 		c.forceCmd(message)
253
-	
254
-		
250
+
255 251
 	default:
256 252
 		if !c.goCmd(message) {
257 253
 			c.output("What?\n")
@@ -264,7 +260,7 @@ func (c *ExecutionContext) lookCmd(target string) {
264 260
 
265 261
 	if len(target) > 0 {
266 262
 		object, found := c.MatchFirst(c.context.ID, target, false, false)
267
-		if (!found) {
263
+		if !found {
268 264
 			c.output("I don't see that here.")
269 265
 			return
270 266
 		}
@@ -273,11 +269,11 @@ func (c *ExecutionContext) lookCmd(target string) {
273 269
 		c.output("%s\n%s", c.context.DetailedName(), c.context.Description)
274 270
 		contents := c.context.GetContents(c.actor.ID)
275 271
 		if len(contents) > 0 {
276
-			c.output("Contents:\n"+strings.Join(contents,"\n"))
272
+			c.output("Contents:\n" + strings.Join(contents, "\n"))
277 273
 		}
278 274
 		exits := c.context.GetExits()
279 275
 		if len(exits) > 0 {
280
-			c.output("Obvious Exits:\n"+strings.Join(exits," "))
276
+			c.output("Obvious Exits:\n" + strings.Join(exits, " "))
281 277
 		}
282 278
 	}
283 279
 
@@ -295,11 +291,11 @@ func (c *ExecutionContext) objectName(id DBRef) string {
295 291
 func (c *ExecutionContext) examineCmd(objectName string) {
296 292
 
297 293
 	object, found := c.MatchFirst(c.context.ID, objectName, true, true)
298
-	if (!found) {
294
+	if !found {
299 295
 		c.output("I don't see that here.")
300 296
 		return
301 297
 	}
302
-	
298
+
303 299
 	c.output("%s", object.DetailedName())
304 300
 	c.output("ID: %d", object.ID)
305 301
 	c.output("Type: %s", object.Type)
@@ -313,31 +309,27 @@ func (c *ExecutionContext) examineCmd(objectName string) {
313 309
 	if len(contents) > 0 {
314 310
 		c.output("Contents:\n %s", strings.Join(contents, "\n "))
315 311
 	}
316
-	
312
+
317 313
 	exits := object.GetExits()
318 314
 	if len(exits) > 0 {
319 315
 		c.output("Exits:\n %s", strings.Join(exits, "\n "))
320 316
 	}
321
-	
322
-	
323
-   
324
-    flags := make([]string, 0, len(object.Flags))
325
-    for k, v := range object.Flags {
326
-        if v {
327
-        	flags = append(flags, k)
328
-        }
329
-    }
330
-    c.output("Flags:\n%s", strings.Join(flags, ", "))
331
-    
332
-    properties := make([]string, 0, len(object.Properties))
333
-    for k, v := range object.Properties {
334
-        properties = append(properties, fmt.Sprintf("%s: \"%s\"", k, v))
335
-    }
336
-    c.output("Properties:\n%s", strings.Join(properties, ", "))
337 317
 
338
-}
318
+	flags := make([]string, 0, len(object.Flags))
319
+	for k, v := range object.Flags {
320
+		if v {
321
+			flags = append(flags, k)
322
+		}
323
+	}
324
+	c.output("Flags:\n%s", strings.Join(flags, ", "))
339 325
 
326
+	properties := make([]string, 0, len(object.Properties))
327
+	for k, v := range object.Properties {
328
+		properties = append(properties, fmt.Sprintf("%s: \"%s\"", k, v))
329
+	}
330
+	c.output("Properties:\n%s", strings.Join(properties, ", "))
340 331
 
332
+}
341 333
 
342 334
 func (c *ExecutionContext) forceCmd(input string) {
343 335
 
@@ -352,7 +344,7 @@ func (c *ExecutionContext) forceCmd(input string) {
352 344
 	wizard := c.actor.GetFlag("wizard")
353 345
 
354 346
 	object, found := c.MatchFirst(c.context.ID, objectName, true, false)
355
-	if (!found) {
347
+	if !found {
356 348
 		c.output("I don't see that here.")
357 349
 		return
358 350
 	}
@@ -363,11 +355,11 @@ func (c *ExecutionContext) forceCmd(input string) {
363 355
 	if object.Type == "player" && !wizard {
364 356
 		c.output("It's not nice to force others to do your bidding.")
365 357
 		return
366
-	} 
358
+	}
367 359
 	if object.Owner != c.actor.ID && !wizard {
368 360
 		c.output("It's not nice to touch other people's things.")
369 361
 		return
370
-	} 
362
+	}
371 363
 	c.outbound <- PlayerEvent{src: c.actor.ID, dst: object.ID, message: command, messageType: EventTypeForce}
372 364
 
373 365
 }
@@ -398,13 +390,13 @@ func (c *ExecutionContext) inventoryCmd() {
398 390
 }
399 391
 
400 392
 func (c *ExecutionContext) getCmd(objectName string) {
401
-	
393
+
402 394
 	object, found := c.MatchFirst(c.context.ID, objectName, false, false)
403
-	if (!found) {
395
+	if !found {
404 396
 		c.output("I don't see that here.")
405 397
 		return
406 398
 	}
407
-	
399
+
408 400
 	if object.ID == c.actor.ID {
409 401
 		c.output("You can't pick yourself up.")
410 402
 		return
@@ -422,7 +414,6 @@ func (c *ExecutionContext) getCmd(objectName string) {
422 414
 	c.pemit(object.ID, "%s picked you up.", c.actor.Name)
423 415
 	c.oemit(c.context.ID, "%s picks up %s.", c.actor.Name, object.Name)
424 416
 
425
-
426 417
 }
427 418
 
428 419
 func (c *ExecutionContext) putCmd(input string) {
@@ -433,10 +424,9 @@ func (c *ExecutionContext) giveCmd(input string) {
433 424
 	c.xferCmd(input, "give", "to")
434 425
 }
435 426
 
436
-
437 427
 func (c *ExecutionContext) xferCmd(input string, verb string, preposition string) {
438 428
 
439
-	r, _ := regexp.Compile(`^`+verb+`\pZ+([^=]*[^=\pZ]{1})\pZ*`+preposition+`\pZ*(.*)\pZ*$`)
429
+	r, _ := regexp.Compile(`^` + verb + `\pZ+([^=]*[^=\pZ]{1})\pZ*` + preposition + `\pZ*(.*)\pZ*$`)
440 430
 
441 431
 	params := r.FindStringSubmatch(input)
442 432
 	if params == nil {
@@ -446,13 +436,13 @@ func (c *ExecutionContext) xferCmd(input string, verb string, preposition string
446 436
 	objectName, receiverName := params[1], params[2]
447 437
 
448 438
 	object, found := c.MatchFirst(c.actor.ID, objectName, false, false)
449
-	if (!found) {
450
-		c.output("You can't "+verb+" what you don't have.")
439
+	if !found {
440
+		c.output("You can't " + verb + " what you don't have.")
451 441
 		return
452 442
 	}
453 443
 	receiver, found := c.MatchFirst(c.context.ID, receiverName, false, false)
454
-	if (!found) {
455
-		c.output("I cant find who or what you want to "+verb+" this "+preposition+".")
444
+	if !found {
445
+		c.output("I cant find who or what you want to " + verb + " this " + preposition + ".")
456 446
 		return
457 447
 	}
458 448
 
@@ -460,16 +450,16 @@ func (c *ExecutionContext) xferCmd(input string, verb string, preposition string
460 450
 	if err != nil {
461 451
 		return
462 452
 	}
463
-	
453
+
464 454
 	c.output("You "+verb+" %s "+preposition+" %s.", object.Name, receiver.Name)
465 455
 	c.pemit(object.ID, "%s "+verb+"s you "+preposition+" %s.", c.actor.Name, receiver.Name)
466
-	
467
-	if (verb == "give") {
456
+
457
+	if verb == "give" {
468 458
 		c.pemit(receiver.ID, "%s gives you %s.", c.actor.Name, object.Name)
469 459
 	} else {
470 460
 		c.pemit(receiver.ID, "%s puts %s into you.", c.actor.Name, object.Name)
471 461
 	}
472
-	
462
+
473 463
 }
474 464
 
475 465
 func (c *ExecutionContext) MatchFirst(context DBRef, matchName string, globalDBRefMatch bool, playerNameMatch bool) (Object, bool) {
@@ -479,8 +469,8 @@ func (c *ExecutionContext) MatchFirst(context DBRef, matchName string, globalDBR
479 469
 	}
480 470
 	if matchName == "me" {
481 471
 		return c.actor, true
482
-	}	
483
-		
472
+	}
473
+
484 474
 	if globalDBRefMatch {
485 475
 		ref, valid := NewDBRefFromHashRef(matchName)
486 476
 		if valid {
@@ -490,7 +480,7 @@ func (c *ExecutionContext) MatchFirst(context DBRef, matchName string, globalDBR
490 480
 			}
491 481
 		}
492 482
 	}
493
-	
483
+
494 484
 	if playerNameMatch {
495 485
 		playerMeta, foundMeta := c.db.GetPlayer(matchName)
496 486
 		if foundMeta {
@@ -513,17 +503,17 @@ func (c *ExecutionContext) MatchFirst(context DBRef, matchName string, globalDBR
513 503
 		}
514 504
 	}
515 505
 	return Object{}, false
516
-	
506
+
517 507
 }
518 508
 
519 509
 func (c *ExecutionContext) dropCmd(objectName string) {
520 510
 
521 511
 	object, found := c.MatchFirst(c.actor.ID, objectName, false, false)
522
-	if (!found) {
512
+	if !found {
523 513
 		c.output("You're not carrying that.")
524 514
 		return
525 515
 	}
526
-	
516
+
527 517
 	err := c.context.Contains(&object)
528 518
 	if err != nil {
529 519
 		return
@@ -538,11 +528,11 @@ func (c *ExecutionContext) dropCmd(objectName string) {
538 528
 func (c *ExecutionContext) enterCmd(objectName string) {
539 529
 
540 530
 	object, found := c.MatchFirst(c.context.ID, objectName, false, false)
541
-	if (!found) {
531
+	if !found {
542 532
 		c.output("I don't see that here.")
543 533
 		return
544 534
 	}
545
-	
535
+
546 536
 	if object.Type == "player" {
547 537
 		c.output("Maybe you should seek consent prior to entering another player.")
548 538
 		return
@@ -555,7 +545,7 @@ func (c *ExecutionContext) enterCmd(objectName string) {
555 545
 		c.output("Entering yourself would be a bad idea.")
556 546
 		return
557 547
 	}
558
-	
548
+
559 549
 	err := object.Contains(&c.actor)
560 550
 	if err != nil {
561 551
 		return
@@ -563,7 +553,7 @@ func (c *ExecutionContext) enterCmd(objectName string) {
563 553
 	c.output("You climb into %s.", object.Name)
564 554
 	c.oemit(c.context.ID, "%s climbs into %s.", c.actor.Name, object.Name)
565 555
 	c.oemit(object.ID, "%s squeezes into %s with you.", c.actor.Name, object.Name)
566
-	
556
+
567 557
 }
568 558
 
569 559
 func (c *ExecutionContext) leaveCmd() {
@@ -575,10 +565,14 @@ func (c *ExecutionContext) leaveCmd() {
575 565
 	}
576 566
 
577 567
 	container, found := c.db.Fetch(outerObjectID)
578
-	if !found { return }
568
+	if !found {
569
+		return
570
+	}
579 571
 
580 572
 	err := container.Contains(&c.actor)
581
-	if err != nil { return }
573
+	if err != nil {
574
+		return
575
+	}
582 576
 
583 577
 	c.output("You climb out of %s.", c.context.Name)
584 578
 	c.oemit(c.context.ID, "%s climbs out of %s.", c.actor.Name, c.context.Name)
@@ -710,7 +704,6 @@ func (c *ExecutionContext) digCmd(input string) {
710 704
 
711 705
 }
712 706
 
713
-
714 707
 func (c *ExecutionContext) nameCmd(input string) {
715 708
 
716 709
 	r, _ := regexp.Compile(`^@name\pZ+([^=]*[^=\pZ]{1})\pZ*=\pZ*(.*)\pZ*$`)
@@ -751,8 +744,6 @@ func (c *ExecutionContext) nameCmd(input string) {
751 744
 
752 745
 }
753 746
 
754
-
755
-
756 747
 func (c *ExecutionContext) setCmd(input string) {
757 748
 	r, _ := regexp.Compile(`^@set\pZ+([^=]*[^=\pZ]{1})\pZ*=\pZ*(!)?(.*)\pZ*$`)
758 749
 	params := r.FindStringSubmatch(input)
@@ -760,20 +751,19 @@ func (c *ExecutionContext) setCmd(input string) {
760 751
 		return
761 752
 	}
762 753
 
763
-	objectName, value, flag := params[1], params[2]!="!", params[3]
754
+	objectName, value, flag := params[1], params[2] != "!", params[3]
764 755
 
765 756
 	object, found := c.MatchFirst(c.context.ID, objectName, true, true)
766
-	if (!found) {
757
+	if !found {
767 758
 		c.output("I don't know what that is")
768 759
 		return
769 760
 	}
770
-	
771
-		
761
+
772 762
 	object.SetFlag(flag, value)
773 763
 	object.Commit()
774
-	
764
+
775 765
 	c.output("It is so.")
776
-	
766
+
777 767
 }
778 768
 
779 769
 func (c *ExecutionContext) descCmd(input string) {
@@ -803,19 +793,19 @@ func (c *ExecutionContext) telCmd(destStr string) {
803 793
 
804 794
 	var dest Object
805 795
 	var found bool
806
-	
796
+
807 797
 	dest, found = c.MatchFirst(c.context.ID, destStr, true, false)
808
-	
798
+
809 799
 	if !found {
810 800
 		c.output("Invalid destination.")
811 801
 		return
812 802
 	}
813
-	
803
+
814 804
 	if dest.Type == "exit" {
815 805
 		c.output("As fun is it sounds, you're not going to teleport into an exit.")
816 806
 		return
817 807
 	}
818
-	
808
+
819 809
 	if dest.Type == "player" {
820 810
 		c.output("Teleporting into players is very impolite.")
821 811
 		return
@@ -824,7 +814,7 @@ func (c *ExecutionContext) telCmd(destStr string) {
824 814
 	if dest.Owner != c.actor.ID && !dest.GetFlag("jump_ok") {
825 815
 		c.output("You're not allowed to do that.")
826 816
 	}
827
-	
817
+
828 818
 	c.output("You feel an intense wooshing sensation.")
829 819
 	c.oemit(c.context.ID, "%s teleports out of the room.", c.actor.Name)
830 820
 	c.oemit(dest.ID, "%s teleports in to the room.", c.actor.Name)
@@ -833,7 +823,6 @@ func (c *ExecutionContext) telCmd(destStr string) {
833 823
 	if err != nil {
834 824
 		return
835 825
 	}
836
-	
837 826
 
838 827
 	c.actor.Refresh()
839 828
 	c.lookCmd("")
@@ -856,11 +845,11 @@ func (c *ExecutionContext) dumpCmd(refStr string) {
856 845
 func (c *ExecutionContext) destroyCmd(target string) {
857 846
 
858 847
 	object, found := c.MatchFirst(c.actor.ID, target, true, false)
859
-	if (!found) {
848
+	if !found {
860 849
 		c.output("I don't see that here.")
861 850
 		return
862 851
 	}
863
-	
852
+
864 853
 	if object.ID == c.actor.ID {
865 854
 		c.output("There are alternatives to suicide.")
866 855
 		return

+ 42
- 27
object.go Voir le fichier

@@ -13,23 +13,21 @@ const (
13 13
 )
14 14
 
15 15
 type PlayerMeta struct {
16
-	ID          DBRef  `json:"id"`
17
-	Password    string `json:"password"`
16
+	ID       DBRef  `json:"id"`
17
+	Password string `json:"password"`
18 18
 }
19 19
 
20 20
 type Object struct {
21
-
22 21
 	ID          DBRef             `json:"id"`
23 22
 	Type        string            `json:"type"`
24 23
 	Owner       DBRef             `json:"owner"`
25 24
 	Next        DBRef             `json:"next"`
26 25
 	Name        string            `json:"name"`
27 26
 	Description string            `json:"description"`
28
-	Flags		map[string]bool   `json:"flags"`
27
+	Flags       map[string]bool   `json:"flags"`
29 28
 	Properties  map[string]string `json:"properties"`
30
-	
31
-	db    *DB
32
-	
29
+
30
+	db *DB
33 31
 }
34 32
 
35 33
 type ObjectFactory struct {
@@ -147,11 +145,19 @@ func (o *Object) GetContents(exclude DBRef) []string {
147 145
 	r := make([]string, 0)
148 146
 	children := o.db.GetChildren(o.ID)
149 147
 	for childID, linkType := range children {
150
-		if childID == exclude { continue }
151
-		if !(linkType == "player" || linkType == "thing") { continue }
148
+		if childID == exclude {
149
+			continue
150
+		}
151
+		if !(linkType == "player" || linkType == "thing") {
152
+			continue
153
+		}
152 154
 		o, found := o.db.Fetch(childID)
153
-		if !found { continue }
154
-		if linkType == "player" && !o.GetFlag("online") { continue }
155
+		if !found {
156
+			continue
157
+		}
158
+		if linkType == "player" && !o.GetFlag("online") {
159
+			continue
160
+		}
155 161
 		r = append(r, o.DetailedName())
156 162
 	}
157 163
 	sort.Strings(r)
@@ -162,13 +168,17 @@ func (o *Object) GetExits() []string {
162 168
 	r := make([]string, 0)
163 169
 	children := o.db.GetChildren(o.ID)
164 170
 	for exitID, linkType := range children {
165
-		if linkType != "exit" { continue }
171
+		if linkType != "exit" {
172
+			continue
173
+		}
166 174
 		exit, found := o.db.Fetch(exitID)
167
-		if !found { continue }
175
+		if !found {
176
+			continue
177
+		}
168 178
 		aliases := strings.Split(exit.Name, ";")
169 179
 		r = append(r, aliases[0])
170 180
 	}
171
-	
181
+
172 182
 	sort.Strings(r)
173 183
 	return r
174 184
 }
@@ -177,15 +187,19 @@ func (o *Object) SetFlag(flag string, value bool) {
177 187
 	if o.Flags == nil {
178 188
 		o.Flags = make(map[string]bool)
179 189
 	}
180
-	o.Flags[flag]=value
190
+	o.Flags[flag] = value
181 191
 }
182 192
 
183 193
 func (o *Object) GetFlag(flag string) bool {
184
-	
185
-	if o.Flags == nil { return false }
194
+
195
+	if o.Flags == nil {
196
+		return false
197
+	}
186 198
 	value, ok := o.Flags[flag]
187
-	if !ok { return false }
188
-	
199
+	if !ok {
200
+		return false
201
+	}
202
+
189 203
 	return value
190 204
 }
191 205
 
@@ -193,21 +207,22 @@ func (o *Object) SetProp(key string, value string) {
193 207
 	if o.Properties == nil {
194 208
 		o.Properties = make(map[string]string)
195 209
 	}
196
-	o.Properties[key]=value
210
+	o.Properties[key] = value
197 211
 }
198 212
 
199 213
 func (o *Object) GetProp(key string) string {
200
-	
201
-	if o.Properties == nil { return "" }
214
+
215
+	if o.Properties == nil {
216
+		return ""
217
+	}
202 218
 	value, ok := o.Properties[key]
203
-	if !ok { return "" }
204
-	
219
+	if !ok {
220
+		return ""
221
+	}
222
+
205 223
 	return value
206 224
 }
207 225
 
208
-
209
-
210
-
211 226
 type ObjectList []Object
212 227
 
213 228
 func (l ObjectList) First() Object {